"""RapBooster platform API client (generated by scripts/generate-sdks.mjs; do not edit).

Standard library only (Python 3.8+):

    from rapbooster import RapBooster
    rb = RapBooster(api_key=os.environ["RAPBOOSTER_KEY"], workspace_id="...")
    print(rb.request("GET", "/api/v1/crm/leads", query={"limit": 5}))
"""
import json
import urllib.error
import urllib.parse
import urllib.request
import uuid


class RapBoosterError(Exception):
    def __init__(self, status, body):
        super().__init__(f"HTTP {status}: {body}")
        self.status = status
        self.body = body


class RapBooster:
    def __init__(self, api_key, workspace_id=None, base_url="https://api.rapbooster.com", timeout=30):
        if not api_key:
            raise ValueError("api_key is required")
        self.api_key = api_key
        self.workspace_id = workspace_id
        self.base_url = base_url.rstrip("/")
        self.timeout = timeout

    def request(self, method, path, path_params=None, query=None, body=None):
        for key, value in (path_params or {}).items():
            path = path.replace("{" + key + "}", urllib.parse.quote(str(value), safe=""))
        url = self.base_url + path
        if query:
            url += "?" + urllib.parse.urlencode({k: v for k, v in query.items() if v is not None}, doseq=True)
        headers = {"Authorization": "Bearer " + self.api_key, "Accept": "application/json"}
        if self.workspace_id and not path.startswith("/api/v1/public/v1/"):
            headers["x-workspace-id"] = self.workspace_id
        data = None
        if body is not None:
            data = json.dumps(body).encode("utf-8")
            headers["Content-Type"] = "application/json"
        if method != "GET":
            headers["Idempotency-Key"] = str(uuid.uuid4())
        req = urllib.request.Request(url, data=data, headers=headers, method=method)
        try:
            with urllib.request.urlopen(req, timeout=self.timeout) as res:
                text = res.read().decode("utf-8")
        except urllib.error.HTTPError as e:
            raise RapBoosterError(e.code, e.read().decode("utf-8")) from None
        return json.loads(text) if text else None

    def invoices_list(self, query=None):
        """GET /api/v1/billing/invoices: List quotes, proformas and tax invoices (filters, q = number or buyer) (beta, scope billing:read)"""
        return self.request("GET", "/api/v1/billing/invoices", {}, query, None)

    def invoices_list_credit_notes(self, query=None):
        """GET /api/v1/billing/invoices/credit-notes: List credit notes (optionally for one invoice) (beta, scope billing:read)"""
        return self.request("GET", "/api/v1/billing/invoices/credit-notes", {}, query, None)

    def invoices_get_credit_note(self, id, query=None):
        """GET /api/v1/billing/invoices/credit-notes/{id}: One credit note with its lines (beta, scope billing:read)"""
        return self.request("GET", "/api/v1/billing/invoices/credit-notes/{id}", {"id": id}, query, None)

    def invoices_get(self, id, query=None):
        """GET /api/v1/billing/invoices/{id}: One document with its lines (beta, scope billing:read)"""
        return self.request("GET", "/api/v1/billing/invoices/{id}", {"id": id}, query, None)

    def offers_list(self, query=None):
        """GET /api/v1/billing/offers: Offers with their uses, revenue and discount cost (q = name or code) (beta, scope billing:read)"""
        return self.request("GET", "/api/v1/billing/offers", {}, query, None)

    def offers_get_one(self, id, query=None):
        """GET /api/v1/billing/offers/{id}: One offer (beta, scope billing:read)"""
        return self.request("GET", "/api/v1/billing/offers/{id}", {"id": id}, query, None)

    def offers_codes(self, id, query=None):
        """GET /api/v1/billing/offers/{id}/codes: The offer's codes (q = part of a code; batch_id = one bulk batch) (beta, scope billing:read)"""
        return self.request("GET", "/api/v1/billing/offers/{id}/codes", {"id": id}, query, None)

    def offers_redemptions(self, id, query=None):
        """GET /api/v1/billing/offers/{id}/redemptions: Where the offer was used, newest first (reversed ones carry reversed_at) (beta, scope billing:read)"""
        return self.request("GET", "/api/v1/billing/offers/{id}/redemptions", {"id": id}, query, None)

    def offers_report(self, id, query=None):
        """GET /api/v1/billing/offers/{id}/report: The offer's report: uses, revenue, discount cost, per channel and per day (30 days) (beta, scope billing:read)"""
        return self.request("GET", "/api/v1/billing/offers/{id}/report", {"id": id}, query, None)

    def leads_list(self, query=None):
        """GET /api/v1/crm/leads: List leads (newest first by default; q, status_id, type, view filters; sortBy). Scoped to the caller's own / team leads, except that an exact phone or email in q finds any lead (LT119); leads of a type the caller lacks the key of never show (R36-45) (beta, scope crm:read)"""
        return self.request("GET", "/api/v1/crm/leads", {}, query, None)

    def leads_counts(self, query=None):
        """GET /api/v1/crm/leads/counts: How many leads are in each status and each sidebar view (beta, scope crm:read)"""
        return self.request("GET", "/api/v1/crm/leads/counts", {}, query, None)

    def lead_statuses_list(self, query=None):
        """GET /api/v1/crm/leads/lead-statuses: The workspace's lead statuses, in its order (removed ones on request) (beta, scope crm:read)"""
        return self.request("GET", "/api/v1/crm/leads/lead-statuses", {}, query, None)

    def leads_get(self, id, query=None):
        """GET /api/v1/crm/leads/{id}: Get a lead with its default billing detail and header fields. Any member with leads:read may open any lead (LT119) (beta, scope crm:read)"""
        return self.request("GET", "/api/v1/crm/leads/{id}", {"id": id}, query, None)

    def contacts_list(self, query=None):
        """GET /api/v1/marketing/audience/contacts: All contacts (searched, filtered, sorted) (beta, scope marketing:read)"""
        return self.request("GET", "/api/v1/marketing/audience/contacts", {}, query, None)

    def contacts_get(self, id, query=None):
        """GET /api/v1/marketing/audience/contacts/{id}: Get a contact (beta, scope marketing:read)"""
        return self.request("GET", "/api/v1/marketing/audience/contacts/{id}", {"id": id}, query, None)

    def contact_groups_list(self, query=None):
        """GET /api/v1/marketing/audience/groups: List groups (the Contacts home table) (beta, scope marketing:read)"""
        return self.request("GET", "/api/v1/marketing/audience/groups", {}, query, None)

    def contact_groups_get(self, id, query=None):
        """GET /api/v1/marketing/audience/groups/{id}: Get a group (metadata + fields + usage) (beta, scope marketing:read)"""
        return self.request("GET", "/api/v1/marketing/audience/groups/{id}", {"id": id}, query, None)

    def orders_list(self, query=None):
        """GET /api/v1/orders: List goods orders (status, lead, q = order number, from/to = placed) (beta, scope orders:read)"""
        return self.request("GET", "/api/v1/orders", {}, query, None)

    def orders_summary(self, query=None):
        """GET /api/v1/orders/summary: Overview and sidebar counts: to ship, shipped in 7 days, delivered, cancelled, to pack, ready to ship, in transit, issues, returns, COD to collect (beta, scope orders:read)"""
        return self.request("GET", "/api/v1/orders/summary", {}, query, None)

    def orders_get(self, id, query=None):
        """GET /api/v1/orders/{id}: An order with its lines and shipments (beta, scope orders:read)"""
        return self.request("GET", "/api/v1/orders/{id}", {"id": id}, query, None)

    def site_enquiries_submit(self, query=None, body=None):
        """POST /api/v1/public/v1/crm/enquiries: Send a site form (contact, service, corporate gifting, trade, franchise, careers) (stable)"""
        return self.request("POST", "/api/v1/public/v1/crm/enquiries", {}, query, body)

    def public_leads_list(self, query=None):
        """GET /api/v1/public/v1/crm/leads: List leads (q, status; sort_by, sort; page, limit) (stable)"""
        return self.request("GET", "/api/v1/public/v1/crm/leads", {}, query, None)

    def public_leads_create(self, query=None, body=None):
        """POST /api/v1/public/v1/crm/leads: Create a lead (owned by the key's creator) (stable)"""
        return self.request("POST", "/api/v1/public/v1/crm/leads", {}, query, body)

    def public_leads_get(self, id, query=None):
        """GET /api/v1/public/v1/crm/leads/{id}: Get a lead (stable)"""
        return self.request("GET", "/api/v1/public/v1/crm/leads/{id}", {"id": id}, query, None)

    def public_leads_update(self, id, query=None, body=None):
        """PATCH /api/v1/public/v1/crm/leads/{id}: Update a lead's name, mobile, email, status or location (city, state, country_code) (stable)"""
        return self.request("PATCH", "/api/v1/public/v1/crm/leads/{id}", {"id": id}, query, body)

    def site_hrms_apply(self, query=None, body=None):
        """POST /api/v1/public/v1/hrms/applications: Apply to an open role (CV as a PDF, at most 5 MB) (stable)"""
        return self.request("POST", "/api/v1/public/v1/hrms/applications", {}, query, body)

    def site_hrms_request_otp(self, query=None, body=None):
        """POST /api/v1/public/v1/hrms/applications/otp: Send a code to the applicant's phone (careers form) (stable)"""
        return self.request("POST", "/api/v1/public/v1/hrms/applications/otp", {}, query, body)

    def site_hrms_verify_otp(self, query=None, body=None):
        """POST /api/v1/public/v1/hrms/applications/otp/verify: Check the code: answers a single-use phone-verified token (30 minutes) (stable)"""
        return self.request("POST", "/api/v1/public/v1/hrms/applications/otp/verify", {}, query, body)

    def site_hrms_jobs(self, query=None):
        """GET /api/v1/public/v1/hrms/jobs: Open roles, newest first, with the JobPosting fields (stable)"""
        return self.request("GET", "/api/v1/public/v1/hrms/jobs", {}, query, None)

    def site_hrms_job(self, slug, query=None):
        """GET /api/v1/public/v1/hrms/jobs/{slug}: One open role (stable)"""
        return self.request("GET", "/api/v1/public/v1/hrms/jobs/{slug}", {"slug": slug}, query, None)

    def public_messages_email(self, query=None, body=None):
        """POST /api/v1/public/v1/inbox/messages/email: Send one email from a connection (default: the system one) (stable)"""
        return self.request("POST", "/api/v1/public/v1/inbox/messages/email", {}, query, body)

    def public_messages_whatsapp(self, query=None, body=None):
        """POST /api/v1/public/v1/inbox/messages/whatsapp: Send an approved WhatsApp template to a number (stable)"""
        return self.request("POST", "/api/v1/public/v1/inbox/messages/whatsapp", {}, query, body)

    def public_messages_status(self, channel, id, query=None):
        """GET /api/v1/public/v1/inbox/messages/{channel}/{id}: A sent message's delivery status (stable)"""
        return self.request("GET", "/api/v1/public/v1/inbox/messages/{channel}/{id}", {"channel": channel, "id": id}, query, None)

    def site_marketing_campaigns(self, query=None):
        """GET /api/v1/public/v1/marketing/campaigns: Campaigns with their status and counts (stable)"""
        return self.request("GET", "/api/v1/public/v1/marketing/campaigns", {}, query, None)

    def public_contacts_list(self, query=None):
        """GET /api/v1/public/v1/marketing/contacts: List people (q, group_id; sort_by, sort; page, limit) (stable)"""
        return self.request("GET", "/api/v1/public/v1/marketing/contacts", {}, query, None)

    def public_contacts_create(self, query=None, body=None):
        """POST /api/v1/public/v1/marketing/contacts: Add a person: a known email or phone returns that person (`existing: true`) (stable)"""
        return self.request("POST", "/api/v1/public/v1/marketing/contacts", {}, query, body)

    def public_contacts_get(self, id, query=None):
        """GET /api/v1/public/v1/marketing/contacts/{id}: Get a person (stable)"""
        return self.request("GET", "/api/v1/public/v1/marketing/contacts/{id}", {"id": id}, query, None)

    def public_contacts_update(self, id, query=None, body=None):
        """PATCH /api/v1/public/v1/marketing/contacts/{id}: Update a person (null clears a field; group_ids replaces groups) (stable)"""
        return self.request("PATCH", "/api/v1/public/v1/marketing/contacts/{id}", {"id": id}, query, body)

    def site_marketing_subscribe(self, query=None, body=None):
        """POST /api/v1/public/v1/marketing/subscriptions: Opt a person in to an Audience group, with the consent they gave (stable)"""
        return self.request("POST", "/api/v1/public/v1/marketing/subscriptions", {}, query, body)

    def site_marketing_unsubscribe(self, query=None, body=None):
        """DELETE /api/v1/public/v1/marketing/subscriptions: Opt a person out of an Audience group (stable)"""
        return self.request("DELETE", "/api/v1/public/v1/marketing/subscriptions", {}, query, body)

    def site_marketing_templates(self, query=None):
        """GET /api/v1/public/v1/marketing/templates: Approved WhatsApp templates and ready email templates (stable)"""
        return self.request("GET", "/api/v1/public/v1/marketing/templates", {}, query, None)

    def store_api_catalogue_info(self, query=None):
        """GET /api/v1/public/v1/store: The store: name, legal and support details, checkout and shipping settings (stable)"""
        return self.request("GET", "/api/v1/public/v1/store", {}, query, None)

    def store_api_auth_apple(self, query=None, body=None):
        """POST /api/v1/public/v1/store/auth/apple: Sign in with an Apple ID token (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/auth/apple", {}, query, body)

    def store_api_auth_google(self, query=None, body=None):
        """POST /api/v1/public/v1/store/auth/google: Sign in with a Google ID token (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/auth/google", {}, query, body)

    def store_api_auth_logout(self, query=None, body=None):
        """POST /api/v1/public/v1/store/auth/logout: End the session of a refresh token (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/auth/logout", {}, query, body)

    def store_api_auth_request_otp(self, query=None, body=None):
        """POST /api/v1/public/v1/store/auth/otp: Send a sign-in code to a phone (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/auth/otp", {}, query, body)

    def store_api_auth_verify_otp(self, query=None, body=None):
        """POST /api/v1/public/v1/store/auth/otp/verify: Check the code: signs the buyer in (or up) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/auth/otp/verify", {}, query, body)

    def store_api_auth_refresh(self, query=None, body=None):
        """POST /api/v1/public/v1/store/auth/refresh: Swap a refresh token for a new pair (the old one stops working) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/auth/refresh", {}, query, body)

    def store_api_buyers_get(self, id, query=None):
        """GET /api/v1/public/v1/store/buyers/{id}: A buyer (secret key with store:write) (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/buyers/{id}", {"id": id}, query, None)

    def store_api_buyers_erase(self, id, query=None):
        """DELETE /api/v1/public/v1/store/buyers/{id}: Erase a buyer's account (DPDP); orders keep their tax records (stable)"""
        return self.request("DELETE", "/api/v1/public/v1/store/buyers/{id}", {"id": id}, query, None)

    def store_api_buyers_set_groups(self, id, query=None, body=None):
        """PUT /api/v1/public/v1/store/buyers/{id}/groups: Set a buyer's groups (offer eligibility, e.g. patron) (stable)"""
        return self.request("PUT", "/api/v1/public/v1/store/buyers/{id}/groups", {"id": id}, query, body)

    def store_api_cart_create(self, query=None, body=None):
        """POST /api/v1/public/v1/store/carts: Start a cart (attached to the buyer when signed in) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/carts", {}, query, body)

    def store_api_cart_get(self, cart_id, query=None):
        """GET /api/v1/public/v1/store/carts/{cartId}: A cart, priced now (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/carts/{cartId}", {"cartId": cart_id}, query, None)

    def store_api_cart_attach(self, cart_id, query=None):
        """POST /api/v1/public/v1/store/carts/{cartId}/attach: Attach a guest cart to the signed-in buyer (merged into their open cart) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/carts/{cartId}/attach", {"cartId": cart_id}, query, None)

    def store_api_cart_apply_coupon(self, cart_id, query=None, body=None):
        """POST /api/v1/public/v1/store/carts/{cartId}/coupon: Apply a coupon code (422 COUPON_INVALID with details.reason) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/carts/{cartId}/coupon", {"cartId": cart_id}, query, body)

    def store_api_cart_remove_coupon(self, cart_id, query=None):
        """DELETE /api/v1/public/v1/store/carts/{cartId}/coupon: Remove the coupon (stable)"""
        return self.request("DELETE", "/api/v1/public/v1/store/carts/{cartId}/coupon", {"cartId": cart_id}, query, None)

    def store_api_cart_set_delivery(self, cart_id, query=None, body=None):
        """PUT /api/v1/public/v1/store/carts/{cartId}/delivery: Set the delivery address or PIN code (shipping fee, ETA) (stable)"""
        return self.request("PUT", "/api/v1/public/v1/store/carts/{cartId}/delivery", {"cartId": cart_id}, query, body)

    def store_api_cart_set_gift(self, cart_id, query=None, body=None):
        """PUT /api/v1/public/v1/store/carts/{cartId}/gift: Mark the order a gift, with a message (≤ 300) (stable)"""
        return self.request("PUT", "/api/v1/public/v1/store/carts/{cartId}/gift", {"cartId": cart_id}, query, body)

    def store_api_cart_set_lines(self, cart_id, query=None, body=None):
        """PUT /api/v1/public/v1/store/carts/{cartId}/lines: Replace the cart's lines (stable)"""
        return self.request("PUT", "/api/v1/public/v1/store/carts/{cartId}/lines", {"cartId": cart_id}, query, body)

    def store_api_catalogue_categories(self, query=None):
        """GET /api/v1/public/v1/store/categories: The store's categories (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/categories", {}, query, None)

    def store_api_checkout_checkout(self, query=None, body=None):
        """POST /api/v1/public/v1/store/checkout: Place the order: Razorpay order to pay in-page, or trade credit (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/checkout", {}, query, body)

    def store_api_checkout_confirm(self, number, query=None, body=None):
        """POST /api/v1/public/v1/store/checkout/{number}/confirm: Confirm the in-page Razorpay payment (signature check) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/checkout/{number}/confirm", {"number": number}, query, body)

    def store_api_catalogue_merchant_feed(self, query=None):
        """GET /api/v1/public/v1/store/feeds/merchant.xml: Google Merchant Center feed (RSS 2.0) of the visible products (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/feeds/merchant.xml", {}, query, None)

    def store_api_me_me(self, query=None):
        """GET /api/v1/public/v1/store/me: The signed-in buyer (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me", {}, query, None)

    def store_api_me_update(self, query=None, body=None):
        """PATCH /api/v1/public/v1/store/me: Change the buyer's name, email or consents (stable)"""
        return self.request("PATCH", "/api/v1/public/v1/store/me", {}, query, body)

    def store_api_me_addresses(self, query=None):
        """GET /api/v1/public/v1/store/me/addresses: The buyer's addresses (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/addresses", {}, query, None)

    def store_api_me_add_address(self, query=None, body=None):
        """POST /api/v1/public/v1/store/me/addresses: Add an address (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/addresses", {}, query, body)

    def store_api_me_delete_address(self, id, query=None):
        """DELETE /api/v1/public/v1/store/me/addresses/{id}: Delete an address (stable)"""
        return self.request("DELETE", "/api/v1/public/v1/store/me/addresses/{id}", {"id": id}, query, None)

    def store_api_me_update_address(self, id, query=None, body=None):
        """PATCH /api/v1/public/v1/store/me/addresses/{id}: Change an address (stable)"""
        return self.request("PATCH", "/api/v1/public/v1/store/me/addresses/{id}", {"id": id}, query, body)

    def store_api_claims_list(self, query=None):
        """GET /api/v1/public/v1/store/me/claims: The buyer's claims, newest first (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/claims", {}, query, None)

    def store_api_me_request_deletion(self, query=None):
        """POST /api/v1/public/v1/store/me/deletion-request: Ask the store to delete the buyer's account (nothing is deleted now) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/deletion-request", {}, query, None)

    def store_api_me_add_device(self, query=None, body=None):
        """POST /api/v1/public/v1/store/me/devices: Register an app install for push (order updates; offers when opted in) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/devices", {}, query, body)

    def store_api_me_remove_device(self, token, query=None):
        """DELETE /api/v1/public/v1/store/me/devices/{token}: Forget an app install (stable)"""
        return self.request("DELETE", "/api/v1/public/v1/store/me/devices/{token}", {"token": token}, query, None)

    def store_api_me_export_data(self, query=None):
        """POST /api/v1/public/v1/store/me/export: Email the buyer a JSON export of their data within 24 h (once a day) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/export", {}, query, None)

    def store_api_orders_list(self, query=None):
        """GET /api/v1/public/v1/store/me/orders: The buyer's orders, newest first (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/orders", {}, query, None)

    def store_api_orders_get(self, number, query=None):
        """GET /api/v1/public/v1/store/me/orders/{number}: One order with its shipments, claims and invoice (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/orders/{number}", {"number": number}, query, None)

    def store_api_claims_create(self, number, query=None, body=None):
        """POST /api/v1/public/v1/store/me/orders/{number}/claims: Report a damaged, wrong or missing item (409 CLAIM_WINDOW_CLOSED after 48 h) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/orders/{number}/claims", {"number": number}, query, body)

    def store_api_orders_invoice(self, number, query=None):
        """GET /api/v1/public/v1/store/me/orders/{number}/invoice: A signed link (10 minutes) to the order's GST invoice PDF (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/orders/{number}/invoice", {"number": number}, query, None)

    def store_api_orders_reorder(self, number, query=None):
        """POST /api/v1/public/v1/store/me/orders/{number}/reorder: Put the order's items in the buyer's cart again (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/orders/{number}/reorder", {"number": number}, query, None)

    def store_api_my_reviews_list(self, query=None):
        """GET /api/v1/public/v1/store/me/reviews: The buyer's reviews (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/reviews", {}, query, None)

    def store_api_my_reviews_create(self, query=None, body=None):
        """POST /api/v1/public/v1/store/me/reviews: Review a delivered product (status pending until moderated) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/reviews", {}, query, body)

    def store_api_subscriptions_list(self, query=None):
        """GET /api/v1/public/v1/store/me/subscriptions: The buyer's subscriptions (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/subscriptions", {}, query, None)

    def store_api_subscriptions_create(self, query=None, body=None):
        """POST /api/v1/public/v1/store/me/subscriptions: Subscribe (box: interval, lines, address; plan: plan_code); returns the Razorpay ids (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/subscriptions", {}, query, body)

    def store_api_subscriptions_update(self, id, query=None, body=None):
        """PATCH /api/v1/public/v1/store/me/subscriptions/{id}: Change a box's interval, lines or address (stable)"""
        return self.request("PATCH", "/api/v1/public/v1/store/me/subscriptions/{id}", {"id": id}, query, body)

    def store_api_subscriptions_cancel(self, id, query=None):
        """POST /api/v1/public/v1/store/me/subscriptions/{id}/cancel: Cancel a subscription (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/subscriptions/{id}/cancel", {"id": id}, query, None)

    def store_api_subscriptions_pause(self, id, query=None):
        """POST /api/v1/public/v1/store/me/subscriptions/{id}/pause: Pause a subscription (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/subscriptions/{id}/pause", {"id": id}, query, None)

    def store_api_subscriptions_resume(self, id, query=None):
        """POST /api/v1/public/v1/store/me/subscriptions/{id}/resume: Resume a paused subscription (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/subscriptions/{id}/resume", {"id": id}, query, None)

    def store_api_subscriptions_skip(self, id, query=None):
        """POST /api/v1/public/v1/store/me/subscriptions/{id}/skip: Skip the next delivery (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/subscriptions/{id}/skip", {"id": id}, query, None)

    def store_api_trade_get(self, query=None):
        """GET /api/v1/public/v1/store/me/trade: The buyer's trade account (404 when they never applied) (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/trade", {}, query, None)

    def store_api_trade_apply(self, query=None, body=None):
        """POST /api/v1/public/v1/store/me/trade/apply: Apply for a trade account with a GSTIN (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/trade/apply", {}, query, body)

    def store_api_trade_ledger(self, query=None):
        """GET /api/v1/public/v1/store/me/trade/ledger: The trade account's ledger: invoices, payments, credit notes (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/trade/ledger", {}, query, None)

    def store_api_me_upload(self, query=None, body=None):
        """POST /api/v1/public/v1/store/me/uploads: Upload a photo for a claim or a review (jpeg / png / webp, at most 5 MB) (stable)"""
        return self.request("POST", "/api/v1/public/v1/store/me/uploads", {}, query, body)

    def store_api_me_wishlist(self, query=None):
        """GET /api/v1/public/v1/store/me/wishlist: The buyer's wishlist (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/me/wishlist", {}, query, None)

    def store_api_me_add_to_wishlist(self, product_id, query=None):
        """PUT /api/v1/public/v1/store/me/wishlist/{productId}: Add a product to the wishlist (stable)"""
        return self.request("PUT", "/api/v1/public/v1/store/me/wishlist/{productId}", {"productId": product_id}, query, None)

    def store_api_me_remove_from_wishlist(self, product_id, query=None):
        """DELETE /api/v1/public/v1/store/me/wishlist/{productId}: Remove a product from the wishlist (stable)"""
        return self.request("DELETE", "/api/v1/public/v1/store/me/wishlist/{productId}", {"productId": product_id}, query, None)

    def store_api_catalogue_policy(self, kind, query=None):
        """GET /api/v1/public/v1/store/policies/{kind}: One policy page (refund, shipping, terms, privacy, returns) (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/policies/{kind}", {"kind": kind}, query, None)

    def store_api_catalogue_products(self, query=None):
        """GET /api/v1/public/v1/store/products: Visible products (q, category, sort_by, in_stock, updated_since, include=variants; page, limit ≤ 100) (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/products", {}, query, None)

    def store_api_catalogue_product(self, slug, query=None):
        """GET /api/v1/public/v1/store/products/{slug}: One product with its variants (an approved trade buyer sees trade prices) (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/products/{slug}", {"slug": slug}, query, None)

    def store_api_product_reviews_list(self, slug, query=None):
        """GET /api/v1/public/v1/store/products/{slug}/reviews: A product's published reviews (rating filter; page, limit) (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/products/{slug}/reviews", {"slug": slug}, query, None)

    def store_api_shipping_quote(self, query=None):
        """GET /api/v1/public/v1/store/shipping/quote: Is the PIN code served, the fee, free-above and the ETA (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/shipping/quote", {}, query, None)

    def store_api_subscription_plans_plans(self, query=None):
        """GET /api/v1/public/v1/store/subscription-plans: What a buyer may subscribe to: box intervals and recurring catalogue prices (stable)"""
        return self.request("GET", "/api/v1/public/v1/store/subscription-plans", {}, query, None)

    def public_webhook_endpoints_list(self, query=None):
        """GET /api/v1/public/v1/webhook-endpoints: List webhook endpoints (stable)"""
        return self.request("GET", "/api/v1/public/v1/webhook-endpoints", {}, query, None)

    def public_webhook_endpoints_create(self, query=None, body=None):
        """POST /api/v1/public/v1/webhook-endpoints: Add an endpoint (https): its signing secret is in this response only (stable)"""
        return self.request("POST", "/api/v1/public/v1/webhook-endpoints", {}, query, body)

    def public_webhook_endpoints_remove(self, id, query=None):
        """DELETE /api/v1/public/v1/webhook-endpoints/{id}: Delete an endpoint (stable)"""
        return self.request("DELETE", "/api/v1/public/v1/webhook-endpoints/{id}", {"id": id}, query, None)

    def public_webhook_endpoints_update(self, id, query=None, body=None):
        """PATCH /api/v1/public/v1/webhook-endpoints/{id}: Change an endpoint's URL or events, or turn it off and on (stable)"""
        return self.request("PATCH", "/api/v1/public/v1/webhook-endpoints/{id}", {"id": id}, query, body)

    def site_workspace_get(self, query=None):
        """GET /api/v1/public/v1/workspace/profile: Company facts: legal and brand name, CIN, GSTIN, address, logo, socials, hours (stable)"""
        return self.request("GET", "/api/v1/public/v1/workspace/profile", {}, query, None)

    def social_accounts_list_accounts(self, query=None):
        """GET /api/v1/social/accounts: Connected accounts (with health) and the plan's Social accounts allowance (beta, scope marketing:read)"""
        return self.request("GET", "/api/v1/social/accounts", {}, query, None)

    def social_inbox_list(self, query=None):
        """GET /api/v1/social/inbox: Inbox threads (paged; filter by network, kind, status (default open), account, assignee) (beta, scope inbox:read)"""
        return self.request("GET", "/api/v1/social/inbox", {}, query, None)

    def social_inbox_thread(self, id, query=None):
        """GET /api/v1/social/inbox/{id}: One thread with its messages (oldest first, 500 at most) (beta, scope inbox:read)"""
        return self.request("GET", "/api/v1/social/inbox/{id}", {"id": id}, query, None)

    def social_posts_list(self, query=None):
        """GET /api/v1/social/posts: Posts (paged; filter by status, account and a time range; sort by time) (beta, scope marketing:read)"""
        return self.request("GET", "/api/v1/social/posts", {}, query, None)

    def social_posts_create(self, query=None, body=None):
        """POST /api/v1/social/posts: Save a new draft (beta, scope marketing:write)"""
        return self.request("POST", "/api/v1/social/posts", {}, query, body)

    def social_posts_get(self, id, query=None):
        """GET /api/v1/social/posts/{id}: One post with its accounts' states (beta, scope marketing:read)"""
        return self.request("GET", "/api/v1/social/posts/{id}", {"id": id}, query, None)

    def social_posts_schedule(self, id, query=None, body=None):
        """POST /api/v1/social/posts/{id}/schedule: Schedule (a time, the next queue slot, or now), or send for approval (beta, scope marketing:write)"""
        return self.request("POST", "/api/v1/social/posts/{id}/schedule", {"id": id}, query, body)

    def store_items_list(self, query=None):
        """GET /api/v1/store/items: The store's items (paged; sort by sort_order, name or created_at; item_type + item_id for one catalogue item) (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/items", {}, query, None)

    def store_items_add(self, query=None, body=None):
        """POST /api/v1/store/items: Add catalogue items to the store (up to 100 at once) (beta, scope store:write)"""
        return self.request("POST", "/api/v1/store/items", {}, query, body)

    def store_items_remove(self, id, query=None):
        """DELETE /api/v1/store/items/{id}: Take an item off the store (the catalogue item stays) (beta, scope store:write)"""
        return self.request("DELETE", "/api/v1/store/items/{id}", {"id": id}, query, None)

    def store_items_update(self, id, query=None, body=None):
        """PATCH /api/v1/store/items/{id}: Show / hide, action, per-item delivery, order, featured (beta, scope store:write)"""
        return self.request("PATCH", "/api/v1/store/items/{id}", {"id": id}, query, body)

    def store_orders_list(self, query=None):
        """GET /api/v1/store/orders: Store orders, newest first (search: buyer, number, phone) (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/orders", {}, query, None)

    def store_orders_get(self, id, query=None):
        """GET /api/v1/store/orders/{id}: One store order, with its payments and shipping (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/orders/{id}", {"id": id}, query, None)

    def store_settings_get_settings(self, query=None):
        """GET /api/v1/store/settings: The store's settings (defaults until first saved) (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/settings", {}, query, None)

    def sync_review_conflicts(self, query=None):
        """GET /api/v1/store/sync/conflicts: Sync conflicts (default open; paged; sort by created_at or field) (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/sync/conflicts", {}, query, None)

    def sync_connections_list(self, query=None):
        """GET /api/v1/store/sync/connections: The workspace's sync connections (paged; sort by created_at, display_name, last_run_at) (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/sync/connections", {}, query, None)

    def sync_connections_get(self, id, query=None):
        """GET /api/v1/store/sync/connections/{id}: One sync connection (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/sync/connections/{id}", {"id": id}, query, None)

    def sync_review_links(self, id, query=None):
        """GET /api/v1/store/sync/connections/{id}/links: A connection's linked items (paged; q on the name; sort by last_synced_at or created_at) (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/sync/connections/{id}/links", {"id": id}, query, None)

    def sync_review_runs(self, id, query=None):
        """GET /api/v1/store/sync/connections/{id}/runs: A connection's run log (paged, newest first; sort by started_at) (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/sync/connections/{id}/runs", {"id": id}, query, None)

    def sync_review_run(self, id, query=None):
        """GET /api/v1/store/sync/runs/{id}: One run with its report (what a dry run would change) (beta, scope store:read)"""
        return self.request("GET", "/api/v1/store/sync/runs/{id}", {"id": id}, query, None)

    def support_list_categories(self, query=None):
        """GET /api/v1/support/categories: List ticket categories (beta, scope support:read)"""
        return self.request("GET", "/api/v1/support/categories", {}, query, None)

    def support_list(self, query=None):
        """GET /api/v1/support/tickets: List tickets (beta, scope support:read)"""
        return self.request("GET", "/api/v1/support/tickets", {}, query, None)

    def support_get(self, id, query=None):
        """GET /api/v1/support/tickets/{id}: Read a ticket and its whole thread, internal notes included (beta, scope support:read)"""
        return self.request("GET", "/api/v1/support/tickets/{id}", {"id": id}, query, None)
