feat: implement backend API clients for multi-marketplace integration and frontend service layer

This commit is contained in:
2026-05-12 13:16:14 +03:00
parent 6974af486a
commit ee39a3d83b
65 changed files with 2501 additions and 33 deletions

View File

@@ -0,0 +1,30 @@
from typing import Dict, Any, Optional
from ..client import AEClient
class ProductsService:
"""Service to handle AE Platform Products and Links."""
def __init__(self, client: AEClient):
self.client = client
def get_link_info(self, link: str, user_id: Optional[str] = None, user_sub_id: Optional[str] = None) -> Dict[str, Any]:
"""
Get information about a product/link including commission rates.
Endpoint: POST /users/{userId}/link/info
"""
uid = user_id or self.client.user_id
if not uid:
raise ValueError("user_id must be provided either in the method call or client initialization.")
payload = {"link": link}
if user_sub_id:
payload["userSubId"] = user_sub_id
return self.client.post(f"/users/{uid}/link/info", data=payload)
def get_products_feeds(self, limit: int = 30) -> Dict[str, Any]:
"""
Get product feeds.
Endpoint: GET /productsfeeds/feeds
"""
return self.client.get("/productsfeeds/feeds", params={"limit": limit})

View File

@@ -0,0 +1,19 @@
from typing import Dict, Any, Optional
from ..client import AEClient
class TransactionsService:
"""Service to handle AE Platform Transactions (Orders)."""
def __init__(self, client: AEClient):
self.client = client
def get_list(self, user_id: Optional[str] = None, params: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
"""
Get list of transactions (orders) for a user.
Endpoint: GET /users/{user_id}/transactions
"""
uid = user_id or self.client.user_id
if not uid:
raise ValueError("user_id must be provided either in the method call or client initialization.")
return self.client.get(f"/users/{uid}/transactions", params=params)