Skip to content

Commit

Permalink
Merge pull request #1 from KaveTech/feat/manage-reference-entities
Browse files Browse the repository at this point in the history
Manage reference entities
  • Loading branch information
amatmv authored Feb 14, 2023
2 parents 726fa9c + 2829a4a commit 9ee6a0f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 4 deletions.
33 changes: 29 additions & 4 deletions akeneo_api_client/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
# -*- coding: utf-8 -*-

from akeneo_api_client.auth import *
from akeneo_api_client.resources import *
import requests

from akeneo_api_client.auth import Auth
from akeneo_api_client.resources import (
AssociationTypesPool,
AttributesPool,
AttributeGroupsPool,
CategoriesPool,
ChannelsPool,
CurrenciesPool,
FamiliesPool,
LocalesPool,
MeasureFamiliesPool,
MediaFilesPool,
ProductsPool,
ProductModelsPool,
PublishedProductsPool,
AssetFamilyPool,
ReferenceEntityPool,
)
from akeneo_api_client.utils import urljoin


class Client:
Expand Down Expand Up @@ -68,6 +85,10 @@ def _init(self, base_url, session, auth):
urljoin(self._base_url, self.BASIC_API_PATH, 'published-products/'), session),
'asset_families': AssetFamilyPool(
urljoin(self._base_url, self.BASIC_API_PATH, 'asset-families/'), session),
"reference_entities": ReferenceEntityPool(
urljoin(self._base_url, self.BASIC_API_PATH, "reference-entities/"),
session,
),
}

@property
Expand Down Expand Up @@ -130,3 +151,7 @@ def published_products(self):
@property
def asset_families(self):
return self._resources["asset_families"]

@property
def reference_entities(self):
return self._resources["reference_entities"]
24 changes: 24 additions & 0 deletions akeneo_api_client/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,3 +361,27 @@ def assets(self, code):
urljoin(self._endpoint, code, 'assets/'),
self._session
)


class ReferenceEntityRecordPool(
ResourcePool,
CodeBasedResource,
GettableResource,
ListableResource,
UpdatableResource,
UpdatableListResource,
):
pass


class ReferenceEntityPool(
ResourcePool,
CodeBasedResource,
GettableResource,
ListableResource,
UpdatableResource,
):
def records(self, entity_code):
return ReferenceEntityRecordPool(
urljoin(self._endpoint, entity_code, "records/"), self._session
)

0 comments on commit 9ee6a0f

Please sign in to comment.