# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from __future__ import annotations

from typing_extensions import Literal

import httpx

from .transfers import (
    TransfersResource,
    AsyncTransfersResource,
    TransfersResourceWithRawResponse,
    AsyncTransfersResourceWithRawResponse,
    TransfersResourceWithStreamingResponse,
    AsyncTransfersResourceWithStreamingResponse,
)
from ....._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from ....._utils import maybe_transform, async_maybe_transform
from ....._compat import cached_property
from ....._resource import SyncAPIResource, AsyncAPIResource
from ....._response import (
    to_raw_response_wrapper,
    to_streamed_response_wrapper,
    async_to_raw_response_wrapper,
    async_to_streamed_response_wrapper,
)
from ....._base_client import make_request_options
from .....types.api.v2 import (
    order_list_params,
    order_void_params,
    order_create_params,
    order_relist_params,
    order_update_params,
    order_retrieve_params,
    order_refund_voucher_params,
    order_update_reclaim_params,
    order_assigned_customers_params,
    order_retrieve_relist_info_params,
    order_resend_confirmation_email_params,
    order_ticket_protection_redemption_params,
    order_retrieve_customer_care_information_params,
)
from .....types.api.v2.order import Order
from .....types.api.v2.customer_care_order import CustomerCareOrder
from .....types.api.v2.order_list_response import OrderListResponse
from .....types.api.v2.order_retrieve_response import OrderRetrieveResponse
from .....types.api.v2.order_retrieve_apple_passes_response import OrderRetrieveApplePassesResponse
from .....types.api.v2.order_retrieve_google_passes_response import OrderRetrieveGooglePassesResponse
from .....types.api.v2.order_ticket_protection_redemption_response import OrderTicketProtectionRedemptionResponse

__all__ = ["OrdersResource", "AsyncOrdersResource"]


class OrdersResource(SyncAPIResource):
    @cached_property
    def transfers(self) -> TransfersResource:
        return TransfersResource(self._client)

    @cached_property
    def with_raw_response(self) -> OrdersResourceWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#accessing-raw-response-data-eg-headers
        """
        return OrdersResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> OrdersResourceWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#with_streaming_response
        """
        return OrdersResourceWithStreamingResponse(self)

    def create(
        self,
        *,
        country_code: str,
        device_data: str,
        email: str,
        hold: int,
        is_guest_order: bool,
        phone: str,
        pickup_name: str,
        agent_payment_reference: str | NotGiven = NOT_GIVEN,
        amount: float | NotGiven = NOT_GIVEN,
        billing_zip: str | NotGiven = NOT_GIVEN,
        checkout_type: Literal["BASKET", "EXPRESS_PAY"] | NotGiven = NOT_GIVEN,
        click_id: str | NotGiven = NOT_GIVEN,
        first_name: str | NotGiven = NOT_GIVEN,
        last_name: str | NotGiven = NOT_GIVEN,
        non_commissionable_markup_per_ticket: float | NotGiven = NOT_GIVEN,
        payment_details: order_create_params.PaymentDetails | NotGiven = NOT_GIVEN,
        payment_gateway_type: Literal["PAYMENT_ON_ACCOUNT", "PAYMENT_SERVICE", "EXTERNAL_SERVICE"]
        | NotGiven = NOT_GIVEN,
        payment_nonce: str | NotGiven = NOT_GIVEN,
        paypal_device_data: str | NotGiven = NOT_GIVEN,
        should_send_confirmation_email_override: bool | NotGiven = NOT_GIVEN,
        upgraded3d_secure_nonce: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> Order:
        """
        Create a new order for the requested customer, or guest, using the requested
        holdId. The server will verify that the access token is authorized to access
        this hold, and also that the authenticated principal has the ability to create
        an order for the requested customer.

        Args:
          country_code: Country code.

          device_data: Device data to send to Braintree and 3rd party fraud tools to help detect
              fraudulent activity.

          email: Email address.

          hold: Numeric identifier for a resource

          is_guest_order: A boolean to determine whether or not the current order is being made through
              "Guest Checkout."

          phone: Phone number.

          agent_payment_reference: A unique string to identify the booking within a payment on-account retailer's
              internal system

          amount: The amount that payment_service has authorized. used to verify that what's been
              authorized on payment service, matches the cost platform is expecting. required
              for all non-todaytix retailers.

          billing_zip: Billing zip of payment method (used only in case payment method is Apple Pay
              Card or Google Pay)

          checkout_type: The type of checkout being used. BASKET = checkout from the basket page.
              EXPRESS_PAY = express pay checkout.

          click_id: ImpactRadius click tracking id

          first_name: the first name of the user ("user" because they might not be a registered
              customer).

          last_name: the last name of the user ("user" because they might not be a registered
              customer).

          non_commissionable_markup_per_ticket: The non-commissionable markup per ticket for Prio retailers.

          payment_gateway_type: Supported payment gateway

          payment_nonce: Nonce that client should get from Braintree (supports only Apple Pay Card and
              Google Pay)

          paypal_device_data: device data for paypal

          should_send_confirmation_email_override: An optional boolean field that will override the flag that helps identify of the
              confirmation email are to be sent by the system or not. 'null' - means we are
              not overriding anything 'true' - we are always sending confirmation email
              'false' - we are suppressing confirmation email

          upgraded3d_secure_nonce: Optional nonce based on user's credit card used by Braintree in order to adhere
              to 3DS2-compliance

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._post(
            "/api/v2/orders",
            body=maybe_transform(
                {
                    "country_code": country_code,
                    "device_data": device_data,
                    "email": email,
                    "hold": hold,
                    "is_guest_order": is_guest_order,
                    "phone": phone,
                    "pickup_name": pickup_name,
                    "agent_payment_reference": agent_payment_reference,
                    "amount": amount,
                    "billing_zip": billing_zip,
                    "checkout_type": checkout_type,
                    "click_id": click_id,
                    "first_name": first_name,
                    "last_name": last_name,
                    "non_commissionable_markup_per_ticket": non_commissionable_markup_per_ticket,
                    "payment_details": payment_details,
                    "payment_gateway_type": payment_gateway_type,
                    "payment_nonce": payment_nonce,
                    "paypal_device_data": paypal_device_data,
                    "should_send_confirmation_email_override": should_send_confirmation_email_override,
                    "upgraded3d_secure_nonce": upgraded3d_secure_nonce,
                },
                order_create_params.OrderCreateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=Order,
        )

    def retrieve(
        self,
        hold_id: str,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderRetrieveResponse:
        """
        Get an order ID by HoldTransaction ID.

        If the request originates from the TodayTix retailer, the ID represents the
        transaction ID.

        For requests from non-TT retailers, the ID is the hold ID prefixed with "TTG"
        (e.g., "TTG12341234"). Non-TT retailers do not use authorization tokens, so the
        hold's `secretKey` must be included in the request payload.

        Args:
          secret: The secret key for authorization, required for non-TT retailers.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not hold_id:
            raise ValueError(f"Expected a non-empty value for `hold_id` but received {hold_id!r}")
        return self._get(
            f"/api/v2/orders/byHoldId/{hold_id}",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform({"secret": secret}, order_retrieve_params.OrderRetrieveParams),
            ),
            cast_to=OrderRetrieveResponse,
        )

    def update(
        self,
        id: str,
        *,
        country_code: str | NotGiven = NOT_GIVEN,
        customer: str | NotGiven = NOT_GIVEN,
        email: str | NotGiven = NOT_GIVEN,
        phone: str | NotGiven = NOT_GIVEN,
        pickup_name: str | NotGiven = NOT_GIVEN,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> object:
        """Modify an order.

        The server will verify that the authenticated principal is
        allowed to edit this orderId, by verifying the customer of the order is
        currently authenticated. If the id is a hold id, then the authentication is
        based on the secret in the request body and the secret in the hold transaction
        being equal.

        Args:
          country_code: Country code.

          customer: The new customer pubId. When a customer makes a guest purchase and then signs up
              for an account.

          email: Email address.

          phone: Phone number.

          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not id:
            raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
        return self._patch(
            f"/api/v2/orders/{id}",
            body=maybe_transform(
                {
                    "country_code": country_code,
                    "customer": customer,
                    "email": email,
                    "phone": phone,
                    "pickup_name": pickup_name,
                    "secret": secret,
                },
                order_update_params.OrderUpdateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=object,
        )

    def list(
        self,
        *,
        customer: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderListResponse:
        """Get all orders that the authenticated principal has access to.

        Best usage will
        specify the customer public id or "me" in the query filter parameter, even
        though it is not strictly necessary (as a customer can only access their own
        orders).

        Args:
          customer: optional customerId (pubId on server side)

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._get(
            "/api/v2/orders",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform({"customer": customer}, order_list_params.OrderListParams),
            ),
            cast_to=OrderListResponse,
        )

    def assigned_customers(
        self,
        id: int,
        *,
        email: str,
        first_name: str,
        last_name: str,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> Order:
        """Assigning a customer to an order.

        The server will verify that the authenticated
        principal is allowed to create a customer for this orderId, by verifying the
        customer of the order is currently authenticated.

        Args:
          email: Email address.

          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._post(
            f"/api/v2/orders/{id}/assignedCustomers",
            body=maybe_transform(
                {
                    "email": email,
                    "first_name": first_name,
                    "last_name": last_name,
                    "secret": secret,
                },
                order_assigned_customers_params.OrderAssignedCustomersParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=Order,
        )

    def initiate_transfer(
        self,
        confirmation_number: str,
        *,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> None:
        """
        Starts the transfer of the received order to the currently authenticated
        customer.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not confirmation_number:
            raise ValueError(
                f"Expected a non-empty value for `confirmation_number` but received {confirmation_number!r}"
            )
        extra_headers = {"Accept": "*/*", **(extra_headers or {})}
        return self._post(
            f"/api/v2/orders/{confirmation_number}/initiateTransfer",
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=NoneType,
        )

    def refund_voucher(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> CustomerCareOrder:
        """
        Refund a PWYH voucher to credit card.

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._post(
            f"/api/v2/orders/{id}/refundVoucher",
            body=maybe_transform({"secret": secret}, order_refund_voucher_params.OrderRefundVoucherParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=CustomerCareOrder,
        )

    def reissue_ticket(
        self,
        id: int,
        *,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> str:
        """Send a new email related to this order with the new barcodes.

        The server will
        verify that the authenticated principal is allowed to access this order's id.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._post(
            f"/api/v2/orders/{id}/reissueTicket",
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=str,
        )

    def relist(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> CustomerCareOrder:
        """
        Puts an order up for resale, and will issue a voucher to the customer if it
        resells

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._post(
            f"/api/v2/orders/{id}/relist",
            body=maybe_transform({"secret": secret}, order_relist_params.OrderRelistParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=CustomerCareOrder,
        )

    def resend_confirmation_email(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> None:
        """Send a new email related to this order.

        The server will verify that the
        authenticated principal is allowed to access this id.

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        extra_headers = {"Accept": "*/*", **(extra_headers or {})}
        return self._post(
            f"/api/v2/orders/{id}/resendConfirmationEmail",
            body=maybe_transform(
                {"secret": secret}, order_resend_confirmation_email_params.OrderResendConfirmationEmailParams
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=NoneType,
        )

    def retrieve_apple_passes(
        self,
        id: int,
        *,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderRetrieveApplePassesResponse:
        """Get a List of Apple passes to add to Wallet.

        The server will verify access to
        this order.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._get(
            f"/api/v2/orders/{id}/applePasses",
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=OrderRetrieveApplePassesResponse,
        )

    def retrieve_customer_care_information(
        self,
        confirmation_number: str,
        *,
        secret: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> CustomerCareOrder:
        """
        Get the order with a given confirmation number, authenticating with the attached
        secret.

        Args:
          secret: order secret

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not confirmation_number:
            raise ValueError(
                f"Expected a non-empty value for `confirmation_number` but received {confirmation_number!r}"
            )
        return self._get(
            f"/api/v2/orders/{confirmation_number}/customerCareInformation",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {"secret": secret},
                    order_retrieve_customer_care_information_params.OrderRetrieveCustomerCareInformationParams,
                ),
            ),
            cast_to=CustomerCareOrder,
        )

    def retrieve_google_passes(
        self,
        id: int,
        *,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderRetrieveGooglePassesResponse:
        """
        Get a URL containing one or more Google Pay Passes for this order.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._get(
            f"/api/v2/orders/{id}/googlePasses",
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=OrderRetrieveGooglePassesResponse,
        )

    def retrieve_relist_info(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> object:
        """
        Get the relist information for this order.

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._get(
            f"/api/v2/orders/{id}/relistInfo",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform(
                    {"secret": secret}, order_retrieve_relist_info_params.OrderRetrieveRelistInfoParams
                ),
            ),
            cast_to=object,
        )

    def ticket_protection_redemption(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderTicketProtectionRedemptionResponse:
        """
        Redeem ticket protection for an existing order given order's id

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._post(
            f"/api/v2/orders/{id}/ticketProtectionRedemption",
            body=maybe_transform(
                {"secret": secret}, order_ticket_protection_redemption_params.OrderTicketProtectionRedemptionParams
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=OrderTicketProtectionRedemptionResponse,
        )

    def update_reclaim(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> Order:
        """
        Reclaim tickets from customer relist transaction given original transaction Id

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. The
              secret is passed in as URL param.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return self._patch(
            f"/api/v2/orders/{id}/reclaim",
            body=maybe_transform({"secret": secret}, order_update_reclaim_params.OrderUpdateReclaimParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=Order,
        )

    def void(
        self,
        hold_id: str,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> None:
        """
        Void an order by its hold ID.

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not hold_id:
            raise ValueError(f"Expected a non-empty value for `hold_id` but received {hold_id!r}")
        extra_headers = {"Accept": "*/*", **(extra_headers or {})}
        return self._post(
            f"/api/v2/orders/{hold_id}/void",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=maybe_transform({"secret": secret}, order_void_params.OrderVoidParams),
            ),
            cast_to=NoneType,
        )


class AsyncOrdersResource(AsyncAPIResource):
    @cached_property
    def transfers(self) -> AsyncTransfersResource:
        return AsyncTransfersResource(self._client)

    @cached_property
    def with_raw_response(self) -> AsyncOrdersResourceWithRawResponse:
        """
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#accessing-raw-response-data-eg-headers
        """
        return AsyncOrdersResourceWithRawResponse(self)

    @cached_property
    def with_streaming_response(self) -> AsyncOrdersResourceWithStreamingResponse:
        """
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/alisytsma/ali-test-mcp#with_streaming_response
        """
        return AsyncOrdersResourceWithStreamingResponse(self)

    async def create(
        self,
        *,
        country_code: str,
        device_data: str,
        email: str,
        hold: int,
        is_guest_order: bool,
        phone: str,
        pickup_name: str,
        agent_payment_reference: str | NotGiven = NOT_GIVEN,
        amount: float | NotGiven = NOT_GIVEN,
        billing_zip: str | NotGiven = NOT_GIVEN,
        checkout_type: Literal["BASKET", "EXPRESS_PAY"] | NotGiven = NOT_GIVEN,
        click_id: str | NotGiven = NOT_GIVEN,
        first_name: str | NotGiven = NOT_GIVEN,
        last_name: str | NotGiven = NOT_GIVEN,
        non_commissionable_markup_per_ticket: float | NotGiven = NOT_GIVEN,
        payment_details: order_create_params.PaymentDetails | NotGiven = NOT_GIVEN,
        payment_gateway_type: Literal["PAYMENT_ON_ACCOUNT", "PAYMENT_SERVICE", "EXTERNAL_SERVICE"]
        | NotGiven = NOT_GIVEN,
        payment_nonce: str | NotGiven = NOT_GIVEN,
        paypal_device_data: str | NotGiven = NOT_GIVEN,
        should_send_confirmation_email_override: bool | NotGiven = NOT_GIVEN,
        upgraded3d_secure_nonce: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> Order:
        """
        Create a new order for the requested customer, or guest, using the requested
        holdId. The server will verify that the access token is authorized to access
        this hold, and also that the authenticated principal has the ability to create
        an order for the requested customer.

        Args:
          country_code: Country code.

          device_data: Device data to send to Braintree and 3rd party fraud tools to help detect
              fraudulent activity.

          email: Email address.

          hold: Numeric identifier for a resource

          is_guest_order: A boolean to determine whether or not the current order is being made through
              "Guest Checkout."

          phone: Phone number.

          agent_payment_reference: A unique string to identify the booking within a payment on-account retailer's
              internal system

          amount: The amount that payment_service has authorized. used to verify that what's been
              authorized on payment service, matches the cost platform is expecting. required
              for all non-todaytix retailers.

          billing_zip: Billing zip of payment method (used only in case payment method is Apple Pay
              Card or Google Pay)

          checkout_type: The type of checkout being used. BASKET = checkout from the basket page.
              EXPRESS_PAY = express pay checkout.

          click_id: ImpactRadius click tracking id

          first_name: the first name of the user ("user" because they might not be a registered
              customer).

          last_name: the last name of the user ("user" because they might not be a registered
              customer).

          non_commissionable_markup_per_ticket: The non-commissionable markup per ticket for Prio retailers.

          payment_gateway_type: Supported payment gateway

          payment_nonce: Nonce that client should get from Braintree (supports only Apple Pay Card and
              Google Pay)

          paypal_device_data: device data for paypal

          should_send_confirmation_email_override: An optional boolean field that will override the flag that helps identify of the
              confirmation email are to be sent by the system or not. 'null' - means we are
              not overriding anything 'true' - we are always sending confirmation email
              'false' - we are suppressing confirmation email

          upgraded3d_secure_nonce: Optional nonce based on user's credit card used by Braintree in order to adhere
              to 3DS2-compliance

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._post(
            "/api/v2/orders",
            body=await async_maybe_transform(
                {
                    "country_code": country_code,
                    "device_data": device_data,
                    "email": email,
                    "hold": hold,
                    "is_guest_order": is_guest_order,
                    "phone": phone,
                    "pickup_name": pickup_name,
                    "agent_payment_reference": agent_payment_reference,
                    "amount": amount,
                    "billing_zip": billing_zip,
                    "checkout_type": checkout_type,
                    "click_id": click_id,
                    "first_name": first_name,
                    "last_name": last_name,
                    "non_commissionable_markup_per_ticket": non_commissionable_markup_per_ticket,
                    "payment_details": payment_details,
                    "payment_gateway_type": payment_gateway_type,
                    "payment_nonce": payment_nonce,
                    "paypal_device_data": paypal_device_data,
                    "should_send_confirmation_email_override": should_send_confirmation_email_override,
                    "upgraded3d_secure_nonce": upgraded3d_secure_nonce,
                },
                order_create_params.OrderCreateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=Order,
        )

    async def retrieve(
        self,
        hold_id: str,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderRetrieveResponse:
        """
        Get an order ID by HoldTransaction ID.

        If the request originates from the TodayTix retailer, the ID represents the
        transaction ID.

        For requests from non-TT retailers, the ID is the hold ID prefixed with "TTG"
        (e.g., "TTG12341234"). Non-TT retailers do not use authorization tokens, so the
        hold's `secretKey` must be included in the request payload.

        Args:
          secret: The secret key for authorization, required for non-TT retailers.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not hold_id:
            raise ValueError(f"Expected a non-empty value for `hold_id` but received {hold_id!r}")
        return await self._get(
            f"/api/v2/orders/byHoldId/{hold_id}",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform({"secret": secret}, order_retrieve_params.OrderRetrieveParams),
            ),
            cast_to=OrderRetrieveResponse,
        )

    async def update(
        self,
        id: str,
        *,
        country_code: str | NotGiven = NOT_GIVEN,
        customer: str | NotGiven = NOT_GIVEN,
        email: str | NotGiven = NOT_GIVEN,
        phone: str | NotGiven = NOT_GIVEN,
        pickup_name: str | NotGiven = NOT_GIVEN,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> object:
        """Modify an order.

        The server will verify that the authenticated principal is
        allowed to edit this orderId, by verifying the customer of the order is
        currently authenticated. If the id is a hold id, then the authentication is
        based on the secret in the request body and the secret in the hold transaction
        being equal.

        Args:
          country_code: Country code.

          customer: The new customer pubId. When a customer makes a guest purchase and then signs up
              for an account.

          email: Email address.

          phone: Phone number.

          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not id:
            raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
        return await self._patch(
            f"/api/v2/orders/{id}",
            body=await async_maybe_transform(
                {
                    "country_code": country_code,
                    "customer": customer,
                    "email": email,
                    "phone": phone,
                    "pickup_name": pickup_name,
                    "secret": secret,
                },
                order_update_params.OrderUpdateParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=object,
        )

    async def list(
        self,
        *,
        customer: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderListResponse:
        """Get all orders that the authenticated principal has access to.

        Best usage will
        specify the customer public id or "me" in the query filter parameter, even
        though it is not strictly necessary (as a customer can only access their own
        orders).

        Args:
          customer: optional customerId (pubId on server side)

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._get(
            "/api/v2/orders",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform({"customer": customer}, order_list_params.OrderListParams),
            ),
            cast_to=OrderListResponse,
        )

    async def assigned_customers(
        self,
        id: int,
        *,
        email: str,
        first_name: str,
        last_name: str,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> Order:
        """Assigning a customer to an order.

        The server will verify that the authenticated
        principal is allowed to create a customer for this orderId, by verifying the
        customer of the order is currently authenticated.

        Args:
          email: Email address.

          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._post(
            f"/api/v2/orders/{id}/assignedCustomers",
            body=await async_maybe_transform(
                {
                    "email": email,
                    "first_name": first_name,
                    "last_name": last_name,
                    "secret": secret,
                },
                order_assigned_customers_params.OrderAssignedCustomersParams,
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=Order,
        )

    async def initiate_transfer(
        self,
        confirmation_number: str,
        *,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> None:
        """
        Starts the transfer of the received order to the currently authenticated
        customer.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not confirmation_number:
            raise ValueError(
                f"Expected a non-empty value for `confirmation_number` but received {confirmation_number!r}"
            )
        extra_headers = {"Accept": "*/*", **(extra_headers or {})}
        return await self._post(
            f"/api/v2/orders/{confirmation_number}/initiateTransfer",
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=NoneType,
        )

    async def refund_voucher(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> CustomerCareOrder:
        """
        Refund a PWYH voucher to credit card.

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._post(
            f"/api/v2/orders/{id}/refundVoucher",
            body=await async_maybe_transform({"secret": secret}, order_refund_voucher_params.OrderRefundVoucherParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=CustomerCareOrder,
        )

    async def reissue_ticket(
        self,
        id: int,
        *,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> str:
        """Send a new email related to this order with the new barcodes.

        The server will
        verify that the authenticated principal is allowed to access this order's id.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._post(
            f"/api/v2/orders/{id}/reissueTicket",
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=str,
        )

    async def relist(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> CustomerCareOrder:
        """
        Puts an order up for resale, and will issue a voucher to the customer if it
        resells

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._post(
            f"/api/v2/orders/{id}/relist",
            body=await async_maybe_transform({"secret": secret}, order_relist_params.OrderRelistParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=CustomerCareOrder,
        )

    async def resend_confirmation_email(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> None:
        """Send a new email related to this order.

        The server will verify that the
        authenticated principal is allowed to access this id.

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        extra_headers = {"Accept": "*/*", **(extra_headers or {})}
        return await self._post(
            f"/api/v2/orders/{id}/resendConfirmationEmail",
            body=await async_maybe_transform(
                {"secret": secret}, order_resend_confirmation_email_params.OrderResendConfirmationEmailParams
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=NoneType,
        )

    async def retrieve_apple_passes(
        self,
        id: int,
        *,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderRetrieveApplePassesResponse:
        """Get a List of Apple passes to add to Wallet.

        The server will verify access to
        this order.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._get(
            f"/api/v2/orders/{id}/applePasses",
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=OrderRetrieveApplePassesResponse,
        )

    async def retrieve_customer_care_information(
        self,
        confirmation_number: str,
        *,
        secret: str,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> CustomerCareOrder:
        """
        Get the order with a given confirmation number, authenticating with the attached
        secret.

        Args:
          secret: order secret

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not confirmation_number:
            raise ValueError(
                f"Expected a non-empty value for `confirmation_number` but received {confirmation_number!r}"
            )
        return await self._get(
            f"/api/v2/orders/{confirmation_number}/customerCareInformation",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform(
                    {"secret": secret},
                    order_retrieve_customer_care_information_params.OrderRetrieveCustomerCareInformationParams,
                ),
            ),
            cast_to=CustomerCareOrder,
        )

    async def retrieve_google_passes(
        self,
        id: int,
        *,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderRetrieveGooglePassesResponse:
        """
        Get a URL containing one or more Google Pay Passes for this order.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._get(
            f"/api/v2/orders/{id}/googlePasses",
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=OrderRetrieveGooglePassesResponse,
        )

    async def retrieve_relist_info(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> object:
        """
        Get the relist information for this order.

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._get(
            f"/api/v2/orders/{id}/relistInfo",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform(
                    {"secret": secret}, order_retrieve_relist_info_params.OrderRetrieveRelistInfoParams
                ),
            ),
            cast_to=object,
        )

    async def ticket_protection_redemption(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> OrderTicketProtectionRedemptionResponse:
        """
        Redeem ticket protection for an existing order given order's id

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._post(
            f"/api/v2/orders/{id}/ticketProtectionRedemption",
            body=await async_maybe_transform(
                {"secret": secret}, order_ticket_protection_redemption_params.OrderTicketProtectionRedemptionParams
            ),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=OrderTicketProtectionRedemptionResponse,
        )

    async def update_reclaim(
        self,
        id: int,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> Order:
        """
        Reclaim tickets from customer relist transaction given original transaction Id

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. The
              secret is passed in as URL param.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        return await self._patch(
            f"/api/v2/orders/{id}/reclaim",
            body=await async_maybe_transform({"secret": secret}, order_update_reclaim_params.OrderUpdateReclaimParams),
            options=make_request_options(
                extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
            ),
            cast_to=Order,
        )

    async def void(
        self,
        hold_id: str,
        *,
        secret: str | NotGiven = NOT_GIVEN,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
    ) -> None:
        """
        Void an order by its hold ID.

        Args:
          secret: This is a secret which can be used to access a hold without a JWT token. If
              provided, the id in path param will be considered as Hold Id.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        """
        if not hold_id:
            raise ValueError(f"Expected a non-empty value for `hold_id` but received {hold_id!r}")
        extra_headers = {"Accept": "*/*", **(extra_headers or {})}
        return await self._post(
            f"/api/v2/orders/{hold_id}/void",
            options=make_request_options(
                extra_headers=extra_headers,
                extra_query=extra_query,
                extra_body=extra_body,
                timeout=timeout,
                query=await async_maybe_transform({"secret": secret}, order_void_params.OrderVoidParams),
            ),
            cast_to=NoneType,
        )


class OrdersResourceWithRawResponse:
    def __init__(self, orders: OrdersResource) -> None:
        self._orders = orders

        self.create = to_raw_response_wrapper(
            orders.create,
        )
        self.retrieve = to_raw_response_wrapper(
            orders.retrieve,
        )
        self.update = to_raw_response_wrapper(
            orders.update,
        )
        self.list = to_raw_response_wrapper(
            orders.list,
        )
        self.assigned_customers = to_raw_response_wrapper(
            orders.assigned_customers,
        )
        self.initiate_transfer = to_raw_response_wrapper(
            orders.initiate_transfer,
        )
        self.refund_voucher = to_raw_response_wrapper(
            orders.refund_voucher,
        )
        self.reissue_ticket = to_raw_response_wrapper(
            orders.reissue_ticket,
        )
        self.relist = to_raw_response_wrapper(
            orders.relist,
        )
        self.resend_confirmation_email = to_raw_response_wrapper(
            orders.resend_confirmation_email,
        )
        self.retrieve_apple_passes = to_raw_response_wrapper(
            orders.retrieve_apple_passes,
        )
        self.retrieve_customer_care_information = to_raw_response_wrapper(
            orders.retrieve_customer_care_information,
        )
        self.retrieve_google_passes = to_raw_response_wrapper(
            orders.retrieve_google_passes,
        )
        self.retrieve_relist_info = to_raw_response_wrapper(
            orders.retrieve_relist_info,
        )
        self.ticket_protection_redemption = to_raw_response_wrapper(
            orders.ticket_protection_redemption,
        )
        self.update_reclaim = to_raw_response_wrapper(
            orders.update_reclaim,
        )
        self.void = to_raw_response_wrapper(
            orders.void,
        )

    @cached_property
    def transfers(self) -> TransfersResourceWithRawResponse:
        return TransfersResourceWithRawResponse(self._orders.transfers)


class AsyncOrdersResourceWithRawResponse:
    def __init__(self, orders: AsyncOrdersResource) -> None:
        self._orders = orders

        self.create = async_to_raw_response_wrapper(
            orders.create,
        )
        self.retrieve = async_to_raw_response_wrapper(
            orders.retrieve,
        )
        self.update = async_to_raw_response_wrapper(
            orders.update,
        )
        self.list = async_to_raw_response_wrapper(
            orders.list,
        )
        self.assigned_customers = async_to_raw_response_wrapper(
            orders.assigned_customers,
        )
        self.initiate_transfer = async_to_raw_response_wrapper(
            orders.initiate_transfer,
        )
        self.refund_voucher = async_to_raw_response_wrapper(
            orders.refund_voucher,
        )
        self.reissue_ticket = async_to_raw_response_wrapper(
            orders.reissue_ticket,
        )
        self.relist = async_to_raw_response_wrapper(
            orders.relist,
        )
        self.resend_confirmation_email = async_to_raw_response_wrapper(
            orders.resend_confirmation_email,
        )
        self.retrieve_apple_passes = async_to_raw_response_wrapper(
            orders.retrieve_apple_passes,
        )
        self.retrieve_customer_care_information = async_to_raw_response_wrapper(
            orders.retrieve_customer_care_information,
        )
        self.retrieve_google_passes = async_to_raw_response_wrapper(
            orders.retrieve_google_passes,
        )
        self.retrieve_relist_info = async_to_raw_response_wrapper(
            orders.retrieve_relist_info,
        )
        self.ticket_protection_redemption = async_to_raw_response_wrapper(
            orders.ticket_protection_redemption,
        )
        self.update_reclaim = async_to_raw_response_wrapper(
            orders.update_reclaim,
        )
        self.void = async_to_raw_response_wrapper(
            orders.void,
        )

    @cached_property
    def transfers(self) -> AsyncTransfersResourceWithRawResponse:
        return AsyncTransfersResourceWithRawResponse(self._orders.transfers)


class OrdersResourceWithStreamingResponse:
    def __init__(self, orders: OrdersResource) -> None:
        self._orders = orders

        self.create = to_streamed_response_wrapper(
            orders.create,
        )
        self.retrieve = to_streamed_response_wrapper(
            orders.retrieve,
        )
        self.update = to_streamed_response_wrapper(
            orders.update,
        )
        self.list = to_streamed_response_wrapper(
            orders.list,
        )
        self.assigned_customers = to_streamed_response_wrapper(
            orders.assigned_customers,
        )
        self.initiate_transfer = to_streamed_response_wrapper(
            orders.initiate_transfer,
        )
        self.refund_voucher = to_streamed_response_wrapper(
            orders.refund_voucher,
        )
        self.reissue_ticket = to_streamed_response_wrapper(
            orders.reissue_ticket,
        )
        self.relist = to_streamed_response_wrapper(
            orders.relist,
        )
        self.resend_confirmation_email = to_streamed_response_wrapper(
            orders.resend_confirmation_email,
        )
        self.retrieve_apple_passes = to_streamed_response_wrapper(
            orders.retrieve_apple_passes,
        )
        self.retrieve_customer_care_information = to_streamed_response_wrapper(
            orders.retrieve_customer_care_information,
        )
        self.retrieve_google_passes = to_streamed_response_wrapper(
            orders.retrieve_google_passes,
        )
        self.retrieve_relist_info = to_streamed_response_wrapper(
            orders.retrieve_relist_info,
        )
        self.ticket_protection_redemption = to_streamed_response_wrapper(
            orders.ticket_protection_redemption,
        )
        self.update_reclaim = to_streamed_response_wrapper(
            orders.update_reclaim,
        )
        self.void = to_streamed_response_wrapper(
            orders.void,
        )

    @cached_property
    def transfers(self) -> TransfersResourceWithStreamingResponse:
        return TransfersResourceWithStreamingResponse(self._orders.transfers)


class AsyncOrdersResourceWithStreamingResponse:
    def __init__(self, orders: AsyncOrdersResource) -> None:
        self._orders = orders

        self.create = async_to_streamed_response_wrapper(
            orders.create,
        )
        self.retrieve = async_to_streamed_response_wrapper(
            orders.retrieve,
        )
        self.update = async_to_streamed_response_wrapper(
            orders.update,
        )
        self.list = async_to_streamed_response_wrapper(
            orders.list,
        )
        self.assigned_customers = async_to_streamed_response_wrapper(
            orders.assigned_customers,
        )
        self.initiate_transfer = async_to_streamed_response_wrapper(
            orders.initiate_transfer,
        )
        self.refund_voucher = async_to_streamed_response_wrapper(
            orders.refund_voucher,
        )
        self.reissue_ticket = async_to_streamed_response_wrapper(
            orders.reissue_ticket,
        )
        self.relist = async_to_streamed_response_wrapper(
            orders.relist,
        )
        self.resend_confirmation_email = async_to_streamed_response_wrapper(
            orders.resend_confirmation_email,
        )
        self.retrieve_apple_passes = async_to_streamed_response_wrapper(
            orders.retrieve_apple_passes,
        )
        self.retrieve_customer_care_information = async_to_streamed_response_wrapper(
            orders.retrieve_customer_care_information,
        )
        self.retrieve_google_passes = async_to_streamed_response_wrapper(
            orders.retrieve_google_passes,
        )
        self.retrieve_relist_info = async_to_streamed_response_wrapper(
            orders.retrieve_relist_info,
        )
        self.ticket_protection_redemption = async_to_streamed_response_wrapper(
            orders.ticket_protection_redemption,
        )
        self.update_reclaim = async_to_streamed_response_wrapper(
            orders.update_reclaim,
        )
        self.void = async_to_streamed_response_wrapper(
            orders.void,
        )

    @cached_property
    def transfers(self) -> AsyncTransfersResourceWithStreamingResponse:
        return AsyncTransfersResourceWithStreamingResponse(self._orders.transfers)
