diff --git a/.fern/metadata.json b/.fern/metadata.json
index ac4c8814..7203ea45 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -1,5 +1,5 @@
{
- "cliVersion": "3.98.5",
+ "cliVersion": "5.56.0",
"generatorName": "fernapi/fern-python-sdk",
"generatorVersion": "4.55.4",
"generatorConfig": {
@@ -14,5 +14,6 @@
"use_typeddict_requests_for_file_upload": true,
"exclude_types_from_init_exports": true
},
- "sdkVersion": "44.2.0-rc.0"
+ "originGitCommit": "b2dac8b2c1b9fe87c0e1fe3eb6257b259caa0715",
+ "sdkVersion": "45.0.1.20260715"
}
\ No newline at end of file
diff --git a/.fern/replay.lock b/.fern/replay.lock
index 276d1b4d..5edd26f5 100644
--- a/.fern/replay.lock
+++ b/.fern/replay.lock
@@ -6,5 +6,11 @@ generations:
timestamp: 2026-05-19T21:17:07.449Z
cli_version: unknown
generator_versions: {}
-current_generation: 813313da9098aacfa234225449b0c67cf4a6284c
+ - commit_sha: 20fdc7bbb8d546dddddc81eb6d529308bd168d08
+ tree_hash: a122988cb5ca436b953d395eef18e3b7b51224cb
+ timestamp: 2026-07-14T16:59:18.638Z
+ cli_version: unknown
+ generator_versions:
+ fernapi/fern-python-sdk: 4.55.4
+current_generation: 20fdc7bbb8d546dddddc81eb6d529308bd168d08
patches: []
diff --git a/pyproject.toml b/pyproject.toml
index 2dba3aba..bb56312e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ dynamic = ["version"]
[tool.poetry]
name = "squareup"
-version = "44.2.0-rc.0"
+version = "45.0.1.20260715"
description = ""
readme = "README.md"
authors = []
diff --git a/reference.md b/reference.md
index 4857a1df..c056b1f3 100644
--- a/reference.md
+++ b/reference.md
@@ -2748,9 +2748,15 @@ batches will be processed in order as long as the total object count for the
request (items, variations, modifier lists, discounts, and taxes) is no more
than 10,000.
+This endpoint uses full-replacement semantics. The client must send the complete object, and any
+field absent from the request is interpreted as an intentional clear. This logic applies to
+nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
-update requests are rejected with the `429` error code.
+update requests are rejected with the `429` error code. Prefer batching related changes into a
+single call rather than issuing many small writes, since each write acquires the lock separately
+and parallel writes to the same seller will contend with each other, producing `429` errors.
@@ -2935,6 +2941,8 @@ Returns a list of all [CatalogObject](entity:CatalogObject)s of the specified ty
The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](entity:CatalogObjectType) values,
for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`".
+Always specify `types` explicitly. When upgrading to a newer API version, omitting `types` may
+cause new object types to appear in results that were not returned under the previous version.
__Important:__ ListCatalog does not return deleted catalog items. To retrieve
deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects)
@@ -3065,6 +3073,11 @@ endpoint in the following aspects:
- `SearchCatalogItems` supports the custom attribute query filters to return items or item variations that contain custom attribute values, where `SearchCatalogObjects` does not.
- `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does.
- The both endpoints have different call conventions, including the query filter formats.
+
+The `object_types` parameter is specified as a list of [CatalogObjectType](entity:CatalogObjectType) values.
+Always specify `object_types` explicitly. When upgrading to a newer API version, omitting
+`object_types` may cause new object types to appear in results that were not returned under
+the previous version.
@@ -6437,10 +6450,578 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
-**location_id:** `str`
+**location_id:** `str`
+
+The ID of the [location](entity:Location) where the gift card should be registered for
+reporting purposes. Gift cards can be redeemed at any of the seller's locations.
+
+
+
+
+
+-
+
+**gift_card:** `GiftCardParams`
+
+The gift card to create. The `type` field is required for this request. The `gan_source`
+and `gan` fields are included as follows:
+
+To direct Square to generate a 16-digit GAN, omit `gan_source` and `gan`.
+
+To provide a custom GAN, include `gan_source` and `gan`.
+- For `gan_source`, specify `OTHER`.
+- For `gan`, provide a custom GAN containing 8 to 20 alphanumeric characters. The GAN must be
+unique for the seller and cannot start with the same bank identification number (BIN) as major
+credit cards. Do not use GANs that are easy to guess (such as 12345678) because they greatly
+increase the risk of fraud. It is the responsibility of the developer to ensure the security
+of their custom GANs. For more information, see
+[Custom GANs](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#custom-gans).
+
+To register an unused, physical gift card that the seller previously ordered from Square,
+include `gan` and provide the GAN that is printed on the gift card.
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
+
+
+
+
+client.gift_cards.get_from_gan(...) -> AsyncHttpResponse[GetGiftCardFromGanResponse]
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieves a gift card using the gift card account number (GAN).
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from square import Square
+
+client = Square(
+ token="YOUR_TOKEN",
+)
+client.gift_cards.get_from_gan(
+ gan="7783320001001635",
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**gan:** `str`
+
+The gift card account number (GAN) of the gift card to retrieve.
+The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported.
+Square-issued gift cards have 16-digit GANs.
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
+
+
+
+
+client.gift_cards.get_from_nonce(...) -> AsyncHttpResponse[GetGiftCardFromNonceResponse]
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieves a gift card using a secure payment token that represents the gift card.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from square import Square
+
+client = Square(
+ token="YOUR_TOKEN",
+)
+client.gift_cards.get_from_nonce(
+ nonce="cnon:7783322135245171",
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**nonce:** `str`
+
+The payment token of the gift card to retrieve. Payment tokens are generated by the
+Web Payments SDK or In-App Payments SDK.
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
+
+
+
+
+client.gift_cards.link_customer(...) -> AsyncHttpResponse[LinkCustomerToGiftCardResponse]
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Links a customer to a gift card, which is also referred to as adding a card on file.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from square import Square
+
+client = Square(
+ token="YOUR_TOKEN",
+)
+client.gift_cards.link_customer(
+ gift_card_id="gift_card_id",
+ customer_id="GKY0FZ3V717AH8Q2D821PNT2ZW",
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**gift_card_id:** `str` — The ID of the gift card to be linked.
+
+
+
+
+
+-
+
+**customer_id:** `str` — The ID of the customer to link to the gift card.
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
+
+
+
+
+client.gift_cards.unlink_customer(...) -> AsyncHttpResponse[UnlinkCustomerFromGiftCardResponse]
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Unlinks a customer from a gift card, which is also referred to as removing a card on file.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from square import Square
+
+client = Square(
+ token="YOUR_TOKEN",
+)
+client.gift_cards.unlink_customer(
+ gift_card_id="gift_card_id",
+ customer_id="GKY0FZ3V717AH8Q2D821PNT2ZW",
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**gift_card_id:** `str` — The ID of the gift card to be unlinked.
+
+
+
+
+
+-
+
+**customer_id:** `str` — The ID of the customer to unlink from the gift card.
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
+
+
+
+
+client.gift_cards.get(...) -> AsyncHttpResponse[GetGiftCardResponse]
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Retrieves a gift card using the gift card ID.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from square import Square
+
+client = Square(
+ token="YOUR_TOKEN",
+)
+client.gift_cards.get(
+ id="id",
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**id:** `str` — The ID of the gift card to retrieve.
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
+
+
+
+
+## Inventory
+client.inventory.list_inventory_adjustment_reasons(...) -> AsyncHttpResponse[ListInventoryAdjustmentReasonsResponse]
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Returns the standard and custom inventory adjustment reasons available
+to the seller.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from square import Square
+
+client = Square(
+ token="YOUR_TOKEN",
+)
+client.inventory.list_inventory_adjustment_reasons(
+ include_deleted=True,
+ include_system_codes=True,
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**include_deleted:** `typing.Optional[bool]`
+
+Indicates whether the response should include deleted custom inventory
+adjustment reasons. The default value is `false`.
+
+
+
+
+
+-
+
+**include_system_codes:** `typing.Optional[bool]`
+
+Indicates whether the response should include Square-generated system
+inventory adjustment reason codes that cannot be used to write adjustments
+from the Connect API, such as `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`,
+and `CANCELED_SALE`. The default value is `false`.
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
+
+
+
+
+client.inventory.create_inventory_adjustment_reason(...) -> AsyncHttpResponse[CreateInventoryAdjustmentReasonResponse]
+
+-
+
+#### 📝 Description
+
+
+-
+
+
+-
+
+Creates a custom inventory adjustment reason.
+
+
+
+
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from square import Square
+
+client = Square(
+ token="YOUR_TOKEN",
+)
+client.inventory.create_inventory_adjustment_reason(
+ idempotency_key="27b2f2b1-1c2a-4b9e-8f3a-0d9c3a1e5b47",
+ adjustment_reason={
+ "id": {"type": "CUSTOM"},
+ "name": "Donated to charity",
+ "direction": "DECREASE",
+ },
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
-The ID of the [location](entity:Location) where the gift card should be registered for
-reporting purposes. Gift cards can be redeemed at any of the seller's locations.
+**idempotency_key:** `str`
+
+A client-supplied, universally unique identifier to make this
+[CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason)
+request idempotent.
@@ -6448,24 +7029,10 @@ reporting purposes. Gift cards can be redeemed at any of the seller's locations.
-
-**gift_card:** `GiftCardParams`
-
-The gift card to create. The `type` field is required for this request. The `gan_source`
-and `gan` fields are included as follows:
-
-To direct Square to generate a 16-digit GAN, omit `gan_source` and `gan`.
-
-To provide a custom GAN, include `gan_source` and `gan`.
-- For `gan_source`, specify `OTHER`.
-- For `gan`, provide a custom GAN containing 8 to 20 alphanumeric characters. The GAN must be
-unique for the seller and cannot start with the same bank identification number (BIN) as major
-credit cards. Do not use GANs that are easy to guess (such as 12345678) because they greatly
-increase the risk of fraud. It is the responsibility of the developer to ensure the security
-of their custom GANs. For more information, see
-[Custom GANs](https://developer.squareup.com/docs/gift-cards/using-gift-cards-api#custom-gans).
+**adjustment_reason:** `InventoryAdjustmentReasonParams`
-To register an unused, physical gift card that the seller previously ordered from Square,
-include `gan` and provide the GAN that is printed on the gift card.
+The custom inventory adjustment reason to create. Only custom
+adjustment reasons can be created.
@@ -6485,7 +7052,7 @@ include `gan` and provide the GAN that is printed on the gift card.
-client.gift_cards.get_from_gan(...) -> AsyncHttpResponse[GetGiftCardFromGanResponse]
+client.inventory.delete_inventory_adjustment_reason(...) -> AsyncHttpResponse[DeleteInventoryAdjustmentReasonResponse]
-
@@ -6497,7 +7064,7 @@ include `gan` and provide the GAN that is printed on the gift card.
-
-Retrieves a gift card using the gift card account number (GAN).
+Soft deletes a custom inventory adjustment reason.
@@ -6517,8 +7084,8 @@ from square import Square
client = Square(
token="YOUR_TOKEN",
)
-client.gift_cards.get_from_gan(
- gan="7783320001001635",
+client.inventory.delete_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
)
```
@@ -6535,11 +7102,7 @@ client.gift_cards.get_from_gan(
-
-**gan:** `str`
-
-The gift card account number (GAN) of the gift card to retrieve.
-The maximum length of a GAN is 255 digits to account for third-party GANs that have been imported.
-Square-issued gift cards have 16-digit GANs.
+**reason_id:** `InventoryAdjustmentReasonIdParams` — The identifier of the custom inventory adjustment reason to soft delete.
@@ -6559,7 +7122,7 @@ Square-issued gift cards have 16-digit GANs.
-client.gift_cards.get_from_nonce(...) -> AsyncHttpResponse[GetGiftCardFromNonceResponse]
+client.inventory.restore_inventory_adjustment_reason(...) -> AsyncHttpResponse[RestoreInventoryAdjustmentReasonResponse]
-
@@ -6571,7 +7134,7 @@ Square-issued gift cards have 16-digit GANs.
-
-Retrieves a gift card using a secure payment token that represents the gift card.
+Restores a soft-deleted custom inventory adjustment reason.
@@ -6591,8 +7154,8 @@ from square import Square
client = Square(
token="YOUR_TOKEN",
)
-client.gift_cards.get_from_nonce(
- nonce="cnon:7783322135245171",
+client.inventory.restore_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
)
```
@@ -6609,10 +7172,10 @@ client.gift_cards.get_from_nonce(
-
-**nonce:** `str`
+**reason_id:** `InventoryAdjustmentReasonIdParams`
-The payment token of the gift card to retrieve. Payment tokens are generated by the
-Web Payments SDK or In-App Payments SDK.
+The identifier of the soft-deleted custom inventory adjustment reason
+to restore.
@@ -6632,7 +7195,7 @@ Web Payments SDK or In-App Payments SDK.
-client.gift_cards.link_customer(...) -> AsyncHttpResponse[LinkCustomerToGiftCardResponse]
+client.inventory.retrieve_inventory_adjustment_reason(...) -> AsyncHttpResponse[RetrieveInventoryAdjustmentReasonResponse]
-
@@ -6644,7 +7207,8 @@ Web Payments SDK or In-App Payments SDK.
-
-Links a customer to a gift card, which is also referred to as adding a card on file.
+Returns the inventory adjustment reason identified by the provided
+`reason_id`. Deleted custom reasons can be retrieved by ID.
@@ -6664,9 +7228,8 @@ from square import Square
client = Square(
token="YOUR_TOKEN",
)
-client.gift_cards.link_customer(
- gift_card_id="gift_card_id",
- customer_id="GKY0FZ3V717AH8Q2D821PNT2ZW",
+client.inventory.retrieve_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
)
```
@@ -6683,15 +7246,7 @@ client.gift_cards.link_customer(
-
-**gift_card_id:** `str` — The ID of the gift card to be linked.
-
-
-
-
-
--
-
-**customer_id:** `str` — The ID of the customer to link to the gift card.
+**reason_id:** `InventoryAdjustmentReasonIdParams` — The identifier of the inventory adjustment reason to retrieve.
@@ -6711,7 +7266,7 @@ client.gift_cards.link_customer(
-client.gift_cards.unlink_customer(...) -> AsyncHttpResponse[UnlinkCustomerFromGiftCardResponse]
+client.inventory.update_inventory_adjustment_reason(...) -> AsyncHttpResponse[UpdateInventoryAdjustmentReasonResponse]
-
@@ -6723,7 +7278,7 @@ client.gift_cards.link_customer(
-
-Unlinks a customer from a gift card, which is also referred to as removing a card on file.
+Updates a custom inventory adjustment reason.
@@ -6743,9 +7298,12 @@ from square import Square
client = Square(
token="YOUR_TOKEN",
)
-client.gift_cards.unlink_customer(
- gift_card_id="gift_card_id",
- customer_id="GKY0FZ3V717AH8Q2D821PNT2ZW",
+client.inventory.update_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ adjustment_reason={
+ "id": {"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ "name": "Charitable donation",
+ },
)
```
@@ -6762,7 +7320,7 @@ client.gift_cards.unlink_customer(
-
-**gift_card_id:** `str` — The ID of the gift card to be unlinked.
+**reason_id:** `InventoryAdjustmentReasonIdParams` — The identifier of the custom inventory adjustment reason to update.
@@ -6770,7 +7328,12 @@ client.gift_cards.unlink_customer(
-
-**customer_id:** `str` — The ID of the customer to unlink from the gift card.
+**adjustment_reason:** `InventoryAdjustmentReasonParams`
+
+The requested custom inventory adjustment reason update. Only the
+`name` field can be updated. Deleted custom reasons cannot be updated. To
+restore a deleted custom reason, call
+[RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
@@ -6790,7 +7353,7 @@ client.gift_cards.unlink_customer(
-client.gift_cards.get(...) -> AsyncHttpResponse[GetGiftCardResponse]
+client.inventory.deprecated_get_adjustment(...) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]
-
@@ -6802,7 +7365,8 @@ client.gift_cards.unlink_customer(
-
-Retrieves a gift card using the gift card ID.
+Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL
+is updated to conform to the standard convention.
@@ -6822,8 +7386,8 @@ from square import Square
client = Square(
token="YOUR_TOKEN",
)
-client.gift_cards.get(
- id="id",
+client.inventory.deprecated_get_adjustment(
+ adjustment_id="adjustment_id",
)
```
@@ -6840,7 +7404,7 @@ client.gift_cards.get(
-
-**id:** `str` — The ID of the gift card to retrieve.
+**adjustment_id:** `str` — ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
@@ -6860,8 +7424,7 @@ client.gift_cards.get(
-## Inventory
-client.inventory.deprecated_get_adjustment(...) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]
+client.inventory.update_inventory_adjustment(...) -> AsyncHttpResponse[UpdateInventoryAdjustmentResponse]
-
@@ -6873,8 +7436,10 @@ client.gift_cards.get(
-
-Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL
-is updated to conform to the standard convention.
+Applies an update to the provided adjustment.
+
+On success: returns the newly updated adjustment.
+On failure: returns a list of related errors.
@@ -6894,8 +7459,9 @@ from square import Square
client = Square(
token="YOUR_TOKEN",
)
-client.inventory.deprecated_get_adjustment(
- adjustment_id="adjustment_id",
+client.inventory.update_inventory_adjustment(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ adjustment={},
)
```
@@ -6912,7 +7478,35 @@ client.inventory.deprecated_get_adjustment(
-
-**adjustment_id:** `str` — ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+**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
+[Build Basics](https://developer.squareup.com/docs/buildbasics) section for more
+information.
+
+
+
+
+
+-
+
+**adjustment:** `InventoryAdjustmentParams`
+
+Represents the updates being written to a past/existing inventory adjustment.
+This works using sparse updates, meaning that any fields omitted from the inputted InventoryAdjustment
+will retain their values.
+
+Only updates to the quantity, cost_money, vendor_id, and reason_id fields of an InventoryAdjustment can be made here.
+Note that the quantity field must be provided, but it can be identical to the current quantity if there are no desired quantity changes.
+cost_money and vendor_id can only be written to adjustments that add stock to the system (from_state of NONE or UNLINKED_RETURN) and to untracked sale adjustments.
+reason_id can be changed to any reason that is valid for the adjustment's state transition. The reason of a system-generated adjustment (for example, SALE or RECOUNT) cannot be changed.
+Adjustments generated by Square from other records cannot be updated. This includes inferred adjustments created by physical counts, transfer-like cross-location adjustments, and component adjustments.
+Adjustments linked to purchase orders cannot be updated. Adjustments linked to sales can only have cost_money and vendor_id updated, and only for untracked sales.
+Restock adjustments linked to an itemized return can have their quantity updated, up to the quantity remaining on the return.
+Adjustments older than one year cannot be updated.
@@ -7265,6 +7859,31 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
+**sort:** `typing.Optional[BatchRetrieveInventoryChangesSortParams]`
+
+Specification of how returned inventory changes should be ordered.
+
+Currently, inventory changes can only be ordered by the occurred_at field.
+The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+
+
+
+
+-
+
+**reason_ids:** `typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]`
+
+The filter to return `ADJUSTMENT` query results by inventory
+adjustment reason. This filter is only applied when set. The request cannot
+include both `reason_ids` and `states`.
+
+
+
+
+
+-
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -7685,6 +8304,31 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
+**sort:** `typing.Optional[BatchRetrieveInventoryChangesSortParams]`
+
+Specification of how returned inventory changes should be ordered.
+
+Currently, inventory changes can only be ordered by the occurred_at field.
+The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+
+
+
+
+-
+
+**reason_ids:** `typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]`
+
+The filter to return `ADJUSTMENT` query results by inventory
+adjustment reason. This filter is only applied when set. The request cannot
+include both `reason_ids` and `states`.
+
+
+
+
+
+-
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -7987,77 +8631,6 @@ ID of the
-
-
-
-
-client.inventory.get_transfer(...) -> AsyncHttpResponse[GetInventoryTransferResponse]
-
--
-
-#### 📝 Description
-
-
--
-
-
--
-
-Returns the [InventoryTransfer](entity:InventoryTransfer) object
-with the provided `transfer_id`.
-
-
-
-
-
-#### 🔌 Usage
-
-
--
-
-
--
-
-```python
-from square import Square
-
-client = Square(
- token="YOUR_TOKEN",
-)
-client.inventory.get_transfer(
- transfer_id="transfer_id",
-)
-
-```
-
-
-
-
-
-#### ⚙️ Parameters
-
-
--
-
-
--
-
-**transfer_id:** `str` — ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve.
-
-
-
-
-
--
-
-**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
-
-
-
-
-
-
-
@@ -8275,6 +8848,62 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
+
+
+
+
+client.inventory.get_transfer(...) -> AsyncHttpResponse[None]
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```python
+from square import Square
+
+client = Square(
+ token="YOUR_TOKEN",
+)
+client.inventory.get_transfer(
+ transfer_id="transfer_id",
+)
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**transfer_id:** `str`
+
+
+
+
+
+-
+
+**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
+
+
+
+
+
+
+
@@ -20495,6 +21124,10 @@ typing.Optional[core.File]` — See core.File for more documentation
Creates a new or updates the specified [CatalogObject](entity:CatalogObject).
+This endpoint uses full-replacement semantics. The client must send the complete object, and any
+field absent from the request is interpreted as an intentional clear. This logic applies to
+nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
update requests are rejected with the `429` error code.
diff --git a/src/square/catalog/client.py b/src/square/catalog/client.py
index 4bd63686..66bab377 100644
--- a/src/square/catalog/client.py
+++ b/src/square/catalog/client.py
@@ -202,9 +202,15 @@ def batch_upsert(
request (items, variations, modifier lists, discounts, and taxes) is no more
than 10,000.
+ This endpoint uses full-replacement semantics. The client must send the complete object, and any
+ field absent from the request is interpreted as an intentional clear. This logic applies to
+ nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
- update requests are rejected with the `429` error code.
+ update requests are rejected with the `429` error code. Prefer batching related changes into a
+ single call rather than issuing many small writes, since each write acquires the lock separately
+ and parallel writes to the same seller will contend with each other, producing `429` errors.
Parameters
----------
@@ -316,6 +322,8 @@ def list(
The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](entity:CatalogObjectType) values,
for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`".
+ Always specify `types` explicitly. When upgrading to a newer API version, omitting `types` may
+ cause new object types to appear in results that were not returned under the previous version.
__Important:__ ListCatalog does not return deleted catalog items. To retrieve
deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects)
@@ -405,6 +413,11 @@ def search(
- `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does.
- The both endpoints have different call conventions, including the query filter formats.
+ The `object_types` parameter is specified as a list of [CatalogObjectType](entity:CatalogObjectType) values.
+ Always specify `object_types` explicitly. When upgrading to a newer API version, omitting
+ `object_types` may cause new object types to appear in results that were not returned under
+ the previous version.
+
Parameters
----------
cursor : typing.Optional[str]
@@ -930,9 +943,15 @@ async def batch_upsert(
request (items, variations, modifier lists, discounts, and taxes) is no more
than 10,000.
+ This endpoint uses full-replacement semantics. The client must send the complete object, and any
+ field absent from the request is interpreted as an intentional clear. This logic applies to
+ nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
- update requests are rejected with the `429` error code.
+ update requests are rejected with the `429` error code. Prefer batching related changes into a
+ single call rather than issuing many small writes, since each write acquires the lock separately
+ and parallel writes to the same seller will contend with each other, producing `429` errors.
Parameters
----------
@@ -1060,6 +1079,8 @@ async def list(
The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](entity:CatalogObjectType) values,
for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`".
+ Always specify `types` explicitly. When upgrading to a newer API version, omitting `types` may
+ cause new object types to appear in results that were not returned under the previous version.
__Important:__ ListCatalog does not return deleted catalog items. To retrieve
deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects)
@@ -1158,6 +1179,11 @@ async def search(
- `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does.
- The both endpoints have different call conventions, including the query filter formats.
+ The `object_types` parameter is specified as a list of [CatalogObjectType](entity:CatalogObjectType) values.
+ Always specify `object_types` explicitly. When upgrading to a newer API version, omitting
+ `object_types` may cause new object types to appear in results that were not returned under
+ the previous version.
+
Parameters
----------
cursor : typing.Optional[str]
diff --git a/src/square/catalog/object/client.py b/src/square/catalog/object/client.py
index fd591707..e33b5f42 100644
--- a/src/square/catalog/object/client.py
+++ b/src/square/catalog/object/client.py
@@ -39,6 +39,10 @@ def upsert(
"""
Creates a new or updates the specified [CatalogObject](entity:CatalogObject).
+ This endpoint uses full-replacement semantics. The client must send the complete object, and any
+ field absent from the request is interpreted as an intentional clear. This logic applies to
+ nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
update requests are rejected with the `429` error code.
@@ -240,6 +244,10 @@ async def upsert(
"""
Creates a new or updates the specified [CatalogObject](entity:CatalogObject).
+ This endpoint uses full-replacement semantics. The client must send the complete object, and any
+ field absent from the request is interpreted as an intentional clear. This logic applies to
+ nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
update requests are rejected with the `429` error code.
diff --git a/src/square/catalog/object/raw_client.py b/src/square/catalog/object/raw_client.py
index 507bcd98..72f29637 100644
--- a/src/square/catalog/object/raw_client.py
+++ b/src/square/catalog/object/raw_client.py
@@ -33,6 +33,10 @@ def upsert(
"""
Creates a new or updates the specified [CatalogObject](entity:CatalogObject).
+ This endpoint uses full-replacement semantics. The client must send the complete object, and any
+ field absent from the request is interpreted as an intentional clear. This logic applies to
+ nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
update requests are rejected with the `429` error code.
@@ -244,6 +248,10 @@ async def upsert(
"""
Creates a new or updates the specified [CatalogObject](entity:CatalogObject).
+ This endpoint uses full-replacement semantics. The client must send the complete object, and any
+ field absent from the request is interpreted as an intentional clear. This logic applies to
+ nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
update requests are rejected with the `429` error code.
diff --git a/src/square/catalog/raw_client.py b/src/square/catalog/raw_client.py
index a2fd5d89..6a1da146 100644
--- a/src/square/catalog/raw_client.py
+++ b/src/square/catalog/raw_client.py
@@ -209,9 +209,15 @@ def batch_upsert(
request (items, variations, modifier lists, discounts, and taxes) is no more
than 10,000.
+ This endpoint uses full-replacement semantics. The client must send the complete object, and any
+ field absent from the request is interpreted as an intentional clear. This logic applies to
+ nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
- update requests are rejected with the `429` error code.
+ update requests are rejected with the `429` error code. Prefer batching related changes into a
+ single call rather than issuing many small writes, since each write acquires the lock separately
+ and parallel writes to the same seller will contend with each other, producing `429` errors.
Parameters
----------
@@ -335,6 +341,8 @@ def list(
The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](entity:CatalogObjectType) values,
for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`".
+ Always specify `types` explicitly. When upgrading to a newer API version, omitting `types` may
+ cause new object types to appear in results that were not returned under the previous version.
__Important:__ ListCatalog does not return deleted catalog items. To retrieve
deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects)
@@ -436,6 +444,11 @@ def search(
- `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does.
- The both endpoints have different call conventions, including the query filter formats.
+ The `object_types` parameter is specified as a list of [CatalogObjectType](entity:CatalogObjectType) values.
+ Always specify `object_types` explicitly. When upgrading to a newer API version, omitting
+ `object_types` may cause new object types to appear in results that were not returned under
+ the previous version.
+
Parameters
----------
cursor : typing.Optional[str]
@@ -954,9 +967,15 @@ async def batch_upsert(
request (items, variations, modifier lists, discounts, and taxes) is no more
than 10,000.
+ This endpoint uses full-replacement semantics. The client must send the complete object, and any
+ field absent from the request is interpreted as an intentional clear. This logic applies to
+ nested objects as well. For example, omitting inlined children like variations will delete them.
+
To ensure consistency, only one update request is processed at a time per seller account.
While one (batch or non-batch) update request is being processed, other (batched and non-batched)
- update requests are rejected with the `429` error code.
+ update requests are rejected with the `429` error code. Prefer batching related changes into a
+ single call rather than issuing many small writes, since each write acquires the lock separately
+ and parallel writes to the same seller will contend with each other, producing `429` errors.
Parameters
----------
@@ -1082,6 +1101,8 @@ async def list(
The `types` parameter is specified as a comma-separated list of the [CatalogObjectType](entity:CatalogObjectType) values,
for example, "`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`, `IMAGE`".
+ Always specify `types` explicitly. When upgrading to a newer API version, omitting `types` may
+ cause new object types to appear in results that were not returned under the previous version.
__Important:__ ListCatalog does not return deleted catalog items. To retrieve
deleted catalog items, use [SearchCatalogObjects](api-endpoint:Catalog-SearchCatalogObjects)
@@ -1186,6 +1207,11 @@ async def search(
- `SearchCatalogItems` does not support the `include_deleted_objects` filter to search for deleted items or item variations, whereas `SearchCatalogObjects` does.
- The both endpoints have different call conventions, including the query filter formats.
+ The `object_types` parameter is specified as a list of [CatalogObjectType](entity:CatalogObjectType) values.
+ Always specify `object_types` explicitly. When upgrading to a newer API version, omitting
+ `object_types` may cause new object types to appear in results that were not returned under
+ the previous version.
+
Parameters
----------
cursor : typing.Optional[str]
diff --git a/src/square/core/client_wrapper.py b/src/square/core/client_wrapper.py
index cc63bfa5..2d828739 100644
--- a/src/square/core/client_wrapper.py
+++ b/src/square/core/client_wrapper.py
@@ -26,18 +26,18 @@ def get_headers(self) -> typing.Dict[str, str]:
import platform
headers: typing.Dict[str, str] = {
- "User-Agent": "squareup/44.2.0-rc.0",
+ "User-Agent": "squareup/45.0.1.20260715",
"X-Fern-Language": "Python",
"X-Fern-Runtime": f"python/{platform.python_version()}",
"X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
"X-Fern-SDK-Name": "squareup",
- "X-Fern-SDK-Version": "44.2.0-rc.0",
+ "X-Fern-SDK-Version": "45.0.1.20260715",
**(self.get_custom_headers() or {}),
}
token = self._get_token()
if token is not None:
headers["Authorization"] = f"Bearer {token}"
- headers["Square-Version"] = self._version if self._version is not None else "2026-05-20"
+ headers["Square-Version"] = self._version if self._version is not None else "2026-07-15"
return headers
def _get_token(self) -> typing.Optional[str]:
diff --git a/src/square/inventory/client.py b/src/square/inventory/client.py
index 7ae7a02b..03e03441 100644
--- a/src/square/inventory/client.py
+++ b/src/square/inventory/client.py
@@ -5,19 +5,29 @@
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.pagination import AsyncPager, SyncPager
from ..core.request_options import RequestOptions
+from ..requests.batch_retrieve_inventory_changes_sort import BatchRetrieveInventoryChangesSortParams
+from ..requests.inventory_adjustment import InventoryAdjustmentParams
+from ..requests.inventory_adjustment_reason import InventoryAdjustmentReasonParams
+from ..requests.inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
from ..requests.inventory_change import InventoryChangeParams
from ..types.batch_change_inventory_response import BatchChangeInventoryResponse
from ..types.batch_get_inventory_changes_response import BatchGetInventoryChangesResponse
from ..types.batch_get_inventory_counts_response import BatchGetInventoryCountsResponse
+from ..types.create_inventory_adjustment_reason_response import CreateInventoryAdjustmentReasonResponse
+from ..types.delete_inventory_adjustment_reason_response import DeleteInventoryAdjustmentReasonResponse
from ..types.get_inventory_adjustment_response import GetInventoryAdjustmentResponse
from ..types.get_inventory_changes_response import GetInventoryChangesResponse
from ..types.get_inventory_count_response import GetInventoryCountResponse
from ..types.get_inventory_physical_count_response import GetInventoryPhysicalCountResponse
-from ..types.get_inventory_transfer_response import GetInventoryTransferResponse
from ..types.inventory_change import InventoryChange
from ..types.inventory_change_type import InventoryChangeType
from ..types.inventory_count import InventoryCount
from ..types.inventory_state import InventoryState
+from ..types.list_inventory_adjustment_reasons_response import ListInventoryAdjustmentReasonsResponse
+from ..types.restore_inventory_adjustment_reason_response import RestoreInventoryAdjustmentReasonResponse
+from ..types.retrieve_inventory_adjustment_reason_response import RetrieveInventoryAdjustmentReasonResponse
+from ..types.update_inventory_adjustment_reason_response import UpdateInventoryAdjustmentReasonResponse
+from ..types.update_inventory_adjustment_response import UpdateInventoryAdjustmentResponse
from .raw_client import AsyncRawInventoryClient, RawInventoryClient
# this is used as the default value for optional parameters
@@ -39,6 +49,260 @@ def with_raw_response(self) -> RawInventoryClient:
"""
return self._raw_client
+ def list_inventory_adjustment_reasons(
+ self,
+ *,
+ include_deleted: typing.Optional[bool] = None,
+ include_system_codes: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ListInventoryAdjustmentReasonsResponse:
+ """
+ Returns the standard and custom inventory adjustment reasons available
+ to the seller.
+
+ Parameters
+ ----------
+ include_deleted : typing.Optional[bool]
+ Indicates whether the response should include deleted custom inventory
+ adjustment reasons. The default value is `false`.
+
+ include_system_codes : typing.Optional[bool]
+ Indicates whether the response should include Square-generated system
+ inventory adjustment reason codes that cannot be used to write adjustments
+ from the Connect API, such as `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`,
+ and `CANCELED_SALE`. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListInventoryAdjustmentReasonsResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.list_inventory_adjustment_reasons(
+ include_deleted=True,
+ include_system_codes=True,
+ )
+ """
+ _response = self._raw_client.list_inventory_adjustment_reasons(
+ include_deleted=include_deleted, include_system_codes=include_system_codes, request_options=request_options
+ )
+ return _response.data
+
+ def create_inventory_adjustment_reason(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateInventoryAdjustmentReasonResponse:
+ """
+ Creates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier to make this
+ [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason)
+ request idempotent.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The custom inventory adjustment reason to create. Only custom
+ adjustment reasons can be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.create_inventory_adjustment_reason(
+ idempotency_key="27b2f2b1-1c2a-4b9e-8f3a-0d9c3a1e5b47",
+ adjustment_reason={
+ "id": {"type": "CUSTOM"},
+ "name": "Donated to charity",
+ "direction": "DECREASE",
+ },
+ )
+ """
+ _response = self._raw_client.create_inventory_adjustment_reason(
+ idempotency_key=idempotency_key, adjustment_reason=adjustment_reason, request_options=request_options
+ )
+ return _response.data
+
+ def delete_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteInventoryAdjustmentReasonResponse:
+ """
+ Soft deletes a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to soft delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.delete_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+ """
+ _response = self._raw_client.delete_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ def restore_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> RestoreInventoryAdjustmentReasonResponse:
+ """
+ Restores a soft-deleted custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the soft-deleted custom inventory adjustment reason
+ to restore.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RestoreInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.restore_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+ """
+ _response = self._raw_client.restore_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ def retrieve_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveInventoryAdjustmentReasonResponse:
+ """
+ Returns the inventory adjustment reason identified by the provided
+ `reason_id`. Deleted custom reasons can be retrieved by ID.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the inventory adjustment reason to retrieve.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RetrieveInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.retrieve_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+ """
+ _response = self._raw_client.retrieve_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ def update_inventory_adjustment_reason(
+ self,
+ *,
+ reason_id: InventoryAdjustmentReasonIdParams,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateInventoryAdjustmentReasonResponse:
+ """
+ Updates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to update.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The requested custom inventory adjustment reason update. Only the
+ `name` field can be updated. Deleted custom reasons cannot be updated. To
+ restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.update_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ adjustment_reason={
+ "id": {"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ "name": "Charitable donation",
+ },
+ )
+ """
+ _response = self._raw_client.update_inventory_adjustment_reason(
+ reason_id=reason_id, adjustment_reason=adjustment_reason, request_options=request_options
+ )
+ return _response.data
+
def deprecated_get_adjustment(
self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetInventoryAdjustmentResponse:
@@ -73,6 +337,68 @@ def deprecated_get_adjustment(
_response = self._raw_client.deprecated_get_adjustment(adjustment_id, request_options=request_options)
return _response.data
+ def update_inventory_adjustment(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment: InventoryAdjustmentParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateInventoryAdjustmentResponse:
+ """
+ Applies an update to the provided adjustment.
+
+ On success: returns the newly updated adjustment.
+ 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
+ [Build Basics](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ adjustment : InventoryAdjustmentParams
+ Represents the updates being written to a past/existing inventory adjustment.
+ This works using sparse updates, meaning that any fields omitted from the inputted InventoryAdjustment
+ will retain their values.
+
+ Only updates to the quantity, cost_money, vendor_id, and reason_id fields of an InventoryAdjustment can be made here.
+ Note that the quantity field must be provided, but it can be identical to the current quantity if there are no desired quantity changes.
+ cost_money and vendor_id can only be written to adjustments that add stock to the system (from_state of NONE or UNLINKED_RETURN) and to untracked sale adjustments.
+ reason_id can be changed to any reason that is valid for the adjustment's state transition. The reason of a system-generated adjustment (for example, SALE or RECOUNT) cannot be changed.
+ Adjustments generated by Square from other records cannot be updated. This includes inferred adjustments created by physical counts, transfer-like cross-location adjustments, and component adjustments.
+ Adjustments linked to purchase orders cannot be updated. Adjustments linked to sales can only have cost_money and vendor_id updated, and only for untracked sales.
+ Restock adjustments linked to an itemized return can have their quantity updated, up to the quantity remaining on the return.
+ Adjustments older than one year cannot be updated.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateInventoryAdjustmentResponse
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.update_inventory_adjustment(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ adjustment={},
+ )
+ """
+ _response = self._raw_client.update_inventory_adjustment(
+ idempotency_key=idempotency_key, adjustment=adjustment, request_options=request_options
+ )
+ return _response.data
+
def get_adjustment(
self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetInventoryAdjustmentResponse:
@@ -191,6 +517,8 @@ def deprecated_batch_get_changes(
updated_before: typing.Optional[str] = OMIT,
cursor: typing.Optional[str] = OMIT,
limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> BatchGetInventoryChangesResponse:
"""
@@ -235,6 +563,17 @@ def deprecated_batch_get_changes(
limit : typing.Optional[int]
The number of [records](entity:InventoryChange) to return.
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -268,6 +607,8 @@ def deprecated_batch_get_changes(
updated_before=updated_before,
cursor=cursor,
limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
request_options=request_options,
)
return _response.data
@@ -435,6 +776,8 @@ def batch_get_changes(
updated_before: typing.Optional[str] = OMIT,
cursor: typing.Optional[str] = OMIT,
limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> SyncPager[InventoryChange, BatchGetInventoryChangesResponse]:
"""
@@ -485,6 +828,17 @@ def batch_get_changes(
limit : typing.Optional[int]
The number of [records](entity:InventoryChange) to return.
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -523,6 +877,8 @@ def batch_get_changes(
updated_before=updated_before,
cursor=cursor,
limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
request_options=request_options,
)
@@ -685,182 +1041,477 @@ def get_physical_count(
_response = self._raw_client.get_physical_count(physical_count_id, request_options=request_options)
return _response.data
- def get_transfer(
- self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None
- ) -> GetInventoryTransferResponse:
+ def get(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryCount, GetInventoryCountResponse]:
+ """
+ Retrieves the current calculated stock count for a given
+ [CatalogObject](entity:CatalogObject) at a given set of
+ [Location](entity:Location)s. Responses are paginated and unsorted.
+ For more sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ 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.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryCount, GetInventoryCountResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.inventory.get(
+ catalog_object_id="catalog_object_id",
+ location_ids="location_ids",
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.get(
+ catalog_object_id, location_ids=location_ids, cursor=cursor, request_options=request_options
+ )
+
+ def changes(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryChange, GetInventoryChangesResponse]:
"""
- Returns the [InventoryTransfer](entity:InventoryTransfer) object
- with the provided `transfer_id`.
+ Returns a set of physical counts and inventory adjustments for the
+ provided [CatalogObject](entity:CatalogObject) at the requested
+ [Location](entity:Location)s.
+
+ You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges)
+ and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
+
+ Results are paginated and sorted in descending order according to their
+ `occurred_at` timestamp (newest first).
+
+ There are no limits on how far back the caller can page. This endpoint can be
+ used to display recent changes for a specific item. For more
+ sophisticated queries, use a batch endpoint.
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ 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.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryChange, GetInventoryChangesResponse]
+ Success
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ response = client.inventory.changes(
+ catalog_object_id="catalog_object_id",
+ location_ids="location_ids",
+ cursor="cursor",
+ )
+ for item in response:
+ yield item
+ # alternatively, you can paginate page-by-page
+ for page in response.iter_pages():
+ yield page
+ """
+ return self._raw_client.changes(
+ catalog_object_id, location_ids=location_ids, cursor=cursor, request_options=request_options
+ )
+
+ def get_transfer(self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
+ """
Parameters
----------
transfer_id : str
- ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- GetInventoryTransferResponse
+ None
+
+ Examples
+ --------
+ from square import Square
+
+ client = Square(
+ token="YOUR_TOKEN",
+ )
+ client.inventory.get_transfer(
+ transfer_id="transfer_id",
+ )
+ """
+ _response = self._raw_client.get_transfer(transfer_id, request_options=request_options)
+ return _response.data
+
+
+class AsyncInventoryClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._raw_client = AsyncRawInventoryClient(client_wrapper=client_wrapper)
+
+ @property
+ def with_raw_response(self) -> AsyncRawInventoryClient:
+ """
+ Retrieves a raw implementation of this client that returns raw responses.
+
+ Returns
+ -------
+ AsyncRawInventoryClient
+ """
+ return self._raw_client
+
+ async def list_inventory_adjustment_reasons(
+ self,
+ *,
+ include_deleted: typing.Optional[bool] = None,
+ include_system_codes: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> ListInventoryAdjustmentReasonsResponse:
+ """
+ Returns the standard and custom inventory adjustment reasons available
+ to the seller.
+
+ Parameters
+ ----------
+ include_deleted : typing.Optional[bool]
+ Indicates whether the response should include deleted custom inventory
+ adjustment reasons. The default value is `false`.
+
+ include_system_codes : typing.Optional[bool]
+ Indicates whether the response should include Square-generated system
+ inventory adjustment reason codes that cannot be used to write adjustments
+ from the Connect API, such as `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`,
+ and `CANCELED_SALE`. The default value is `false`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ ListInventoryAdjustmentReasonsResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.list_inventory_adjustment_reasons(
+ include_deleted=True,
+ include_system_codes=True,
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.list_inventory_adjustment_reasons(
+ include_deleted=include_deleted, include_system_codes=include_system_codes, request_options=request_options
+ )
+ return _response.data
+
+ async def create_inventory_adjustment_reason(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> CreateInventoryAdjustmentReasonResponse:
+ """
+ Creates a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ idempotency_key : str
+ A client-supplied, universally unique identifier to make this
+ [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason)
+ request idempotent.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The custom inventory adjustment reason to create. Only custom
+ adjustment reasons can be created.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ CreateInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.create_inventory_adjustment_reason(
+ idempotency_key="27b2f2b1-1c2a-4b9e-8f3a-0d9c3a1e5b47",
+ adjustment_reason={
+ "id": {"type": "CUSTOM"},
+ "name": "Donated to charity",
+ "direction": "DECREASE",
+ },
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.create_inventory_adjustment_reason(
+ idempotency_key=idempotency_key, adjustment_reason=adjustment_reason, request_options=request_options
+ )
+ return _response.data
+
+ async def delete_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> DeleteInventoryAdjustmentReasonResponse:
+ """
+ Soft deletes a custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to soft delete.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ DeleteInventoryAdjustmentReasonResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.delete_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.delete_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
+ return _response.data
+
+ async def restore_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> RestoreInventoryAdjustmentReasonResponse:
+ """
+ Restores a soft-deleted custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the soft-deleted custom inventory adjustment reason
+ to restore.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ RestoreInventoryAdjustmentReasonResponse
Success
Examples
--------
- from square import Square
+ import asyncio
- client = Square(
+ from square import AsyncSquare
+
+ client = AsyncSquare(
token="YOUR_TOKEN",
)
- client.inventory.get_transfer(
- transfer_id="transfer_id",
- )
+
+
+ async def main() -> None:
+ await client.inventory.restore_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+
+
+ asyncio.run(main())
"""
- _response = self._raw_client.get_transfer(transfer_id, request_options=request_options)
+ _response = await self._raw_client.restore_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
+ )
return _response.data
- def get(
- self,
- catalog_object_id: str,
- *,
- location_ids: typing.Optional[str] = None,
- cursor: typing.Optional[str] = None,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> SyncPager[InventoryCount, GetInventoryCountResponse]:
+ async def retrieve_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> RetrieveInventoryAdjustmentReasonResponse:
"""
- Retrieves the current calculated stock count for a given
- [CatalogObject](entity:CatalogObject) at a given set of
- [Location](entity:Location)s. Responses are paginated and unsorted.
- For more sophisticated queries, use a batch endpoint.
+ Returns the inventory adjustment reason identified by the provided
+ `reason_id`. Deleted custom reasons can be retrieved by ID.
Parameters
----------
- catalog_object_id : str
- ID of the [CatalogObject](entity:CatalogObject) to retrieve.
-
- location_ids : typing.Optional[str]
- The [Location](entity:Location) IDs to look up as a comma-separated
- list. An empty list queries all locations.
-
- 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.
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the inventory adjustment reason to retrieve.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- SyncPager[InventoryCount, GetInventoryCountResponse]
+ RetrieveInventoryAdjustmentReasonResponse
Success
Examples
--------
- from square import Square
+ import asyncio
- client = Square(
+ from square import AsyncSquare
+
+ client = AsyncSquare(
token="YOUR_TOKEN",
)
- response = client.inventory.get(
- catalog_object_id="catalog_object_id",
- location_ids="location_ids",
- cursor="cursor",
- )
- for item in response:
- yield item
- # alternatively, you can paginate page-by-page
- for page in response.iter_pages():
- yield page
+
+
+ async def main() -> None:
+ await client.inventory.retrieve_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ )
+
+
+ asyncio.run(main())
"""
- return self._raw_client.get(
- catalog_object_id, location_ids=location_ids, cursor=cursor, request_options=request_options
+ _response = await self._raw_client.retrieve_inventory_adjustment_reason(
+ reason_id=reason_id, request_options=request_options
)
+ return _response.data
- def changes(
+ async def update_inventory_adjustment_reason(
self,
- catalog_object_id: str,
*,
- location_ids: typing.Optional[str] = None,
- cursor: typing.Optional[str] = None,
+ reason_id: InventoryAdjustmentReasonIdParams,
+ adjustment_reason: InventoryAdjustmentReasonParams,
request_options: typing.Optional[RequestOptions] = None,
- ) -> SyncPager[InventoryChange, GetInventoryChangesResponse]:
+ ) -> UpdateInventoryAdjustmentReasonResponse:
"""
- Returns a set of physical counts and inventory adjustments for the
- provided [CatalogObject](entity:CatalogObject) at the requested
- [Location](entity:Location)s.
-
- You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges)
- and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
-
- Results are paginated and sorted in descending order according to their
- `occurred_at` timestamp (newest first).
-
- There are no limits on how far back the caller can page. This endpoint can be
- used to display recent changes for a specific item. For more
- sophisticated queries, use a batch endpoint.
+ Updates a custom inventory adjustment reason.
Parameters
----------
- catalog_object_id : str
- ID of the [CatalogObject](entity:CatalogObject) to retrieve.
-
- location_ids : typing.Optional[str]
- The [Location](entity:Location) IDs to look up as a comma-separated
- list. An empty list queries all locations.
-
- 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.
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to update.
- See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The requested custom inventory adjustment reason update. Only the
+ `name` field can be updated. Deleted custom reasons cannot be updated. To
+ restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- SyncPager[InventoryChange, GetInventoryChangesResponse]
+ UpdateInventoryAdjustmentReasonResponse
Success
Examples
--------
- from square import Square
+ import asyncio
- client = Square(
+ from square import AsyncSquare
+
+ client = AsyncSquare(
token="YOUR_TOKEN",
)
- response = client.inventory.changes(
- catalog_object_id="catalog_object_id",
- location_ids="location_ids",
- cursor="cursor",
- )
- for item in response:
- yield item
- # alternatively, you can paginate page-by-page
- for page in response.iter_pages():
- yield page
- """
- return self._raw_client.changes(
- catalog_object_id, location_ids=location_ids, cursor=cursor, request_options=request_options
- )
-class AsyncInventoryClient:
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
- self._raw_client = AsyncRawInventoryClient(client_wrapper=client_wrapper)
+ async def main() -> None:
+ await client.inventory.update_inventory_adjustment_reason(
+ reason_id={"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ adjustment_reason={
+ "id": {"type": "CUSTOM", "custom_reason_id": "R5BX3PDCZ6EXAMPLE"},
+ "name": "Charitable donation",
+ },
+ )
- @property
- def with_raw_response(self) -> AsyncRawInventoryClient:
- """
- Retrieves a raw implementation of this client that returns raw responses.
- Returns
- -------
- AsyncRawInventoryClient
+ asyncio.run(main())
"""
- return self._raw_client
+ _response = await self._raw_client.update_inventory_adjustment_reason(
+ reason_id=reason_id, adjustment_reason=adjustment_reason, request_options=request_options
+ )
+ return _response.data
async def deprecated_get_adjustment(
self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
@@ -904,6 +1555,76 @@ async def main() -> None:
_response = await self._raw_client.deprecated_get_adjustment(adjustment_id, request_options=request_options)
return _response.data
+ async def update_inventory_adjustment(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment: InventoryAdjustmentParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> UpdateInventoryAdjustmentResponse:
+ """
+ Applies an update to the provided adjustment.
+
+ On success: returns the newly updated adjustment.
+ 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
+ [Build Basics](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ adjustment : InventoryAdjustmentParams
+ Represents the updates being written to a past/existing inventory adjustment.
+ This works using sparse updates, meaning that any fields omitted from the inputted InventoryAdjustment
+ will retain their values.
+
+ Only updates to the quantity, cost_money, vendor_id, and reason_id fields of an InventoryAdjustment can be made here.
+ Note that the quantity field must be provided, but it can be identical to the current quantity if there are no desired quantity changes.
+ cost_money and vendor_id can only be written to adjustments that add stock to the system (from_state of NONE or UNLINKED_RETURN) and to untracked sale adjustments.
+ reason_id can be changed to any reason that is valid for the adjustment's state transition. The reason of a system-generated adjustment (for example, SALE or RECOUNT) cannot be changed.
+ Adjustments generated by Square from other records cannot be updated. This includes inferred adjustments created by physical counts, transfer-like cross-location adjustments, and component adjustments.
+ Adjustments linked to purchase orders cannot be updated. Adjustments linked to sales can only have cost_money and vendor_id updated, and only for untracked sales.
+ Restock adjustments linked to an itemized return can have their quantity updated, up to the quantity remaining on the return.
+ Adjustments older than one year cannot be updated.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ UpdateInventoryAdjustmentResponse
+ Success
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.update_inventory_adjustment(
+ idempotency_key="8fc6a5b0-9fe8-4b46-b46b-2ef95793abbe",
+ adjustment={},
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.update_inventory_adjustment(
+ idempotency_key=idempotency_key, adjustment=adjustment, request_options=request_options
+ )
+ return _response.data
+
async def get_adjustment(
self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> GetInventoryAdjustmentResponse:
@@ -1038,6 +1759,8 @@ async def deprecated_batch_get_changes(
updated_before: typing.Optional[str] = OMIT,
cursor: typing.Optional[str] = OMIT,
limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> BatchGetInventoryChangesResponse:
"""
@@ -1082,6 +1805,17 @@ async def deprecated_batch_get_changes(
limit : typing.Optional[int]
The number of [records](entity:InventoryChange) to return.
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1123,6 +1857,8 @@ async def main() -> None:
updated_before=updated_before,
cursor=cursor,
limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
request_options=request_options,
)
return _response.data
@@ -1306,6 +2042,8 @@ async def batch_get_changes(
updated_before: typing.Optional[str] = OMIT,
cursor: typing.Optional[str] = OMIT,
limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncPager[InventoryChange, BatchGetInventoryChangesResponse]:
"""
@@ -1356,6 +2094,17 @@ async def batch_get_changes(
limit : typing.Optional[int]
The number of [records](entity:InventoryChange) to return.
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1403,6 +2152,8 @@ async def main() -> None:
updated_before=updated_before,
cursor=cursor,
limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
request_options=request_options,
)
@@ -1592,48 +2343,6 @@ async def main() -> None:
_response = await self._raw_client.get_physical_count(physical_count_id, request_options=request_options)
return _response.data
- async def get_transfer(
- self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None
- ) -> 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
- -------
- GetInventoryTransferResponse
- Success
-
- Examples
- --------
- import asyncio
-
- from square import AsyncSquare
-
- client = AsyncSquare(
- token="YOUR_TOKEN",
- )
-
-
- async def main() -> None:
- await client.inventory.get_transfer(
- transfer_id="transfer_id",
- )
-
-
- asyncio.run(main())
- """
- _response = await self._raw_client.get_transfer(transfer_id, request_options=request_options)
- return _response.data
-
async def get(
self,
catalog_object_id: str,
@@ -1778,3 +2487,38 @@ async def main() -> None:
return await self._raw_client.changes(
catalog_object_id, location_ids=location_ids, cursor=cursor, request_options=request_options
)
+
+ async def get_transfer(self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
+ """
+ Parameters
+ ----------
+ transfer_id : str
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ None
+
+ Examples
+ --------
+ import asyncio
+
+ from square import AsyncSquare
+
+ client = AsyncSquare(
+ token="YOUR_TOKEN",
+ )
+
+
+ async def main() -> None:
+ await client.inventory.get_transfer(
+ transfer_id="transfer_id",
+ )
+
+
+ asyncio.run(main())
+ """
+ _response = await self._raw_client.get_transfer(transfer_id, request_options=request_options)
+ return _response.data
diff --git a/src/square/inventory/raw_client.py b/src/square/inventory/raw_client.py
index 3068807d..9e965f32 100644
--- a/src/square/inventory/raw_client.py
+++ b/src/square/inventory/raw_client.py
@@ -11,19 +11,29 @@
from ..core.request_options import RequestOptions
from ..core.serialization import convert_and_respect_annotation_metadata
from ..core.unchecked_base_model import construct_type
+from ..requests.batch_retrieve_inventory_changes_sort import BatchRetrieveInventoryChangesSortParams
+from ..requests.inventory_adjustment import InventoryAdjustmentParams
+from ..requests.inventory_adjustment_reason import InventoryAdjustmentReasonParams
+from ..requests.inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
from ..requests.inventory_change import InventoryChangeParams
from ..types.batch_change_inventory_response import BatchChangeInventoryResponse
from ..types.batch_get_inventory_changes_response import BatchGetInventoryChangesResponse
from ..types.batch_get_inventory_counts_response import BatchGetInventoryCountsResponse
+from ..types.create_inventory_adjustment_reason_response import CreateInventoryAdjustmentReasonResponse
+from ..types.delete_inventory_adjustment_reason_response import DeleteInventoryAdjustmentReasonResponse
from ..types.get_inventory_adjustment_response import GetInventoryAdjustmentResponse
from ..types.get_inventory_changes_response import GetInventoryChangesResponse
from ..types.get_inventory_count_response import GetInventoryCountResponse
from ..types.get_inventory_physical_count_response import GetInventoryPhysicalCountResponse
-from ..types.get_inventory_transfer_response import GetInventoryTransferResponse
from ..types.inventory_change import InventoryChange
from ..types.inventory_change_type import InventoryChangeType
from ..types.inventory_count import InventoryCount
from ..types.inventory_state import InventoryState
+from ..types.list_inventory_adjustment_reasons_response import ListInventoryAdjustmentReasonsResponse
+from ..types.restore_inventory_adjustment_reason_response import RestoreInventoryAdjustmentReasonResponse
+from ..types.retrieve_inventory_adjustment_reason_response import RetrieveInventoryAdjustmentReasonResponse
+from ..types.update_inventory_adjustment_reason_response import UpdateInventoryAdjustmentReasonResponse
+from ..types.update_inventory_adjustment_response import UpdateInventoryAdjustmentResponse
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
@@ -33,37 +43,52 @@ 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]:
+ def list_inventory_adjustment_reasons(
+ self,
+ *,
+ include_deleted: typing.Optional[bool] = None,
+ include_system_codes: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[ListInventoryAdjustmentReasonsResponse]:
"""
- Deprecated version of [RetrieveInventoryAdjustment](api-endpoint:Inventory-RetrieveInventoryAdjustment) after the endpoint URL
- is updated to conform to the standard convention.
+ Returns the standard and custom inventory adjustment reasons available
+ to the seller.
Parameters
----------
- adjustment_id : str
- ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+ include_deleted : typing.Optional[bool]
+ Indicates whether the response should include deleted custom inventory
+ adjustment reasons. The default value is `false`.
+
+ include_system_codes : typing.Optional[bool]
+ Indicates whether the response should include Square-generated system
+ inventory adjustment reason codes that cannot be used to write adjustments
+ from the Connect API, such as `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`,
+ and `CANCELED_SALE`. The default value is `false`.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[GetInventoryAdjustmentResponse]
+ HttpResponse[ListInventoryAdjustmentReasonsResponse]
Success
"""
_response = self._client_wrapper.httpx_client.request(
- f"v2/inventory/adjustment/{jsonable_encoder(adjustment_id)}",
+ "v2/inventory/adjustment-reasons",
method="GET",
+ params={
+ "include_deleted": include_deleted,
+ "include_system_codes": include_system_codes,
+ },
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- GetInventoryAdjustmentResponse,
+ ListInventoryAdjustmentReasonsResponse,
construct_type(
- type_=GetInventoryAdjustmentResponse, # type: ignore
+ type_=ListInventoryAdjustmentReasonsResponse, # type: ignore
object_=_response.json(),
),
)
@@ -73,37 +98,56 @@ def deprecated_get_adjustment(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def get_adjustment(
- self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
- ) -> HttpResponse[GetInventoryAdjustmentResponse]:
+ def create_inventory_adjustment_reason(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[CreateInventoryAdjustmentReasonResponse]:
"""
- Returns the [InventoryAdjustment](entity:InventoryAdjustment) object
- with the provided `adjustment_id`.
+ Creates a custom inventory adjustment reason.
Parameters
----------
- adjustment_id : str
- ID of the [InventoryAdjustment](entity:InventoryAdjustment) to retrieve.
+ idempotency_key : str
+ A client-supplied, universally unique identifier to make this
+ [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason)
+ request idempotent.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The custom inventory adjustment reason to create. Only custom
+ adjustment reasons can be created.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[GetInventoryAdjustmentResponse]
+ HttpResponse[CreateInventoryAdjustmentReasonResponse]
Success
"""
_response = self._client_wrapper.httpx_client.request(
- f"v2/inventory/adjustments/{jsonable_encoder(adjustment_id)}",
- method="GET",
+ "v2/inventory/adjustment-reasons/create",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjustment_reason": convert_and_respect_annotation_metadata(
+ object_=adjustment_reason, annotation=InventoryAdjustmentReasonParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
request_options=request_options,
+ omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- GetInventoryAdjustmentResponse,
+ CreateInventoryAdjustmentReasonResponse,
construct_type(
- type_=GetInventoryAdjustmentResponse, # type: ignore
+ type_=CreateInventoryAdjustmentReasonResponse, # type: ignore
object_=_response.json(),
),
)
@@ -113,56 +157,32 @@ def get_adjustment(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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]:
+ def delete_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[DeleteInventoryAdjustmentReasonResponse]:
"""
- Deprecated version of [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) after the endpoint URL
- is updated to conform to the standard convention.
+ Soft deletes a custom inventory adjustment reason.
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`.
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to soft delete.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[BatchChangeInventoryResponse]
+ HttpResponse[DeleteInventoryAdjustmentReasonResponse]
Success
"""
_response = self._client_wrapper.httpx_client.request(
- "v2/inventory/batch-change",
+ "v2/inventory/adjustment-reasons/delete",
method="POST",
json={
- "idempotency_key": idempotency_key,
- "changes": convert_and_respect_annotation_metadata(
- object_=changes,
- annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
- direction="write",
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
),
- "ignore_unchanged_counts": ignore_unchanged_counts,
},
headers={
"content-type": "application/json",
@@ -173,9 +193,9 @@ def deprecated_batch_change(
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- BatchChangeInventoryResponse,
+ DeleteInventoryAdjustmentReasonResponse,
construct_type(
- type_=BatchChangeInventoryResponse, # type: ignore
+ type_=DeleteInventoryAdjustmentReasonResponse, # type: ignore
object_=_response.json(),
),
)
@@ -185,81 +205,33 @@ def deprecated_batch_change(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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]:
+ def restore_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RestoreInventoryAdjustmentReasonResponse]:
"""
- Deprecated version of [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges) after the endpoint URL
- is updated to conform to the standard convention.
+ Restores a soft-deleted custom inventory adjustment reason.
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.
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the soft-deleted custom inventory adjustment reason
+ to restore.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[BatchGetInventoryChangesResponse]
+ HttpResponse[RestoreInventoryAdjustmentReasonResponse]
Success
"""
_response = self._client_wrapper.httpx_client.request(
- "v2/inventory/batch-retrieve-changes",
+ "v2/inventory/adjustment-reasons/restore",
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,
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
},
headers={
"content-type": "application/json",
@@ -270,9 +242,9 @@ def deprecated_batch_get_changes(
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- BatchGetInventoryChangesResponse,
+ RestoreInventoryAdjustmentReasonResponse,
construct_type(
- type_=BatchGetInventoryChangesResponse, # type: ignore
+ type_=RestoreInventoryAdjustmentReasonResponse, # type: ignore
object_=_response.json(),
),
)
@@ -282,68 +254,33 @@ def deprecated_batch_get_changes(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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]:
+ def retrieve_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[RetrieveInventoryAdjustmentReasonResponse]:
"""
- Deprecated version of [BatchRetrieveInventoryCounts](api-endpoint:Inventory-BatchRetrieveInventoryCounts) after the endpoint URL
- is updated to conform to the standard convention.
+ Returns the inventory adjustment reason identified by the provided
+ `reason_id`. Deleted custom reasons can be retrieved by ID.
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.
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the inventory adjustment reason to retrieve.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[BatchGetInventoryCountsResponse]
+ HttpResponse[RetrieveInventoryAdjustmentReasonResponse]
Success
"""
_response = self._client_wrapper.httpx_client.request(
- "v2/inventory/batch-retrieve-counts",
+ "v2/inventory/adjustment-reasons/retrieve",
method="POST",
json={
- "catalog_object_ids": catalog_object_ids,
- "location_ids": location_ids,
- "updated_after": updated_after,
- "cursor": cursor,
- "states": states,
- "limit": limit,
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
},
headers={
"content-type": "application/json",
@@ -354,9 +291,9 @@ def deprecated_batch_get_counts(
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- BatchGetInventoryCountsResponse,
+ RetrieveInventoryAdjustmentReasonResponse,
construct_type(
- type_=BatchGetInventoryCountsResponse, # type: ignore
+ type_=RetrieveInventoryAdjustmentReasonResponse, # type: ignore
object_=_response.json(),
),
)
@@ -366,59 +303,45 @@ def deprecated_batch_get_counts(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def batch_create_changes(
+ def update_inventory_adjustment_reason(
self,
*,
- idempotency_key: str,
- changes: typing.Optional[typing.Sequence[InventoryChangeParams]] = OMIT,
- ignore_unchanged_counts: typing.Optional[bool] = OMIT,
+ reason_id: InventoryAdjustmentReasonIdParams,
+ adjustment_reason: InventoryAdjustmentReasonParams,
request_options: typing.Optional[RequestOptions] = None,
- ) -> HttpResponse[BatchChangeInventoryResponse]:
+ ) -> HttpResponse[UpdateInventoryAdjustmentReasonResponse]:
"""
- 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.
+ Updates a custom inventory adjustment reason.
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.
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to update.
- 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`.
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The requested custom inventory adjustment reason update. Only the
+ `name` field can be updated. Deleted custom reasons cannot be updated. To
+ restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[BatchChangeInventoryResponse]
+ HttpResponse[UpdateInventoryAdjustmentReasonResponse]
Success
"""
_response = self._client_wrapper.httpx_client.request(
- "v2/inventory/changes/batch-create",
- method="POST",
+ "v2/inventory/adjustment-reasons/update",
+ method="PUT",
json={
- "idempotency_key": idempotency_key,
- "changes": convert_and_respect_annotation_metadata(
- object_=changes,
- annotation=typing.Optional[typing.Sequence[InventoryChangeParams]],
- direction="write",
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ "adjustment_reason": convert_and_respect_annotation_metadata(
+ object_=adjustment_reason, annotation=InventoryAdjustmentReasonParams, direction="write"
),
- "ignore_unchanged_counts": ignore_unchanged_counts,
},
headers={
"content-type": "application/json",
@@ -429,9 +352,9 @@ def batch_create_changes(
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- BatchChangeInventoryResponse,
+ UpdateInventoryAdjustmentReasonResponse,
construct_type(
- type_=BatchChangeInventoryResponse, # type: ignore
+ type_=UpdateInventoryAdjustmentReasonResponse, # type: ignore
object_=_response.json(),
),
)
@@ -441,28 +364,248 @@ def batch_create_changes(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def 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,
- ) -> SyncPager[InventoryChange, BatchGetInventoryChangesResponse]:
+ def deprecated_get_adjustment(
+ self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[GetInventoryAdjustmentResponse]:
"""
- Returns historical physical counts and adjustments based on the
- provided filter criteria.
-
- Results are paginated and sorted in ascending order according their
- `occurred_at` timestamp (oldest first).
-
- BatchRetrieveInventoryChanges is a catch-all query endpoint for queries
- that cannot be handled by other, simpler endpoints.
+ 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, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def update_inventory_adjustment(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment: InventoryAdjustmentParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> HttpResponse[UpdateInventoryAdjustmentResponse]:
+ """
+ Applies an update to the provided adjustment.
+
+ On success: returns the newly updated adjustment.
+ 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
+ [Build Basics](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ adjustment : InventoryAdjustmentParams
+ Represents the updates being written to a past/existing inventory adjustment.
+ This works using sparse updates, meaning that any fields omitted from the inputted InventoryAdjustment
+ will retain their values.
+
+ Only updates to the quantity, cost_money, vendor_id, and reason_id fields of an InventoryAdjustment can be made here.
+ Note that the quantity field must be provided, but it can be identical to the current quantity if there are no desired quantity changes.
+ cost_money and vendor_id can only be written to adjustments that add stock to the system (from_state of NONE or UNLINKED_RETURN) and to untracked sale adjustments.
+ reason_id can be changed to any reason that is valid for the adjustment's state transition. The reason of a system-generated adjustment (for example, SALE or RECOUNT) cannot be changed.
+ Adjustments generated by Square from other records cannot be updated. This includes inferred adjustments created by physical counts, transfer-like cross-location adjustments, and component adjustments.
+ Adjustments linked to purchase orders cannot be updated. Adjustments linked to sales can only have cost_money and vendor_id updated, and only for untracked sales.
+ Restock adjustments linked to an itemized return can have their quantity updated, up to the quantity remaining on the return.
+ Adjustments older than one year cannot be updated.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[UpdateInventoryAdjustmentResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustments/update",
+ method="PUT",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjustment": convert_and_respect_annotation_metadata(
+ object_=adjustment, annotation=InventoryAdjustmentParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateInventoryAdjustmentResponse,
+ construct_type(
+ type_=UpdateInventoryAdjustmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return HttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = 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
----------
@@ -499,57 +642,603 @@ def batch_get_changes(
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.
-
+ limit : typing.Optional[int]
+ The number of [records](entity:InventoryChange) to return.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ 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,
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=BatchRetrieveInventoryChangesSortParams, direction="write"
+ ),
+ "reason_ids": convert_and_respect_annotation_metadata(
+ object_=reason_ids,
+ annotation=typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]],
+ direction="write",
+ ),
+ },
+ 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, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def 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,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryChange, BatchGetInventoryChangesResponse]:
+ """
+ Returns historical physical counts and adjustments based on the
+ provided filter criteria.
+
+ Results are paginated and sorted in ascending order according their
+ `occurred_at` timestamp (oldest first).
+
+ BatchRetrieveInventoryChanges is a catch-all query endpoint for queries
+ that cannot be handled by other, simpler endpoints.
+
+ 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.
+
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ SyncPager[InventoryChange, BatchGetInventoryChangesResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/changes/batch-retrieve",
+ 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,
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=BatchRetrieveInventoryChangesSortParams, direction="write"
+ ),
+ "reason_ids": convert_and_respect_annotation_metadata(
+ object_=reason_ids,
+ annotation=typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]],
+ direction="write",
+ ),
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _parsed_response = typing.cast(
+ BatchGetInventoryChangesResponse,
+ construct_type(
+ type_=BatchGetInventoryChangesResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.changes
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.batch_get_changes(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ types=types,
+ states=states,
+ updated_after=updated_after,
+ updated_before=updated_before,
+ cursor=_parsed_next,
+ limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def 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,
+ ) -> SyncPager[InventoryCount, BatchGetInventoryCountsResponse]:
+ """
+ Returns current counts for the provided
+ [CatalogObject](entity:CatalogObject)s at the requested
+ [Location](entity:Location)s.
+
+ Results are paginated and sorted in descending order according to their
+ `calculated_at` timestamp (newest first).
+
+ When `updated_after` is specified, only counts that have changed since that
+ time (based on the server timestamp for the most recent change) are
+ returned. This allows clients to perform a "sync" operation, for example
+ in response to receiving a Webhook notification.
+
+ 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
+ -------
+ SyncPager[InventoryCount, BatchGetInventoryCountsResponse]
+ Success
+ """
+ _response = self._client_wrapper.httpx_client.request(
+ "v2/inventory/counts/batch-retrieve",
+ 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:
+ _parsed_response = typing.cast(
+ BatchGetInventoryCountsResponse,
+ construct_type(
+ type_=BatchGetInventoryCountsResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ _items = _parsed_response.counts
+ _parsed_next = _parsed_response.cursor
+ _has_next = _parsed_next is not None and _parsed_next != ""
+ _get_next = lambda: self.batch_get_counts(
+ catalog_object_ids=catalog_object_ids,
+ location_ids=location_ids,
+ updated_after=updated_after,
+ cursor=_parsed_next,
+ states=states,
+ limit=limit,
+ request_options=request_options,
+ )
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ def get(
+ self,
+ catalog_object_id: str,
+ *,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> SyncPager[InventoryCount, GetInventoryCountResponse]:
+ """
+ Retrieves the current calculated stock count for a given
+ [CatalogObject](entity:CatalogObject) at a given set of
+ [Location](entity:Location)s. Responses are paginated and unsorted.
+ For more sophisticated queries, use a batch endpoint.
+
+ Parameters
+ ----------
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
+
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
+
+ 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.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- SyncPager[InventoryChange, BatchGetInventoryChangesResponse]
+ SyncPager[InventoryCount, GetInventoryCountResponse]
Success
"""
_response = self._client_wrapper.httpx_client.request(
- "v2/inventory/changes/batch-retrieve",
- method="POST",
- json={
- "catalog_object_ids": catalog_object_ids,
+ f"v2/inventory/{jsonable_encoder(catalog_object_id)}",
+ method="GET",
+ params={
"location_ids": location_ids,
- "types": types,
- "states": states,
- "updated_after": updated_after,
- "updated_before": updated_before,
"cursor": cursor,
- "limit": limit,
- },
- headers={
- "content-type": "application/json",
},
request_options=request_options,
- omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_parsed_response = typing.cast(
- BatchGetInventoryChangesResponse,
+ GetInventoryCountResponse,
construct_type(
- type_=BatchGetInventoryChangesResponse, # type: ignore
+ type_=GetInventoryCountResponse, # type: ignore
object_=_response.json(),
),
)
- _items = _parsed_response.changes
+ _items = _parsed_response.counts
_parsed_next = _parsed_response.cursor
_has_next = _parsed_next is not None and _parsed_next != ""
- _get_next = lambda: self.batch_get_changes(
- catalog_object_ids=catalog_object_ids,
+ _get_next = lambda: self.get(
+ catalog_object_id,
location_ids=location_ids,
- types=types,
- states=states,
- updated_after=updated_after,
- updated_before=updated_before,
cursor=_parsed_next,
- limit=limit,
request_options=request_options,
)
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
@@ -558,44 +1247,37 @@ def batch_get_changes(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def batch_get_counts(
+ def changes(
self,
+ catalog_object_id: str,
*,
- 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,
+ location_ids: typing.Optional[str] = None,
+ cursor: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
- ) -> SyncPager[InventoryCount, BatchGetInventoryCountsResponse]:
+ ) -> SyncPager[InventoryChange, GetInventoryChangesResponse]:
"""
- Returns current counts for the provided
- [CatalogObject](entity:CatalogObject)s at the requested
+ Returns a set of physical counts and inventory adjustments for the
+ provided [CatalogObject](entity:CatalogObject) at the requested
[Location](entity:Location)s.
+ You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges)
+ and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
+
Results are paginated and sorted in descending order according to their
- `calculated_at` timestamp (newest first).
+ `occurred_at` timestamp (newest first).
- When `updated_after` is specified, only counts that have changed since that
- time (based on the server timestamp for the most recent change) are
- returned. This allows clients to perform a "sync" operation, for example
- in response to receiving a Webhook notification.
+ There are no limits on how far back the caller can page. This endpoint can be
+ used to display recent changes for a specific item. For more
+ sophisticated queries, use a batch endpoint.
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.
+ catalog_object_id : str
+ ID of the [CatalogObject](entity:CatalogObject) to retrieve.
- 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`).
+ location_ids : typing.Optional[str]
+ The [Location](entity:Location) IDs to look up as a comma-separated
+ list. An empty list queries all locations.
cursor : typing.Optional[str]
A pagination cursor returned by a previous call to this endpoint.
@@ -603,58 +1285,39 @@ def batch_get_counts(
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
-------
- SyncPager[InventoryCount, BatchGetInventoryCountsResponse]
+ SyncPager[InventoryChange, GetInventoryChangesResponse]
Success
"""
_response = self._client_wrapper.httpx_client.request(
- "v2/inventory/counts/batch-retrieve",
- method="POST",
- json={
- "catalog_object_ids": catalog_object_ids,
+ f"v2/inventory/{jsonable_encoder(catalog_object_id)}/changes",
+ method="GET",
+ params={
"location_ids": location_ids,
- "updated_after": updated_after,
"cursor": cursor,
- "states": states,
- "limit": limit,
- },
- headers={
- "content-type": "application/json",
},
request_options=request_options,
- omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_parsed_response = typing.cast(
- BatchGetInventoryCountsResponse,
+ GetInventoryChangesResponse,
construct_type(
- type_=BatchGetInventoryCountsResponse, # type: ignore
+ type_=GetInventoryChangesResponse, # type: ignore
object_=_response.json(),
),
)
- _items = _parsed_response.counts
+ _items = _parsed_response.changes
_parsed_next = _parsed_response.cursor
_has_next = _parsed_next is not None and _parsed_next != ""
- _get_next = lambda: self.batch_get_counts(
- catalog_object_ids=catalog_object_ids,
+ _get_next = lambda: self.changes(
+ catalog_object_id,
location_ids=location_ids,
- updated_after=updated_after,
cursor=_parsed_next,
- states=states,
- limit=limit,
request_options=request_options,
)
return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
@@ -663,282 +1326,360 @@ def batch_get_counts(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def deprecated_get_physical_count(
- self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
- ) -> HttpResponse[GetInventoryPhysicalCountResponse]:
+ def get_transfer(
+ self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> HttpResponse[None]:
"""
- Deprecated version of [RetrieveInventoryPhysicalCount](api-endpoint:Inventory-RetrieveInventoryPhysicalCount) after the endpoint URL
- is updated to conform to the standard convention.
+ Parameters
+ ----------
+ transfer_id : str
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ HttpResponse[None]
+ """
+ _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:
+ return HttpResponse(response=_response, data=None)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+
+class AsyncRawInventoryClient:
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
+ self._client_wrapper = client_wrapper
+
+ async def list_inventory_adjustment_reasons(
+ self,
+ *,
+ include_deleted: typing.Optional[bool] = None,
+ include_system_codes: typing.Optional[bool] = None,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[ListInventoryAdjustmentReasonsResponse]:
+ """
+ Returns the standard and custom inventory adjustment reasons available
+ to the seller.
Parameters
----------
- physical_count_id : str
- ID of the
- [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+ include_deleted : typing.Optional[bool]
+ Indicates whether the response should include deleted custom inventory
+ adjustment reasons. The default value is `false`.
+
+ include_system_codes : typing.Optional[bool]
+ Indicates whether the response should include Square-generated system
+ inventory adjustment reason codes that cannot be used to write adjustments
+ from the Connect API, such as `SALE`, `RECOUNT`, `TRANSFER`, `IN_TRANSIT`,
+ and `CANCELED_SALE`. The default value is `false`.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[GetInventoryPhysicalCountResponse]
+ AsyncHttpResponse[ListInventoryAdjustmentReasonsResponse]
Success
"""
- _response = self._client_wrapper.httpx_client.request(
- f"v2/inventory/physical-count/{jsonable_encoder(physical_count_id)}",
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons",
method="GET",
+ params={
+ "include_deleted": include_deleted,
+ "include_system_codes": include_system_codes,
+ },
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- GetInventoryPhysicalCountResponse,
+ ListInventoryAdjustmentReasonsResponse,
construct_type(
- type_=GetInventoryPhysicalCountResponse, # type: ignore
+ type_=ListInventoryAdjustmentReasonsResponse, # type: ignore
object_=_response.json(),
),
)
- return HttpResponse(response=_response, data=_data)
+ return AsyncHttpResponse(response=_response, data=_data)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def get_physical_count(
- self, physical_count_id: str, *, request_options: typing.Optional[RequestOptions] = None
- ) -> HttpResponse[GetInventoryPhysicalCountResponse]:
+ async def create_inventory_adjustment_reason(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment_reason: InventoryAdjustmentReasonParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[CreateInventoryAdjustmentReasonResponse]:
"""
- Returns the [InventoryPhysicalCount](entity:InventoryPhysicalCount)
- object with the provided `physical_count_id`.
+ Creates a custom inventory adjustment reason.
Parameters
----------
- physical_count_id : str
- ID of the
- [InventoryPhysicalCount](entity:InventoryPhysicalCount) to retrieve.
+ idempotency_key : str
+ A client-supplied, universally unique identifier to make this
+ [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason)
+ request idempotent.
+
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The custom inventory adjustment reason to create. Only custom
+ adjustment reasons can be created.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[GetInventoryPhysicalCountResponse]
+ AsyncHttpResponse[CreateInventoryAdjustmentReasonResponse]
Success
"""
- _response = self._client_wrapper.httpx_client.request(
- f"v2/inventory/physical-counts/{jsonable_encoder(physical_count_id)}",
- method="GET",
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/create",
+ method="POST",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjustment_reason": convert_and_respect_annotation_metadata(
+ object_=adjustment_reason, annotation=InventoryAdjustmentReasonParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
request_options=request_options,
+ omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- GetInventoryPhysicalCountResponse,
+ CreateInventoryAdjustmentReasonResponse,
construct_type(
- type_=GetInventoryPhysicalCountResponse, # type: ignore
+ type_=CreateInventoryAdjustmentReasonResponse, # type: ignore
object_=_response.json(),
),
)
- return HttpResponse(response=_response, data=_data)
+ return AsyncHttpResponse(response=_response, data=_data)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def get_transfer(
- self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None
- ) -> HttpResponse[GetInventoryTransferResponse]:
+ async def delete_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[DeleteInventoryAdjustmentReasonResponse]:
"""
- Returns the [InventoryTransfer](entity:InventoryTransfer) object
- with the provided `transfer_id`.
+ Soft deletes a custom inventory adjustment reason.
Parameters
----------
- transfer_id : str
- ID of the [InventoryTransfer](entity:InventoryTransfer) to retrieve.
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to soft delete.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- HttpResponse[GetInventoryTransferResponse]
+ AsyncHttpResponse[DeleteInventoryAdjustmentReasonResponse]
Success
"""
- _response = self._client_wrapper.httpx_client.request(
- f"v2/inventory/transfers/{jsonable_encoder(transfer_id)}",
- method="GET",
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/delete",
+ method="POST",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
request_options=request_options,
+ omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
- GetInventoryTransferResponse,
+ DeleteInventoryAdjustmentReasonResponse,
construct_type(
- type_=GetInventoryTransferResponse, # type: ignore
+ type_=DeleteInventoryAdjustmentReasonResponse, # type: ignore
object_=_response.json(),
),
)
- return HttpResponse(response=_response, data=_data)
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def restore_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RestoreInventoryAdjustmentReasonResponse]:
+ """
+ Restores a soft-deleted custom inventory adjustment reason.
+
+ Parameters
+ ----------
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the soft-deleted custom inventory adjustment reason
+ to restore.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[RestoreInventoryAdjustmentReasonResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/restore",
+ method="POST",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ RestoreInventoryAdjustmentReasonResponse,
+ construct_type(
+ type_=RestoreInventoryAdjustmentReasonResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def get(
- self,
- catalog_object_id: str,
- *,
- location_ids: typing.Optional[str] = None,
- cursor: typing.Optional[str] = None,
- request_options: typing.Optional[RequestOptions] = None,
- ) -> SyncPager[InventoryCount, GetInventoryCountResponse]:
+ async def retrieve_inventory_adjustment_reason(
+ self, *, reason_id: InventoryAdjustmentReasonIdParams, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[RetrieveInventoryAdjustmentReasonResponse]:
"""
- Retrieves the current calculated stock count for a given
- [CatalogObject](entity:CatalogObject) at a given set of
- [Location](entity:Location)s. Responses are paginated and unsorted.
- For more sophisticated queries, use a batch endpoint.
+ Returns the inventory adjustment reason identified by the provided
+ `reason_id`. Deleted custom reasons can be retrieved by ID.
Parameters
----------
- catalog_object_id : str
- ID of the [CatalogObject](entity:CatalogObject) to retrieve.
-
- location_ids : typing.Optional[str]
- The [Location](entity:Location) IDs to look up as a comma-separated
- list. An empty list queries all locations.
-
- 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.
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the inventory adjustment reason to retrieve.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- SyncPager[InventoryCount, GetInventoryCountResponse]
+ AsyncHttpResponse[RetrieveInventoryAdjustmentReasonResponse]
Success
"""
- _response = self._client_wrapper.httpx_client.request(
- f"v2/inventory/{jsonable_encoder(catalog_object_id)}",
- method="GET",
- params={
- "location_ids": location_ids,
- "cursor": cursor,
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/retrieve",
+ method="POST",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
},
request_options=request_options,
+ omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
- _parsed_response = typing.cast(
- GetInventoryCountResponse,
+ _data = typing.cast(
+ RetrieveInventoryAdjustmentReasonResponse,
construct_type(
- type_=GetInventoryCountResponse, # type: ignore
+ type_=RetrieveInventoryAdjustmentReasonResponse, # type: ignore
object_=_response.json(),
),
)
- _items = _parsed_response.counts
- _parsed_next = _parsed_response.cursor
- _has_next = _parsed_next is not None and _parsed_next != ""
- _get_next = lambda: self.get(
- catalog_object_id,
- location_ids=location_ids,
- cursor=_parsed_next,
- request_options=request_options,
- )
- return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ return AsyncHttpResponse(response=_response, data=_data)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
- def changes(
+ async def update_inventory_adjustment_reason(
self,
- catalog_object_id: str,
*,
- location_ids: typing.Optional[str] = None,
- cursor: typing.Optional[str] = None,
+ reason_id: InventoryAdjustmentReasonIdParams,
+ adjustment_reason: InventoryAdjustmentReasonParams,
request_options: typing.Optional[RequestOptions] = None,
- ) -> SyncPager[InventoryChange, GetInventoryChangesResponse]:
+ ) -> AsyncHttpResponse[UpdateInventoryAdjustmentReasonResponse]:
"""
- Returns a set of physical counts and inventory adjustments for the
- provided [CatalogObject](entity:CatalogObject) at the requested
- [Location](entity:Location)s.
-
- You can achieve the same result by calling [BatchRetrieveInventoryChanges](api-endpoint:Inventory-BatchRetrieveInventoryChanges)
- and having the `catalog_object_ids` list contain a single element of the `CatalogObject` ID.
-
- Results are paginated and sorted in descending order according to their
- `occurred_at` timestamp (newest first).
-
- There are no limits on how far back the caller can page. This endpoint can be
- used to display recent changes for a specific item. For more
- sophisticated queries, use a batch endpoint.
+ Updates a custom inventory adjustment reason.
Parameters
----------
- catalog_object_id : str
- ID of the [CatalogObject](entity:CatalogObject) to retrieve.
-
- location_ids : typing.Optional[str]
- The [Location](entity:Location) IDs to look up as a comma-separated
- list. An empty list queries all locations.
-
- 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.
+ reason_id : InventoryAdjustmentReasonIdParams
+ The identifier of the custom inventory adjustment reason to update.
- See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information.
+ adjustment_reason : InventoryAdjustmentReasonParams
+ The requested custom inventory adjustment reason update. Only the
+ `name` field can be updated. Deleted custom reasons cannot be updated. To
+ restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
- SyncPager[InventoryChange, GetInventoryChangesResponse]
+ AsyncHttpResponse[UpdateInventoryAdjustmentReasonResponse]
Success
"""
- _response = self._client_wrapper.httpx_client.request(
- f"v2/inventory/{jsonable_encoder(catalog_object_id)}/changes",
- method="GET",
- params={
- "location_ids": location_ids,
- "cursor": cursor,
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustment-reasons/update",
+ method="PUT",
+ json={
+ "reason_id": convert_and_respect_annotation_metadata(
+ object_=reason_id, annotation=InventoryAdjustmentReasonIdParams, direction="write"
+ ),
+ "adjustment_reason": convert_and_respect_annotation_metadata(
+ object_=adjustment_reason, annotation=InventoryAdjustmentReasonParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
},
request_options=request_options,
+ omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
- _parsed_response = typing.cast(
- GetInventoryChangesResponse,
+ _data = typing.cast(
+ UpdateInventoryAdjustmentReasonResponse,
construct_type(
- type_=GetInventoryChangesResponse, # type: ignore
+ type_=UpdateInventoryAdjustmentReasonResponse, # type: ignore
object_=_response.json(),
),
)
- _items = _parsed_response.changes
- _parsed_next = _parsed_response.cursor
- _has_next = _parsed_next is not None and _parsed_next != ""
- _get_next = lambda: self.changes(
- catalog_object_id,
- location_ids=location_ids,
- cursor=_parsed_next,
- request_options=request_options,
- )
- return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response)
+ return AsyncHttpResponse(response=_response, data=_data)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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]:
@@ -979,6 +1720,81 @@ async def deprecated_get_adjustment(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+ async def update_inventory_adjustment(
+ self,
+ *,
+ idempotency_key: str,
+ adjustment: InventoryAdjustmentParams,
+ request_options: typing.Optional[RequestOptions] = None,
+ ) -> AsyncHttpResponse[UpdateInventoryAdjustmentResponse]:
+ """
+ Applies an update to the provided adjustment.
+
+ On success: returns the newly updated adjustment.
+ 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
+ [Build Basics](https://developer.squareup.com/docs/buildbasics) section for more
+ information.
+
+ adjustment : InventoryAdjustmentParams
+ Represents the updates being written to a past/existing inventory adjustment.
+ This works using sparse updates, meaning that any fields omitted from the inputted InventoryAdjustment
+ will retain their values.
+
+ Only updates to the quantity, cost_money, vendor_id, and reason_id fields of an InventoryAdjustment can be made here.
+ Note that the quantity field must be provided, but it can be identical to the current quantity if there are no desired quantity changes.
+ cost_money and vendor_id can only be written to adjustments that add stock to the system (from_state of NONE or UNLINKED_RETURN) and to untracked sale adjustments.
+ reason_id can be changed to any reason that is valid for the adjustment's state transition. The reason of a system-generated adjustment (for example, SALE or RECOUNT) cannot be changed.
+ Adjustments generated by Square from other records cannot be updated. This includes inferred adjustments created by physical counts, transfer-like cross-location adjustments, and component adjustments.
+ Adjustments linked to purchase orders cannot be updated. Adjustments linked to sales can only have cost_money and vendor_id updated, and only for untracked sales.
+ Restock adjustments linked to an itemized return can have their quantity updated, up to the quantity remaining on the return.
+ Adjustments older than one year cannot be updated.
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[UpdateInventoryAdjustmentResponse]
+ Success
+ """
+ _response = await self._client_wrapper.httpx_client.request(
+ "v2/inventory/adjustments/update",
+ method="PUT",
+ json={
+ "idempotency_key": idempotency_key,
+ "adjustment": convert_and_respect_annotation_metadata(
+ object_=adjustment, annotation=InventoryAdjustmentParams, direction="write"
+ ),
+ },
+ headers={
+ "content-type": "application/json",
+ },
+ request_options=request_options,
+ omit=OMIT,
+ )
+ try:
+ if 200 <= _response.status_code < 300:
+ _data = typing.cast(
+ UpdateInventoryAdjustmentResponse,
+ construct_type(
+ type_=UpdateInventoryAdjustmentResponse, # type: ignore
+ object_=_response.json(),
+ ),
+ )
+ return AsyncHttpResponse(response=_response, data=_data)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
async def get_adjustment(
self, adjustment_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]:
@@ -1070,9 +1886,6 @@ async def deprecated_batch_change(
),
"ignore_unchanged_counts": ignore_unchanged_counts,
},
- headers={
- "content-type": "application/json",
- },
request_options=request_options,
omit=OMIT,
)
@@ -1102,6 +1915,8 @@ async def deprecated_batch_get_changes(
updated_before: typing.Optional[str] = OMIT,
cursor: typing.Optional[str] = OMIT,
limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[BatchGetInventoryChangesResponse]:
"""
@@ -1146,6 +1961,17 @@ async def deprecated_batch_get_changes(
limit : typing.Optional[int]
The number of [records](entity:InventoryChange) to return.
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1166,9 +1992,14 @@ async def deprecated_batch_get_changes(
"updated_before": updated_before,
"cursor": cursor,
"limit": limit,
- },
- headers={
- "content-type": "application/json",
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=BatchRetrieveInventoryChangesSortParams, direction="write"
+ ),
+ "reason_ids": convert_and_respect_annotation_metadata(
+ object_=reason_ids,
+ annotation=typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]],
+ direction="write",
+ ),
},
request_options=request_options,
omit=OMIT,
@@ -1251,9 +2082,6 @@ async def deprecated_batch_get_counts(
"states": states,
"limit": limit,
},
- headers={
- "content-type": "application/json",
- },
request_options=request_options,
omit=OMIT,
)
@@ -1326,9 +2154,6 @@ async def batch_create_changes(
),
"ignore_unchanged_counts": ignore_unchanged_counts,
},
- headers={
- "content-type": "application/json",
- },
request_options=request_options,
omit=OMIT,
)
@@ -1358,6 +2183,8 @@ async def batch_get_changes(
updated_before: typing.Optional[str] = OMIT,
cursor: typing.Optional[str] = OMIT,
limit: typing.Optional[int] = OMIT,
+ sort: typing.Optional[BatchRetrieveInventoryChangesSortParams] = OMIT,
+ reason_ids: typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncPager[InventoryChange, BatchGetInventoryChangesResponse]:
"""
@@ -1408,6 +2235,17 @@ async def batch_get_changes(
limit : typing.Optional[int]
The number of [records](entity:InventoryChange) to return.
+ sort : typing.Optional[BatchRetrieveInventoryChangesSortParams]
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+
+ reason_ids : typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1428,9 +2266,14 @@ async def batch_get_changes(
"updated_before": updated_before,
"cursor": cursor,
"limit": limit,
- },
- headers={
- "content-type": "application/json",
+ "sort": convert_and_respect_annotation_metadata(
+ object_=sort, annotation=BatchRetrieveInventoryChangesSortParams, direction="write"
+ ),
+ "reason_ids": convert_and_respect_annotation_metadata(
+ object_=reason_ids,
+ annotation=typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]],
+ direction="write",
+ ),
},
request_options=request_options,
omit=OMIT,
@@ -1458,6 +2301,8 @@ async def _get_next():
updated_before=updated_before,
cursor=_parsed_next,
limit=limit,
+ sort=sort,
+ reason_ids=reason_ids,
request_options=request_options,
)
@@ -1539,9 +2384,6 @@ async def batch_get_counts(
"states": states,
"limit": limit,
},
- headers={
- "content-type": "application/json",
- },
request_options=request_options,
omit=OMIT,
)
@@ -1657,46 +2499,6 @@ async def get_physical_count(
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), 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, headers=dict(_response.headers), body=_response.text)
- raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
-
async def get(
self,
catalog_object_id: str,
@@ -1851,3 +2653,31 @@ async def _get_next():
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
+
+ async def get_transfer(
+ self, transfer_id: str, *, request_options: typing.Optional[RequestOptions] = None
+ ) -> AsyncHttpResponse[None]:
+ """
+ Parameters
+ ----------
+ transfer_id : str
+
+ request_options : typing.Optional[RequestOptions]
+ Request-specific configuration.
+
+ Returns
+ -------
+ AsyncHttpResponse[None]
+ """
+ _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:
+ return AsyncHttpResponse(response=_response, data=None)
+ _response_json = _response.json()
+ except JSONDecodeError:
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
diff --git a/src/square/orders/raw_client.py b/src/square/orders/raw_client.py
index 5fd5067b..cfa9f709 100644
--- a/src/square/orders/raw_client.py
+++ b/src/square/orders/raw_client.py
@@ -79,9 +79,6 @@ def create(
),
"idempotency_key": idempotency_key,
},
- headers={
- "content-type": "application/json",
- },
request_options=request_options,
omit=OMIT,
)
@@ -655,9 +652,6 @@ async def create(
),
"idempotency_key": idempotency_key,
},
- headers={
- "content-type": "application/json",
- },
request_options=request_options,
omit=OMIT,
)
diff --git a/src/square/requests/batch_retrieve_inventory_changes_request.py b/src/square/requests/batch_retrieve_inventory_changes_request.py
index aff54c23..e119fe22 100644
--- a/src/square/requests/batch_retrieve_inventory_changes_request.py
+++ b/src/square/requests/batch_retrieve_inventory_changes_request.py
@@ -5,6 +5,8 @@
import typing_extensions
from ..types.inventory_change_type import InventoryChangeType
from ..types.inventory_state import InventoryState
+from .batch_retrieve_inventory_changes_sort import BatchRetrieveInventoryChangesSortParams
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
class BatchRetrieveInventoryChangesRequestParams(typing_extensions.TypedDict):
@@ -59,3 +61,18 @@ class BatchRetrieveInventoryChangesRequestParams(typing_extensions.TypedDict):
"""
The number of [records](entity:InventoryChange) to return.
"""
+
+ sort: typing_extensions.NotRequired[BatchRetrieveInventoryChangesSortParams]
+ """
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+ """
+
+ reason_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[InventoryAdjustmentReasonIdParams]]]
+ """
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+ """
diff --git a/src/square/requests/batch_retrieve_inventory_changes_sort.py b/src/square/requests/batch_retrieve_inventory_changes_sort.py
new file mode 100644
index 00000000..6258f4a6
--- /dev/null
+++ b/src/square/requests/batch_retrieve_inventory_changes_sort.py
@@ -0,0 +1,19 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing_extensions
+from ..types.batch_retrieve_inventory_changes_sort_field import BatchRetrieveInventoryChangesSortField
+from ..types.sort_order import SortOrder
+
+
+class BatchRetrieveInventoryChangesSortParams(typing_extensions.TypedDict):
+ field: typing_extensions.NotRequired[BatchRetrieveInventoryChangesSortField]
+ """
+ The field to sort inventory changes by.
+ See [Field](#type-field) for possible values
+ """
+
+ order: typing_extensions.NotRequired[SortOrder]
+ """
+ The order to sort inventory changes by.
+ See [SortOrder](#type-sortorder) for possible values
+ """
diff --git a/src/square/requests/catalog_category.py b/src/square/requests/catalog_category.py
index 65f5b76b..847aa64e 100644
--- a/src/square/requests/catalog_category.py
+++ b/src/square/requests/catalog_category.py
@@ -37,7 +37,8 @@ class CatalogCategoryParams(typing_extensions.TypedDict):
parent_category: typing_extensions.NotRequired["CatalogObjectCategoryParams"]
"""
- The ID of the parent category of this category instance.
+ The parent category of this category instance. This includes the parent category ID and an ordinal
+ value that determines the category's relative position among sibling categories with the same parent.
"""
is_top_level: typing_extensions.NotRequired[typing.Optional[bool]]
diff --git a/src/square/requests/catalog_item.py b/src/square/requests/catalog_item.py
index 957f3078..743cc2a4 100644
--- a/src/square/requests/catalog_item.py
+++ b/src/square/requests/catalog_item.py
@@ -142,7 +142,8 @@ class CatalogItemParams(typing_extensions.TypedDict):
categories: typing_extensions.NotRequired[typing.Optional[typing.Sequence[CatalogObjectCategoryParams]]]
"""
- The list of categories.
+ The list of categories to which this item belongs. Each entry includes the category ID and an ordinal
+ value that determines the item's relative position within that category.
"""
description_html: typing_extensions.NotRequired[typing.Optional[str]]
diff --git a/src/square/requests/catalog_item_modifier_list_info.py b/src/square/requests/catalog_item_modifier_list_info.py
index c9e00e63..b20cf8d9 100644
--- a/src/square/requests/catalog_item_modifier_list_info.py
+++ b/src/square/requests/catalog_item_modifier_list_info.py
@@ -54,7 +54,7 @@ class CatalogItemModifierListInfoParams(typing_extensions.TypedDict):
ordinal: typing_extensions.NotRequired[typing.Optional[int]]
"""
- The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied
+ The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied
to a `CatalogItem` instance.
"""
diff --git a/src/square/requests/catalog_item_variation.py b/src/square/requests/catalog_item_variation.py
index e688de9b..1a7a05b7 100644
--- a/src/square/requests/catalog_item_variation.py
+++ b/src/square/requests/catalog_item_variation.py
@@ -6,6 +6,7 @@
from ..types.catalog_pricing_type import CatalogPricingType
from ..types.inventory_alert_type import InventoryAlertType
from .catalog_item_option_value_for_item_variation import CatalogItemOptionValueForItemVariationParams
+from .catalog_item_variation_vendor_information import CatalogItemVariationVendorInformationParams
from .catalog_stock_conversion import CatalogStockConversionParams
from .item_variation_location_overrides import ItemVariationLocationOverridesParams
from .money import MoneyParams
@@ -82,22 +83,26 @@ class CatalogItemVariationParams(typing_extensions.TypedDict):
track_inventory: typing_extensions.NotRequired[typing.Optional[bool]]
"""
- If `true`, inventory tracking is active for the variation.
+ If `true`, inventory tracking is active for the variation at all locations by default.
+ This value can be overridden for specific locations using `ItemVariationLocationOverrides.track_inventory`.
+ If unset at both levels, inventory tracking is disabled.
"""
inventory_alert_type: typing_extensions.NotRequired[InventoryAlertType]
"""
Indicates whether the item variation displays an alert when its inventory quantity is less than or equal
to its `inventory_alert_threshold`.
+
+ Deprecated because this field has never been global.
See [InventoryAlertType](#type-inventoryalerttype) for possible values
"""
inventory_alert_threshold: typing_extensions.NotRequired[typing.Optional[int]]
"""
If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type`
- is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard.
+ is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. This value is always an integer.
- This value is always an integer.
+ Deprecated because this field has never been global.
"""
user_data: typing_extensions.NotRequired[typing.Optional[str]]
@@ -176,3 +181,12 @@ class CatalogItemVariationParams(typing_extensions.TypedDict):
e.g., customer name might be "Mega-Jumbo Triplesized" and the
kitchen name is "Large container"
"""
+
+ vendor_information: typing_extensions.NotRequired[
+ typing.Optional[typing.Sequence[CatalogItemVariationVendorInformationParams]]
+ ]
+ """
+ Details of the vendor this product is purchased from.
+ This field can be set only if the seller has an active subscription
+ to either Square for Retail Premium or Square for Restaurants Premium.
+ """
diff --git a/src/square/requests/catalog_item_variation_vendor_information.py b/src/square/requests/catalog_item_variation_vendor_information.py
new file mode 100644
index 00000000..c8764afb
--- /dev/null
+++ b/src/square/requests/catalog_item_variation_vendor_information.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .money import MoneyParams
+
+
+class CatalogItemVariationVendorInformationParams(typing_extensions.TypedDict):
+ """
+ Information about the vendor of an item variation.
+ """
+
+ vendor_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ ID of the [Vendor](entity:Vendor) linked to a default cost of this product.
+ When the product is added to a purchase order, the default cost is pre-filled.
+ This field is not validated. Clients should gracefully handle cases where the vendor_id
+ does not match any existing vendor.
+ """
+
+ vendor_code: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ Unique identifier of this product in the specified vendor's' inventory system.
+ When the product is added to a purchase order, the vendor code is pre-filled based
+ on the selected vendor.
+ """
+
+ unit_cost_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The unit cost of the linked product, when purchased from the linked vendor.
+ """
diff --git a/src/square/requests/catalog_modifier_list.py b/src/square/requests/catalog_modifier_list.py
index e0571439..c0da4825 100644
--- a/src/square/requests/catalog_modifier_list.py
+++ b/src/square/requests/catalog_modifier_list.py
@@ -23,7 +23,7 @@ class CatalogModifierListParams(typing_extensions.TypedDict):
name: typing_extensions.NotRequired[typing.Optional[str]]
"""
- The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of
+ The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of
Unicode code points.
"""
@@ -41,14 +41,14 @@ class CatalogModifierListParams(typing_extensions.TypedDict):
modifiers: typing_extensions.NotRequired[typing.Optional[typing.Sequence["CatalogObjectParams"]]]
"""
- A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`,
- for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list
+ A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`,
+ for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list
is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes:
```
{
"id": "{{catalog_modifier_id}}",
- "type": "MODIFIER",
- "modifier_data": {{a CatalogModifier instance>}}
+ "type": "MODIFIER",
+ "modifier_data": {{a CatalogModifier instance>}}
}
```
"""
@@ -71,16 +71,16 @@ class CatalogModifierListParams(typing_extensions.TypedDict):
modifier_type: typing_extensions.NotRequired[CatalogModifierListModifierType]
"""
- The type of the modifier.
+ The type of the modifier.
- When this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier.
+ When this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier.
When this `modifier_type` value is `LIST`, the `CatalogModifierList` contains a list of `CatalogModifier` objects.
See [CatalogModifierListModifierType](#type-catalogmodifierlistmodifiertype) for possible values
"""
max_length: typing_extensions.NotRequired[typing.Optional[int]]
"""
- The maximum length, in Unicode points, of the text string of the text-based modifier as represented by
+ The maximum length, in Unicode points, of the text string of the text-based modifier as represented by
this `CatalogModifierList` object with the `modifier_type` set to `TEXT`.
"""
@@ -92,13 +92,13 @@ class CatalogModifierListParams(typing_extensions.TypedDict):
internal_name: typing_extensions.NotRequired[typing.Optional[str]]
"""
- A note for internal use by the business.
+ A note for internal use by the business.
- For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!"
- is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as
- an instruction for the business to follow.
+ For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!"
+ is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as
+ an instruction for the business to follow.
- For non text-based modifiers, this `internal_name` attribute can be
+ For non text-based modifiers, this `internal_name` attribute can be
used to include SKUs, internal codes, or supplemental descriptions for internal use.
"""
diff --git a/src/square/requests/catalog_object_category.py b/src/square/requests/catalog_object_category.py
index b9751c6f..7c8113d6 100644
--- a/src/square/requests/catalog_object_category.py
+++ b/src/square/requests/catalog_object_category.py
@@ -27,7 +27,9 @@ class CatalogObjectCategoryParams(typing_extensions.TypedDict):
ordinal: typing_extensions.NotRequired[typing.Optional[int]]
"""
- The order of the object within the context of the category.
+ The position of this object within the specified category. When an item is assigned to a category,
+ the ordinal determines the item's position relative to other items in the same category. When used for a
+ parent category reference, the ordinal determines the category's position among its sibling categories.
"""
type: typing_extensions.NotRequired[typing.Literal["CATEGORY"]]
diff --git a/src/square/requests/create_inventory_adjustment_reason_response.py b/src/square/requests/create_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..fad600c2
--- /dev/null
+++ b/src/square/requests/create_inventory_adjustment_reason_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class CreateInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully created inventory adjustment reason.
+ """
diff --git a/src/square/requests/delete_inventory_adjustment_reason_response.py b/src/square/requests/delete_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..08a97317
--- /dev/null
+++ b/src/square/requests/delete_inventory_adjustment_reason_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class DeleteInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [DeleteInventoryAdjustmentReason](api-endpoint:Inventory-DeleteInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully soft-deleted inventory adjustment reason.
+ """
diff --git a/src/square/requests/device_checkout_options.py b/src/square/requests/device_checkout_options.py
index a9737d4b..f52c2666 100644
--- a/src/square/requests/device_checkout_options.py
+++ b/src/square/requests/device_checkout_options.py
@@ -40,5 +40,5 @@ class DeviceCheckoutOptionsParams(typing_extensions.TypedDict):
Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout.
If true, ACS is applied based on Dashboard configuration.
If false, ACS is not applied regardless of that configuration.
- For more information, see [Add a Card Surcharge](https://developer.squareupstaging.com/docs/terminal-api/additional-payment-checkout-features#add-a-card-surcharge).
+ For more information, see [Add a Card Surcharge](https://developer.squareup.com/docs/terminal-api/additional-payment-checkout-features#add-a-card-surcharge).
"""
diff --git a/src/square/requests/fulfillment.py b/src/square/requests/fulfillment.py
index 4873ffb6..1286a572 100644
--- a/src/square/requests/fulfillment.py
+++ b/src/square/requests/fulfillment.py
@@ -8,6 +8,7 @@
from ..types.fulfillment_type import FulfillmentType
from .fulfillment_delivery_details import FulfillmentDeliveryDetailsParams
from .fulfillment_fulfillment_entry import FulfillmentFulfillmentEntryParams
+from .fulfillment_in_store_details import FulfillmentInStoreDetailsParams
from .fulfillment_pickup_details import FulfillmentPickupDetailsParams
from .fulfillment_shipment_details import FulfillmentShipmentDetailsParams
@@ -104,3 +105,9 @@ class FulfillmentParams(typing_extensions.TypedDict):
"""
Describes delivery details of an order fulfillment.
"""
+
+ in_store_details: typing_extensions.NotRequired[FulfillmentInStoreDetailsParams]
+ """
+ Contains details for an in-store fulfillment. These details are required when the fulfillment
+ type is `IN_STORE`.
+ """
diff --git a/src/square/requests/fulfillment_in_store_details.py b/src/square/requests/fulfillment_in_store_details.py
new file mode 100644
index 00000000..5b38edc2
--- /dev/null
+++ b/src/square/requests/fulfillment_in_store_details.py
@@ -0,0 +1,61 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .fulfillment_recipient import FulfillmentRecipientParams
+
+
+class FulfillmentInStoreDetailsParams(typing_extensions.TypedDict):
+ """
+ Contains the details necessary to fulfill an in-store order.
+ """
+
+ note: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ A note to provide additional instructions about the in-store fulfillment
+ displayed in the Square Point of Sale application and set by the API.
+ """
+
+ recipient: typing_extensions.NotRequired[FulfillmentRecipientParams]
+ """
+ Information about the person to receive this in-store fulfillment.
+ """
+
+ placed_at: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ completed_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was completed. This field is automatically set when the
+ fulfillment `state` changes to `COMPLETED`. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ in_progress_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicates when the seller started processing the fulfillment.
+ This field is automatically set when the fulfillment `state` changes to `RESERVED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ prepared_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was moved to the `PREPARED` state, which indicates that the
+ fulfillment is ready. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing_extensions.NotRequired[str]
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was canceled. This field is automatically set when the
+ fulfillment `state` changes to `CANCELED`. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
diff --git a/src/square/requests/inventory_adjustment.py b/src/square/requests/inventory_adjustment.py
index 90a635b1..fe6bf54c 100644
--- a/src/square/requests/inventory_adjustment.py
+++ b/src/square/requests/inventory_adjustment.py
@@ -5,6 +5,7 @@
import typing_extensions
from ..types.inventory_state import InventoryState
from .inventory_adjustment_group import InventoryAdjustmentGroupParams
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
from .money import MoneyParams
from .source_application import SourceApplicationParams
@@ -42,10 +43,16 @@ class InventoryAdjustmentParams(typing_extensions.TypedDict):
See [InventoryState](#type-inventorystate) for possible values
"""
- location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ from_location_id: typing_extensions.NotRequired[typing.Optional[str]]
"""
The Square-generated ID of the [Location](entity:Location) where the related
- quantity of items is being tracked.
+ quantity of items is being tracked before the adjustment.
+ """
+
+ to_location_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked after the adjustment.
"""
catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
@@ -138,3 +145,29 @@ class InventoryAdjustmentParams(typing_extensions.TypedDict):
"""
An adjustment group bundling the related adjustments of item variations through stock conversions in a single inventory event.
"""
+
+ cost_money: typing_extensions.NotRequired[MoneyParams]
+ """
+ The total amount paid by the merchant to the supplying vendor for these units of the product.
+ This field is only applicable for stock receive adjustments that introduce stock into the system (from_state is NONE or UNLINKED_RETURN).
+ May be empty.
+ This field will only accept writes if the merchant has an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
+ vendor_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the Vendor from which the merchant purchased this product.
+ This field is only applicable for stock receive adjustments that introduce stock into the system (from_state is NONE or UNLINKED_RETURN).
+ This field will only accept writes if the merchant has an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
+ physical_count_id: typing_extensions.NotRequired[str]
+ """
+ The Square-generated ID of the InventoryPhysicalCount (recount) that generated this adjustment, if applicable.
+ The quantity of an adjustment generated by a physical count cannot be edited.
+ """
+
+ reason_id: typing_extensions.NotRequired[InventoryAdjustmentReasonIdParams]
+ """
+ Identifies the reason for this inventory adjustment.
+ """
diff --git a/src/square/requests/inventory_adjustment_reason.py b/src/square/requests/inventory_adjustment_reason.py
new file mode 100644
index 00000000..f6ac3fe7
--- /dev/null
+++ b/src/square/requests/inventory_adjustment_reason.py
@@ -0,0 +1,58 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.inventory_adjustment_reason_direction import InventoryAdjustmentReasonDirection
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonIdParams
+
+
+class InventoryAdjustmentReasonParams(typing_extensions.TypedDict):
+ """
+ Represents an inventory adjustment reason.
+ """
+
+ id: InventoryAdjustmentReasonIdParams
+ """
+ The identifier for this inventory adjustment reason.
+ """
+
+ name: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The seller-facing name for a custom inventory adjustment reason. This
+ field is empty for standard and system-generated adjustment reasons.
+ """
+
+ direction: typing_extensions.NotRequired[InventoryAdjustmentReasonDirection]
+ """
+ Indicates whether this inventory adjustment reason increases or
+ decreases inventory. This field is set for custom reasons and for standard
+ seller-selectable reasons. It is empty for system-generated inventory
+ events.
+ See [Direction](#type-direction) for possible values
+ """
+
+ created_at: typing_extensions.NotRequired[str]
+ """
+ An RFC 3339-formatted timestamp that indicates when the custom
+ adjustment reason was created. This field is empty for standard
+ adjustment reasons.
+ """
+
+ updated_at: typing_extensions.NotRequired[str]
+ """
+ An RFC 3339-formatted timestamp that indicates when the custom
+ adjustment reason was last updated. This field is empty for standard
+ adjustment reasons.
+ """
+
+ is_deleted: typing_extensions.NotRequired[typing.Optional[bool]]
+ """
+ Indicates whether this custom inventory adjustment reason has been
+ deleted. Deleted custom reasons can still be retrieved by ID, but are
+ omitted from list responses unless deleted reasons are explicitly included.
+ To restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+ This field is always `false` for standard and system-generated adjustment
+ reasons.
+ """
diff --git a/src/square/requests/inventory_adjustment_reason_id.py b/src/square/requests/inventory_adjustment_reason_id.py
new file mode 100644
index 00000000..159164b5
--- /dev/null
+++ b/src/square/requests/inventory_adjustment_reason_id.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from ..types.inventory_adjustment_reason_id_type import InventoryAdjustmentReasonIdType
+
+
+class InventoryAdjustmentReasonIdParams(typing_extensions.TypedDict):
+ """
+ Identifies a standard or custom inventory adjustment reason.
+ """
+
+ type: InventoryAdjustmentReasonIdType
+ """
+ The adjustment reason type.
+ See [Type](#type-type) for possible values
+ """
+
+ custom_reason_id: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The Square-generated ID of the custom adjustment reason. This field
+ is only set when `type` is `CUSTOM`.
+ """
diff --git a/src/square/requests/inventory_change.py b/src/square/requests/inventory_change.py
index bd4baa2a..3fe6404a 100644
--- a/src/square/requests/inventory_change.py
+++ b/src/square/requests/inventory_change.py
@@ -5,7 +5,6 @@
from .catalog_measurement_unit import CatalogMeasurementUnitParams
from .inventory_adjustment import InventoryAdjustmentParams
from .inventory_physical_count import InventoryPhysicalCountParams
-from .inventory_transfer import InventoryTransferParams
class InventoryChangeParams(typing_extensions.TypedDict):
@@ -34,15 +33,6 @@ class InventoryChangeParams(typing_extensions.TypedDict):
`ADJUSTMENT`, and is unset for all other change types.
"""
- transfer: typing_extensions.NotRequired[InventoryTransferParams]
- """
- Contains details about the inventory transfer when `type` is
- `TRANSFER`, and is unset for all other change types.
-
- _Note:_ An [InventoryTransfer](entity:InventoryTransfer) object can only be set in the input to the
- [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) endpoint when the seller has an active Retail Plus subscription.
- """
-
measurement_unit: typing_extensions.NotRequired[CatalogMeasurementUnitParams]
"""
The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change.
diff --git a/src/square/requests/inventory_count.py b/src/square/requests/inventory_count.py
index 19a10b27..f99930d5 100644
--- a/src/square/requests/inventory_count.py
+++ b/src/square/requests/inventory_count.py
@@ -10,7 +10,8 @@ class InventoryCountParams(typing_extensions.TypedDict):
"""
Represents Square-estimated quantity of items in a particular state at a
particular seller location based on the known history of physical counts and
- inventory adjustments.
+ inventory adjustments. The absence of an inventory count indicates that the
+ catalog object hasn't interacted with the given inventory state at the given location.
"""
catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
diff --git a/src/square/requests/inventory_physical_count.py b/src/square/requests/inventory_physical_count.py
index d0b1be10..0924d87d 100644
--- a/src/square/requests/inventory_physical_count.py
+++ b/src/square/requests/inventory_physical_count.py
@@ -91,3 +91,10 @@ class InventoryPhysicalCountParams(typing_extensions.TypedDict):
"""
An RFC 3339-formatted timestamp that indicates when the physical count is received.
"""
+
+ adjustment_id: typing_extensions.NotRequired[str]
+ """
+ The Square-generated ID of the InventoryAdjustment that was generated by this physical count in order to
+ adjust the current stock count to reflect the re-counted quantity.
+ This field may be empty if the merchant does not have an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
diff --git a/src/square/requests/inventory_transfer.py b/src/square/requests/inventory_transfer.py
deleted file mode 100644
index b9ffcd88..00000000
--- a/src/square/requests/inventory_transfer.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import typing_extensions
-from ..types.inventory_state import InventoryState
-from .source_application import SourceApplicationParams
-
-
-class InventoryTransferParams(typing_extensions.TypedDict):
- """
- Represents the transfer of a quantity of product inventory at a
- particular time from one location to another.
- """
-
- id: typing_extensions.NotRequired[str]
- """
- A unique ID generated by Square for the
- `InventoryTransfer`.
- """
-
- reference_id: typing_extensions.NotRequired[typing.Optional[str]]
- """
- An optional ID provided by the application to tie the
- `InventoryTransfer` to an external system.
- """
-
- state: typing_extensions.NotRequired[InventoryState]
- """
- The [inventory state](entity:InventoryState) for the quantity of
- items being transferred.
- See [InventoryState](#type-inventorystate) for possible values
- """
-
- from_location_id: typing_extensions.NotRequired[typing.Optional[str]]
- """
- The Square-generated ID of the [Location](entity:Location) where the related
- quantity of items was tracked before the transfer.
- """
-
- to_location_id: typing_extensions.NotRequired[typing.Optional[str]]
- """
- The Square-generated ID of the [Location](entity:Location) where the related
- quantity of items was tracked after the transfer.
- """
-
- catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]]
- """
- The Square-generated ID of the
- [CatalogObject](entity:CatalogObject) being tracked.
- """
-
- catalog_object_type: typing_extensions.NotRequired[typing.Optional[str]]
- """
- The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.
-
- The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
- In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
- """
-
- quantity: typing_extensions.NotRequired[typing.Optional[str]]
- """
- The number of items affected by the transfer as a decimal string.
- Can support up to 5 digits after the decimal point.
- """
-
- occurred_at: typing_extensions.NotRequired[typing.Optional[str]]
- """
- A client-generated RFC 3339-formatted timestamp that indicates when
- the transfer took place. For write actions, the `occurred_at` timestamp
- cannot be older than 24 hours or in the future relative to the time of the
- request.
- """
-
- created_at: typing_extensions.NotRequired[str]
- """
- An RFC 3339-formatted timestamp that indicates when Square
- received the transfer request.
- """
-
- source: typing_extensions.NotRequired[SourceApplicationParams]
- """
- Information about the application that initiated the
- inventory transfer.
- """
-
- employee_id: typing_extensions.NotRequired[typing.Optional[str]]
- """
- The Square-generated ID of the [Employee](entity:Employee) responsible for the
- inventory transfer.
- """
-
- team_member_id: typing_extensions.NotRequired[typing.Optional[str]]
- """
- The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
- inventory transfer.
- """
diff --git a/src/square/requests/item_variation_location_overrides.py b/src/square/requests/item_variation_location_overrides.py
index 3f57850d..a69b4e87 100644
--- a/src/square/requests/item_variation_location_overrides.py
+++ b/src/square/requests/item_variation_location_overrides.py
@@ -31,7 +31,9 @@ class ItemVariationLocationOverridesParams(typing_extensions.TypedDict):
track_inventory: typing_extensions.NotRequired[typing.Optional[bool]]
"""
- If `true`, inventory tracking is active for the `CatalogItemVariation` at this `Location`.
+ Indicates whether inventory tracking is active for the `CatalogItemVariation` at this `Location`.
+ When set, this value explicitly overrides the global `track_inventory` setting. When unset, the location
+ should use the global value. If both global and location-level values are unset, inventory tracking is disabled.
"""
inventory_alert_type: typing_extensions.NotRequired[InventoryAlertType]
diff --git a/src/square/requests/list_inventory_adjustment_reasons_response.py b/src/square/requests/list_inventory_adjustment_reasons_response.py
new file mode 100644
index 00000000..a67a96ec
--- /dev/null
+++ b/src/square/requests/list_inventory_adjustment_reasons_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class ListInventoryAdjustmentReasonsResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [ListInventoryAdjustmentReasons](api-endpoint:Inventory-ListInventoryAdjustmentReasons).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reasons: typing_extensions.NotRequired[typing.Sequence[InventoryAdjustmentReasonParams]]
+ """
+ The standard, system-generated, and custom inventory adjustment
+ reasons available to the seller.
+ """
diff --git a/src/square/requests/loyalty_event.py b/src/square/requests/loyalty_event.py
index 54f29d02..0ef2fb02 100644
--- a/src/square/requests/loyalty_event.py
+++ b/src/square/requests/loyalty_event.py
@@ -24,7 +24,7 @@ class LoyaltyEventParams(typing_extensions.TypedDict):
The Square-assigned ID of the loyalty event.
"""
- type: LoyaltyEventType
+ type: typing_extensions.NotRequired[LoyaltyEventType]
"""
The type of the loyalty event.
See [LoyaltyEventType](#type-loyaltyeventtype) for possible values
@@ -70,7 +70,7 @@ class LoyaltyEventParams(typing_extensions.TypedDict):
The ID of the [location](entity:Location) where the event occurred.
"""
- source: LoyaltyEventSource
+ source: typing_extensions.NotRequired[LoyaltyEventSource]
"""
Defines whether the event was generated by the Square Point of Sale.
See [LoyaltyEventSource](#type-loyaltyeventsource) for possible values
diff --git a/src/square/requests/order.py b/src/square/requests/order.py
index a6480d03..925cef02 100644
--- a/src/square/requests/order.py
+++ b/src/square/requests/order.py
@@ -48,7 +48,17 @@ class OrderParams(typing_extensions.TypedDict):
source: typing_extensions.NotRequired[OrderSourceParams]
"""
- The origination details of the order.
+ The latest source details of the order.
+
+ This field reflects the most recent source that interacted with or modified the order,
+ and may change during the order lifecycle. For example:
+ - An order created via API (source.name = "MyPOS") paid with Square Terminal may have
+ source updated to reflect the Terminal application (which uses REGISTER, like POS)
+ - An order updated or completed by a different application may have source updated
+ to reflect that application.
+
+ To preserve the original source from order creation regardless of subsequent updates,
+ use the `creation_source` field instead.
"""
customer_id: typing_extensions.NotRequired[typing.Optional[str]]
diff --git a/src/square/requests/order_line_item_modifier.py b/src/square/requests/order_line_item_modifier.py
index 6b7f922c..780aa930 100644
--- a/src/square/requests/order_line_item_modifier.py
+++ b/src/square/requests/order_line_item_modifier.py
@@ -78,3 +78,8 @@ class OrderLineItemModifierParams(typing_extensions.TypedDict):
For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
"""
+
+ parent_modifier_uid: typing_extensions.NotRequired[typing.Optional[str]]
+ """
+ The `uid` of the parent modifier, if this modifier is nested under another modifier.
+ """
diff --git a/src/square/requests/restore_inventory_adjustment_reason_response.py b/src/square/requests/restore_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..36d160d8
--- /dev/null
+++ b/src/square/requests/restore_inventory_adjustment_reason_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class RestoreInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully restored inventory adjustment reason.
+ """
diff --git a/src/square/requests/retrieve_inventory_adjustment_reason_response.py b/src/square/requests/retrieve_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..fafd47cd
--- /dev/null
+++ b/src/square/requests/retrieve_inventory_adjustment_reason_response.py
@@ -0,0 +1,24 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class RetrieveInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [RetrieveInventoryAdjustmentReason](api-endpoint:Inventory-RetrieveInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully retrieved inventory adjustment reason. Deleted custom
+ reasons can be retrieved by ID and have `is_deleted` set to `true`.
+ """
diff --git a/src/square/requests/update_inventory_adjustment_reason_response.py b/src/square/requests/update_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..77a7fcb8
--- /dev/null
+++ b/src/square/requests/update_inventory_adjustment_reason_response.py
@@ -0,0 +1,23 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import typing_extensions
+from .error import ErrorParams
+from .inventory_adjustment_reason import InventoryAdjustmentReasonParams
+
+
+class UpdateInventoryAdjustmentReasonResponseParams(typing_extensions.TypedDict):
+ """
+ Represents an output from a call to [UpdateInventoryAdjustmentReason](api-endpoint:Inventory-UpdateInventoryAdjustmentReason).
+ """
+
+ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing_extensions.NotRequired[InventoryAdjustmentReasonParams]
+ """
+ The successfully updated inventory adjustment reason.
+ """
diff --git a/src/square/requests/get_inventory_transfer_response.py b/src/square/requests/update_inventory_adjustment_response.py
similarity index 52%
rename from src/square/requests/get_inventory_transfer_response.py
rename to src/square/requests/update_inventory_adjustment_response.py
index 83297433..33e41bb7 100644
--- a/src/square/requests/get_inventory_transfer_response.py
+++ b/src/square/requests/update_inventory_adjustment_response.py
@@ -4,16 +4,16 @@
import typing_extensions
from .error import ErrorParams
-from .inventory_transfer import InventoryTransferParams
+from .inventory_adjustment import InventoryAdjustmentParams
-class GetInventoryTransferResponseParams(typing_extensions.TypedDict):
+class UpdateInventoryAdjustmentResponseParams(typing_extensions.TypedDict):
errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]]
"""
Any errors that occurred during the request.
"""
- transfer: typing_extensions.NotRequired[InventoryTransferParams]
+ adjustment: typing_extensions.NotRequired[InventoryAdjustmentParams]
"""
- The requested [InventoryTransfer](entity:InventoryTransfer).
+ The newly updated adjustment.
"""
diff --git a/src/square/team_members/raw_client.py b/src/square/team_members/raw_client.py
index b47fbdf3..29a9b11f 100644
--- a/src/square/team_members/raw_client.py
+++ b/src/square/team_members/raw_client.py
@@ -74,9 +74,6 @@ def create(
object_=team_member, annotation=TeamMemberParams, direction="write"
),
},
- headers={
- "content-type": "application/json",
- },
request_options=request_options,
omit=OMIT,
)
@@ -427,9 +424,6 @@ async def create(
object_=team_member, annotation=TeamMemberParams, direction="write"
),
},
- headers={
- "content-type": "application/json",
- },
request_options=request_options,
omit=OMIT,
)
diff --git a/src/square/types/batch_retrieve_inventory_changes_request.py b/src/square/types/batch_retrieve_inventory_changes_request.py
index dcdf8497..ca682b97 100644
--- a/src/square/types/batch_retrieve_inventory_changes_request.py
+++ b/src/square/types/batch_retrieve_inventory_changes_request.py
@@ -5,6 +5,8 @@
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
+from .batch_retrieve_inventory_changes_sort import BatchRetrieveInventoryChangesSort
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonId
from .inventory_change_type import InventoryChangeType
from .inventory_state import InventoryState
@@ -62,6 +64,21 @@ class BatchRetrieveInventoryChangesRequest(UncheckedBaseModel):
The number of [records](entity:InventoryChange) to return.
"""
+ sort: typing.Optional[BatchRetrieveInventoryChangesSort] = pydantic.Field(default=None)
+ """
+ Specification of how returned inventory changes should be ordered.
+
+ Currently, inventory changes can only be ordered by the occurred_at field.
+ The default sort order for occurred_at is ASC (changes are returned oldest-first by default).
+ """
+
+ reason_ids: typing.Optional[typing.List[InventoryAdjustmentReasonId]] = pydantic.Field(default=None)
+ """
+ The filter to return `ADJUSTMENT` query results by inventory
+ adjustment reason. This filter is only applied when set. The request cannot
+ include both `reason_ids` and `states`.
+ """
+
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
diff --git a/src/square/types/batch_retrieve_inventory_changes_sort.py b/src/square/types/batch_retrieve_inventory_changes_sort.py
new file mode 100644
index 00000000..aaa1c633
--- /dev/null
+++ b/src/square/types/batch_retrieve_inventory_changes_sort.py
@@ -0,0 +1,32 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .batch_retrieve_inventory_changes_sort_field import BatchRetrieveInventoryChangesSortField
+from .sort_order import SortOrder
+
+
+class BatchRetrieveInventoryChangesSort(UncheckedBaseModel):
+ field: typing.Optional[BatchRetrieveInventoryChangesSortField] = pydantic.Field(default=None)
+ """
+ The field to sort inventory changes by.
+ See [Field](#type-field) for possible values
+ """
+
+ order: typing.Optional[SortOrder] = pydantic.Field(default=None)
+ """
+ The order to sort inventory changes by.
+ See [SortOrder](#type-sortorder) for possible values
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/batch_retrieve_inventory_changes_sort_field.py b/src/square/types/batch_retrieve_inventory_changes_sort_field.py
new file mode 100644
index 00000000..9ecf1398
--- /dev/null
+++ b/src/square/types/batch_retrieve_inventory_changes_sort_field.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+BatchRetrieveInventoryChangesSortField = typing.Literal["OCCURRED_AT"]
diff --git a/src/square/types/catalog_category.py b/src/square/types/catalog_category.py
index 3c2a4813..8508aea7 100644
--- a/src/square/types/catalog_category.py
+++ b/src/square/types/catalog_category.py
@@ -36,7 +36,8 @@ class CatalogCategory(UncheckedBaseModel):
parent_category: typing.Optional["CatalogObjectCategory"] = pydantic.Field(default=None)
"""
- The ID of the parent category of this category instance.
+ The parent category of this category instance. This includes the parent category ID and an ordinal
+ value that determines the category's relative position among sibling categories with the same parent.
"""
is_top_level: typing.Optional[bool] = pydantic.Field(default=None)
diff --git a/src/square/types/catalog_item.py b/src/square/types/catalog_item.py
index d064ae80..fb04ab58 100644
--- a/src/square/types/catalog_item.py
+++ b/src/square/types/catalog_item.py
@@ -138,7 +138,8 @@ class CatalogItem(UncheckedBaseModel):
categories: typing.Optional[typing.List["CatalogObjectCategory"]] = pydantic.Field(default=None)
"""
- The list of categories.
+ The list of categories to which this item belongs. Each entry includes the category ID and an ordinal
+ value that determines the item's relative position within that category.
"""
description_html: typing.Optional[str] = pydantic.Field(default=None)
diff --git a/src/square/types/catalog_item_modifier_list_info.py b/src/square/types/catalog_item_modifier_list_info.py
index 7f09ff44..0edf6935 100644
--- a/src/square/types/catalog_item_modifier_list_info.py
+++ b/src/square/types/catalog_item_modifier_list_info.py
@@ -56,7 +56,7 @@ class CatalogItemModifierListInfo(UncheckedBaseModel):
ordinal: typing.Optional[int] = pydantic.Field(default=None)
"""
- The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied
+ The position of this `CatalogItemModifierListInfo` object within the `modifier_list_info` list applied
to a `CatalogItem` instance.
"""
diff --git a/src/square/types/catalog_item_variation.py b/src/square/types/catalog_item_variation.py
index 21a657a8..d1f1be07 100644
--- a/src/square/types/catalog_item_variation.py
+++ b/src/square/types/catalog_item_variation.py
@@ -6,6 +6,7 @@
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .catalog_item_option_value_for_item_variation import CatalogItemOptionValueForItemVariation
+from .catalog_item_variation_vendor_information import CatalogItemVariationVendorInformation
from .catalog_pricing_type import CatalogPricingType
from .catalog_stock_conversion import CatalogStockConversion
from .inventory_alert_type import InventoryAlertType
@@ -82,22 +83,26 @@ class CatalogItemVariation(UncheckedBaseModel):
track_inventory: typing.Optional[bool] = pydantic.Field(default=None)
"""
- If `true`, inventory tracking is active for the variation.
+ If `true`, inventory tracking is active for the variation at all locations by default.
+ This value can be overridden for specific locations using `ItemVariationLocationOverrides.track_inventory`.
+ If unset at both levels, inventory tracking is disabled.
"""
inventory_alert_type: typing.Optional[InventoryAlertType] = pydantic.Field(default=None)
"""
Indicates whether the item variation displays an alert when its inventory quantity is less than or equal
to its `inventory_alert_threshold`.
+
+ Deprecated because this field has never been global.
See [InventoryAlertType](#type-inventoryalerttype) for possible values
"""
inventory_alert_threshold: typing.Optional[int] = pydantic.Field(default=None)
"""
If the inventory quantity for the variation is less than or equal to this value and `inventory_alert_type`
- is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard.
+ is `LOW_QUANTITY`, the variation displays an alert in the merchant dashboard. This value is always an integer.
- This value is always an integer.
+ Deprecated because this field has never been global.
"""
user_data: typing.Optional[str] = pydantic.Field(default=None)
@@ -177,6 +182,15 @@ class CatalogItemVariation(UncheckedBaseModel):
kitchen name is "Large container"
"""
+ vendor_information: typing.Optional[typing.List[CatalogItemVariationVendorInformation]] = pydantic.Field(
+ default=None
+ )
+ """
+ Details of the vendor this product is purchased from.
+ This field can be set only if the seller has an active subscription
+ to either Square for Retail Premium or Square for Restaurants Premium.
+ """
+
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
diff --git a/src/square/types/catalog_item_variation_vendor_information.py b/src/square/types/catalog_item_variation_vendor_information.py
new file mode 100644
index 00000000..dda6d346
--- /dev/null
+++ b/src/square/types/catalog_item_variation_vendor_information.py
@@ -0,0 +1,43 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .money import Money
+
+
+class CatalogItemVariationVendorInformation(UncheckedBaseModel):
+ """
+ Information about the vendor of an item variation.
+ """
+
+ vendor_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ ID of the [Vendor](entity:Vendor) linked to a default cost of this product.
+ When the product is added to a purchase order, the default cost is pre-filled.
+ This field is not validated. Clients should gracefully handle cases where the vendor_id
+ does not match any existing vendor.
+ """
+
+ vendor_code: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ Unique identifier of this product in the specified vendor's' inventory system.
+ When the product is added to a purchase order, the vendor code is pre-filled based
+ on the selected vendor.
+ """
+
+ unit_cost_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The unit cost of the linked product, when purchased from the linked vendor.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/catalog_modifier_list.py b/src/square/types/catalog_modifier_list.py
index 3b678716..2035f446 100644
--- a/src/square/types/catalog_modifier_list.py
+++ b/src/square/types/catalog_modifier_list.py
@@ -22,7 +22,7 @@ class CatalogModifierList(UncheckedBaseModel):
name: typing.Optional[str] = pydantic.Field(default=None)
"""
- The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of
+ The name of the `CatalogModifierList` instance. This is a searchable attribute for use in applicable query filters, and its value length is of
Unicode code points.
"""
@@ -40,14 +40,14 @@ class CatalogModifierList(UncheckedBaseModel):
modifiers: typing.Optional[typing.List["CatalogObject"]] = pydantic.Field(default=None)
"""
- A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`,
- for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list
+ A non-empty list of `CatalogModifier` objects to be included in the `CatalogModifierList`,
+ for non text-based modifiers when the `modifier_type` attribute is `LIST`. Each element of this list
is a `CatalogObject` instance of the `MODIFIER` type, containing the following attributes:
```
{
"id": "{{catalog_modifier_id}}",
- "type": "MODIFIER",
- "modifier_data": {{a CatalogModifier instance>}}
+ "type": "MODIFIER",
+ "modifier_data": {{a CatalogModifier instance>}}
}
```
"""
@@ -70,16 +70,16 @@ class CatalogModifierList(UncheckedBaseModel):
modifier_type: typing.Optional[CatalogModifierListModifierType] = pydantic.Field(default=None)
"""
- The type of the modifier.
+ The type of the modifier.
- When this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier.
+ When this `modifier_type` value is `TEXT`, the `CatalogModifierList` represents a text-based modifier.
When this `modifier_type` value is `LIST`, the `CatalogModifierList` contains a list of `CatalogModifier` objects.
See [CatalogModifierListModifierType](#type-catalogmodifierlistmodifiertype) for possible values
"""
max_length: typing.Optional[int] = pydantic.Field(default=None)
"""
- The maximum length, in Unicode points, of the text string of the text-based modifier as represented by
+ The maximum length, in Unicode points, of the text string of the text-based modifier as represented by
this `CatalogModifierList` object with the `modifier_type` set to `TEXT`.
"""
@@ -91,13 +91,13 @@ class CatalogModifierList(UncheckedBaseModel):
internal_name: typing.Optional[str] = pydantic.Field(default=None)
"""
- A note for internal use by the business.
+ A note for internal use by the business.
- For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!"
- is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as
- an instruction for the business to follow.
+ For example, for a text-based modifier applied to a T-shirt item, if the buyer-supplied text of "Hello, Kitty!"
+ is to be printed on the T-shirt, this `internal_name` attribute can be "Use italic face" as
+ an instruction for the business to follow.
- For non text-based modifiers, this `internal_name` attribute can be
+ For non text-based modifiers, this `internal_name` attribute can be
used to include SKUs, internal codes, or supplemental descriptions for internal use.
"""
diff --git a/src/square/types/catalog_object_category.py b/src/square/types/catalog_object_category.py
index 69355258..555f81c4 100644
--- a/src/square/types/catalog_object_category.py
+++ b/src/square/types/catalog_object_category.py
@@ -27,7 +27,9 @@ class CatalogObjectCategory(UncheckedBaseModel):
ordinal: typing.Optional[int] = pydantic.Field(default=None)
"""
- The order of the object within the context of the category.
+ The position of this object within the specified category. When an item is assigned to a category,
+ the ordinal determines the item's position relative to other items in the same category. When used for a
+ parent category reference, the ordinal determines the category's position among its sibling categories.
"""
type: typing.Optional[typing.Literal["CATEGORY"]] = None
diff --git a/src/square/types/create_inventory_adjustment_reason_response.py b/src/square/types/create_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..ab5f8680
--- /dev/null
+++ b/src/square/types/create_inventory_adjustment_reason_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class CreateInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [CreateInventoryAdjustmentReason](api-endpoint:Inventory-CreateInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully created inventory adjustment reason.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/delete_inventory_adjustment_reason_response.py b/src/square/types/delete_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..cc770575
--- /dev/null
+++ b/src/square/types/delete_inventory_adjustment_reason_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class DeleteInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [DeleteInventoryAdjustmentReason](api-endpoint:Inventory-DeleteInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully soft-deleted inventory adjustment reason.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/device_checkout_options.py b/src/square/types/device_checkout_options.py
index c9c2b7d7..7bd1deda 100644
--- a/src/square/types/device_checkout_options.py
+++ b/src/square/types/device_checkout_options.py
@@ -42,7 +42,7 @@ class DeviceCheckoutOptions(UncheckedBaseModel):
Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout.
If true, ACS is applied based on Dashboard configuration.
If false, ACS is not applied regardless of that configuration.
- For more information, see [Add a Card Surcharge](https://developer.squareupstaging.com/docs/terminal-api/additional-payment-checkout-features#add-a-card-surcharge).
+ For more information, see [Add a Card Surcharge](https://developer.squareup.com/docs/terminal-api/additional-payment-checkout-features#add-a-card-surcharge).
"""
if IS_PYDANTIC_V2:
diff --git a/src/square/types/exclude_strategy.py b/src/square/types/exclude_strategy.py
index ced3f87f..270d9c32 100644
--- a/src/square/types/exclude_strategy.py
+++ b/src/square/types/exclude_strategy.py
@@ -2,4 +2,6 @@
import typing
-ExcludeStrategy = typing.Union[typing.Literal["LEAST_EXPENSIVE", "MOST_EXPENSIVE"], typing.Any]
+ExcludeStrategy = typing.Union[
+ typing.Literal["LEAST_EXPENSIVE", "MOST_EXPENSIVE", "MOST_EXPENSIVE_LOWEST_VALUE"], typing.Any
+]
diff --git a/src/square/types/fulfillment.py b/src/square/types/fulfillment.py
index 5ba2478e..340091ca 100644
--- a/src/square/types/fulfillment.py
+++ b/src/square/types/fulfillment.py
@@ -8,6 +8,7 @@
from .fulfillment_delivery_details import FulfillmentDeliveryDetails
from .fulfillment_fulfillment_entry import FulfillmentFulfillmentEntry
from .fulfillment_fulfillment_line_item_application import FulfillmentFulfillmentLineItemApplication
+from .fulfillment_in_store_details import FulfillmentInStoreDetails
from .fulfillment_pickup_details import FulfillmentPickupDetails
from .fulfillment_shipment_details import FulfillmentShipmentDetails
from .fulfillment_state import FulfillmentState
@@ -107,6 +108,12 @@ class Fulfillment(UncheckedBaseModel):
Describes delivery details of an order fulfillment.
"""
+ in_store_details: typing.Optional[FulfillmentInStoreDetails] = pydantic.Field(default=None)
+ """
+ Contains details for an in-store fulfillment. These details are required when the fulfillment
+ type is `IN_STORE`.
+ """
+
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
diff --git a/src/square/types/fulfillment_in_store_details.py b/src/square/types/fulfillment_in_store_details.py
new file mode 100644
index 00000000..6b50f164
--- /dev/null
+++ b/src/square/types/fulfillment_in_store_details.py
@@ -0,0 +1,72 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .fulfillment_recipient import FulfillmentRecipient
+
+
+class FulfillmentInStoreDetails(UncheckedBaseModel):
+ """
+ Contains the details necessary to fulfill an in-store order.
+ """
+
+ note: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ A note to provide additional instructions about the in-store fulfillment
+ displayed in the Square Point of Sale application and set by the API.
+ """
+
+ recipient: typing.Optional[FulfillmentRecipient] = pydantic.Field(default=None)
+ """
+ Information about the person to receive this in-store fulfillment.
+ """
+
+ placed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was placed. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ completed_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was completed. This field is automatically set when the
+ fulfillment `state` changes to `COMPLETED`. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ in_progress_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicates when the seller started processing the fulfillment.
+ This field is automatically set when the fulfillment `state` changes to `RESERVED`.
+ The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ prepared_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was moved to the `PREPARED` state, which indicates that the
+ fulfillment is ready. The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ canceled_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates)
+ indicating when the fulfillment was canceled. This field is automatically set when the
+ fulfillment `state` changes to `CANCELED`. The timestamp must be in RFC 3339 format
+ (for example, "2016-09-04T23:59:33.123Z").
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/fulfillment_type.py b/src/square/types/fulfillment_type.py
index 048ce597..74d1995d 100644
--- a/src/square/types/fulfillment_type.py
+++ b/src/square/types/fulfillment_type.py
@@ -2,4 +2,4 @@
import typing
-FulfillmentType = typing.Union[typing.Literal["PICKUP", "SHIPMENT", "DELIVERY"], typing.Any]
+FulfillmentType = typing.Union[typing.Literal["PICKUP", "SHIPMENT", "DELIVERY", "IN_STORE"], typing.Any]
diff --git a/src/square/types/get_inventory_transfer_response.py b/src/square/types/get_inventory_transfer_response.py
index d37d1b43..50df7f75 100644
--- a/src/square/types/get_inventory_transfer_response.py
+++ b/src/square/types/get_inventory_transfer_response.py
@@ -2,29 +2,4 @@
import typing
-import pydantic
-from ..core.pydantic_utilities import IS_PYDANTIC_V2
-from ..core.unchecked_base_model import UncheckedBaseModel
-from .error import Error
-from .inventory_transfer import InventoryTransfer
-
-
-class GetInventoryTransferResponse(UncheckedBaseModel):
- errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
- """
- Any errors that occurred during the request.
- """
-
- transfer: typing.Optional[InventoryTransfer] = pydantic.Field(default=None)
- """
- The requested [InventoryTransfer](entity:InventoryTransfer).
- """
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
+GetInventoryTransferResponse = typing.Any
diff --git a/src/square/types/inventory_adjustment.py b/src/square/types/inventory_adjustment.py
index 971d171d..34f9a1dc 100644
--- a/src/square/types/inventory_adjustment.py
+++ b/src/square/types/inventory_adjustment.py
@@ -6,6 +6,7 @@
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .inventory_adjustment_group import InventoryAdjustmentGroup
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonId
from .inventory_state import InventoryState
from .money import Money
from .source_application import SourceApplication
@@ -44,10 +45,16 @@ class InventoryAdjustment(UncheckedBaseModel):
See [InventoryState](#type-inventorystate) for possible values
"""
- location_id: typing.Optional[str] = pydantic.Field(default=None)
+ from_location_id: typing.Optional[str] = pydantic.Field(default=None)
"""
The Square-generated ID of the [Location](entity:Location) where the related
- quantity of items is being tracked.
+ quantity of items is being tracked before the adjustment.
+ """
+
+ to_location_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the [Location](entity:Location) where the related
+ quantity of items is being tracked after the adjustment.
"""
catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
@@ -141,6 +148,32 @@ class InventoryAdjustment(UncheckedBaseModel):
An adjustment group bundling the related adjustments of item variations through stock conversions in a single inventory event.
"""
+ cost_money: typing.Optional[Money] = pydantic.Field(default=None)
+ """
+ The total amount paid by the merchant to the supplying vendor for these units of the product.
+ This field is only applicable for stock receive adjustments that introduce stock into the system (from_state is NONE or UNLINKED_RETURN).
+ May be empty.
+ This field will only accept writes if the merchant has an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
+ vendor_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the Vendor from which the merchant purchased this product.
+ This field is only applicable for stock receive adjustments that introduce stock into the system (from_state is NONE or UNLINKED_RETURN).
+ This field will only accept writes if the merchant has an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
+ physical_count_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the InventoryPhysicalCount (recount) that generated this adjustment, if applicable.
+ The quantity of an adjustment generated by a physical count cannot be edited.
+ """
+
+ reason_id: typing.Optional[InventoryAdjustmentReasonId] = pydantic.Field(default=None)
+ """
+ Identifies the reason for this inventory adjustment.
+ """
+
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
diff --git a/src/square/types/inventory_adjustment_reason.py b/src/square/types/inventory_adjustment_reason.py
new file mode 100644
index 00000000..dd870522
--- /dev/null
+++ b/src/square/types/inventory_adjustment_reason.py
@@ -0,0 +1,69 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_adjustment_reason_direction import InventoryAdjustmentReasonDirection
+from .inventory_adjustment_reason_id import InventoryAdjustmentReasonId
+
+
+class InventoryAdjustmentReason(UncheckedBaseModel):
+ """
+ Represents an inventory adjustment reason.
+ """
+
+ id: InventoryAdjustmentReasonId = pydantic.Field()
+ """
+ The identifier for this inventory adjustment reason.
+ """
+
+ name: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The seller-facing name for a custom inventory adjustment reason. This
+ field is empty for standard and system-generated adjustment reasons.
+ """
+
+ direction: typing.Optional[InventoryAdjustmentReasonDirection] = pydantic.Field(default=None)
+ """
+ Indicates whether this inventory adjustment reason increases or
+ decreases inventory. This field is set for custom reasons and for standard
+ seller-selectable reasons. It is empty for system-generated inventory
+ events.
+ See [Direction](#type-direction) for possible values
+ """
+
+ created_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339-formatted timestamp that indicates when the custom
+ adjustment reason was created. This field is empty for standard
+ adjustment reasons.
+ """
+
+ updated_at: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ An RFC 3339-formatted timestamp that indicates when the custom
+ adjustment reason was last updated. This field is empty for standard
+ adjustment reasons.
+ """
+
+ is_deleted: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Indicates whether this custom inventory adjustment reason has been
+ deleted. Deleted custom reasons can still be retrieved by ID, but are
+ omitted from list responses unless deleted reasons are explicitly included.
+ To restore a deleted custom reason, call
+ [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+ This field is always `false` for standard and system-generated adjustment
+ reasons.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_adjustment_reason_direction.py b/src/square/types/inventory_adjustment_reason_direction.py
new file mode 100644
index 00000000..29a7d971
--- /dev/null
+++ b/src/square/types/inventory_adjustment_reason_direction.py
@@ -0,0 +1,5 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InventoryAdjustmentReasonDirection = typing.Union[typing.Literal["INCREASE", "DECREASE"], typing.Any]
diff --git a/src/square/types/inventory_adjustment_reason_id.py b/src/square/types/inventory_adjustment_reason_id.py
new file mode 100644
index 00000000..96d2860d
--- /dev/null
+++ b/src/square/types/inventory_adjustment_reason_id.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .inventory_adjustment_reason_id_type import InventoryAdjustmentReasonIdType
+
+
+class InventoryAdjustmentReasonId(UncheckedBaseModel):
+ """
+ Identifies a standard or custom inventory adjustment reason.
+ """
+
+ type: InventoryAdjustmentReasonIdType = pydantic.Field()
+ """
+ The adjustment reason type.
+ See [Type](#type-type) for possible values
+ """
+
+ custom_reason_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the custom adjustment reason. This field
+ is only set when `type` is `CUSTOM`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/inventory_adjustment_reason_id_type.py b/src/square/types/inventory_adjustment_reason_id_type.py
new file mode 100644
index 00000000..f43ca7a0
--- /dev/null
+++ b/src/square/types/inventory_adjustment_reason_id_type.py
@@ -0,0 +1,25 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+InventoryAdjustmentReasonIdType = typing.Union[
+ typing.Literal[
+ "RECEIVED",
+ "DAMAGED",
+ "THEFT",
+ "LOST",
+ "RETURNED",
+ "SPOILAGE_WASTE",
+ "SAMPLES_PROMOTIONAL",
+ "INTERNAL_USE",
+ "VENDOR_RETURN",
+ "PRODUCTION_WASTE",
+ "SALE",
+ "RECOUNT",
+ "TRANSFER",
+ "IN_TRANSIT",
+ "CANCELED_SALE",
+ "CUSTOM",
+ ],
+ typing.Any,
+]
diff --git a/src/square/types/inventory_change.py b/src/square/types/inventory_change.py
index 4a66c495..e2a8439b 100644
--- a/src/square/types/inventory_change.py
+++ b/src/square/types/inventory_change.py
@@ -9,7 +9,6 @@
from .inventory_adjustment import InventoryAdjustment
from .inventory_change_type import InventoryChangeType
from .inventory_physical_count import InventoryPhysicalCount
-from .inventory_transfer import InventoryTransfer
class InventoryChange(UncheckedBaseModel):
@@ -38,15 +37,6 @@ class InventoryChange(UncheckedBaseModel):
`ADJUSTMENT`, and is unset for all other change types.
"""
- transfer: typing.Optional[InventoryTransfer] = pydantic.Field(default=None)
- """
- Contains details about the inventory transfer when `type` is
- `TRANSFER`, and is unset for all other change types.
-
- _Note:_ An [InventoryTransfer](entity:InventoryTransfer) object can only be set in the input to the
- [BatchChangeInventory](api-endpoint:Inventory-BatchChangeInventory) endpoint when the seller has an active Retail Plus subscription.
- """
-
measurement_unit: typing.Optional[CatalogMeasurementUnit] = pydantic.Field(default=None)
"""
The [CatalogMeasurementUnit](entity:CatalogMeasurementUnit) object representing the catalog measurement unit associated with the inventory change.
diff --git a/src/square/types/inventory_change_type.py b/src/square/types/inventory_change_type.py
index 7b790112..81e3c3ac 100644
--- a/src/square/types/inventory_change_type.py
+++ b/src/square/types/inventory_change_type.py
@@ -2,4 +2,4 @@
import typing
-InventoryChangeType = typing.Union[typing.Literal["PHYSICAL_COUNT", "ADJUSTMENT", "TRANSFER"], typing.Any]
+InventoryChangeType = typing.Union[typing.Literal["PHYSICAL_COUNT", "ADJUSTMENT"], typing.Any]
diff --git a/src/square/types/inventory_count.py b/src/square/types/inventory_count.py
index f7f48859..289485f8 100644
--- a/src/square/types/inventory_count.py
+++ b/src/square/types/inventory_count.py
@@ -12,7 +12,8 @@ class InventoryCount(UncheckedBaseModel):
"""
Represents Square-estimated quantity of items in a particular state at a
particular seller location based on the known history of physical counts and
- inventory adjustments.
+ inventory adjustments. The absence of an inventory count indicates that the
+ catalog object hasn't interacted with the given inventory state at the given location.
"""
catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
diff --git a/src/square/types/inventory_physical_count.py b/src/square/types/inventory_physical_count.py
index 20bb2cf7..816bbeaf 100644
--- a/src/square/types/inventory_physical_count.py
+++ b/src/square/types/inventory_physical_count.py
@@ -94,6 +94,13 @@ class InventoryPhysicalCount(UncheckedBaseModel):
An RFC 3339-formatted timestamp that indicates when the physical count is received.
"""
+ adjustment_id: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The Square-generated ID of the InventoryAdjustment that was generated by this physical count in order to
+ adjust the current stock count to reflect the re-counted quantity.
+ This field may be empty if the merchant does not have an active subscription for either Retail Plus, Restaurants Plus, or Restaurants Premium.
+ """
+
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
diff --git a/src/square/types/inventory_state.py b/src/square/types/inventory_state.py
index d69f8785..8f03c5d2 100644
--- a/src/square/types/inventory_state.py
+++ b/src/square/types/inventory_state.py
@@ -20,6 +20,7 @@
"DECOMPOSED",
"SUPPORTED_BY_NEWER_VERSION",
"IN_TRANSIT",
+ "UNTRACKED",
],
typing.Any,
]
diff --git a/src/square/types/inventory_transfer.py b/src/square/types/inventory_transfer.py
deleted file mode 100644
index 6dd5c25f..00000000
--- a/src/square/types/inventory_transfer.py
+++ /dev/null
@@ -1,108 +0,0 @@
-# This file was auto-generated by Fern from our API Definition.
-
-import typing
-
-import pydantic
-from ..core.pydantic_utilities import IS_PYDANTIC_V2
-from ..core.unchecked_base_model import UncheckedBaseModel
-from .inventory_state import InventoryState
-from .source_application import SourceApplication
-
-
-class InventoryTransfer(UncheckedBaseModel):
- """
- Represents the transfer of a quantity of product inventory at a
- particular time from one location to another.
- """
-
- id: typing.Optional[str] = pydantic.Field(default=None)
- """
- A unique ID generated by Square for the
- `InventoryTransfer`.
- """
-
- reference_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- An optional ID provided by the application to tie the
- `InventoryTransfer` to an external system.
- """
-
- state: typing.Optional[InventoryState] = pydantic.Field(default=None)
- """
- The [inventory state](entity:InventoryState) for the quantity of
- items being transferred.
- See [InventoryState](#type-inventorystate) for possible values
- """
-
- from_location_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- The Square-generated ID of the [Location](entity:Location) where the related
- quantity of items was tracked before the transfer.
- """
-
- to_location_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- The Square-generated ID of the [Location](entity:Location) where the related
- quantity of items was tracked after the transfer.
- """
-
- catalog_object_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- The Square-generated ID of the
- [CatalogObject](entity:CatalogObject) being tracked.
- """
-
- catalog_object_type: typing.Optional[str] = pydantic.Field(default=None)
- """
- The [type](entity:CatalogObjectType) of the [CatalogObject](entity:CatalogObject) being tracked.
-
- The Inventory API supports setting and reading the `"catalog_object_type": "ITEM_VARIATION"` field value.
- In addition, it can also read the `"catalog_object_type": "ITEM"` field value that is set by the Square Restaurants app.
- """
-
- quantity: typing.Optional[str] = pydantic.Field(default=None)
- """
- The number of items affected by the transfer as a decimal string.
- Can support up to 5 digits after the decimal point.
- """
-
- occurred_at: typing.Optional[str] = pydantic.Field(default=None)
- """
- A client-generated RFC 3339-formatted timestamp that indicates when
- the transfer took place. For write actions, the `occurred_at` timestamp
- cannot be older than 24 hours or in the future relative to the time of the
- request.
- """
-
- created_at: typing.Optional[str] = pydantic.Field(default=None)
- """
- An RFC 3339-formatted timestamp that indicates when Square
- received the transfer request.
- """
-
- source: typing.Optional[SourceApplication] = pydantic.Field(default=None)
- """
- Information about the application that initiated the
- inventory transfer.
- """
-
- employee_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- The Square-generated ID of the [Employee](entity:Employee) responsible for the
- inventory transfer.
- """
-
- team_member_id: typing.Optional[str] = pydantic.Field(default=None)
- """
- The Square-generated ID of the [Team Member](entity:TeamMember) responsible for the
- inventory transfer.
- """
-
- if IS_PYDANTIC_V2:
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
- else:
-
- class Config:
- frozen = True
- smart_union = True
- extra = pydantic.Extra.allow
diff --git a/src/square/types/item_variation_location_overrides.py b/src/square/types/item_variation_location_overrides.py
index 24d01cde..a36f7cae 100644
--- a/src/square/types/item_variation_location_overrides.py
+++ b/src/square/types/item_variation_location_overrides.py
@@ -33,7 +33,9 @@ class ItemVariationLocationOverrides(UncheckedBaseModel):
track_inventory: typing.Optional[bool] = pydantic.Field(default=None)
"""
- If `true`, inventory tracking is active for the `CatalogItemVariation` at this `Location`.
+ Indicates whether inventory tracking is active for the `CatalogItemVariation` at this `Location`.
+ When set, this value explicitly overrides the global `track_inventory` setting. When unset, the location
+ should use the global value. If both global and location-level values are unset, inventory tracking is disabled.
"""
inventory_alert_type: typing.Optional[InventoryAlertType] = pydantic.Field(default=None)
diff --git a/src/square/types/list_inventory_adjustment_reasons_response.py b/src/square/types/list_inventory_adjustment_reasons_response.py
new file mode 100644
index 00000000..8ee2eaef
--- /dev/null
+++ b/src/square/types/list_inventory_adjustment_reasons_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class ListInventoryAdjustmentReasonsResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [ListInventoryAdjustmentReasons](api-endpoint:Inventory-ListInventoryAdjustmentReasons).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reasons: typing.Optional[typing.List[InventoryAdjustmentReason]] = pydantic.Field(default=None)
+ """
+ The standard, system-generated, and custom inventory adjustment
+ reasons available to the seller.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/loyalty_event.py b/src/square/types/loyalty_event.py
index 3838ffba..b8264a43 100644
--- a/src/square/types/loyalty_event.py
+++ b/src/square/types/loyalty_event.py
@@ -28,7 +28,7 @@ class LoyaltyEvent(UncheckedBaseModel):
The Square-assigned ID of the loyalty event.
"""
- type: LoyaltyEventType = pydantic.Field()
+ type: typing.Optional[LoyaltyEventType] = pydantic.Field(default=None)
"""
The type of the loyalty event.
See [LoyaltyEventType](#type-loyaltyeventtype) for possible values
@@ -74,7 +74,7 @@ class LoyaltyEvent(UncheckedBaseModel):
The ID of the [location](entity:Location) where the event occurred.
"""
- source: LoyaltyEventSource = pydantic.Field()
+ source: typing.Optional[LoyaltyEventSource] = pydantic.Field(default=None)
"""
Defines whether the event was generated by the Square Point of Sale.
See [LoyaltyEventSource](#type-loyaltyeventsource) for possible values
diff --git a/src/square/types/order.py b/src/square/types/order.py
index 695e15e7..9f7e1902 100644
--- a/src/square/types/order.py
+++ b/src/square/types/order.py
@@ -50,7 +50,17 @@ class Order(UncheckedBaseModel):
source: typing.Optional[OrderSource] = pydantic.Field(default=None)
"""
- The origination details of the order.
+ The latest source details of the order.
+
+ This field reflects the most recent source that interacted with or modified the order,
+ and may change during the order lifecycle. For example:
+ - An order created via API (source.name = "MyPOS") paid with Square Terminal may have
+ source updated to reflect the Terminal application (which uses REGISTER, like POS)
+ - An order updated or completed by a different application may have source updated
+ to reflect that application.
+
+ To preserve the original source from order creation regardless of subsequent updates,
+ use the `creation_source` field instead.
"""
customer_id: typing.Optional[str] = pydantic.Field(default=None)
diff --git a/src/square/types/order_line_item_modifier.py b/src/square/types/order_line_item_modifier.py
index 50888a8d..04e72429 100644
--- a/src/square/types/order_line_item_modifier.py
+++ b/src/square/types/order_line_item_modifier.py
@@ -81,6 +81,11 @@ class OrderLineItemModifier(UncheckedBaseModel):
For more information, see [Metadata](https://developer.squareup.com/docs/build-basics/metadata).
"""
+ parent_modifier_uid: typing.Optional[str] = pydantic.Field(default=None)
+ """
+ The `uid` of the parent modifier, if this modifier is nested under another modifier.
+ """
+
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
diff --git a/src/square/types/restore_inventory_adjustment_reason_response.py b/src/square/types/restore_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..0b0a3f2a
--- /dev/null
+++ b/src/square/types/restore_inventory_adjustment_reason_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class RestoreInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [RestoreInventoryAdjustmentReason](api-endpoint:Inventory-RestoreInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully restored inventory adjustment reason.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/retrieve_inventory_adjustment_reason_response.py b/src/square/types/retrieve_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..d9f1f589
--- /dev/null
+++ b/src/square/types/retrieve_inventory_adjustment_reason_response.py
@@ -0,0 +1,35 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class RetrieveInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [RetrieveInventoryAdjustmentReason](api-endpoint:Inventory-RetrieveInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully retrieved inventory adjustment reason. Deleted custom
+ reasons can be retrieved by ID and have `is_deleted` set to `true`.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_inventory_adjustment_reason_response.py b/src/square/types/update_inventory_adjustment_reason_response.py
new file mode 100644
index 00000000..089f153d
--- /dev/null
+++ b/src/square/types/update_inventory_adjustment_reason_response.py
@@ -0,0 +1,34 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment_reason import InventoryAdjustmentReason
+
+
+class UpdateInventoryAdjustmentReasonResponse(UncheckedBaseModel):
+ """
+ Represents an output from a call to [UpdateInventoryAdjustmentReason](api-endpoint:Inventory-UpdateInventoryAdjustmentReason).
+ """
+
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Errors encountered when the request fails.
+ """
+
+ adjustment_reason: typing.Optional[InventoryAdjustmentReason] = pydantic.Field(default=None)
+ """
+ The successfully updated inventory adjustment reason.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/src/square/types/update_inventory_adjustment_response.py b/src/square/types/update_inventory_adjustment_response.py
new file mode 100644
index 00000000..f5f25978
--- /dev/null
+++ b/src/square/types/update_inventory_adjustment_response.py
@@ -0,0 +1,30 @@
+# This file was auto-generated by Fern from our API Definition.
+
+import typing
+
+import pydantic
+from ..core.pydantic_utilities import IS_PYDANTIC_V2
+from ..core.unchecked_base_model import UncheckedBaseModel
+from .error import Error
+from .inventory_adjustment import InventoryAdjustment
+
+
+class UpdateInventoryAdjustmentResponse(UncheckedBaseModel):
+ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None)
+ """
+ Any errors that occurred during the request.
+ """
+
+ adjustment: typing.Optional[InventoryAdjustment] = pydantic.Field(default=None)
+ """
+ The newly updated adjustment.
+ """
+
+ if IS_PYDANTIC_V2:
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
+ else:
+
+ class Config:
+ frozen = True
+ smart_union = True
+ extra = pydantic.Extra.allow
diff --git a/tests/integration/test_inventory.py b/tests/integration/test_inventory.py
index 67774f9f..d83708ec 100644
--- a/tests/integration/test_inventory.py
+++ b/tests/integration/test_inventory.py
@@ -10,8 +10,6 @@
from square.requests.catalog_object import (
CatalogObject_ItemVariationParams,
)
-from square.types.catalog_item import CatalogItem
-from square.types.catalog_object_item import CatalogObjectItem
from square.types.inventory_adjustment import InventoryAdjustment
from square.types.inventory_physical_count import InventoryPhysicalCount
@@ -74,18 +72,14 @@ def create_catalog_item_variation() -> str:
)
assert catalog_response.catalog_object is not None
- assert isinstance(catalog_response.catalog_object, CatalogObjectItem)
- item = catalog_response.catalog_object.item_data
- assert item is not None
- assert isinstance(item, CatalogItem)
- variations = item.variations
- assert variations is not None
- assert len(variations) > 0
+ # Note: catalog_object may deserialize as a raw dict on some pydantic
+ # versions (the CatalogObject discriminated union is not always resolved),
+ # so resolve the variation ID from id_mappings instead of the parsed object.
assert catalog_response.id_mappings is not None
item_variation_ids = [
mapping.object_id
for mapping in catalog_response.id_mappings
- if mapping.object_id == variations[0].id
+ if mapping.client_object_id == "#colombian-coffee"
]
assert len(item_variation_ids) > 0
assert item_variation_ids[0] is not None
@@ -93,12 +87,12 @@ def create_catalog_item_variation() -> str:
@retry_on_rate_limit
-@pytest.mark.skip(reason="Temporarily skipping create_initial_adjustment")
def create_initial_adjustment(item_variation_id: str) -> Optional[str]:
"""
Create an initial inventory adjustment and return the physical count ID
"""
client = helpers.test_client()
+ location_id = helpers.get_default_location_id(client)
response = client.inventory.batch_create_changes(
idempotency_key=str(uuid.uuid4()),
changes=[
@@ -107,7 +101,8 @@ def create_initial_adjustment(item_variation_id: str) -> Optional[str]:
"adjustment": {
"from_state": "NONE",
"to_state": "IN_STOCK",
- "location_id": helpers.get_default_location_id(client),
+ "from_location_id": location_id,
+ "to_location_id": location_id,
"catalog_object_id": item_variation_id,
"quantity": "100",
"occurred_at": helpers.format_date_string(
@@ -163,7 +158,6 @@ def create_initial_adjustment(item_variation_id: str) -> Optional[str]:
return physical_change.physical_count.id
-@pytest.mark.skip(reason="Temporarily skipping test_batch_change_inventory")
def test_batch_change_inventory():
client = helpers.test_client()
item_variation_id = create_catalog_item_variation()
@@ -171,6 +165,7 @@ def test_batch_change_inventory():
create_initial_adjustment(item_variation_id)
time.sleep(2) # Add delay after adjustment
+ location_id = helpers.get_default_location_id(client)
response = client.inventory.batch_create_changes(
idempotency_key=str(uuid.uuid4()),
changes=[
@@ -179,7 +174,8 @@ def test_batch_change_inventory():
"adjustment": {
"from_state": "NONE",
"to_state": "IN_STOCK",
- "location_id": helpers.get_default_location_id(client),
+ "from_location_id": location_id,
+ "to_location_id": location_id,
"catalog_object_id": item_variation_id,
"quantity": "50",
"occurred_at": helpers.format_date_string(datetime.now()),
@@ -196,7 +192,6 @@ def test_batch_change_inventory():
assert "50" == response.changes[0].adjustment.quantity
-@pytest.mark.skip(reason="Temporarily skipping test_batch_retrieve_inventory_changes")
def test_batch_retrieve_inventory_changes():
client = helpers.test_client()
item_variation_id = create_catalog_item_variation()
@@ -211,7 +206,6 @@ def test_batch_retrieve_inventory_changes():
assert len(response.items) > 0
-@pytest.mark.skip(reason="Temporarily skipping test_batch_retrieve_inventory_counts")
def test_batch_retrieve_inventory_counts():
client = helpers.test_client()
item_variation_id = create_catalog_item_variation()
@@ -224,7 +218,6 @@ def test_batch_retrieve_inventory_counts():
assert len(response.items) > 0
-@pytest.mark.skip(reason="Temporarily skipping test_retrieve_inventory_changes")
def test_retrieve_inventory_changes():
client = helpers.test_client()
item_variation_id = create_catalog_item_variation()
@@ -237,7 +230,6 @@ def test_retrieve_inventory_changes():
assert len(response.items) > 0
-@pytest.mark.skip(reason="Temporarily skipping test_retrieve_inventory_counts")
def test_retrieve_inventory_counts():
client = helpers.test_client()
item_variation_id = create_catalog_item_variation()
@@ -249,7 +241,6 @@ def test_retrieve_inventory_counts():
assert response.count is not None
-@pytest.mark.skip(reason="Temporarily skipping test_retrieve_inventory_adjustments")
def test_retrieve_inventory_adjustments():
client = helpers.test_client()
item_variation_id = create_catalog_item_variation()
@@ -257,6 +248,7 @@ def test_retrieve_inventory_adjustments():
create_initial_adjustment(item_variation_id)
time.sleep(2) # Add delay after adjustment
+ location_id = helpers.get_default_location_id(client)
response = client.inventory.batch_create_changes(
idempotency_key=str(uuid.uuid4()),
changes=[
@@ -265,7 +257,8 @@ def test_retrieve_inventory_adjustments():
"adjustment": {
"from_state": "NONE",
"to_state": "IN_STOCK",
- "location_id": helpers.get_default_location_id(client),
+ "from_location_id": location_id,
+ "to_location_id": location_id,
"catalog_object_id": item_variation_id,
"quantity": "10",
"occurred_at": helpers.format_date_string(datetime.now()),