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,29 @@
from typing import Dict, Any
from ..client import FlowwowClient
class OrdersService:
"""Service to handle Flowwow Orders."""
def __init__(self, client: FlowwowClient):
self.client = client
def get_new_orders(self, limit: int = 50) -> Dict[str, Any]:
"""
Get list of new, unprocessed orders.
Endpoint: /orders/new
"""
return self.client.get("/orders/new", params={"limit": limit})
def accept_order(self, order_id: str) -> Dict[str, Any]:
"""
Accept an order for processing.
Endpoint: /orders/{order_id}/accept
"""
return self.client.post(f"/orders/{order_id}/accept")
def upload_photo(self, order_id: str, image_url: str) -> Dict[str, Any]:
"""
Upload a photo of the completed order before shipping.
Endpoint: /orders/{order_id}/photo
"""
return self.client.post(f"/orders/{order_id}/photo", data={"image_url": image_url})

View File

@@ -0,0 +1,30 @@
from typing import Dict, Any, List
from ..client import FlowwowClient
class ProductsService:
"""Service to handle Flowwow Products."""
def __init__(self, client: FlowwowClient):
self.client = client
def get_list(self, limit: int = 100, offset: int = 0) -> Dict[str, Any]:
"""
Get list of products.
Endpoint: /products
"""
params = {"limit": limit, "offset": offset}
return self.client.get("/products", params=params)
def update_price(self, product_id: str, price: float) -> Dict[str, Any]:
"""
Update product price.
Endpoint: /products/{product_id}/price
"""
return self.client.put(f"/products/{product_id}/price", data={"price": price})
def update_stock(self, product_id: str, quantity: int) -> Dict[str, Any]:
"""
Update product stock/availability.
Endpoint: /products/{product_id}/stock
"""
return self.client.put(f"/products/{product_id}/stock", data={"quantity": quantity})