# This file was auto-generated by Fern from our API Definition.

import typing
from ..core.client_wrapper import SyncClientWrapper
from ..core.request_options import RequestOptions
from ..core.http_response import HttpResponse
from ..types.get_inventory_adjustment_response import GetInventoryAdjustmentResponse
from ..core.jsonable_encoder import jsonable_encoder
from ..core.unchecked_base_model import construct_type
from json.decoder import JSONDecodeError
from ..core.api_error import ApiError
from ..requests.inventory_change import InventoryChangeParams
from ..types.batch_change_inventory_response import BatchChangeInventoryResponse
from ..core.serialization import convert_and_respect_annotation_metadata
from ..types.inventory_change_type import InventoryChangeType
from ..types.inventory_state import InventoryState
from ..types.batch_get_inventory_changes_response import BatchGetInventoryChangesResponse
from ..types.batch_get_inventory_counts_response import BatchGetInventoryCountsResponse
from ..types.get_inventory_physical_count_response import GetInventoryPhysicalCountResponse
from ..types.get_inventory_transfer_response import GetInventoryTransferResponse
from ..core.client_wrapper import AsyncClientWrapper
from ..core.http_response import AsyncHttpResponse

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class RawInventoryClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._client_wrapper = client_wrapper

    def deprecated_get_adjustment(
        self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[GetInventoryAdjustmentResponse]:
        """
        Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        adjustment_id : str
            ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[GetInventoryAdjustmentResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v2/inventory/adjustment/{jsonable_encoder(adjustment_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryAdjustmentResponse,
                    construct_type(
                        type_=GetInventoryAdjustmentResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def get_adjustment(
        self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[GetInventoryAdjustmentResponse]:
        """
        Returns the [InventoryAdjustment](entity:InventoryAdjustment) object
        with the provided `adjustment_id`.

        Parameters
        ----------
        adjustment_id : str
            ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[GetInventoryAdjustmentResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v2/inventory/adjustments/{jsonable_encoder(adjustment_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryAdjustmentResponse,
                    construct_type(
                        type_=GetInventoryAdjustmentResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def deprecated_batch_change(
        self,
        *,
        idempotency_key: str,
        changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
        ignore_unchanged_counts: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[BatchChangeInventoryResponse]:
        """
        Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        idempotency_key : str
            A client-supplied, universally unique identifier (UUID) for the
            request.

            See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
            [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
            information.

        changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
            The set of physical counts and inventory adjustments to be made.
            Changes are applied based on the client-supplied timestamp and may be sent
            out of order.

        ignore_unchanged_counts : typing.Optional[bool]
            Indicates whether the current physical count should be ignored if
            the quantity is unchanged since the last physical count. Default: `true`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[BatchChangeInventoryResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            "v2/inventory/batch-change",
            method="POST",
            json={
                "idempotency_key": idempotency_key,
                "changes": convert_and_respect_annotation_metadata(
                    object_=changes,
                    annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
                    direction="write",
                ),
                "ignore_unchanged_counts": ignore_unchanged_counts,
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BatchChangeInventoryResponse,
                    construct_type(
                        type_=BatchChangeInventoryResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def deprecated_batch_get_changes(
        self,
        *,
        catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
        states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
        updated_after: typing.Optional[str] = OMIT,
        updated_before: typing.Optional[str] = OMIT,
        cursor: typing.Optional[str] = OMIT,
        limit: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[BatchGetInventoryChangesResponse]:
        """
        Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        catalog_object_ids : typing.Optional[typing.Sequence[str]]
            The filter to return results by `CatalogObject` ID.
            The filter is only applicable when set. The default value is null.

        location_ids : typing.Optional[typing.Sequence[str]]
            The filter to return results by `Location` ID.
            The filter is only applicable when set. The default value is null.

        types : typing.Optional[typing.Sequence[InventoryChangeType]]
            The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
            The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.

        states : typing.Optional[typing.Sequence[InventoryState]]
            The filter to return `ADJUSTMENT` query results by
            `InventoryState`. This filter is only applied when set.
            The default value is null.

        updated_after : typing.Optional[str]
            The filter to return results with their `calculated_at` value
            after the given time as specified in an RFC 3339 timestamp.
            The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).

        updated_before : typing.Optional[str]
            The filter to return results with their `created_at` or `calculated_at` value
            strictly before the given time as specified in an RFC 3339 timestamp.
            The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).

        cursor : typing.Optional[str]
            A pagination cursor returned by a previous call to this endpoint.
            Provide this to retrieve the next set of results for the original query.

            See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.

        limit : typing.Optional[int]
            The number of [records](entity:InventoryChange) to return.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[BatchGetInventoryChangesResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            "v2/inventory/batch-retrieve-changes",
            method="POST",
            json={
                "catalog_object_ids": catalog_object_ids,
                "location_ids": location_ids,
                "types": types,
                "states": states,
                "updated_after": updated_after,
                "updated_before": updated_before,
                "cursor": cursor,
                "limit": limit,
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BatchGetInventoryChangesResponse,
                    construct_type(
                        type_=BatchGetInventoryChangesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def deprecated_batch_get_counts(
        self,
        *,
        catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        updated_after: typing.Optional[str] = OMIT,
        cursor: typing.Optional[str] = OMIT,
        states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
        limit: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[BatchGetInventoryCountsResponse]:
        """
        Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        catalog_object_ids : typing.Optional[typing.Sequence[str]]
            The filter to return results by `CatalogObject` ID.
            The filter is applicable only when set.  The default is null.

        location_ids : typing.Optional[typing.Sequence[str]]
            The filter to return results by `Location` ID.
            This filter is applicable only when set. The default is null.

        updated_after : typing.Optional[str]
            The filter to return results with their `calculated_at` value
            after the given time as specified in an RFC 3339 timestamp.
            The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).

        cursor : typing.Optional[str]
            A pagination cursor returned by a previous call to this endpoint.
            Provide this to retrieve the next set of results for the original query.

            See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.

        states : typing.Optional[typing.Sequence[InventoryState]]
            The filter to return results by `InventoryState`. The filter is only applicable when set.
            Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
            The default is null.

        limit : typing.Optional[int]
            The number of [records](entity:InventoryCount) to return.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[BatchGetInventoryCountsResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            "v2/inventory/batch-retrieve-counts",
            method="POST",
            json={
                "catalog_object_ids": catalog_object_ids,
                "location_ids": location_ids,
                "updated_after": updated_after,
                "cursor": cursor,
                "states": states,
                "limit": limit,
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BatchGetInventoryCountsResponse,
                    construct_type(
                        type_=BatchGetInventoryCountsResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def batch_create_changes(
        self,
        *,
        idempotency_key: str,
        changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
        ignore_unchanged_counts: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> HttpResponse[BatchChangeInventoryResponse]:
        """
        Applies adjustments and counts to the provided item quantities.

        On success: returns the current calculated counts for all objects
        referenced in the request.
        On failure: returns a list of related errors.

        Parameters
        ----------
        idempotency_key : str
            A client-supplied, universally unique identifier (UUID) for the
            request.

            See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
            [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
            information.

        changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
            The set of physical counts and inventory adjustments to be made.
            Changes are applied based on the client-supplied timestamp and may be sent
            out of order.

        ignore_unchanged_counts : typing.Optional[bool]
            Indicates whether the current physical count should be ignored if
            the quantity is unchanged since the last physical count. Default: `true`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[BatchChangeInventoryResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            "v2/inventory/changes/batch-create",
            method="POST",
            json={
                "idempotency_key": idempotency_key,
                "changes": convert_and_respect_annotation_metadata(
                    object_=changes,
                    annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
                    direction="write",
                ),
                "ignore_unchanged_counts": ignore_unchanged_counts,
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BatchChangeInventoryResponse,
                    construct_type(
                        type_=BatchChangeInventoryResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def deprecated_get_physical_count(
        self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[GetInventoryPhysicalCountResponse]:
        """
        Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        physical_count_id : str
            ID of the
            [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[GetInventoryPhysicalCountResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v2/inventory/physical-count/{jsonable_encoder(physical_count_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryPhysicalCountResponse,
                    construct_type(
                        type_=GetInventoryPhysicalCountResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def get_physical_count(
        self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[GetInventoryPhysicalCountResponse]:
        """
        Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount)
        object with the provided `physical_count_id`.

        Parameters
        ----------
        physical_count_id : str
            ID of the
            [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[GetInventoryPhysicalCountResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v2/inventory/physical-counts/{jsonable_encoder(physical_count_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryPhysicalCountResponse,
                    construct_type(
                        type_=GetInventoryPhysicalCountResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def get_transfer(
        self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[GetInventoryTransferResponse]:
        """
        Returns the [InventoryTransfer](entity:InventoryTransfer) object
        with the provided `transfer_id`.

        Parameters
        ----------
        transfer_id : str
            ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[GetInventoryTransferResponse]
            Success
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v2/inventory/transfers/{jsonable_encoder(transfer_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryTransferResponse,
                    construct_type(
                        type_=GetInventoryTransferResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)


class AsyncRawInventoryClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._client_wrapper = client_wrapper

    async def deprecated_get_adjustment(
        self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]:
        """
        Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        adjustment_id : str
            ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[GetInventoryAdjustmentResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v2/inventory/adjustment/{jsonable_encoder(adjustment_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryAdjustmentResponse,
                    construct_type(
                        type_=GetInventoryAdjustmentResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def get_adjustment(
        self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]:
        """
        Returns the [InventoryAdjustment](entity:InventoryAdjustment) object
        with the provided `adjustment_id`.

        Parameters
        ----------
        adjustment_id : str
            ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[GetInventoryAdjustmentResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v2/inventory/adjustments/{jsonable_encoder(adjustment_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryAdjustmentResponse,
                    construct_type(
                        type_=GetInventoryAdjustmentResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def deprecated_batch_change(
        self,
        *,
        idempotency_key: str,
        changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
        ignore_unchanged_counts: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[BatchChangeInventoryResponse]:
        """
        Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        idempotency_key : str
            A client-supplied, universally unique identifier (UUID) for the
            request.

            See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
            [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
            information.

        changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
            The set of physical counts and inventory adjustments to be made.
            Changes are applied based on the client-supplied timestamp and may be sent
            out of order.

        ignore_unchanged_counts : typing.Optional[bool]
            Indicates whether the current physical count should be ignored if
            the quantity is unchanged since the last physical count. Default: `true`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[BatchChangeInventoryResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            "v2/inventory/batch-change",
            method="POST",
            json={
                "idempotency_key": idempotency_key,
                "changes": convert_and_respect_annotation_metadata(
                    object_=changes,
                    annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
                    direction="write",
                ),
                "ignore_unchanged_counts": ignore_unchanged_counts,
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BatchChangeInventoryResponse,
                    construct_type(
                        type_=BatchChangeInventoryResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def deprecated_batch_get_changes(
        self,
        *,
        catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        types: typing.Optional[typing.Sequence[InventoryChangeType]] = OMIT,
        states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
        updated_after: typing.Optional[str] = OMIT,
        updated_before: typing.Optional[str] = OMIT,
        cursor: typing.Optional[str] = OMIT,
        limit: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[BatchGetInventoryChangesResponse]:
        """
        Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        catalog_object_ids : typing.Optional[typing.Sequence[str]]
            The filter to return results by `CatalogObject` ID.
            The filter is only applicable when set. The default value is null.

        location_ids : typing.Optional[typing.Sequence[str]]
            The filter to return results by `Location` ID.
            The filter is only applicable when set. The default value is null.

        types : typing.Optional[typing.Sequence[InventoryChangeType]]
            The filter to return results by `InventoryChangeType` values other than `TRANSFER`.
            The default value is `[PHYSICAL_COUNT, ADJUSTMENT]`.

        states : typing.Optional[typing.Sequence[InventoryState]]
            The filter to return `ADJUSTMENT` query results by
            `InventoryState`. This filter is only applied when set.
            The default value is null.

        updated_after : typing.Optional[str]
            The filter to return results with their `calculated_at` value
            after the given time as specified in an RFC 3339 timestamp.
            The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).

        updated_before : typing.Optional[str]
            The filter to return results with their `created_at` or `calculated_at` value
            strictly before the given time as specified in an RFC 3339 timestamp.
            The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).

        cursor : typing.Optional[str]
            A pagination cursor returned by a previous call to this endpoint.
            Provide this to retrieve the next set of results for the original query.

            See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.

        limit : typing.Optional[int]
            The number of [records](entity:InventoryChange) to return.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[BatchGetInventoryChangesResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            "v2/inventory/batch-retrieve-changes",
            method="POST",
            json={
                "catalog_object_ids": catalog_object_ids,
                "location_ids": location_ids,
                "types": types,
                "states": states,
                "updated_after": updated_after,
                "updated_before": updated_before,
                "cursor": cursor,
                "limit": limit,
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BatchGetInventoryChangesResponse,
                    construct_type(
                        type_=BatchGetInventoryChangesResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def deprecated_batch_get_counts(
        self,
        *,
        catalog_object_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        location_ids: typing.Optional[typing.Sequence[str]] = OMIT,
        updated_after: typing.Optional[str] = OMIT,
        cursor: typing.Optional[str] = OMIT,
        states: typing.Optional[typing.Sequence[InventoryState]] = OMIT,
        limit: typing.Optional[int] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[BatchGetInventoryCountsResponse]:
        """
        Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        catalog_object_ids : typing.Optional[typing.Sequence[str]]
            The filter to return results by `CatalogObject` ID.
            The filter is applicable only when set.  The default is null.

        location_ids : typing.Optional[typing.Sequence[str]]
            The filter to return results by `Location` ID.
            This filter is applicable only when set. The default is null.

        updated_after : typing.Optional[str]
            The filter to return results with their `calculated_at` value
            after the given time as specified in an RFC 3339 timestamp.
            The default value is the UNIX epoch of (`1970-01-01T00:00:00Z`).

        cursor : typing.Optional[str]
            A pagination cursor returned by a previous call to this endpoint.
            Provide this to retrieve the next set of results for the original query.

            See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.

        states : typing.Optional[typing.Sequence[InventoryState]]
            The filter to return results by `InventoryState`. The filter is only applicable when set.
            Ignored are untracked states of `NONE`, `SOLD`, and `UNLINKED_RETURN`.
            The default is null.

        limit : typing.Optional[int]
            The number of [records](entity:InventoryCount) to return.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[BatchGetInventoryCountsResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            "v2/inventory/batch-retrieve-counts",
            method="POST",
            json={
                "catalog_object_ids": catalog_object_ids,
                "location_ids": location_ids,
                "updated_after": updated_after,
                "cursor": cursor,
                "states": states,
                "limit": limit,
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BatchGetInventoryCountsResponse,
                    construct_type(
                        type_=BatchGetInventoryCountsResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def batch_create_changes(
        self,
        *,
        idempotency_key: str,
        changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
        ignore_unchanged_counts: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncHttpResponse[BatchChangeInventoryResponse]:
        """
        Applies adjustments and counts to the provided item quantities.

        On success: returns the current calculated counts for all objects
        referenced in the request.
        On failure: returns a list of related errors.

        Parameters
        ----------
        idempotency_key : str
            A client-supplied, universally unique identifier (UUID) for the
            request.

            See [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency) in the
            [API Development 101](https://developer.squareup.com/docs/buildbasics) section for more
            information.

        changes : typing.Optional[typing.Sequence[InventoryChangeParams]]
            The set of physical counts and inventory adjustments to be made.
            Changes are applied based on the client-supplied timestamp and may be sent
            out of order.

        ignore_unchanged_counts : typing.Optional[bool]
            Indicates whether the current physical count should be ignored if
            the quantity is unchanged since the last physical count. Default: `true`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[BatchChangeInventoryResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            "v2/inventory/changes/batch-create",
            method="POST",
            json={
                "idempotency_key": idempotency_key,
                "changes": convert_and_respect_annotation_metadata(
                    object_=changes,
                    annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
                    direction="write",
                ),
                "ignore_unchanged_counts": ignore_unchanged_counts,
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    BatchChangeInventoryResponse,
                    construct_type(
                        type_=BatchChangeInventoryResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def deprecated_get_physical_count(
        self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]:
        """
        Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL
        is updated to conform to the standard convention.

        Parameters
        ----------
        physical_count_id : str
            ID of the
            [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[GetInventoryPhysicalCountResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v2/inventory/physical-count/{jsonable_encoder(physical_count_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryPhysicalCountResponse,
                    construct_type(
                        type_=GetInventoryPhysicalCountResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def get_physical_count(
        self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]:
        """
        Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount)
        object with the provided `physical_count_id`.

        Parameters
        ----------
        physical_count_id : str
            ID of the
            [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[GetInventoryPhysicalCountResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v2/inventory/physical-counts/{jsonable_encoder(physical_count_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryPhysicalCountResponse,
                    construct_type(
                        type_=GetInventoryPhysicalCountResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def get_transfer(
        self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[GetInventoryTransferResponse]:
        """
        Returns the [InventoryTransfer](entity:InventoryTransfer) object
        with the provided `transfer_id`.

        Parameters
        ----------
        transfer_id : str
            ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[GetInventoryTransferResponse]
            Success
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v2/inventory/transfers/{jsonable_encoder(transfer_id)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    GetInventoryTransferResponse,
                    construct_type(
                        type_=GetInventoryTransferResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)
