31 lines
983 B
Python
31 lines
983 B
Python
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})
|