30 lines
979 B
Python
30 lines
979 B
Python
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})
|