feat: implement backend API clients for multi-marketplace integration and frontend service layer
This commit is contained in:
30
backend/mm_api/services/shipments.py
Normal file
30
backend/mm_api/services/shipments.py
Normal file
@@ -0,0 +1,30 @@
|
||||
from typing import Dict, Any
|
||||
from ..client import MMClient
|
||||
|
||||
class ShipmentsService:
|
||||
"""Service to handle Magnit Market Shipments."""
|
||||
|
||||
def __init__(self, client: MMClient):
|
||||
self.client = client
|
||||
|
||||
def get_list(self, dir: str = "ASC", page_size: int = 100, page_token: str = None, **filters) -> Dict[str, Any]:
|
||||
"""
|
||||
Get list of shipments.
|
||||
Endpoint: /api/seller/v1/shipments/list
|
||||
"""
|
||||
payload = {
|
||||
"dir": dir,
|
||||
"page_size": page_size
|
||||
}
|
||||
if page_token:
|
||||
payload["page_token"] = page_token
|
||||
|
||||
payload.update(filters)
|
||||
return self.client.post("/api/seller/v1/shipments/list", data=payload)
|
||||
|
||||
def confirm(self, shipment_id: str) -> Dict[str, Any]:
|
||||
"""
|
||||
Confirm a shipment.
|
||||
Endpoint: /api/seller/v1/shipments/confirm
|
||||
"""
|
||||
return self.client.post("/api/seller/v1/shipments/confirm", data={"shipment_id": shipment_id})
|
||||
Reference in New Issue
Block a user