From 18ed221b360f28538488e23239e6a77bc0626d0b Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 16:58:58 +0000 Subject: [PATCH] SDK regeneration --- .fern/metadata.json | 4 +- pyproject.toml | 3 +- reference.md | 700 +++++++------- src/square/catalog/client.py | 64 +- src/square/catalog/object/client.py | 4 +- src/square/core/client_wrapper.py | 14 +- src/square/core/http_client.py | 250 +++-- src/square/core/unchecked_base_model.py | 22 +- src/square/requests/catalog_object.py | 406 +++++++- .../catalog_object_availability_period.py | 91 +- src/square/requests/catalog_object_base.py | 8 - .../requests/catalog_object_category.py | 2 +- ...alog_object_custom_attribute_definition.py | 91 +- .../requests/catalog_object_discount.py | 91 +- src/square/requests/catalog_object_image.py | 91 +- src/square/requests/catalog_object_item.py | 89 +- .../requests/catalog_object_item_option.py | 89 +- .../catalog_object_item_option_value.py | 91 +- .../requests/catalog_object_item_variation.py | 91 +- .../catalog_object_measurement_unit.py | 91 +- .../requests/catalog_object_modifier.py | 91 +- .../requests/catalog_object_modifier_list.py | 89 +- .../requests/catalog_object_pricing_rule.py | 91 +- .../requests/catalog_object_product_set.py | 91 +- .../catalog_object_quick_amounts_settings.py | 91 +- .../catalog_object_subscription_plan.py | 89 +- ...alog_object_subscription_plan_variation.py | 91 +- src/square/requests/catalog_object_tax.py | 91 +- .../requests/catalog_object_time_period.py | 91 +- .../batch_get_catalog_objects_response.py | 15 +- .../batch_upsert_catalog_objects_response.py | 15 +- src/square/types/catalog_category.py | 2 +- src/square/types/catalog_item.py | 18 +- src/square/types/catalog_item_option.py | 13 +- src/square/types/catalog_modifier_list.py | 13 +- src/square/types/catalog_object.py | 884 +++++++++++++++++- .../catalog_object_availability_period.py | 93 +- src/square/types/catalog_object_base.py | 8 - src/square/types/catalog_object_batch.py | 15 +- src/square/types/catalog_object_category.py | 4 +- ...alog_object_custom_attribute_definition.py | 93 +- src/square/types/catalog_object_discount.py | 93 +- src/square/types/catalog_object_image.py | 93 +- src/square/types/catalog_object_item.py | 114 +-- .../types/catalog_object_item_option.py | 114 +-- .../types/catalog_object_item_option_value.py | 93 +- .../types/catalog_object_item_variation.py | 93 +- .../types/catalog_object_measurement_unit.py | 93 +- src/square/types/catalog_object_modifier.py | 93 +- .../types/catalog_object_modifier_list.py | 114 +-- .../types/catalog_object_pricing_rule.py | 93 +- .../types/catalog_object_product_set.py | 93 +- .../catalog_object_quick_amounts_settings.py | 93 +- .../types/catalog_object_subscription_plan.py | 112 +-- ...alog_object_subscription_plan_variation.py | 93 +- src/square/types/catalog_object_tax.py | 93 +- .../types/catalog_object_time_period.py | 93 +- src/square/types/catalog_subscription_plan.py | 13 +- .../types/create_catalog_image_request.py | 15 +- .../types/create_catalog_image_response.py | 15 +- .../types/get_catalog_object_response.py | 15 +- src/square/types/list_catalog_response.py | 15 +- .../types/payment_link_related_resources.py | 15 +- .../types/search_catalog_items_response.py | 15 +- .../types/search_catalog_objects_response.py | 15 +- .../types/update_catalog_image_response.py | 15 +- .../types/upsert_catalog_object_response.py | 15 +- tests/utils/test_http_client.py | 194 +++- 68 files changed, 2301 insertions(+), 3891 deletions(-) diff --git a/.fern/metadata.json b/.fern/metadata.json index d4b24802..4f25b48c 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "2.2.5", + "cliVersion": "3.20.0", "generatorName": "fernapi/fern-python-sdk", - "generatorVersion": "4.38.4", + "generatorVersion": "4.45.9", "generatorConfig": { "client": { "class_name": "Square", diff --git a/pyproject.toml b/pyproject.toml index 64fe2625..1ac5d525 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,10 @@ [project] name = "squareup" +dynamic = ["version"] [tool.poetry] name = "squareup" -version = "43.2.1.20251016" +version = "43.3.0.20251016" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index d42bf0f8..e037bb9e 100644 --- a/reference.md +++ b/reference.md @@ -1,6 +1,6 @@ # Reference ## Mobile -
client.mobile.authorization_code(...) +
client.mobile.authorization_code(...) -> AsyncHttpResponse[CreateMobileAuthorizationCodeResponse]
@@ -85,7 +85,7 @@ client.mobile.authorization_code(
## OAuth -
client.o_auth.revoke_token(...) +
client.o_auth.revoke_token(...) -> AsyncHttpResponse[RevokeTokenResponse]
@@ -206,7 +206,7 @@ Default: `false`
-
client.o_auth.obtain_token(...) +
client.o_auth.obtain_token(...) -> AsyncHttpResponse[ObtainTokenResponse]
@@ -429,7 +429,7 @@ Required for the PKCE flow if `grant_type` is `authorization_code`.
-
client.o_auth.retrieve_token_status() +
client.o_auth.retrieve_token_status() -> AsyncHttpResponse[RetrieveTokenStatusResponse]
@@ -502,7 +502,7 @@ client.o_auth.retrieve_token_status()
-
client.o_auth.authorize() +
client.o_auth.authorize() -> AsyncHttpResponse[None]
@@ -549,7 +549,7 @@ client.o_auth.authorize()
## V1Transactions -
client.v1transactions.v1list_orders(...) +
client.v1transactions.v1list_orders(...) -> AsyncHttpResponse[typing.List[V1Order]]
@@ -649,7 +649,7 @@ original query to the endpoint.
-
client.v1transactions.v1retrieve_order(...) +
client.v1transactions.v1retrieve_order(...) -> AsyncHttpResponse[V1Order]
@@ -728,7 +728,7 @@ client.v1transactions.v1retrieve_order(
-
client.v1transactions.v1update_order(...) +
client.v1transactions.v1update_order(...) -> AsyncHttpResponse[V1Order]
@@ -852,7 +852,7 @@ See [V1UpdateOrderRequestAction](#type-v1updateorderrequestaction) for possible
## ApplePay -
client.apple_pay.register_domain(...) +
client.apple_pay.register_domain(...) -> AsyncHttpResponse[RegisterDomainResponse]
@@ -936,7 +936,7 @@ client.apple_pay.register_domain(
## BankAccounts -
client.bank_accounts.list(...) +
client.bank_accounts.list(...) -> AsyncPager[BankAccount, ListBankAccountsResponse]
@@ -1042,7 +1042,7 @@ to retrieve only the linked bank accounts belonging to a specific location.
-
client.bank_accounts.get_by_v1id(...) +
client.bank_accounts.get_by_v1id(...) -> AsyncHttpResponse[GetBankAccountByV1IdResponse]
@@ -1115,7 +1115,7 @@ Connect V1 ID of the desired `BankAccount`. For more information, see
-
client.bank_accounts.get(...) +
client.bank_accounts.get(...) -> AsyncHttpResponse[GetBankAccountResponse]
@@ -1187,7 +1187,7 @@ client.bank_accounts.get(
## Bookings -
client.bookings.list(...) +
client.bookings.list(...) -> AsyncPager[Booking, ListBookingsResponse]
@@ -1319,7 +1319,7 @@ for page in response.iter_pages():
-
client.bookings.create(...) +
client.bookings.create(...) -> AsyncHttpResponse[CreateBookingResponse]
@@ -1410,7 +1410,7 @@ client.bookings.create(
-
client.bookings.search_availability(...) +
client.bookings.search_availability(...) -> AsyncHttpResponse[SearchAvailabilityResponse]
@@ -1483,7 +1483,7 @@ client.bookings.search_availability(
-
client.bookings.bulk_retrieve_bookings(...) +
client.bookings.bulk_retrieve_bookings(...) -> AsyncHttpResponse[BulkRetrieveBookingsResponse]
@@ -1556,7 +1556,7 @@ client.bookings.bulk_retrieve_bookings(
-
client.bookings.get_business_profile() +
client.bookings.get_business_profile() -> AsyncHttpResponse[GetBusinessBookingProfileResponse]
@@ -1616,7 +1616,7 @@ client.bookings.get_business_profile()
-
client.bookings.retrieve_location_booking_profile(...) +
client.bookings.retrieve_location_booking_profile(...) -> AsyncHttpResponse[RetrieveLocationBookingProfileResponse]
@@ -1686,7 +1686,7 @@ client.bookings.retrieve_location_booking_profile(
-
client.bookings.bulk_retrieve_team_member_booking_profiles(...) +
client.bookings.bulk_retrieve_team_member_booking_profiles(...) -> AsyncHttpResponse[BulkRetrieveTeamMemberBookingProfilesResponse]
@@ -1756,7 +1756,7 @@ client.bookings.bulk_retrieve_team_member_booking_profiles(
-
client.bookings.get(...) +
client.bookings.get(...) -> AsyncHttpResponse[GetBookingResponse]
@@ -1829,7 +1829,7 @@ client.bookings.get(
-
client.bookings.update(...) +
client.bookings.update(...) -> AsyncHttpResponse[UpdateBookingResponse]
@@ -1922,7 +1922,7 @@ client.bookings.update(
-
client.bookings.cancel(...) +
client.bookings.cancel(...) -> AsyncHttpResponse[CancelBookingResponse]
@@ -2015,7 +2015,7 @@ client.bookings.cancel(
## Cards -
client.cards.list(...) +
client.cards.list(...) -> AsyncPager[Card, ListCardsResponse]
@@ -2141,7 +2141,7 @@ This field defaults to ASC.
-
client.cards.create(...) +
client.cards.create(...) -> AsyncHttpResponse[CreateCardResponse]
@@ -2262,7 +2262,7 @@ See the [SCA Overview](https://developer.squareup.com/docs/sca-overview).
-
client.cards.get(...) +
client.cards.get(...) -> AsyncHttpResponse[GetCardResponse]
@@ -2332,7 +2332,7 @@ client.cards.get(
-
client.cards.disable(...) +
client.cards.disable(...) -> AsyncHttpResponse[DisableCardResponse]
@@ -2404,7 +2404,7 @@ client.cards.disable(
## Catalog -
client.catalog.batch_delete(...) +
client.catalog.batch_delete(...) -> AsyncHttpResponse[BatchDeleteCatalogObjectsResponse]
@@ -2491,7 +2491,7 @@ CatalogItem will delete its CatalogItemVariation.
-
client.catalog.batch_get(...) +
client.catalog.batch_get(...) -> AsyncHttpResponse[BatchGetCatalogObjectsResponse]
@@ -2624,7 +2624,7 @@ in the response payload.
-
client.catalog.batch_upsert(...) +
client.catalog.batch_upsert(...) -> AsyncHttpResponse[BatchUpsertCatalogObjectsResponse]
@@ -2673,34 +2673,10 @@ client.catalog.batch_upsert( batches=[ { "objects": [ - { - "type": "IMAGE", - "id": "#Tea", - "present_at_all_locations": True, - }, - { - "type": "IMAGE", - "id": "#Coffee", - "present_at_all_locations": True, - }, - { - "type": "ITEM", - "id": "#Beverages", - "present_at_all_locations": True, - }, - { - "type": "TAX", - "id": "#SalesTax", - "present_at_all_locations": True, - "tax_data": { - "name": "Sales Tax", - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "inclusion_type": "ADDITIVE", - "percentage": "5.0", - "applies_to_custom_amounts": True, - "enabled": True, - }, - }, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "TAX"}, ] } ], @@ -2780,7 +2756,7 @@ be inserted or updated.
-
client.catalog.info() +
client.catalog.info() -> AsyncHttpResponse[CatalogInfoResponse]
@@ -2841,7 +2817,7 @@ client.catalog.info()
-
client.catalog.list(...) +
client.catalog.list(...) -> AsyncPager[CatalogObject, ListCatalogResponse]
@@ -2965,7 +2941,7 @@ current version of the catalog.
-
client.catalog.search(...) +
client.catalog.search(...) -> AsyncHttpResponse[SearchCatalogObjectsResponse]
@@ -3145,7 +3121,7 @@ is higher than the maximum limit of 1,000, it will be ignored.
-
client.catalog.search_items(...) +
client.catalog.search_items(...) -> AsyncHttpResponse[SearchCatalogItemsResponse]
@@ -3328,7 +3304,7 @@ a single call to the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItem
-
client.catalog.update_item_modifier_lists(...) +
client.catalog.update_item_modifier_lists(...) -> AsyncHttpResponse[UpdateItemModifierListsResponse]
@@ -3427,7 +3403,7 @@ At least one of `modifier_lists_to_enable` or `modifier_lists_to_disable` must b
-
client.catalog.update_item_taxes(...) +
client.catalog.update_item_taxes(...) -> AsyncHttpResponse[UpdateItemTaxesResponse]
@@ -3527,7 +3503,7 @@ At least one of `taxes_to_enable` or `taxes_to_disable` must be specified.
## Channels -
client.channels.list(...) +
client.channels.list(...) -> AsyncPager[Channel, ListChannelsResponse]
@@ -3641,7 +3617,7 @@ When not provided the returned results will be cap at 100 channels.
-
client.channels.bulk_retrieve(...) +
client.channels.bulk_retrieve(...) -> AsyncHttpResponse[BulkRetrieveChannelsResponse]
@@ -3711,7 +3687,7 @@ client.channels.bulk_retrieve(
-
client.channels.get(...) +
client.channels.get(...) -> AsyncHttpResponse[RetrieveChannelResponse]
@@ -3782,7 +3758,7 @@ client.channels.get(
## Customers -
client.customers.list(...) +
client.customers.list(...) -> AsyncPager[Customer, ListCustomersResponse]
@@ -3920,7 +3896,7 @@ The default value is `false`.
-
client.customers.create(...) +
client.customers.create(...) -> AsyncHttpResponse[CreateCustomerResponse]
@@ -4144,7 +4120,7 @@ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it
-
client.customers.batch_create(...) +
client.customers.batch_create(...) -> AsyncHttpResponse[BulkCreateCustomersResponse]
@@ -4264,7 +4240,7 @@ customer profile.
-
client.customers.bulk_delete_customers(...) +
client.customers.bulk_delete_customers(...) -> AsyncHttpResponse[BulkDeleteCustomersResponse]
@@ -4340,7 +4316,7 @@ client.customers.bulk_delete_customers(
-
client.customers.bulk_retrieve_customers(...) +
client.customers.bulk_retrieve_customers(...) -> AsyncHttpResponse[BulkRetrieveCustomersResponse]
@@ -4416,7 +4392,7 @@ client.customers.bulk_retrieve_customers(
-
client.customers.bulk_update_customers(...) +
client.customers.bulk_update_customers(...) -> AsyncHttpResponse[BulkUpdateCustomersResponse]
@@ -4508,7 +4484,7 @@ update a field, specify the new value. To remove a field, specify `null`.
-
client.customers.search(...) +
client.customers.search(...) -> AsyncHttpResponse[SearchCustomersResponse]
@@ -4639,7 +4615,7 @@ The default value is `false`.
-
client.customers.get(...) +
client.customers.get(...) -> AsyncHttpResponse[GetCustomerResponse]
@@ -4709,7 +4685,7 @@ client.customers.get(
-
client.customers.update(...) +
client.customers.update(...) -> AsyncHttpResponse[UpdateCustomerResponse]
@@ -4927,7 +4903,7 @@ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it
-
client.customers.delete(...) +
client.customers.delete(...) -> AsyncHttpResponse[DeleteCustomerResponse]
@@ -5013,7 +4989,7 @@ As a best practice, you should include this parameter to enable [optimistic conc
## Devices -
client.devices.list(...) +
client.devices.list(...) -> AsyncPager[Device, ListDevicesResponse]
@@ -5124,7 +5100,7 @@ The order in which results are listed.
-
client.devices.get(...) +
client.devices.get(...) -> AsyncHttpResponse[GetDeviceResponse]
@@ -5195,7 +5171,7 @@ client.devices.get(
## Disputes -
client.disputes.list(...) +
client.disputes.list(...) -> AsyncPager[Dispute, ListDisputesResponse]
@@ -5295,7 +5271,7 @@ If not specified, the endpoint returns disputes associated with all locations.
-
client.disputes.get(...) +
client.disputes.get(...) -> AsyncHttpResponse[GetDisputeResponse]
@@ -5365,7 +5341,7 @@ client.disputes.get(
-
client.disputes.accept(...) +
client.disputes.accept(...) -> AsyncHttpResponse[AcceptDisputeResponse]
@@ -5439,7 +5415,7 @@ client.disputes.accept(
-
client.disputes.create_evidence_file(...) +
client.disputes.create_evidence_file(...) -> AsyncHttpResponse[CreateDisputeEvidenceFileResponse]
@@ -5528,7 +5504,7 @@ typing.Optional[core.File]` — See core.File for more documentation
-
client.disputes.create_evidence_text(...) +
client.disputes.create_evidence_text(...) -> AsyncHttpResponse[CreateDisputeEvidenceTextResponse]
@@ -5628,7 +5604,7 @@ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
-
client.disputes.submit_evidence(...) +
client.disputes.submit_evidence(...) -> AsyncHttpResponse[SubmitEvidenceResponse]
@@ -5705,7 +5681,7 @@ client.disputes.submit_evidence(
## Employees -
client.employees.list(...) +
client.employees.list(...) -> AsyncPager[Employee, ListEmployeesResponse]
@@ -5807,7 +5783,7 @@ for page in response.iter_pages():
-
client.employees.get(...) +
client.employees.get(...) -> AsyncHttpResponse[GetEmployeeResponse]
@@ -5878,7 +5854,7 @@ client.employees.get(
## Events -
client.events.search_events(...) +
client.events.search_events(...) -> AsyncHttpResponse[SearchEventsResponse]
@@ -5972,7 +5948,7 @@ Default: 100
-
client.events.disable_events() +
client.events.disable_events() -> AsyncHttpResponse[DisableEventsResponse]
@@ -6034,7 +6010,7 @@ client.events.disable_events()
-
client.events.enable_events() +
client.events.enable_events() -> AsyncHttpResponse[EnableEventsResponse]
@@ -6094,7 +6070,7 @@ client.events.enable_events()
-
client.events.list_event_types(...) +
client.events.list_event_types(...) -> AsyncHttpResponse[ListEventTypesResponse]
@@ -6165,7 +6141,7 @@ client.events.list_event_types(
## GiftCards -
client.gift_cards.list(...) +
client.gift_cards.list(...) -> AsyncPager[GiftCard, ListGiftCardsResponse]
@@ -6292,7 +6268,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/worki
-
client.gift_cards.create(...) +
client.gift_cards.create(...) -> AsyncHttpResponse[CreateGiftCardResponse]
@@ -6407,7 +6383,7 @@ include `gan` and provide the GAN that is printed on the gift card.
-
client.gift_cards.get_from_gan(...) +
client.gift_cards.get_from_gan(...) -> AsyncHttpResponse[GetGiftCardFromGanResponse]
@@ -6481,7 +6457,7 @@ Square-issued gift cards have 16-digit GANs.
-
client.gift_cards.get_from_nonce(...) +
client.gift_cards.get_from_nonce(...) -> AsyncHttpResponse[GetGiftCardFromNonceResponse]
@@ -6554,7 +6530,7 @@ Web Payments SDK or In-App Payments SDK.
-
client.gift_cards.link_customer(...) +
client.gift_cards.link_customer(...) -> AsyncHttpResponse[LinkCustomerToGiftCardResponse]
@@ -6633,7 +6609,7 @@ client.gift_cards.link_customer(
-
client.gift_cards.unlink_customer(...) +
client.gift_cards.unlink_customer(...) -> AsyncHttpResponse[UnlinkCustomerFromGiftCardResponse]
@@ -6712,7 +6688,7 @@ client.gift_cards.unlink_customer(
-
client.gift_cards.get(...) +
client.gift_cards.get(...) -> AsyncHttpResponse[GetGiftCardResponse]
@@ -6783,7 +6759,7 @@ client.gift_cards.get(
## Inventory -
client.inventory.deprecated_get_adjustment(...) +
client.inventory.deprecated_get_adjustment(...) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]
@@ -6854,7 +6830,7 @@ client.inventory.deprecated_get_adjustment(
-
client.inventory.get_adjustment(...) +
client.inventory.get_adjustment(...) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]
@@ -6925,7 +6901,7 @@ client.inventory.get_adjustment(
-
client.inventory.deprecated_batch_change(...) +
client.inventory.deprecated_batch_change(...) -> AsyncHttpResponse[BatchChangeInventoryResponse]
@@ -7041,7 +7017,7 @@ the quantity is unchanged since the last physical count. Default: `true`.
-
client.inventory.deprecated_batch_get_changes(...) +
client.inventory.deprecated_batch_get_changes(...) -> AsyncHttpResponse[BatchGetInventoryChangesResponse]
@@ -7199,7 +7175,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.inventory.deprecated_batch_get_counts(...) +
client.inventory.deprecated_batch_get_counts(...) -> AsyncHttpResponse[BatchGetInventoryCountsResponse]
@@ -7331,7 +7307,7 @@ The default is null.
-
client.inventory.batch_create_changes(...) +
client.inventory.batch_create_changes(...) -> AsyncHttpResponse[BatchChangeInventoryResponse]
@@ -7450,7 +7426,7 @@ the quantity is unchanged since the last physical count. Default: `true`.
-
client.inventory.batch_get_changes(...) +
client.inventory.batch_get_changes(...) -> AsyncPager[InventoryChange, BatchGetInventoryChangesResponse]
@@ -7619,7 +7595,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.inventory.batch_get_counts(...) +
client.inventory.batch_get_counts(...) -> AsyncPager[InventoryCount, BatchGetInventoryCountsResponse]
@@ -7765,7 +7741,7 @@ The default is null.
-
client.inventory.deprecated_get_physical_count(...) +
client.inventory.deprecated_get_physical_count(...) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]
@@ -7839,7 +7815,7 @@ ID of the
-
client.inventory.get_physical_count(...) +
client.inventory.get_physical_count(...) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]
@@ -7913,7 +7889,7 @@ ID of the
-
client.inventory.get_transfer(...) +
client.inventory.get_transfer(...) -> AsyncHttpResponse[GetInventoryTransferResponse]
@@ -7984,7 +7960,7 @@ client.inventory.get_transfer(
-
client.inventory.get(...) +
client.inventory.get(...) -> AsyncPager[InventoryCount, GetInventoryCountResponse]
@@ -8088,7 +8064,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.inventory.changes(...) +
client.inventory.changes(...) -> AsyncPager[InventoryChange, GetInventoryChangesResponse]
@@ -8202,7 +8178,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
## Invoices -
client.invoices.list(...) +
client.invoices.list(...) -> AsyncPager[Invoice, ListInvoicesResponse]
@@ -8305,7 +8281,7 @@ If not provided, the server uses a default limit of 100 invoices.
-
client.invoices.create(...) +
client.invoices.create(...) -> AsyncHttpResponse[CreateInvoiceResponse]
@@ -8438,7 +8414,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.invoices.search(...) +
client.invoices.search(...) -> AsyncHttpResponse[SearchInvoicesResponse]
@@ -8545,7 +8521,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.invoices.get(...) +
client.invoices.get(...) -> AsyncHttpResponse[GetInvoiceResponse]
@@ -8615,7 +8591,7 @@ client.invoices.get(
-
client.invoices.update(...) +
client.invoices.update(...) -> AsyncHttpResponse[UpdateInvoiceResponse]
@@ -8737,7 +8713,7 @@ recommend using null values or the `remove` field when possible. For examples, s
-
client.invoices.delete(...) +
client.invoices.delete(...) -> AsyncHttpResponse[DeleteInvoiceResponse]
@@ -8822,7 +8798,7 @@ If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-
-
client.invoices.create_invoice_attachment(...) +
client.invoices.create_invoice_attachment(...) -> AsyncHttpResponse[CreateInvoiceAttachmentResponse]
@@ -8917,7 +8893,7 @@ typing.Optional[core.File]` — See core.File for more documentation
-
client.invoices.delete_invoice_attachment(...) +
client.invoices.delete_invoice_attachment(...) -> AsyncHttpResponse[DeleteInvoiceAttachmentResponse]
@@ -8997,7 +8973,7 @@ client.invoices.delete_invoice_attachment(
-
client.invoices.cancel(...) +
client.invoices.cancel(...) -> AsyncHttpResponse[CancelInvoiceResponse]
@@ -9083,7 +9059,7 @@ If you do not know the version, you can call
-
client.invoices.publish(...) +
client.invoices.publish(...) -> AsyncHttpResponse[PublishInvoiceResponse]
@@ -9194,7 +9170,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
## Labor -
client.labor.create_scheduled_shift(...) +
client.labor.create_scheduled_shift(...) -> AsyncHttpResponse[CreateScheduledShiftResponse]
@@ -9302,7 +9278,7 @@ of the operation.
-
client.labor.bulk_publish_scheduled_shifts(...) +
client.labor.bulk_publish_scheduled_shifts(...) -> AsyncHttpResponse[BulkPublishScheduledShiftsResponse]
@@ -9397,7 +9373,7 @@ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudienc
-
client.labor.search_scheduled_shifts(...) +
client.labor.search_scheduled_shifts(...) -> AsyncHttpResponse[SearchScheduledShiftsResponse]
@@ -9493,7 +9469,7 @@ information, see [Pagination](https://developer.squareup.com/docs/build-basics/c
-
client.labor.retrieve_scheduled_shift(...) +
client.labor.retrieve_scheduled_shift(...) -> AsyncHttpResponse[RetrieveScheduledShiftResponse]
@@ -9563,7 +9539,7 @@ client.labor.retrieve_scheduled_shift(
-
client.labor.update_scheduled_shift(...) +
client.labor.update_scheduled_shift(...) -> AsyncHttpResponse[UpdateScheduledShiftResponse]
@@ -9676,7 +9652,7 @@ omitted, Square executes a blind write, potentially overwriting data from anothe
-
client.labor.publish_scheduled_shift(...) +
client.labor.publish_scheduled_shift(...) -> AsyncHttpResponse[PublishScheduledShiftResponse]
@@ -9786,7 +9762,7 @@ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudienc
-
client.labor.create_timecard(...) +
client.labor.create_timecard(...) -> AsyncHttpResponse[CreateTimecardResponse]
@@ -9903,7 +9879,7 @@ client.labor.create_timecard(
-
client.labor.search_timecards(...) +
client.labor.search_timecards(...) -> AsyncHttpResponse[SearchTimecardsResponse]
@@ -10014,7 +9990,7 @@ client.labor.search_timecards(
-
client.labor.retrieve_timecard(...) +
client.labor.retrieve_timecard(...) -> AsyncHttpResponse[RetrieveTimecardResponse]
@@ -10084,7 +10060,7 @@ client.labor.retrieve_timecard(
-
client.labor.update_timecard(...) +
client.labor.update_timecard(...) -> AsyncHttpResponse[UpdateTimecardResponse]
@@ -10193,7 +10169,7 @@ client.labor.update_timecard(
-
client.labor.delete_timecard(...) +
client.labor.delete_timecard(...) -> AsyncHttpResponse[DeleteTimecardResponse]
@@ -10264,7 +10240,7 @@ client.labor.delete_timecard(
## Locations -
client.locations.list() +
client.locations.list() -> AsyncHttpResponse[ListLocationsResponse]
@@ -10325,7 +10301,7 @@ client.locations.list()
-
client.locations.create(...) +
client.locations.create(...) -> AsyncHttpResponse[CreateLocationResponse]
@@ -10414,7 +10390,7 @@ The remaining fields are automatically added based on the data from the [main lo
-
client.locations.get(...) +
client.locations.get(...) -> AsyncHttpResponse[GetLocationResponse]
@@ -10488,7 +10464,7 @@ The ID of the location to retrieve. Specify the string
-
client.locations.update(...) +
client.locations.update(...) -> AsyncHttpResponse[UpdateLocationResponse]
@@ -10588,7 +10564,7 @@ client.locations.update(
-
client.locations.checkouts(...) +
client.locations.checkouts(...) -> AsyncHttpResponse[CreateCheckoutResponse]
@@ -10870,7 +10846,7 @@ This value cannot exceed 60 characters.
## Loyalty -
client.loyalty.search_events(...) +
client.loyalty.search_events(...) -> AsyncHttpResponse[SearchLoyaltyEventsResponse]
@@ -10982,7 +10958,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
## Merchants -
client.merchants.list(...) +
client.merchants.list(...) -> AsyncPager[Merchant, ListMerchantsResponse]
@@ -11066,7 +11042,7 @@ for page in response.iter_pages():
-
client.merchants.get(...) +
client.merchants.get(...) -> AsyncHttpResponse[GetMerchantResponse]
@@ -11140,7 +11116,7 @@ then retrieve the merchant that is currently accessible to this call.
## Checkout -
client.checkout.retrieve_location_settings(...) +
client.checkout.retrieve_location_settings(...) -> AsyncHttpResponse[RetrieveLocationSettingsResponse]
@@ -11210,7 +11186,7 @@ client.checkout.retrieve_location_settings(
-
client.checkout.update_location_settings(...) +
client.checkout.update_location_settings(...) -> AsyncHttpResponse[UpdateLocationSettingsResponse]
@@ -11289,7 +11265,7 @@ client.checkout.update_location_settings(
-
client.checkout.retrieve_merchant_settings() +
client.checkout.retrieve_merchant_settings() -> AsyncHttpResponse[RetrieveMerchantSettingsResponse]
@@ -11349,7 +11325,7 @@ client.checkout.retrieve_merchant_settings()
-
client.checkout.update_merchant_settings(...) +
client.checkout.update_merchant_settings(...) -> AsyncHttpResponse[UpdateMerchantSettingsResponse]
@@ -11420,7 +11396,7 @@ client.checkout.update_merchant_settings(
## Orders -
client.orders.create(...) +
client.orders.create(...) -> AsyncHttpResponse[CreateOrderResponse]
@@ -11562,7 +11538,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.batch_get(...) +
client.orders.batch_get(...) -> AsyncHttpResponse[BatchGetOrdersResponse]
@@ -11646,7 +11622,7 @@ orders within the scope of the current authorization's merchant ID.
-
client.orders.calculate(...) +
client.orders.calculate(...) -> AsyncHttpResponse[CalculateOrderResponse]
@@ -11747,7 +11723,7 @@ random strings used only to reference the reward tier.
-
client.orders.clone(...) +
client.orders.clone(...) -> AsyncHttpResponse[CloneOrderResponse]
@@ -11850,7 +11826,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.search(...) +
client.orders.search(...) -> AsyncHttpResponse[SearchOrdersResponse]
@@ -12005,7 +11981,7 @@ Default: `false`.
-
client.orders.get(...) +
client.orders.get(...) -> AsyncHttpResponse[GetOrderResponse]
@@ -12075,7 +12051,7 @@ client.orders.get(
-
client.orders.update(...) +
client.orders.update(...) -> AsyncHttpResponse[UpdateOrderResponse]
@@ -12214,7 +12190,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.pay(...) +
client.orders.pay(...) -> AsyncHttpResponse[PayOrderResponse]
@@ -12333,7 +12309,7 @@ The payment total must match the order total.
## Payments -
client.payments.list(...) +
client.payments.list(...) -> AsyncPager[Payment, ListPaymentsResponse]
@@ -12588,7 +12564,7 @@ range is determined using the `updated_at` field for each Payment.
-
client.payments.create(...) +
client.payments.create(...) -> AsyncHttpResponse[CreatePaymentResponse]
@@ -12996,7 +12972,7 @@ internal 1st-party callers only.
-
client.payments.cancel_by_idempotency_key(...) +
client.payments.cancel_by_idempotency_key(...) -> AsyncHttpResponse[CancelPaymentByIdempotencyKeyResponse]
@@ -13076,7 +13052,7 @@ client.payments.cancel_by_idempotency_key(
-
client.payments.get(...) +
client.payments.get(...) -> AsyncHttpResponse[GetPaymentResponse]
@@ -13146,7 +13122,7 @@ client.payments.get(
-
client.payments.update(...) +
client.payments.update(...) -> AsyncHttpResponse[UpdatePaymentResponse]
@@ -13244,7 +13220,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.payments.cancel(...) +
client.payments.cancel(...) -> AsyncHttpResponse[CancelPaymentResponse]
@@ -13315,7 +13291,7 @@ client.payments.cancel(
-
client.payments.complete(...) +
client.payments.complete(...) -> AsyncHttpResponse[CompletePaymentResponse]
@@ -13401,7 +13377,7 @@ the update fails and a response with a VERSION_MISMATCH error is returned.
## Payouts -
client.payouts.list(...) +
client.payouts.list(...) -> AsyncPager[Payout, ListPayoutsResponse]
@@ -13552,7 +13528,7 @@ Default: `100`
-
client.payouts.get(...) +
client.payouts.get(...) -> AsyncHttpResponse[GetPayoutResponse]
@@ -13623,7 +13599,7 @@ client.payouts.get(
-
client.payouts.list_entries(...) +
client.payouts.list_entries(...) -> AsyncPager[PayoutEntry, ListPayoutEntriesResponse]
@@ -13738,7 +13714,7 @@ Default: `100`
## Refunds -
client.refunds.list(...) +
client.refunds.list(...) -> AsyncPager[PaymentRefund, ListPaymentRefundsResponse]
@@ -13960,7 +13936,7 @@ Default: The current time.
-
client.refunds.refund_payment(...) +
client.refunds.refund_payment(...) -> AsyncHttpResponse[RefundPaymentResponse]
@@ -14197,7 +14173,7 @@ Additional details required when recording an unlinked external refund
-
client.refunds.get(...) +
client.refunds.get(...) -> AsyncHttpResponse[GetPaymentRefundResponse]
@@ -14268,7 +14244,7 @@ client.refunds.get(
## Sites -
client.sites.list() +
client.sites.list() -> AsyncHttpResponse[ListSitesResponse]
@@ -14332,7 +14308,7 @@ client.sites.list()
## Snippets -
client.snippets.get(...) +
client.snippets.get(...) -> AsyncHttpResponse[GetSnippetResponse]
@@ -14407,7 +14383,7 @@ client.snippets.get(
-
client.snippets.upsert(...) +
client.snippets.upsert(...) -> AsyncHttpResponse[UpsertSnippetResponse]
@@ -14492,7 +14468,7 @@ client.snippets.upsert(
-
client.snippets.delete(...) +
client.snippets.delete(...) -> AsyncHttpResponse[DeleteSnippetResponse]
@@ -14568,7 +14544,7 @@ client.snippets.delete(
## Subscriptions -
client.subscriptions.create(...) +
client.subscriptions.create(...) -> AsyncHttpResponse[CreateSubscriptionResponse]
@@ -14787,7 +14763,7 @@ a list of time zones, see [List of tz database time zones](https://en.wikipedia.
-
client.subscriptions.bulk_swap_plan(...) +
client.subscriptions.bulk_swap_plan(...) -> AsyncHttpResponse[BulkSwapPlanResponse]
@@ -14884,7 +14860,7 @@ day.
-
client.subscriptions.search(...) +
client.subscriptions.search(...) -> AsyncHttpResponse[SearchSubscriptionsResponse]
@@ -15016,7 +14992,7 @@ The supported values are:
-
client.subscriptions.get(...) +
client.subscriptions.get(...) -> AsyncHttpResponse[GetSubscriptionResponse]
@@ -15101,7 +15077,7 @@ The supported query parameter values are:
-
client.subscriptions.update(...) +
client.subscriptions.update(...) -> AsyncHttpResponse[UpdateSubscriptionResponse]
@@ -15185,7 +15161,7 @@ be treated as a request to clear the relevant data.
-
client.subscriptions.delete_action(...) +
client.subscriptions.delete_action(...) -> AsyncHttpResponse[DeleteSubscriptionActionResponse]
@@ -15264,7 +15240,7 @@ client.subscriptions.delete_action(
-
client.subscriptions.change_billing_anchor_date(...) +
client.subscriptions.change_billing_anchor_date(...) -> AsyncHttpResponse[ChangeBillingAnchorDateResponse]
@@ -15358,7 +15334,7 @@ is changed immediately.
-
client.subscriptions.cancel(...) +
client.subscriptions.cancel(...) -> AsyncHttpResponse[CancelSubscriptionResponse]
@@ -15430,7 +15406,7 @@ client.subscriptions.cancel(
-
client.subscriptions.list_events(...) +
client.subscriptions.list_events(...) -> AsyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]
@@ -15532,7 +15508,7 @@ in a paged response.
-
client.subscriptions.pause(...) +
client.subscriptions.pause(...) -> AsyncHttpResponse[PauseSubscriptionResponse]
@@ -15660,7 +15636,7 @@ See [ChangeTiming](#type-changetiming) for possible values
-
client.subscriptions.resume(...) +
client.subscriptions.resume(...) -> AsyncHttpResponse[ResumeSubscriptionResponse]
@@ -15750,7 +15726,7 @@ See [ChangeTiming](#type-changetiming) for possible values
-
client.subscriptions.swap_plan(...) +
client.subscriptions.swap_plan(...) -> AsyncHttpResponse[SwapPlanResponse]
@@ -15846,7 +15822,7 @@ This field is required.
## TeamMembers -
client.team_members.create(...) +
client.team_members.create(...) -> AsyncHttpResponse[CreateTeamMemberResponse]
@@ -15966,7 +15942,7 @@ The minimum length is 1 and the maximum length is 45.
-
client.team_members.batch_create(...) +
client.team_members.batch_create(...) -> AsyncHttpResponse[BatchCreateTeamMembersResponse]
@@ -16073,7 +16049,7 @@ call [ListJobs](api-endpoint:Team-ListJobs).
-
client.team_members.batch_update(...) +
client.team_members.batch_update(...) -> AsyncHttpResponse[BatchUpdateTeamMembersResponse]
@@ -16184,7 +16160,7 @@ call [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
-
client.team_members.search(...) +
client.team_members.search(...) -> AsyncHttpResponse[SearchTeamMembersResponse]
@@ -16276,7 +16252,7 @@ The opaque cursor for fetching the next page. For more information, see
-
client.team_members.get(...) +
client.team_members.get(...) -> AsyncHttpResponse[GetTeamMemberResponse]
@@ -16347,7 +16323,7 @@ client.team_members.get(
-
client.team_members.update(...) +
client.team_members.update(...) -> AsyncHttpResponse[UpdateTeamMemberResponse]
@@ -16459,7 +16435,7 @@ The team member fields to add, change, or clear. Fields can be cleared using a n
## Team -
client.team.list_jobs(...) +
client.team.list_jobs(...) -> AsyncHttpResponse[ListJobsResponse]
@@ -16533,7 +16509,7 @@ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-pat
-
client.team.create_job(...) +
client.team.create_job(...) -> AsyncHttpResponse[CreateJobResponse]
@@ -16617,7 +16593,7 @@ but must be unique for each request. For more information, see
-
client.team.retrieve_job(...) +
client.team.retrieve_job(...) -> AsyncHttpResponse[RetrieveJobResponse]
@@ -16687,7 +16663,7 @@ client.team.retrieve_job(
-
client.team.update_job(...) +
client.team.update_job(...) -> AsyncHttpResponse[UpdateJobResponse]
@@ -16772,7 +16748,7 @@ to be included in the request. Optionally include `version` to enable optimistic
## Terminal -
client.terminal.dismiss_terminal_action(...) +
client.terminal.dismiss_terminal_action(...) -> AsyncHttpResponse[DismissTerminalActionResponse]
@@ -16844,7 +16820,7 @@ client.terminal.dismiss_terminal_action(
-
client.terminal.dismiss_terminal_checkout(...) +
client.terminal.dismiss_terminal_checkout(...) -> AsyncHttpResponse[DismissTerminalCheckoutResponse]
@@ -16914,7 +16890,7 @@ client.terminal.dismiss_terminal_checkout(
-
client.terminal.dismiss_terminal_refund(...) +
client.terminal.dismiss_terminal_refund(...) -> AsyncHttpResponse[DismissTerminalRefundResponse]
@@ -16985,7 +16961,7 @@ client.terminal.dismiss_terminal_refund(
## TransferOrders -
client.transfer_orders.create(...) +
client.transfer_orders.create(...) -> AsyncHttpResponse[CreateTransferOrderResponse]
@@ -17103,7 +17079,7 @@ any valid string but must be unique for every CreateTransferOrder request.
-
client.transfer_orders.search(...) +
client.transfer_orders.search(...) -> AsyncPager[TransferOrder, SearchTransferOrdersResponse]
@@ -17209,7 +17185,7 @@ for page in response.iter_pages():
-
client.transfer_orders.get(...) +
client.transfer_orders.get(...) -> AsyncHttpResponse[RetrieveTransferOrderResponse]
@@ -17285,7 +17261,7 @@ client.transfer_orders.get(
-
client.transfer_orders.update(...) +
client.transfer_orders.update(...) -> AsyncHttpResponse[UpdateTransferOrderResponse]
@@ -17399,7 +17375,7 @@ client.transfer_orders.update(
-
client.transfer_orders.delete(...) +
client.transfer_orders.delete(...) -> AsyncHttpResponse[DeleteTransferOrderResponse]
@@ -17482,7 +17458,7 @@ client.transfer_orders.delete(
-
client.transfer_orders.cancel(...) +
client.transfer_orders.cancel(...) -> AsyncHttpResponse[CancelTransferOrderResponse]
@@ -17582,7 +17558,7 @@ any valid string but must be unique for every UpdateTransferOrder request.
-
client.transfer_orders.receive(...) +
client.transfer_orders.receive(...) -> AsyncHttpResponse[ReceiveTransferOrderResponse]
@@ -17708,7 +17684,7 @@ client.transfer_orders.receive(
-
client.transfer_orders.start(...) +
client.transfer_orders.start(...) -> AsyncHttpResponse[StartTransferOrderResponse]
@@ -17807,7 +17783,7 @@ any valid string but must be unique for every UpdateTransferOrder request.
## Vendors -
client.vendors.batch_create(...) +
client.vendors.batch_create(...) -> AsyncHttpResponse[BatchCreateVendorsResponse]
@@ -17899,7 +17875,7 @@ client.vendors.batch_create(
-
client.vendors.batch_get(...) +
client.vendors.batch_get(...) -> AsyncHttpResponse[BatchGetVendorsResponse]
@@ -17969,7 +17945,7 @@ client.vendors.batch_get(
-
client.vendors.batch_update(...) +
client.vendors.batch_update(...) -> AsyncHttpResponse[BatchUpdateVendorsResponse]
@@ -18045,7 +18021,7 @@ objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorReq
-
client.vendors.create(...) +
client.vendors.create(...) -> AsyncHttpResponse[CreateVendorResponse]
@@ -18150,7 +18126,7 @@ information.
-
client.vendors.search(...) +
client.vendors.search(...) -> AsyncHttpResponse[SearchVendorsResponse]
@@ -18239,7 +18215,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.vendors.get(...) +
client.vendors.get(...) -> AsyncHttpResponse[GetVendorResponse]
@@ -18309,7 +18285,7 @@ client.vendors.get(
-
client.vendors.update(...) +
client.vendors.update(...) -> AsyncHttpResponse[UpdateVendorResponse]
@@ -18410,7 +18386,9 @@ information.
## Bookings CustomAttributeDefinitions -
client.bookings.custom_attribute_definitions.list(...) +
client.bookings.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListBookingCustomAttributeDefinitionsResponse +]
@@ -18505,7 +18483,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.bookings.custom_attribute_definitions.create(...) +
client.bookings.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateBookingCustomAttributeDefinitionResponse]
@@ -18608,7 +18586,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.bookings.custom_attribute_definitions.get(...) +
client.bookings.custom_attribute_definitions.get(...) -> AsyncHttpResponse[RetrieveBookingCustomAttributeDefinitionResponse]
@@ -18698,7 +18676,7 @@ is higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.bookings.custom_attribute_definitions.update(...) +
client.bookings.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateBookingCustomAttributeDefinitionResponse]
@@ -18807,7 +18785,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.bookings.custom_attribute_definitions.delete(...) +
client.bookings.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteBookingCustomAttributeDefinitionResponse]
@@ -18884,7 +18862,7 @@ client.bookings.custom_attribute_definitions.delete(
## Bookings CustomAttributes -
client.bookings.custom_attributes.batch_delete(...) +
client.bookings.custom_attributes.batch_delete(...) -> AsyncHttpResponse[BulkDeleteBookingCustomAttributesResponse]
@@ -18964,7 +18942,7 @@ information needed to delete a custom attribute.
-
client.bookings.custom_attributes.batch_upsert(...) +
client.bookings.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertBookingCustomAttributesResponse]
@@ -19044,7 +19022,7 @@ information needed to create or update a custom attribute.
-
client.bookings.custom_attributes.list(...) +
client.bookings.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListBookingCustomAttributesResponse]
@@ -19161,7 +19139,7 @@ attribute, information about the data type, or other definition details. The def
-
client.bookings.custom_attributes.get(...) +
client.bookings.custom_attributes.get(...) -> AsyncHttpResponse[RetrieveBookingCustomAttributeResponse]
@@ -19274,7 +19252,7 @@ higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.bookings.custom_attributes.upsert(...) +
client.bookings.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertBookingCustomAttributeResponse]
@@ -19392,7 +19370,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.bookings.custom_attributes.delete(...) +
client.bookings.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteBookingCustomAttributeResponse]
@@ -19482,7 +19460,7 @@ definition owner, you must use the qualified key.
## Bookings LocationProfiles -
client.bookings.location_profiles.list(...) +
client.bookings.location_profiles.list(...) -> AsyncPager[LocationBookingProfile, ListLocationBookingProfilesResponse]
@@ -19567,7 +19545,7 @@ for page in response.iter_pages():
## Bookings TeamMemberProfiles -
client.bookings.team_member_profiles.list(...) +
client.bookings.team_member_profiles.list(...) -> AsyncPager[TeamMemberBookingProfile, ListTeamMemberBookingProfilesResponse]
@@ -19669,7 +19647,7 @@ for page in response.iter_pages():
-
client.bookings.team_member_profiles.get(...) +
client.bookings.team_member_profiles.get(...) -> AsyncHttpResponse[GetTeamMemberBookingProfileResponse]
@@ -19740,7 +19718,7 @@ client.bookings.team_member_profiles.get(
## CashDrawers Shifts -
client.cash_drawers.shifts.list(...) +
client.cash_drawers.shifts.list(...) -> AsyncPager[CashDrawerShiftSummary, ListCashDrawerShiftsResponse]
@@ -19867,7 +19845,7 @@ default, 1000 max).
-
client.cash_drawers.shifts.get(...) +
client.cash_drawers.shifts.get(...) -> AsyncHttpResponse[GetCashDrawerShiftResponse]
@@ -19947,7 +19925,7 @@ client.cash_drawers.shifts.get(
-
client.cash_drawers.shifts.list_events(...) +
client.cash_drawers.shifts.list_events(...) -> AsyncPager[CashDrawerShiftEvent, ListCashDrawerShiftEventsResponse]
@@ -20053,7 +20031,7 @@ default, 1000 max).
## Catalog Images -
client.catalog.images.create(...) +
client.catalog.images.create(...) -> AsyncHttpResponse[CreateCatalogImageResponse]
@@ -20136,7 +20114,7 @@ typing.Optional[core.File]` — See core.File for more documentation
-
client.catalog.images.update(...) +
client.catalog.images.update(...) -> AsyncHttpResponse[UpdateCatalogImageResponse]
@@ -20228,7 +20206,7 @@ typing.Optional[core.File]` — See core.File for more documentation
## Catalog Object -
client.catalog.object.upsert(...) +
client.catalog.object.upsert(...) -> AsyncHttpResponse[UpsertCatalogObjectResponse]
@@ -20266,7 +20244,7 @@ client = Square( ) client.catalog.object.upsert( idempotency_key="af3d1afc-7212-4300-b463-0bfc5314a5ae", - object={"type": "IMAGE", "id": "#Cocoa"}, + object={"id": "id", "type": "ITEM"}, ) ``` @@ -20327,7 +20305,7 @@ A CatalogObject to be created or updated.
-
client.catalog.object.get(...) +
client.catalog.object.get(...) -> AsyncHttpResponse[GetCatalogObjectResponse]
@@ -20455,7 +20433,7 @@ in the response payload.
-
client.catalog.object.delete(...) +
client.catalog.object.delete(...) -> AsyncHttpResponse[DeleteCatalogObjectResponse]
@@ -20539,7 +20517,7 @@ catalog item will delete its catalog item variations).
## Checkout PaymentLinks -
client.checkout.payment_links.list(...) +
client.checkout.payment_links.list(...) -> AsyncPager[PaymentLink, ListPaymentLinksResponse]
@@ -20634,7 +20612,7 @@ Default value: `100`
-
client.checkout.payment_links.create(...) +
client.checkout.payment_links.create(...) -> AsyncHttpResponse[CreatePaymentLinkResponse]
@@ -20781,7 +20759,7 @@ For more information, see [Prepopulate the shipping address](https://developer.s
-
client.checkout.payment_links.get(...) +
client.checkout.payment_links.get(...) -> AsyncHttpResponse[GetPaymentLinkResponse]
@@ -20851,7 +20829,7 @@ client.checkout.payment_links.get(
-
client.checkout.payment_links.update(...) +
client.checkout.payment_links.update(...) -> AsyncHttpResponse[UpdatePaymentLinkResponse]
@@ -20938,7 +20916,7 @@ For more information, see [Update a payment link](https://developer.squareup.com
-
client.checkout.payment_links.delete(...) +
client.checkout.payment_links.delete(...) -> AsyncHttpResponse[DeletePaymentLinkResponse]
@@ -21009,7 +20987,9 @@ client.checkout.payment_links.delete(
## Customers CustomAttributeDefinitions -
client.customers.custom_attribute_definitions.list(...) +
client.customers.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse +]
@@ -21106,7 +21086,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.customers.custom_attribute_definitions.create(...) +
client.customers.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateCustomerCustomAttributeDefinitionResponse]
@@ -21212,7 +21192,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.customers.custom_attribute_definitions.get(...) +
client.customers.custom_attribute_definitions.get(...) -> AsyncHttpResponse[GetCustomerCustomAttributeDefinitionResponse]
@@ -21303,7 +21283,7 @@ is higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.customers.custom_attribute_definitions.update(...) +
client.customers.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateCustomerCustomAttributeDefinitionResponse]
@@ -21418,7 +21398,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.customers.custom_attribute_definitions.delete(...) +
client.customers.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteCustomerCustomAttributeDefinitionResponse]
@@ -21493,7 +21473,7 @@ client.customers.custom_attribute_definitions.delete(
-
client.customers.custom_attribute_definitions.batch_upsert(...) +
client.customers.custom_attribute_definitions.batch_upsert(...) -> AsyncHttpResponse[BatchUpsertCustomerCustomAttributesResponse]
@@ -21611,7 +21591,7 @@ information needed to create or update a custom attribute.
## Customers Groups -
client.customers.groups.list(...) +
client.customers.groups.list(...) -> AsyncPager[CustomerGroup, ListCustomerGroupsResponse]
@@ -21705,7 +21685,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.customers.groups.create(...) +
client.customers.groups.create(...) -> AsyncHttpResponse[CreateCustomerGroupResponse]
@@ -21785,7 +21765,7 @@ client.customers.groups.create(
-
client.customers.groups.get(...) +
client.customers.groups.get(...) -> AsyncHttpResponse[GetCustomerGroupResponse]
@@ -21855,7 +21835,7 @@ client.customers.groups.get(
-
client.customers.groups.update(...) +
client.customers.groups.update(...) -> AsyncHttpResponse[UpdateCustomerGroupResponse]
@@ -21934,7 +21914,7 @@ client.customers.groups.update(
-
client.customers.groups.delete(...) +
client.customers.groups.delete(...) -> AsyncHttpResponse[DeleteCustomerGroupResponse]
@@ -22004,7 +21984,7 @@ client.customers.groups.delete(
-
client.customers.groups.add(...) +
client.customers.groups.add(...) -> AsyncHttpResponse[AddGroupToCustomerResponse]
@@ -22086,7 +22066,7 @@ client.customers.groups.add(
-
client.customers.groups.remove(...) +
client.customers.groups.remove(...) -> AsyncHttpResponse[RemoveGroupFromCustomerResponse]
@@ -22169,7 +22149,7 @@ client.customers.groups.remove(
## Customers Segments -
client.customers.segments.list(...) +
client.customers.segments.list(...) -> AsyncPager[CustomerSegment, ListCustomerSegmentsResponse]
@@ -22263,7 +22243,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.customers.segments.get(...) +
client.customers.segments.get(...) -> AsyncHttpResponse[GetCustomerSegmentResponse]
@@ -22334,7 +22314,7 @@ client.customers.segments.get(
## Customers Cards -
client.customers.cards.create(...) +
client.customers.cards.create(...) -> AsyncHttpResponse[CreateCustomerCardResponse]
@@ -22469,7 +22449,7 @@ challenge results to indicate that Square has verified the buyer identity.
-
client.customers.cards.delete(...) +
client.customers.cards.delete(...) -> AsyncHttpResponse[DeleteCustomerCardResponse]
@@ -22549,7 +22529,7 @@ client.customers.cards.delete(
## Customers CustomAttributes -
client.customers.custom_attributes.list(...) +
client.customers.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]
@@ -22670,7 +22650,7 @@ attribute, information about the data type, or other definition details. The def
-
client.customers.custom_attributes.get(...) +
client.customers.custom_attributes.get(...) -> AsyncHttpResponse[GetCustomerCustomAttributeResponse]
@@ -22787,7 +22767,7 @@ higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.customers.custom_attributes.upsert(...) +
client.customers.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertCustomerCustomAttributeResponse]
@@ -22907,7 +22887,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.customers.custom_attributes.delete(...) +
client.customers.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteCustomerCustomAttributeResponse]
@@ -22995,7 +22975,7 @@ definition owner, you must use the qualified key.
## Devices Codes -
client.devices.codes.list(...) +
client.devices.codes.list(...) -> AsyncPager[DeviceCode, ListDeviceCodesResponse]
@@ -23110,7 +23090,7 @@ Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty.
-
client.devices.codes.create(...) +
client.devices.codes.create(...) -> AsyncHttpResponse[CreateDeviceCodeResponse]
@@ -23199,7 +23179,7 @@ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-a
-
client.devices.codes.get(...) +
client.devices.codes.get(...) -> AsyncHttpResponse[GetDeviceCodeResponse]
@@ -23270,7 +23250,7 @@ client.devices.codes.get(
## Disputes Evidence -
client.disputes.evidence.list(...) +
client.disputes.evidence.list(...) -> AsyncPager[DisputeEvidence, ListDisputeEvidenceResponse]
@@ -23358,7 +23338,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.disputes.evidence.get(...) +
client.disputes.evidence.get(...) -> AsyncHttpResponse[GetDisputeEvidenceResponse]
@@ -23439,7 +23419,7 @@ client.disputes.evidence.get(
-
client.disputes.evidence.delete(...) +
client.disputes.evidence.delete(...) -> AsyncHttpResponse[DeleteDisputeEvidenceResponse]
@@ -23520,7 +23500,7 @@ client.disputes.evidence.delete(
## GiftCards Activities -
client.gift_cards.activities.list(...) +
client.gift_cards.activities.list(...) -> AsyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]
@@ -23690,7 +23670,7 @@ The order in which the endpoint returns the activities, based on `created_at`.
-
client.gift_cards.activities.create(...) +
client.gift_cards.activities.create(...) -> AsyncHttpResponse[CreateGiftCardActivityResponse]
@@ -23782,7 +23762,7 @@ gift card, the `location_id` where the activity occurred, and the activity `type
## Labor BreakTypes -
client.labor.break_types.list(...) +
client.labor.break_types.list(...) -> AsyncPager[BreakType, ListBreakTypesResponse]
@@ -23881,7 +23861,7 @@ and 200. The default is 200.
-
client.labor.break_types.create(...) +
client.labor.break_types.create(...) -> AsyncHttpResponse[CreateBreakTypeResponse]
@@ -23978,7 +23958,7 @@ client.labor.break_types.create(
-
client.labor.break_types.get(...) +
client.labor.break_types.get(...) -> AsyncHttpResponse[GetBreakTypeResponse]
@@ -24048,7 +24028,7 @@ client.labor.break_types.get(
-
client.labor.break_types.update(...) +
client.labor.break_types.update(...) -> AsyncHttpResponse[UpdateBreakTypeResponse]
@@ -24133,7 +24113,7 @@ client.labor.break_types.update(
-
client.labor.break_types.delete(...) +
client.labor.break_types.delete(...) -> AsyncHttpResponse[DeleteBreakTypeResponse]
@@ -24206,7 +24186,7 @@ client.labor.break_types.delete(
## Labor EmployeeWages -
client.labor.employee_wages.list(...) +
client.labor.employee_wages.list(...) -> AsyncPager[EmployeeWage, ListEmployeeWagesResponse]
@@ -24302,7 +24282,7 @@ The maximum number of `EmployeeWage` results to return per page. The number can
-
client.labor.employee_wages.get(...) +
client.labor.employee_wages.get(...) -> AsyncHttpResponse[GetEmployeeWageResponse]
@@ -24373,7 +24353,7 @@ client.labor.employee_wages.get(
## Labor Shifts -
client.labor.shifts.create(...) +
client.labor.shifts.create(...) -> AsyncHttpResponse[CreateShiftResponse]
@@ -24490,7 +24470,7 @@ client.labor.shifts.create(
-
client.labor.shifts.search(...) +
client.labor.shifts.search(...) -> AsyncHttpResponse[SearchShiftsResponse]
@@ -24601,7 +24581,7 @@ client.labor.shifts.search(
-
client.labor.shifts.get(...) +
client.labor.shifts.get(...) -> AsyncHttpResponse[GetShiftResponse]
@@ -24671,7 +24651,7 @@ client.labor.shifts.get(
-
client.labor.shifts.update(...) +
client.labor.shifts.update(...) -> AsyncHttpResponse[UpdateShiftResponse]
@@ -24779,7 +24759,7 @@ client.labor.shifts.update(
-
client.labor.shifts.delete(...) +
client.labor.shifts.delete(...) -> AsyncHttpResponse[DeleteShiftResponse]
@@ -24850,7 +24830,7 @@ client.labor.shifts.delete(
## Labor TeamMemberWages -
client.labor.team_member_wages.list(...) +
client.labor.team_member_wages.list(...) -> AsyncPager[TeamMemberWage, ListTeamMemberWagesResponse]
@@ -24949,7 +24929,7 @@ The maximum number of `TeamMemberWage` results to return per page. The number ca
-
client.labor.team_member_wages.get(...) +
client.labor.team_member_wages.get(...) -> AsyncHttpResponse[GetTeamMemberWageResponse]
@@ -25020,7 +25000,7 @@ client.labor.team_member_wages.get(
## Labor WorkweekConfigs -
client.labor.workweek_configs.list(...) +
client.labor.workweek_configs.list(...) -> AsyncPager[WorkweekConfig, ListWorkweekConfigsResponse]
@@ -25104,7 +25084,7 @@ for page in response.iter_pages():
-
client.labor.workweek_configs.get(...) +
client.labor.workweek_configs.get(...) -> AsyncHttpResponse[UpdateWorkweekConfigResponse]
@@ -25188,7 +25168,9 @@ client.labor.workweek_configs.get(
## Locations CustomAttributeDefinitions -
client.locations.custom_attribute_definitions.list(...) +
client.locations.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse +]
@@ -25292,7 +25274,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.locations.custom_attribute_definitions.create(...) +
client.locations.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateLocationCustomAttributeDefinitionResponse]
@@ -25393,7 +25375,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.locations.custom_attribute_definitions.get(...) +
client.locations.custom_attribute_definitions.get(...) -> AsyncHttpResponse[RetrieveLocationCustomAttributeDefinitionResponse]
@@ -25482,7 +25464,7 @@ is higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.locations.custom_attribute_definitions.update(...) +
client.locations.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateLocationCustomAttributeDefinitionResponse]
@@ -25593,7 +25575,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.locations.custom_attribute_definitions.delete(...) +
client.locations.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteLocationCustomAttributeDefinitionResponse]
@@ -25667,7 +25649,7 @@ client.locations.custom_attribute_definitions.delete(
## Locations CustomAttributes -
client.locations.custom_attributes.batch_delete(...) +
client.locations.custom_attributes.batch_delete(...) -> AsyncHttpResponse[BulkDeleteLocationCustomAttributesResponse]
@@ -25749,7 +25731,7 @@ The keys must be unique and are used to map to the corresponding response.
-
client.locations.custom_attributes.batch_upsert(...) +
client.locations.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertLocationCustomAttributesResponse]
@@ -25854,7 +25836,7 @@ information needed to create or update a custom attribute.
-
client.locations.custom_attributes.list(...) +
client.locations.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListLocationCustomAttributesResponse]
@@ -25982,7 +25964,7 @@ attribute, information about the data type, or other definition details. The def
-
client.locations.custom_attributes.get(...) +
client.locations.custom_attributes.get(...) -> AsyncHttpResponse[RetrieveLocationCustomAttributeResponse]
@@ -26096,7 +26078,7 @@ higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.locations.custom_attributes.upsert(...) +
client.locations.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertLocationCustomAttributeResponse]
@@ -26211,7 +26193,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.locations.custom_attributes.delete(...) +
client.locations.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteLocationCustomAttributeResponse]
@@ -26297,7 +26279,7 @@ definition owner, you must use the qualified key.
## Locations Transactions -
client.locations.transactions.list(...) +
client.locations.transactions.list(...) -> AsyncHttpResponse[ListTransactionsResponse]
@@ -26430,7 +26412,7 @@ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/p
-
client.locations.transactions.get(...) +
client.locations.transactions.get(...) -> AsyncHttpResponse[GetTransactionResponse]
@@ -26509,7 +26491,7 @@ client.locations.transactions.get(
-
client.locations.transactions.capture(...) +
client.locations.transactions.capture(...) -> AsyncHttpResponse[CaptureTransactionResponse]
@@ -26593,7 +26575,7 @@ client.locations.transactions.capture(
-
client.locations.transactions.void(...) +
client.locations.transactions.void(...) -> AsyncHttpResponse[VoidTransactionResponse]
@@ -26678,7 +26660,7 @@ client.locations.transactions.void(
## Loyalty Accounts -
client.loyalty.accounts.create(...) +
client.loyalty.accounts.create(...) -> AsyncHttpResponse[CreateLoyaltyAccountResponse]
@@ -26763,7 +26745,7 @@ Keys can be any valid string, but must be unique for every request.
-
client.loyalty.accounts.search(...) +
client.loyalty.accounts.search(...) -> AsyncHttpResponse[SearchLoyaltyAccountsResponse]
@@ -26861,7 +26843,7 @@ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-pat
-
client.loyalty.accounts.get(...) +
client.loyalty.accounts.get(...) -> AsyncHttpResponse[GetLoyaltyAccountResponse]
@@ -26931,7 +26913,7 @@ client.loyalty.accounts.get(
-
client.loyalty.accounts.accumulate_points(...) +
client.loyalty.accounts.accumulate_points(...) -> AsyncHttpResponse[AccumulateLoyaltyPointsResponse]
@@ -27048,7 +27030,7 @@ Keys can be any valid string but must be unique for every request.
-
client.loyalty.accounts.adjust(...) +
client.loyalty.accounts.adjust(...) -> AsyncHttpResponse[AdjustLoyaltyPointsResponse]
@@ -27159,7 +27141,7 @@ the specified number of points would result in a negative balance. The default v
## Loyalty Programs -
client.loyalty.programs.list() +
client.loyalty.programs.list() -> AsyncHttpResponse[ListLoyaltyProgramsResponse]
@@ -27223,7 +27205,7 @@ client.loyalty.programs.list()
-
client.loyalty.programs.get(...) +
client.loyalty.programs.get(...) -> AsyncHttpResponse[GetLoyaltyProgramResponse]
@@ -27295,7 +27277,7 @@ client.loyalty.programs.get(
-
client.loyalty.programs.calculate(...) +
client.loyalty.programs.calculate(...) -> AsyncHttpResponse[CalculateLoyaltyPointsResponse]
@@ -27423,7 +27405,7 @@ for regardless of the trigger limit.
## Loyalty Rewards -
client.loyalty.rewards.create(...) +
client.loyalty.rewards.create(...) -> AsyncHttpResponse[CreateLoyaltyRewardResponse]
@@ -27516,7 +27498,7 @@ Keys can be any valid string, but must be unique for every request.
-
client.loyalty.rewards.search(...) +
client.loyalty.rewards.search(...) -> AsyncHttpResponse[SearchLoyaltyRewardsResponse]
@@ -27618,7 +27600,7 @@ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-pat
-
client.loyalty.rewards.get(...) +
client.loyalty.rewards.get(...) -> AsyncHttpResponse[GetLoyaltyRewardResponse]
@@ -27688,7 +27670,7 @@ client.loyalty.rewards.get(
-
client.loyalty.rewards.delete(...) +
client.loyalty.rewards.delete(...) -> AsyncHttpResponse[DeleteLoyaltyRewardResponse]
@@ -27766,7 +27748,7 @@ client.loyalty.rewards.delete(
-
client.loyalty.rewards.redeem(...) +
client.loyalty.rewards.redeem(...) -> AsyncHttpResponse[RedeemLoyaltyRewardResponse]
@@ -27868,7 +27850,7 @@ Keys can be any valid string, but must be unique for every request.
## Loyalty Programs Promotions -
client.loyalty.programs.promotions.list(...) +
client.loyalty.programs.promotions.list(...) -> AsyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]
@@ -27986,7 +27968,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.loyalty.programs.promotions.create(...) +
client.loyalty.programs.promotions.create(...) -> AsyncHttpResponse[CreateLoyaltyPromotionResponse]
@@ -28100,7 +28082,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.loyalty.programs.promotions.get(...) +
client.loyalty.programs.promotions.get(...) -> AsyncHttpResponse[GetLoyaltyPromotionResponse]
@@ -28182,7 +28164,7 @@ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using
-
client.loyalty.programs.promotions.cancel(...) +
client.loyalty.programs.promotions.cancel(...) -> AsyncHttpResponse[CancelLoyaltyPromotionResponse]
@@ -28270,7 +28252,9 @@ promotion that has an `ACTIVE` or `SCHEDULED` status.
## Merchants CustomAttributeDefinitions -
client.merchants.custom_attribute_definitions.list(...) +
client.merchants.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse +]
@@ -28374,7 +28358,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.merchants.custom_attribute_definitions.create(...) +
client.merchants.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateMerchantCustomAttributeDefinitionResponse]
@@ -28475,7 +28459,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.merchants.custom_attribute_definitions.get(...) +
client.merchants.custom_attribute_definitions.get(...) -> AsyncHttpResponse[RetrieveMerchantCustomAttributeDefinitionResponse]
@@ -28564,7 +28548,7 @@ is higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.merchants.custom_attribute_definitions.update(...) +
client.merchants.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateMerchantCustomAttributeDefinitionResponse]
@@ -28674,7 +28658,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.merchants.custom_attribute_definitions.delete(...) +
client.merchants.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteMerchantCustomAttributeDefinitionResponse]
@@ -28748,7 +28732,7 @@ client.merchants.custom_attribute_definitions.delete(
## Merchants CustomAttributes -
client.merchants.custom_attributes.batch_delete(...) +
client.merchants.custom_attributes.batch_delete(...) -> AsyncHttpResponse[BulkDeleteMerchantCustomAttributesResponse]
@@ -28829,7 +28813,7 @@ The keys must be unique and are used to map to the corresponding response.
-
client.merchants.custom_attributes.batch_upsert(...) +
client.merchants.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertMerchantCustomAttributesResponse]
@@ -28927,7 +28911,7 @@ information needed to create or update a custom attribute.
-
client.merchants.custom_attributes.list(...) +
client.merchants.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]
@@ -29055,7 +29039,7 @@ attribute, information about the data type, or other definition details. The def
-
client.merchants.custom_attributes.get(...) +
client.merchants.custom_attributes.get(...) -> AsyncHttpResponse[RetrieveMerchantCustomAttributeResponse]
@@ -29169,7 +29153,7 @@ higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.merchants.custom_attributes.upsert(...) +
client.merchants.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertMerchantCustomAttributeResponse]
@@ -29284,7 +29268,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.merchants.custom_attributes.delete(...) +
client.merchants.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteMerchantCustomAttributeResponse]
@@ -29370,7 +29354,9 @@ definition owner, you must use the qualified key.
## Orders CustomAttributeDefinitions -
client.orders.custom_attribute_definitions.list(...) +
client.orders.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse +]
@@ -29477,7 +29463,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/worki
-
client.orders.custom_attribute_definitions.create(...) +
client.orders.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateOrderCustomAttributeDefinitionResponse]
@@ -29578,7 +29564,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.custom_attribute_definitions.get(...) +
client.orders.custom_attribute_definitions.get(...) -> AsyncHttpResponse[RetrieveOrderCustomAttributeDefinitionResponse]
@@ -29664,7 +29650,7 @@ control, include this optional field and specify the current version of the cust
-
client.orders.custom_attribute_definitions.update(...) +
client.orders.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateOrderCustomAttributeDefinitionResponse]
@@ -29767,7 +29753,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.custom_attribute_definitions.delete(...) +
client.orders.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteOrderCustomAttributeDefinitionResponse]
@@ -29840,7 +29826,7 @@ client.orders.custom_attribute_definitions.delete(
## Orders CustomAttributes -
client.orders.custom_attributes.batch_delete(...) +
client.orders.custom_attributes.batch_delete(...) -> AsyncHttpResponse[BulkDeleteOrderCustomAttributesResponse]
@@ -29934,7 +29920,7 @@ client.orders.custom_attributes.batch_delete(
-
client.orders.custom_attributes.batch_upsert(...) +
client.orders.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertOrderCustomAttributesResponse]
@@ -30036,7 +30022,7 @@ client.orders.custom_attributes.batch_upsert(
-
client.orders.custom_attributes.list(...) +
client.orders.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListOrderCustomAttributesResponse]
@@ -30167,7 +30153,7 @@ information about the data type, or other definition details. The default value
-
client.orders.custom_attributes.get(...) +
client.orders.custom_attributes.get(...) -> AsyncHttpResponse[RetrieveOrderCustomAttributeResponse]
@@ -30281,7 +30267,7 @@ information about the data type, or other definition details. The default value
-
client.orders.custom_attributes.upsert(...) +
client.orders.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertOrderCustomAttributeResponse]
@@ -30399,7 +30385,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.custom_attributes.delete(...) +
client.orders.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteOrderCustomAttributeResponse]
@@ -30486,7 +30472,7 @@ existing custom attribute definition.
## TeamMembers WageSetting -
client.team_members.wage_setting.get(...) +
client.team_members.wage_setting.get(...) -> AsyncHttpResponse[GetWageSettingResponse]
@@ -30561,7 +30547,7 @@ client.team_members.wage_setting.get(
-
client.team_members.wage_setting.update(...) +
client.team_members.wage_setting.update(...) -> AsyncHttpResponse[UpdateWageSettingResponse]
@@ -30669,7 +30655,7 @@ This value is ignored if `job_id` is also provided.
## Terminal Actions -
client.terminal.actions.create(...) +
client.terminal.actions.create(...) -> AsyncHttpResponse[CreateTerminalActionResponse]
@@ -30762,7 +30748,7 @@ information.
-
client.terminal.actions.search(...) +
client.terminal.actions.search(...) -> AsyncHttpResponse[SearchTerminalActionsResponse]
@@ -30860,7 +30846,7 @@ information.
-
client.terminal.actions.get(...) +
client.terminal.actions.get(...) -> AsyncHttpResponse[GetTerminalActionResponse]
@@ -30930,7 +30916,7 @@ client.terminal.actions.get(
-
client.terminal.actions.cancel(...) +
client.terminal.actions.cancel(...) -> AsyncHttpResponse[CancelTerminalActionResponse]
@@ -31001,7 +30987,7 @@ client.terminal.actions.cancel(
## Terminal Checkouts -
client.terminal.checkouts.create(...) +
client.terminal.checkouts.create(...) -> AsyncHttpResponse[CreateTerminalCheckoutResponse]
@@ -31091,7 +31077,7 @@ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-a
-
client.terminal.checkouts.search(...) +
client.terminal.checkouts.search(...) -> AsyncHttpResponse[SearchTerminalCheckoutsResponse]
@@ -31185,7 +31171,7 @@ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-pat
-
client.terminal.checkouts.get(...) +
client.terminal.checkouts.get(...) -> AsyncHttpResponse[GetTerminalCheckoutResponse]
@@ -31255,7 +31241,7 @@ client.terminal.checkouts.get(
-
client.terminal.checkouts.cancel(...) +
client.terminal.checkouts.cancel(...) -> AsyncHttpResponse[CancelTerminalCheckoutResponse]
@@ -31326,7 +31312,7 @@ client.terminal.checkouts.cancel(
## Terminal Refunds -
client.terminal.refunds.create(...) +
client.terminal.refunds.create(...) -> AsyncHttpResponse[CreateTerminalRefundResponse]
@@ -31415,7 +31401,7 @@ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-a
-
client.terminal.refunds.search(...) +
client.terminal.refunds.search(...) -> AsyncHttpResponse[SearchTerminalRefundsResponse]
@@ -31509,7 +31495,7 @@ Provide this cursor to retrieve the next set of results for the original query.
-
client.terminal.refunds.get(...) +
client.terminal.refunds.get(...) -> AsyncHttpResponse[GetTerminalRefundResponse]
@@ -31579,7 +31565,7 @@ client.terminal.refunds.get(
-
client.terminal.refunds.cancel(...) +
client.terminal.refunds.cancel(...) -> AsyncHttpResponse[CancelTerminalRefundResponse]
@@ -31650,7 +31636,7 @@ client.terminal.refunds.cancel(
## Webhooks EventTypes -
client.webhooks.event_types.list(...) +
client.webhooks.event_types.list(...) -> AsyncHttpResponse[ListWebhookEventTypesResponse]
@@ -31721,7 +31707,7 @@ client.webhooks.event_types.list(
## Webhooks Subscriptions -
client.webhooks.subscriptions.list(...) +
client.webhooks.subscriptions.list(...) -> AsyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]
@@ -31840,7 +31826,7 @@ Default: 100
-
client.webhooks.subscriptions.create(...) +
client.webhooks.subscriptions.create(...) -> AsyncHttpResponse[CreateWebhookSubscriptionResponse]
@@ -31924,7 +31910,7 @@ client.webhooks.subscriptions.create(
-
client.webhooks.subscriptions.get(...) +
client.webhooks.subscriptions.get(...) -> AsyncHttpResponse[GetWebhookSubscriptionResponse]
@@ -31994,7 +31980,7 @@ client.webhooks.subscriptions.get(
-
client.webhooks.subscriptions.update(...) +
client.webhooks.subscriptions.update(...) -> AsyncHttpResponse[UpdateWebhookSubscriptionResponse]
@@ -32076,7 +32062,7 @@ client.webhooks.subscriptions.update(
-
client.webhooks.subscriptions.delete(...) +
client.webhooks.subscriptions.delete(...) -> AsyncHttpResponse[DeleteWebhookSubscriptionResponse]
@@ -32146,7 +32132,7 @@ client.webhooks.subscriptions.delete(
-
client.webhooks.subscriptions.update_signature_key(...) +
client.webhooks.subscriptions.update_signature_key(...) -> AsyncHttpResponse[UpdateWebhookSubscriptionSignatureKeyResponse]
@@ -32225,7 +32211,7 @@ client.webhooks.subscriptions.update_signature_key(
-
client.webhooks.subscriptions.test(...) +
client.webhooks.subscriptions.test(...) -> AsyncHttpResponse[TestWebhookSubscriptionResponse]
diff --git a/src/square/catalog/client.py b/src/square/catalog/client.py index b644e1c9..4bd63686 100644 --- a/src/square/catalog/client.py +++ b/src/square/catalog/client.py @@ -262,34 +262,10 @@ def batch_upsert( batches=[ { "objects": [ - { - "type": "IMAGE", - "id": "#Tea", - "present_at_all_locations": True, - }, - { - "type": "IMAGE", - "id": "#Coffee", - "present_at_all_locations": True, - }, - { - "type": "ITEM", - "id": "#Beverages", - "present_at_all_locations": True, - }, - { - "type": "TAX", - "id": "#SalesTax", - "present_at_all_locations": True, - "tax_data": { - "name": "Sales Tax", - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "inclusion_type": "ADDITIVE", - "percentage": "5.0", - "applies_to_custom_amounts": True, - "enabled": True, - }, - }, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "TAX"}, ] } ], @@ -1019,34 +995,10 @@ async def main() -> None: batches=[ { "objects": [ - { - "type": "IMAGE", - "id": "#Tea", - "present_at_all_locations": True, - }, - { - "type": "IMAGE", - "id": "#Coffee", - "present_at_all_locations": True, - }, - { - "type": "ITEM", - "id": "#Beverages", - "present_at_all_locations": True, - }, - { - "type": "TAX", - "id": "#SalesTax", - "present_at_all_locations": True, - "tax_data": { - "name": "Sales Tax", - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "inclusion_type": "ADDITIVE", - "percentage": "5.0", - "applies_to_custom_amounts": True, - "enabled": True, - }, - }, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "TAX"}, ] } ], diff --git a/src/square/catalog/object/client.py b/src/square/catalog/object/client.py index 62f923fb..fd591707 100644 --- a/src/square/catalog/object/client.py +++ b/src/square/catalog/object/client.py @@ -80,7 +80,7 @@ def upsert( ) client.catalog.object.upsert( idempotency_key="af3d1afc-7212-4300-b463-0bfc5314a5ae", - object={"type": "IMAGE", "id": "#Cocoa"}, + object={"id": "id", "type": "ITEM"}, ) """ _response = self._raw_client.upsert( @@ -286,7 +286,7 @@ async def upsert( async def main() -> None: await client.catalog.object.upsert( idempotency_key="af3d1afc-7212-4300-b463-0bfc5314a5ae", - object={"type": "IMAGE", "id": "#Cocoa"}, + object={"id": "id", "type": "ITEM"}, ) diff --git a/src/square/core/client_wrapper.py b/src/square/core/client_wrapper.py index 7f6e80d4..03724a1d 100644 --- a/src/square/core/client_wrapper.py +++ b/src/square/core/client_wrapper.py @@ -24,10 +24,10 @@ def __init__( def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { - "User-Agent": "squareup/43.2.1.20251016", + "User-Agent": "squareup/43.3.0.20251016", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "squareup", - "X-Fern-SDK-Version": "43.2.1.20251016", + "X-Fern-SDK-Version": "43.3.0.20251016", **(self.get_custom_headers() or {}), } token = self._get_token() @@ -81,12 +81,22 @@ def __init__( base_url: str, timeout: typing.Optional[float] = None, version: typing.Optional[str] = None, + async_token: typing.Optional[typing.Callable[[], typing.Awaitable[str]]] = None, httpx_client: httpx.AsyncClient, ): super().__init__(token=token, headers=headers, base_url=base_url, timeout=timeout, version=version) + self._async_token = async_token self.httpx_client = AsyncHttpClient( httpx_client=httpx_client, base_headers=self.get_headers, base_timeout=self.get_timeout, base_url=self.get_base_url, + async_base_headers=self.async_get_headers, ) + + async def async_get_headers(self) -> typing.Dict[str, str]: + headers = self.get_headers() + if self._async_token is not None: + token = await self._async_token() + headers["Authorization"] = f"Bearer {token}" + return headers diff --git a/src/square/core/http_client.py b/src/square/core/http_client.py index e4173f99..bf19fcc2 100644 --- a/src/square/core/http_client.py +++ b/src/square/core/http_client.py @@ -14,13 +14,13 @@ from .force_multipart import FORCE_MULTIPART from .jsonable_encoder import jsonable_encoder from .query_encoder import encode_query -from .remove_none_from_dict import remove_none_from_dict +from .remove_none_from_dict import remove_none_from_dict as remove_none_from_dict from .request_options import RequestOptions from httpx._types import RequestFiles -INITIAL_RETRY_DELAY_SECONDS = 0.5 -MAX_RETRY_DELAY_SECONDS = 10 -MAX_RETRY_DELAY_SECONDS_FROM_HEADER = 30 +INITIAL_RETRY_DELAY_SECONDS = 1.0 +MAX_RETRY_DELAY_SECONDS = 60.0 +JITTER_FACTOR = 0.2 # 20% random jitter def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float]: @@ -64,6 +64,38 @@ def _parse_retry_after(response_headers: httpx.Headers) -> typing.Optional[float return seconds +def _add_positive_jitter(delay: float) -> float: + """Add positive jitter (0-20%) to prevent thundering herd.""" + jitter_multiplier = 1 + random() * JITTER_FACTOR + return delay * jitter_multiplier + + +def _add_symmetric_jitter(delay: float) -> float: + """Add symmetric jitter (±10%) for exponential backoff.""" + jitter_multiplier = 1 + (random() - 0.5) * JITTER_FACTOR + return delay * jitter_multiplier + + +def _parse_x_ratelimit_reset(response_headers: httpx.Headers) -> typing.Optional[float]: + """ + Parse the X-RateLimit-Reset header (Unix timestamp in seconds). + Returns seconds to wait, or None if header is missing/invalid. + """ + reset_time_str = response_headers.get("x-ratelimit-reset") + if reset_time_str is None: + return None + + try: + reset_time = int(reset_time_str) + delay = reset_time - time.time() + if delay > 0: + return delay + except (ValueError, TypeError): + pass + + return None + + def _retry_timeout(response: httpx.Response, retries: int) -> float: """ Determine the amount of time to wait before retrying a request. @@ -71,17 +103,19 @@ def _retry_timeout(response: httpx.Response, retries: int) -> float: with a jitter to determine the number of seconds to wait. """ - # If the API asks us to wait a certain amount of time (and it's a reasonable amount), just do what it says. + # 1. Check Retry-After header first retry_after = _parse_retry_after(response.headers) - if retry_after is not None and retry_after <= MAX_RETRY_DELAY_SECONDS_FROM_HEADER: - return retry_after + if retry_after is not None and retry_after > 0: + return min(retry_after, MAX_RETRY_DELAY_SECONDS) - # Apply exponential backoff, capped at MAX_RETRY_DELAY_SECONDS. - retry_delay = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + # 2. Check X-RateLimit-Reset header (with positive jitter) + ratelimit_reset = _parse_x_ratelimit_reset(response.headers) + if ratelimit_reset is not None: + return _add_positive_jitter(min(ratelimit_reset, MAX_RETRY_DELAY_SECONDS)) - # Add a randomness / jitter to the retry delay to avoid overwhelming the server with retries. - timeout = retry_delay * (1 - 0.25 * random()) - return timeout if timeout >= 0 else 0 + # 3. Fall back to exponential backoff (with symmetric jitter) + backoff = min(INITIAL_RETRY_DELAY_SECONDS * pow(2.0, retries), MAX_RETRY_DELAY_SECONDS) + return _add_symmetric_jitter(backoff) def _should_retry(response: httpx.Response) -> bool: @@ -89,6 +123,21 @@ def _should_retry(response: httpx.Response) -> bool: return response.status_code >= 500 or response.status_code in retryable_400s +def _maybe_filter_none_from_multipart_data( + data: typing.Optional[typing.Any], + request_files: typing.Optional[RequestFiles], + force_multipart: typing.Optional[bool], +) -> typing.Optional[typing.Any]: + """ + Filter None values from data body for multipart/form requests. + This prevents httpx from converting None to empty strings in multipart encoding. + Only applies when files are present or force_multipart is True. + """ + if data is not None and isinstance(data, typing.Mapping) and (request_files or force_multipart): + return remove_none_from_dict(data) + return data + + def remove_omit_from_dict( original: typing.Dict[str, typing.Optional[typing.Any]], omit: typing.Optional[typing.Any], @@ -210,6 +259,28 @@ def request( if (request_files is None or len(request_files) == 0) and force_multipart: request_files = FORCE_MULTIPART + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_params = encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) or {} + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ) + response = self.httpx_client.request( method=method, url=urllib.parse.urljoin(f"{base_url}/", path), @@ -222,23 +293,7 @@ def request( } ) ), - params=encode_query( - jsonable_encoder( - remove_none_from_dict( - remove_omit_from_dict( - { - **(params if params is not None else {}), - **( - request_options.get("additional_query_parameters", {}) or {} - if request_options is not None - else {} - ), - }, - omit, - ) - ) - ) - ), + params=_encoded_params if _encoded_params else None, json=json_body, data=data_body, content=content, @@ -307,6 +362,28 @@ def stream( json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_params = encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ) + with self.httpx_client.stream( method=method, url=urllib.parse.urljoin(f"{base_url}/", path), @@ -319,23 +396,7 @@ def stream( } ) ), - params=encode_query( - jsonable_encoder( - remove_none_from_dict( - remove_omit_from_dict( - { - **(params if params is not None else {}), - **( - request_options.get("additional_query_parameters", {}) - if request_options is not None - else {} - ), - }, - omit, - ) - ) - ) - ), + params=_encoded_params if _encoded_params else None, json=json_body, data=data_body, content=content, @@ -353,12 +414,19 @@ def __init__( base_timeout: typing.Callable[[], typing.Optional[float]], base_headers: typing.Callable[[], typing.Dict[str, str]], base_url: typing.Optional[typing.Callable[[], str]] = None, + async_base_headers: typing.Optional[typing.Callable[[], typing.Awaitable[typing.Dict[str, str]]]] = None, ): self.base_url = base_url self.base_timeout = base_timeout self.base_headers = base_headers + self.async_base_headers = async_base_headers self.httpx_client = httpx_client + async def _get_headers(self) -> typing.Dict[str, str]: + if self.async_base_headers is not None: + return await self.async_base_headers() + return self.base_headers() + def get_base_url(self, maybe_base_url: typing.Optional[str]) -> str: base_url = maybe_base_url if self.base_url is not None and base_url is None: @@ -408,6 +476,31 @@ async def request( json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Get headers (supports async token providers) + _headers = await self._get_headers() + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_params = encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) or {} + if request_options is not None + else {} + ), + }, + omit, + ) + ) + ) + ) + # Add the input to each of these and do None-safety checks response = await self.httpx_client.request( method=method, @@ -415,29 +508,13 @@ async def request( headers=jsonable_encoder( remove_none_from_dict( { - **self.base_headers(), + **_headers, **(headers if headers is not None else {}), **(request_options.get("additional_headers", {}) or {} if request_options is not None else {}), } ) ), - params=encode_query( - jsonable_encoder( - remove_none_from_dict( - remove_omit_from_dict( - { - **(params if params is not None else {}), - **( - request_options.get("additional_query_parameters", {}) or {} - if request_options is not None - else {} - ), - }, - omit, - ) - ) - ) - ), + params=_encoded_params if _encoded_params else None, json=json_body, data=data_body, content=content, @@ -505,35 +582,44 @@ async def stream( json_body, data_body = get_request_body(json=json, data=data, request_options=request_options, omit=omit) + data_body = _maybe_filter_none_from_multipart_data(data_body, request_files, force_multipart) + + # Get headers (supports async token providers) + _headers = await self._get_headers() + + # Compute encoded params separately to avoid passing empty list to httpx + # (httpx strips existing query params from URL when params=[] is passed) + _encoded_params = encode_query( + jsonable_encoder( + remove_none_from_dict( + remove_omit_from_dict( + { + **(params if params is not None else {}), + **( + request_options.get("additional_query_parameters", {}) + if request_options is not None + else {} + ), + }, + omit=omit, + ) + ) + ) + ) + async with self.httpx_client.stream( method=method, url=urllib.parse.urljoin(f"{base_url}/", path), headers=jsonable_encoder( remove_none_from_dict( { - **self.base_headers(), + **_headers, **(headers if headers is not None else {}), **(request_options.get("additional_headers", {}) if request_options is not None else {}), } ) ), - params=encode_query( - jsonable_encoder( - remove_none_from_dict( - remove_omit_from_dict( - { - **(params if params is not None else {}), - **( - request_options.get("additional_query_parameters", {}) - if request_options is not None - else {} - ), - }, - omit=omit, - ) - ) - ) - ), + params=_encoded_params if _encoded_params else None, json=json_body, data=data_body, content=content, diff --git a/src/square/core/unchecked_base_model.py b/src/square/core/unchecked_base_model.py index 9ea71ca6..0a645e41 100644 --- a/src/square/core/unchecked_base_model.py +++ b/src/square/core/unchecked_base_model.py @@ -19,7 +19,7 @@ parse_datetime, parse_obj_as, ) -from .serialization import get_field_to_alias_mapping +from .serialization import convert_and_respect_annotation_metadata, get_field_to_alias_mapping from pydantic_core import PydanticUndefined @@ -41,6 +41,26 @@ class UncheckedBaseModel(UniversalBaseModel): class Config: extra = pydantic.Extra.allow + if IS_PYDANTIC_V2: + + @classmethod + def model_validate( + cls: typing.Type["Model"], + obj: typing.Any, + *args: typing.Any, + **kwargs: typing.Any, + ) -> "Model": + """ + Ensure that when using Pydantic v2's `model_validate` entrypoint we still + respect our FieldMetadata-based aliasing. + """ + dealiased_obj = convert_and_respect_annotation_metadata( + object_=obj, + annotation=cls, + direction="read", + ) + return super().model_validate(dealiased_obj, *args, **kwargs) # type: ignore[misc] + @classmethod def model_construct( cls: typing.Type["Model"], diff --git a/src/square/requests/catalog_object.py b/src/square/requests/catalog_object.py index 2afcbf44..c8291a4a 100644 --- a/src/square/requests/catalog_object.py +++ b/src/square/requests/catalog_object.py @@ -4,45 +4,375 @@ import typing -from .catalog_object_availability_period import CatalogObjectAvailabilityPeriodParams -from .catalog_object_category import CatalogObjectCategoryParams -from .catalog_object_custom_attribute_definition import CatalogObjectCustomAttributeDefinitionParams -from .catalog_object_discount import CatalogObjectDiscountParams -from .catalog_object_image import CatalogObjectImageParams -from .catalog_object_item_option_value import CatalogObjectItemOptionValueParams -from .catalog_object_item_variation import CatalogObjectItemVariationParams -from .catalog_object_measurement_unit import CatalogObjectMeasurementUnitParams -from .catalog_object_modifier import CatalogObjectModifierParams -from .catalog_object_pricing_rule import CatalogObjectPricingRuleParams -from .catalog_object_product_set import CatalogObjectProductSetParams -from .catalog_object_quick_amounts_settings import CatalogObjectQuickAmountsSettingsParams -from .catalog_object_subscription_plan_variation import CatalogObjectSubscriptionPlanVariationParams -from .catalog_object_tax import CatalogObjectTaxParams -from .catalog_object_time_period import CatalogObjectTimePeriodParams +import typing_extensions +from ..core.serialization import FieldMetadata +from .catalog_availability_period import CatalogAvailabilityPeriodParams +from .catalog_custom_attribute_definition import CatalogCustomAttributeDefinitionParams +from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams +from .catalog_discount import CatalogDiscountParams +from .catalog_image import CatalogImageParams +from .catalog_item_option_value import CatalogItemOptionValueParams +from .catalog_item_variation import CatalogItemVariationParams +from .catalog_measurement_unit import CatalogMeasurementUnitParams +from .catalog_modifier import CatalogModifierParams +from .catalog_pricing_rule import CatalogPricingRuleParams +from .catalog_product_set import CatalogProductSetParams +from .catalog_quick_amounts_settings import CatalogQuickAmountsSettingsParams +from .catalog_subscription_plan_variation import CatalogSubscriptionPlanVariationParams +from .catalog_tax import CatalogTaxParams +from .catalog_time_period import CatalogTimePeriodParams +from .catalog_v1id import CatalogV1IdParams if typing.TYPE_CHECKING: - from .catalog_object_item import CatalogObjectItemParams - from .catalog_object_item_option import CatalogObjectItemOptionParams - from .catalog_object_modifier_list import CatalogObjectModifierListParams - from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlanParams + from .catalog_category import CatalogCategoryParams + from .catalog_item import CatalogItemParams + from .catalog_item_option import CatalogItemOptionParams + from .catalog_modifier_list import CatalogModifierListParams + from .catalog_subscription_plan import CatalogSubscriptionPlanParams + + +class CatalogObject_ItemParams(typing_extensions.TypedDict): + type: typing.Literal["ITEM"] + item_data: typing_extensions.NotRequired["CatalogItemParams"] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_ImageParams(typing_extensions.TypedDict): + type: typing.Literal["IMAGE"] + image_data: typing_extensions.NotRequired[CatalogImageParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_CategoryParams(typing_extensions.TypedDict): + type: typing.Literal["CATEGORY"] + id: typing_extensions.NotRequired[str] + ordinal: typing_extensions.NotRequired[typing.Optional[int]] + category_data: typing_extensions.NotRequired["CatalogCategoryParams"] + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_ItemVariationParams(typing_extensions.TypedDict): + type: typing.Literal["ITEM_VARIATION"] + item_variation_data: typing_extensions.NotRequired[CatalogItemVariationParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_TaxParams(typing_extensions.TypedDict): + type: typing.Literal["TAX"] + tax_data: typing_extensions.NotRequired[CatalogTaxParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_DiscountParams(typing_extensions.TypedDict): + type: typing.Literal["DISCOUNT"] + discount_data: typing_extensions.NotRequired[CatalogDiscountParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_ModifierListParams(typing_extensions.TypedDict): + type: typing.Literal["MODIFIER_LIST"] + modifier_list_data: typing_extensions.NotRequired["CatalogModifierListParams"] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_ModifierParams(typing_extensions.TypedDict): + type: typing.Literal["MODIFIER"] + modifier_data: typing_extensions.NotRequired[CatalogModifierParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_PricingRuleParams(typing_extensions.TypedDict): + type: typing.Literal["PRICING_RULE"] + pricing_rule_data: typing_extensions.NotRequired[CatalogPricingRuleParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_ProductSetParams(typing_extensions.TypedDict): + type: typing.Literal["PRODUCT_SET"] + product_set_data: typing_extensions.NotRequired[CatalogProductSetParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_TimePeriodParams(typing_extensions.TypedDict): + type: typing.Literal["TIME_PERIOD"] + time_period_data: typing_extensions.NotRequired[CatalogTimePeriodParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_MeasurementUnitParams(typing_extensions.TypedDict): + type: typing.Literal["MEASUREMENT_UNIT"] + measurement_unit_data: typing_extensions.NotRequired[CatalogMeasurementUnitParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_SubscriptionPlanVariationParams(typing_extensions.TypedDict): + type: typing.Literal["SUBSCRIPTION_PLAN_VARIATION"] + subscription_plan_variation_data: typing_extensions.NotRequired[CatalogSubscriptionPlanVariationParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_ItemOptionParams(typing_extensions.TypedDict): + type: typing.Literal["ITEM_OPTION"] + item_option_data: typing_extensions.NotRequired["CatalogItemOptionParams"] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_ItemOptionValParams(typing_extensions.TypedDict): + type: typing.Literal["ITEM_OPTION_VAL"] + item_option_value_data: typing_extensions.NotRequired[CatalogItemOptionValueParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_CustomAttributeDefinitionParams(typing_extensions.TypedDict): + type: typing.Literal["CUSTOM_ATTRIBUTE_DEFINITION"] + custom_attribute_definition_data: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_QuickAmountsSettingsParams(typing_extensions.TypedDict): + type: typing.Literal["QUICK_AMOUNTS_SETTINGS"] + quick_amounts_settings_data: typing_extensions.NotRequired[CatalogQuickAmountsSettingsParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_SubscriptionPlanParams(typing_extensions.TypedDict): + type: typing.Literal["SUBSCRIPTION_PLAN"] + subscription_plan_data: typing_extensions.NotRequired["CatalogSubscriptionPlanParams"] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + +class CatalogObject_AvailabilityPeriodParams(typing_extensions.TypedDict): + type: typing.Literal["AVAILABILITY_PERIOD"] + availability_period_data: typing_extensions.NotRequired[CatalogAvailabilityPeriodParams] + id: str + updated_at: typing_extensions.NotRequired[str] + version: typing_extensions.NotRequired[int] + is_deleted: typing_extensions.NotRequired[bool] + custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] + catalog_v1ids: typing_extensions.NotRequired[ + typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] + ] + present_at_all_locations: typing_extensions.NotRequired[bool] + present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] + image_id: typing_extensions.NotRequired[str] + + CatalogObjectParams = typing.Union[ - "CatalogObjectItemParams", - CatalogObjectImageParams, - CatalogObjectCategoryParams, - CatalogObjectItemVariationParams, - CatalogObjectTaxParams, - CatalogObjectDiscountParams, - "CatalogObjectModifierListParams", - CatalogObjectModifierParams, - CatalogObjectPricingRuleParams, - CatalogObjectProductSetParams, - CatalogObjectTimePeriodParams, - CatalogObjectMeasurementUnitParams, - CatalogObjectSubscriptionPlanVariationParams, - "CatalogObjectItemOptionParams", - CatalogObjectItemOptionValueParams, - CatalogObjectCustomAttributeDefinitionParams, - CatalogObjectQuickAmountsSettingsParams, - "CatalogObjectSubscriptionPlanParams", - CatalogObjectAvailabilityPeriodParams, + CatalogObject_ItemParams, + CatalogObject_ImageParams, + CatalogObject_CategoryParams, + CatalogObject_ItemVariationParams, + CatalogObject_TaxParams, + CatalogObject_DiscountParams, + CatalogObject_ModifierListParams, + CatalogObject_ModifierParams, + CatalogObject_PricingRuleParams, + CatalogObject_ProductSetParams, + CatalogObject_TimePeriodParams, + CatalogObject_MeasurementUnitParams, + CatalogObject_SubscriptionPlanVariationParams, + CatalogObject_ItemOptionParams, + CatalogObject_ItemOptionValParams, + CatalogObject_CustomAttributeDefinitionParams, + CatalogObject_QuickAmountsSettingsParams, + CatalogObject_SubscriptionPlanParams, + CatalogObject_AvailabilityPeriodParams, ] diff --git a/src/square/requests/catalog_object_availability_period.py b/src/square/requests/catalog_object_availability_period.py index 0139b550..78abf984 100644 --- a/src/square/requests/catalog_object_availability_period.py +++ b/src/square/requests/catalog_object_availability_period.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata from .catalog_availability_period import CatalogAvailabilityPeriodParams -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams -class CatalogObjectAvailabilityPeriodParams(typing_extensions.TypedDict): - type: typing.Literal["AVAILABILITY_PERIOD"] +class CatalogObjectAvailabilityPeriodParams(CatalogObjectBaseParams): availability_period_data: typing_extensions.NotRequired[CatalogAvailabilityPeriodParams] """ Structured data for a `CatalogAvailabilityPeriod`, set for CatalogObjects of type `AVAILABILITY_PERIOD`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_base.py b/src/square/requests/catalog_object_base.py index 1f6ec6c0..53239602 100644 --- a/src/square/requests/catalog_object_base.py +++ b/src/square/requests/catalog_object_base.py @@ -4,19 +4,11 @@ import typing_extensions from ..core.serialization import FieldMetadata -from ..types.catalog_object_type import CatalogObjectType from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams from .catalog_v1id import CatalogV1IdParams class CatalogObjectBaseParams(typing_extensions.TypedDict): - type: CatalogObjectType - """ - The type of this object. Each object type has expected - properties expressed in a structured format within its corresponding `*_data` field below. - See [CatalogObjectType](#type-catalogobjecttype) for possible values - """ - id: str """ An identifier to reference this object in the catalog. When a new `CatalogObject` diff --git a/src/square/requests/catalog_object_category.py b/src/square/requests/catalog_object_category.py index 69d3d820..b9751c6f 100644 --- a/src/square/requests/catalog_object_category.py +++ b/src/square/requests/catalog_object_category.py @@ -30,7 +30,7 @@ class CatalogObjectCategoryParams(typing_extensions.TypedDict): The order of the object within the context of the category. """ - type: typing.Literal["CATEGORY"] + type: typing_extensions.NotRequired[typing.Literal["CATEGORY"]] category_data: typing_extensions.NotRequired["CatalogCategoryParams"] """ Structured data for a `CatalogCategory`, set for CatalogObjects of type `CATEGORY`. diff --git a/src/square/requests/catalog_object_custom_attribute_definition.py b/src/square/requests/catalog_object_custom_attribute_definition.py index 81c8be8b..b21b63b3 100644 --- a/src/square/requests/catalog_object_custom_attribute_definition.py +++ b/src/square/requests/catalog_object_custom_attribute_definition.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata from .catalog_custom_attribute_definition import CatalogCustomAttributeDefinitionParams -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams -class CatalogObjectCustomAttributeDefinitionParams(typing_extensions.TypedDict): - type: typing.Literal["CUSTOM_ATTRIBUTE_DEFINITION"] +class CatalogObjectCustomAttributeDefinitionParams(CatalogObjectBaseParams): custom_attribute_definition_data: typing_extensions.NotRequired[CatalogCustomAttributeDefinitionParams] """ Structured data for a `CatalogCustomAttributeDefinition`, set for CatalogObjects of type `CUSTOM_ATTRIBUTE_DEFINITION`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_discount.py b/src/square/requests/catalog_object_discount.py index 23989e6b..f2ec28b7 100644 --- a/src/square/requests/catalog_object_discount.py +++ b/src/square/requests/catalog_object_discount.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams from .catalog_discount import CatalogDiscountParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams -class CatalogObjectDiscountParams(typing_extensions.TypedDict): - type: typing.Literal["DISCOUNT"] +class CatalogObjectDiscountParams(CatalogObjectBaseParams): discount_data: typing_extensions.NotRequired[CatalogDiscountParams] """ Structured data for a `CatalogDiscount`, set for CatalogObjects of type `DISCOUNT`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_image.py b/src/square/requests/catalog_object_image.py index 54aa5c0b..5c5b1805 100644 --- a/src/square/requests/catalog_object_image.py +++ b/src/square/requests/catalog_object_image.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams from .catalog_image import CatalogImageParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams -class CatalogObjectImageParams(typing_extensions.TypedDict): - type: typing.Literal["IMAGE"] +class CatalogObjectImageParams(CatalogObjectBaseParams): image_data: typing_extensions.NotRequired[CatalogImageParams] """ Structured data for a `CatalogImage`, set for CatalogObjects of type `IMAGE`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_item.py b/src/square/requests/catalog_object_item.py index 8076b3d3..5b4b22c1 100644 --- a/src/square/requests/catalog_object_item.py +++ b/src/square/requests/catalog_object_item.py @@ -5,99 +5,14 @@ import typing import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams if typing.TYPE_CHECKING: from .catalog_item import CatalogItemParams -class CatalogObjectItemParams(typing_extensions.TypedDict): - type: typing.Literal["ITEM"] +class CatalogObjectItemParams(CatalogObjectBaseParams): item_data: typing_extensions.NotRequired["CatalogItemParams"] """ Structured data for a `CatalogItem`, set for CatalogObjects of type `ITEM`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_item_option.py b/src/square/requests/catalog_object_item_option.py index 667b6b81..b4e5b83b 100644 --- a/src/square/requests/catalog_object_item_option.py +++ b/src/square/requests/catalog_object_item_option.py @@ -5,99 +5,14 @@ import typing import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams if typing.TYPE_CHECKING: from .catalog_item_option import CatalogItemOptionParams -class CatalogObjectItemOptionParams(typing_extensions.TypedDict): - type: typing.Literal["ITEM_OPTION"] +class CatalogObjectItemOptionParams(CatalogObjectBaseParams): item_option_data: typing_extensions.NotRequired["CatalogItemOptionParams"] """ Structured data for a `CatalogItemOption`, set for CatalogObjects of type `ITEM_OPTION`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_item_option_value.py b/src/square/requests/catalog_object_item_option_value.py index 5cea87b2..7f34f91d 100644 --- a/src/square/requests/catalog_object_item_option_value.py +++ b/src/square/requests/catalog_object_item_option_value.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams from .catalog_item_option_value import CatalogItemOptionValueParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams -class CatalogObjectItemOptionValueParams(typing_extensions.TypedDict): - type: typing.Literal["ITEM_OPTION_VAL"] +class CatalogObjectItemOptionValueParams(CatalogObjectBaseParams): item_option_value_data: typing_extensions.NotRequired[CatalogItemOptionValueParams] """ Structured data for a `CatalogItemOptionValue`, set for CatalogObjects of type `ITEM_OPTION_VAL`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_item_variation.py b/src/square/requests/catalog_object_item_variation.py index 166e6ab6..5830eda1 100644 --- a/src/square/requests/catalog_object_item_variation.py +++ b/src/square/requests/catalog_object_item_variation.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams from .catalog_item_variation import CatalogItemVariationParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams -class CatalogObjectItemVariationParams(typing_extensions.TypedDict): - type: typing.Literal["ITEM_VARIATION"] +class CatalogObjectItemVariationParams(CatalogObjectBaseParams): item_variation_data: typing_extensions.NotRequired[CatalogItemVariationParams] """ Structured data for a `CatalogItemVariation`, set for CatalogObjects of type `ITEM_VARIATION`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_measurement_unit.py b/src/square/requests/catalog_object_measurement_unit.py index d4f682fb..266cf22e 100644 --- a/src/square/requests/catalog_object_measurement_unit.py +++ b/src/square/requests/catalog_object_measurement_unit.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams from .catalog_measurement_unit import CatalogMeasurementUnitParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams -class CatalogObjectMeasurementUnitParams(typing_extensions.TypedDict): - type: typing.Literal["MEASUREMENT_UNIT"] +class CatalogObjectMeasurementUnitParams(CatalogObjectBaseParams): measurement_unit_data: typing_extensions.NotRequired[CatalogMeasurementUnitParams] """ Structured data for a `CatalogMeasurementUnit`, set for CatalogObjects of type `MEASUREMENT_UNIT`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_modifier.py b/src/square/requests/catalog_object_modifier.py index 0a2f523e..aebdddc7 100644 --- a/src/square/requests/catalog_object_modifier.py +++ b/src/square/requests/catalog_object_modifier.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams from .catalog_modifier import CatalogModifierParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams -class CatalogObjectModifierParams(typing_extensions.TypedDict): - type: typing.Literal["MODIFIER"] +class CatalogObjectModifierParams(CatalogObjectBaseParams): modifier_data: typing_extensions.NotRequired[CatalogModifierParams] """ Structured data for a `CatalogModifier`, set for CatalogObjects of type `MODIFIER`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_modifier_list.py b/src/square/requests/catalog_object_modifier_list.py index 80d4f27a..1edc778a 100644 --- a/src/square/requests/catalog_object_modifier_list.py +++ b/src/square/requests/catalog_object_modifier_list.py @@ -5,99 +5,14 @@ import typing import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams if typing.TYPE_CHECKING: from .catalog_modifier_list import CatalogModifierListParams -class CatalogObjectModifierListParams(typing_extensions.TypedDict): - type: typing.Literal["MODIFIER_LIST"] +class CatalogObjectModifierListParams(CatalogObjectBaseParams): modifier_list_data: typing_extensions.NotRequired["CatalogModifierListParams"] """ Structured data for a `CatalogModifierList`, set for CatalogObjects of type `MODIFIER_LIST`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_pricing_rule.py b/src/square/requests/catalog_object_pricing_rule.py index 05fe7516..005e70c4 100644 --- a/src/square/requests/catalog_object_pricing_rule.py +++ b/src/square/requests/catalog_object_pricing_rule.py @@ -1,100 +1,13 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams +from .catalog_object_base import CatalogObjectBaseParams from .catalog_pricing_rule import CatalogPricingRuleParams -from .catalog_v1id import CatalogV1IdParams -class CatalogObjectPricingRuleParams(typing_extensions.TypedDict): - type: typing.Literal["PRICING_RULE"] +class CatalogObjectPricingRuleParams(CatalogObjectBaseParams): pricing_rule_data: typing_extensions.NotRequired[CatalogPricingRuleParams] """ Structured data for a `CatalogPricingRule`, set for CatalogObjects of type `PRICING_RULE`. A `CatalogPricingRule` object often works with a `CatalogProductSet` object or a `CatalogTimePeriod` object. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_product_set.py b/src/square/requests/catalog_object_product_set.py index 11b19f89..986417fb 100644 --- a/src/square/requests/catalog_object_product_set.py +++ b/src/square/requests/catalog_object_product_set.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams +from .catalog_object_base import CatalogObjectBaseParams from .catalog_product_set import CatalogProductSetParams -from .catalog_v1id import CatalogV1IdParams -class CatalogObjectProductSetParams(typing_extensions.TypedDict): - type: typing.Literal["PRODUCT_SET"] +class CatalogObjectProductSetParams(CatalogObjectBaseParams): product_set_data: typing_extensions.NotRequired[CatalogProductSetParams] """ Structured data for a `CatalogProductSet`, set for CatalogObjects of type `PRODUCT_SET`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_quick_amounts_settings.py b/src/square/requests/catalog_object_quick_amounts_settings.py index e8178b86..43d37fa7 100644 --- a/src/square/requests/catalog_object_quick_amounts_settings.py +++ b/src/square/requests/catalog_object_quick_amounts_settings.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams +from .catalog_object_base import CatalogObjectBaseParams from .catalog_quick_amounts_settings import CatalogQuickAmountsSettingsParams -from .catalog_v1id import CatalogV1IdParams -class CatalogObjectQuickAmountsSettingsParams(typing_extensions.TypedDict): - type: typing.Literal["QUICK_AMOUNTS_SETTINGS"] +class CatalogObjectQuickAmountsSettingsParams(CatalogObjectBaseParams): quick_amounts_settings_data: typing_extensions.NotRequired[CatalogQuickAmountsSettingsParams] """ Structured data for a `CatalogQuickAmountsSettings`, set for CatalogObjects of type `QUICK_AMOUNTS_SETTINGS`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_subscription_plan.py b/src/square/requests/catalog_object_subscription_plan.py index fa08f44a..cc533de0 100644 --- a/src/square/requests/catalog_object_subscription_plan.py +++ b/src/square/requests/catalog_object_subscription_plan.py @@ -5,99 +5,14 @@ import typing import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams -from .catalog_v1id import CatalogV1IdParams +from .catalog_object_base import CatalogObjectBaseParams if typing.TYPE_CHECKING: from .catalog_subscription_plan import CatalogSubscriptionPlanParams -class CatalogObjectSubscriptionPlanParams(typing_extensions.TypedDict): - type: typing.Literal["SUBSCRIPTION_PLAN"] +class CatalogObjectSubscriptionPlanParams(CatalogObjectBaseParams): subscription_plan_data: typing_extensions.NotRequired["CatalogSubscriptionPlanParams"] """ Structured data for a `CatalogSubscriptionPlan`, set for CatalogObjects of type `SUBSCRIPTION_PLAN`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_subscription_plan_variation.py b/src/square/requests/catalog_object_subscription_plan_variation.py index e6df5ab9..1abe46b1 100644 --- a/src/square/requests/catalog_object_subscription_plan_variation.py +++ b/src/square/requests/catalog_object_subscription_plan_variation.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams +from .catalog_object_base import CatalogObjectBaseParams from .catalog_subscription_plan_variation import CatalogSubscriptionPlanVariationParams -from .catalog_v1id import CatalogV1IdParams -class CatalogObjectSubscriptionPlanVariationParams(typing_extensions.TypedDict): - type: typing.Literal["SUBSCRIPTION_PLAN_VARIATION"] +class CatalogObjectSubscriptionPlanVariationParams(CatalogObjectBaseParams): subscription_plan_variation_data: typing_extensions.NotRequired[CatalogSubscriptionPlanVariationParams] """ Structured data for a `CatalogSubscriptionPlanVariation`, set for CatalogObjects of type `SUBSCRIPTION_PLAN_VARIATION`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_tax.py b/src/square/requests/catalog_object_tax.py index 4ec491db..6f44bafb 100644 --- a/src/square/requests/catalog_object_tax.py +++ b/src/square/requests/catalog_object_tax.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams +from .catalog_object_base import CatalogObjectBaseParams from .catalog_tax import CatalogTaxParams -from .catalog_v1id import CatalogV1IdParams -class CatalogObjectTaxParams(typing_extensions.TypedDict): - type: typing.Literal["TAX"] +class CatalogObjectTaxParams(CatalogObjectBaseParams): tax_data: typing_extensions.NotRequired[CatalogTaxParams] """ Structured data for a `CatalogTax`, set for CatalogObjects of type `TAX`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/requests/catalog_object_time_period.py b/src/square/requests/catalog_object_time_period.py index bc5cd05e..e6457092 100644 --- a/src/square/requests/catalog_object_time_period.py +++ b/src/square/requests/catalog_object_time_period.py @@ -1,99 +1,12 @@ # This file was auto-generated by Fern from our API Definition. -import typing - import typing_extensions -from ..core.serialization import FieldMetadata -from .catalog_custom_attribute_value import CatalogCustomAttributeValueParams +from .catalog_object_base import CatalogObjectBaseParams from .catalog_time_period import CatalogTimePeriodParams -from .catalog_v1id import CatalogV1IdParams -class CatalogObjectTimePeriodParams(typing_extensions.TypedDict): - type: typing.Literal["TIME_PERIOD"] +class CatalogObjectTimePeriodParams(CatalogObjectBaseParams): time_period_data: typing_extensions.NotRequired[CatalogTimePeriodParams] """ Structured data for a `CatalogTimePeriod`, set for CatalogObjects of type `TIME_PERIOD`. """ - - id: str - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing_extensions.NotRequired[str] - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing_extensions.NotRequired[int] - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing_extensions.NotRequired[bool] - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing_extensions.NotRequired[typing.Dict[str, CatalogCustomAttributeValueParams]] - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.NotRequired[ - typing_extensions.Annotated[typing.Sequence[CatalogV1IdParams], FieldMetadata(alias="catalog_v1_ids")] - ] - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing_extensions.NotRequired[bool] - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing_extensions.NotRequired[typing.Sequence[str]] - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing_extensions.NotRequired[str] - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ diff --git a/src/square/types/batch_get_catalog_objects_response.py b/src/square/types/batch_get_catalog_objects_response.py index cdaf63f9..d47dad47 100644 --- a/src/square/types/batch_get_catalog_objects_response.py +++ b/src/square/types/batch_get_catalog_objects_response.py @@ -36,16 +36,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( BatchGetCatalogObjectsResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/batch_upsert_catalog_objects_response.py b/src/square/types/batch_upsert_catalog_objects_response.py index 87abcc51..79f52b4b 100644 --- a/src/square/types/batch_upsert_catalog_objects_response.py +++ b/src/square/types/batch_upsert_catalog_objects_response.py @@ -42,16 +42,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( BatchUpsertCatalogObjectsResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/catalog_category.py b/src/square/types/catalog_category.py index 3c69e61c..3c2a4813 100644 --- a/src/square/types/catalog_category.py +++ b/src/square/types/catalog_category.py @@ -87,4 +87,4 @@ class Config: from .catalog_object_category import CatalogObjectCategory # noqa: E402, I001 -update_forward_refs(CatalogCategory) +update_forward_refs(CatalogCategory, CatalogObjectCategory=CatalogObjectCategory) diff --git a/src/square/types/catalog_item.py b/src/square/types/catalog_item.py index 08b5c2a6..6bba4f46 100644 --- a/src/square/types/catalog_item.py +++ b/src/square/types/catalog_item.py @@ -210,17 +210,27 @@ class Config: extra = pydantic.Extra.allow -from .catalog_object_category import CatalogObjectCategory # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 +from .catalog_category import CatalogCategory # noqa: E402, I001 +from .catalog_object_category import CatalogObjectCategory # noqa: E402, I001 update_forward_refs( CatalogItem, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogCategory=CatalogCategory, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectCategory=CatalogObjectCategory, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/catalog_item_option.py b/src/square/types/catalog_item_option.py index af0cf3ca..2b8c1710 100644 --- a/src/square/types/catalog_item_option.py +++ b/src/square/types/catalog_item_option.py @@ -53,16 +53,23 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( CatalogItemOption, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/catalog_modifier_list.py b/src/square/types/catalog_modifier_list.py index 36be51b2..3b678716 100644 --- a/src/square/types/catalog_modifier_list.py +++ b/src/square/types/catalog_modifier_list.py @@ -141,16 +141,23 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( CatalogModifierList, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/catalog_object.py b/src/square/types/catalog_object.py index 167f2f54..61152b61 100644 --- a/src/square/types/catalog_object.py +++ b/src/square/types/catalog_object.py @@ -4,45 +4,847 @@ import typing -from .catalog_object_availability_period import CatalogObjectAvailabilityPeriod -from .catalog_object_category import CatalogObjectCategory -from .catalog_object_custom_attribute_definition import CatalogObjectCustomAttributeDefinition -from .catalog_object_discount import CatalogObjectDiscount -from .catalog_object_image import CatalogObjectImage -from .catalog_object_item_option_value import CatalogObjectItemOptionValue -from .catalog_object_item_variation import CatalogObjectItemVariation -from .catalog_object_measurement_unit import CatalogObjectMeasurementUnit -from .catalog_object_modifier import CatalogObjectModifier -from .catalog_object_pricing_rule import CatalogObjectPricingRule -from .catalog_object_product_set import CatalogObjectProductSet -from .catalog_object_quick_amounts_settings import CatalogObjectQuickAmountsSettings -from .catalog_object_subscription_plan_variation import CatalogObjectSubscriptionPlanVariation -from .catalog_object_tax import CatalogObjectTax -from .catalog_object_time_period import CatalogObjectTimePeriod - -if typing.TYPE_CHECKING: - from .catalog_object_item import CatalogObjectItem - from .catalog_object_item_option import CatalogObjectItemOption - from .catalog_object_modifier_list import CatalogObjectModifierList - from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan -CatalogObject = typing.Union[ - "CatalogObjectItem", - CatalogObjectImage, - CatalogObjectCategory, - CatalogObjectItemVariation, - CatalogObjectTax, - CatalogObjectDiscount, - "CatalogObjectModifierList", - CatalogObjectModifier, - CatalogObjectPricingRule, - CatalogObjectProductSet, - CatalogObjectTimePeriod, - CatalogObjectMeasurementUnit, - CatalogObjectSubscriptionPlanVariation, - "CatalogObjectItemOption", - CatalogObjectItemOptionValue, - CatalogObjectCustomAttributeDefinition, - CatalogObjectQuickAmountsSettings, - "CatalogObjectSubscriptionPlan", - CatalogObjectAvailabilityPeriod, +import pydantic +import typing_extensions +from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs +from ..core.serialization import FieldMetadata +from ..core.unchecked_base_model import UncheckedBaseModel, UnionMetadata +from .catalog_availability_period import CatalogAvailabilityPeriod +from .catalog_custom_attribute_definition import CatalogCustomAttributeDefinition +from .catalog_custom_attribute_value import CatalogCustomAttributeValue +from .catalog_discount import CatalogDiscount +from .catalog_image import CatalogImage +from .catalog_item_option_value import CatalogItemOptionValue +from .catalog_item_variation import CatalogItemVariation +from .catalog_measurement_unit import CatalogMeasurementUnit +from .catalog_modifier import CatalogModifier +from .catalog_pricing_rule import CatalogPricingRule +from .catalog_product_set import CatalogProductSet +from .catalog_quick_amounts_settings import CatalogQuickAmountsSettings +from .catalog_subscription_plan_variation import CatalogSubscriptionPlanVariation +from .catalog_tax import CatalogTax +from .catalog_time_period import CatalogTimePeriod +from .catalog_v1id import CatalogV1Id + + +class CatalogObject_Item(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["ITEM"] = "ITEM" + item_data: typing.Optional["CatalogItem"] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_Image(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["IMAGE"] = "IMAGE" + image_data: typing.Optional[CatalogImage] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_Category(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["CATEGORY"] = "CATEGORY" + id: typing.Optional[str] = None + ordinal: typing.Optional[int] = None + category_data: typing.Optional["CatalogCategory"] = None + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_ItemVariation(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["ITEM_VARIATION"] = "ITEM_VARIATION" + item_variation_data: typing.Optional[CatalogItemVariation] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_Tax(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["TAX"] = "TAX" + tax_data: typing.Optional[CatalogTax] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_Discount(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["DISCOUNT"] = "DISCOUNT" + discount_data: typing.Optional[CatalogDiscount] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_ModifierList(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["MODIFIER_LIST"] = "MODIFIER_LIST" + modifier_list_data: typing.Optional["CatalogModifierList"] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_Modifier(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["MODIFIER"] = "MODIFIER" + modifier_data: typing.Optional[CatalogModifier] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_PricingRule(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["PRICING_RULE"] = "PRICING_RULE" + pricing_rule_data: typing.Optional[CatalogPricingRule] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_ProductSet(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["PRODUCT_SET"] = "PRODUCT_SET" + product_set_data: typing.Optional[CatalogProductSet] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_TimePeriod(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["TIME_PERIOD"] = "TIME_PERIOD" + time_period_data: typing.Optional[CatalogTimePeriod] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_MeasurementUnit(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["MEASUREMENT_UNIT"] = "MEASUREMENT_UNIT" + measurement_unit_data: typing.Optional[CatalogMeasurementUnit] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_SubscriptionPlanVariation(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["SUBSCRIPTION_PLAN_VARIATION"] = "SUBSCRIPTION_PLAN_VARIATION" + subscription_plan_variation_data: typing.Optional[CatalogSubscriptionPlanVariation] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_ItemOption(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["ITEM_OPTION"] = "ITEM_OPTION" + item_option_data: typing.Optional["CatalogItemOption"] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_ItemOptionVal(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["ITEM_OPTION_VAL"] = "ITEM_OPTION_VAL" + item_option_value_data: typing.Optional[CatalogItemOptionValue] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_CustomAttributeDefinition(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["CUSTOM_ATTRIBUTE_DEFINITION"] = "CUSTOM_ATTRIBUTE_DEFINITION" + custom_attribute_definition_data: typing.Optional[CatalogCustomAttributeDefinition] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_QuickAmountsSettings(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["QUICK_AMOUNTS_SETTINGS"] = "QUICK_AMOUNTS_SETTINGS" + quick_amounts_settings_data: typing.Optional[CatalogQuickAmountsSettings] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_SubscriptionPlan(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["SUBSCRIPTION_PLAN"] = "SUBSCRIPTION_PLAN" + subscription_plan_data: typing.Optional["CatalogSubscriptionPlan"] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +class CatalogObject_AvailabilityPeriod(UncheckedBaseModel): + """ + The wrapper object for the catalog entries of a given object type. + + Depending on the `type` attribute value, a `CatalogObject` instance assumes a type-specific data to yield the corresponding type of catalog object. + + For example, if `type=ITEM`, the `CatalogObject` instance must have the ITEM-specific data set on the `item_data` attribute. The resulting `CatalogObject` instance is also a `CatalogItem` instance. + + In general, if `type=`, the `CatalogObject` instance must have the ``-specific data set on the `_data` attribute. The resulting `CatalogObject` instance is also a `Catalog` instance. + + For a more detailed discussion of the Catalog data model, please see the + [Design a Catalog](https://developer.squareup.com/docs/catalog-api/design-a-catalog) guide. + """ + + type: typing.Literal["AVAILABILITY_PERIOD"] = "AVAILABILITY_PERIOD" + availability_period_data: typing.Optional[CatalogAvailabilityPeriod] = None + id: str + updated_at: typing.Optional[str] = None + version: typing.Optional[int] = None + is_deleted: typing.Optional[bool] = None + custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = None + catalog_v1ids: typing_extensions.Annotated[ + typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") + ] = None + present_at_all_locations: typing.Optional[bool] = None + present_at_location_ids: typing.Optional[typing.List[str]] = None + absent_at_location_ids: typing.Optional[typing.List[str]] = None + image_id: typing.Optional[str] = None + + 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 + + +CatalogObject = typing_extensions.Annotated[ + typing.Union[ + CatalogObject_Item, + CatalogObject_Image, + CatalogObject_Category, + CatalogObject_ItemVariation, + CatalogObject_Tax, + CatalogObject_Discount, + CatalogObject_ModifierList, + CatalogObject_Modifier, + CatalogObject_PricingRule, + CatalogObject_ProductSet, + CatalogObject_TimePeriod, + CatalogObject_MeasurementUnit, + CatalogObject_SubscriptionPlanVariation, + CatalogObject_ItemOption, + CatalogObject_ItemOptionVal, + CatalogObject_CustomAttributeDefinition, + CatalogObject_QuickAmountsSettings, + CatalogObject_SubscriptionPlan, + CatalogObject_AvailabilityPeriod, + ], + UnionMetadata(discriminant="type"), ] +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 +from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 +from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 +from .catalog_category import CatalogCategory # noqa: E402, I001 +from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 + +update_forward_refs( + CatalogObject_Item, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectItemOption=CatalogObjectItemOption, + CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, +) +update_forward_refs(CatalogObject_Category, CatalogCategory=CatalogCategory) +update_forward_refs( + CatalogObject_ModifierList, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, +) +update_forward_refs( + CatalogObject_ItemOption, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectItem=CatalogObjectItem, + CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, +) +update_forward_refs( + CatalogObject_SubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, + CatalogObjectModifierList=CatalogObjectModifierList, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, +) diff --git a/src/square/types/catalog_object_availability_period.py b/src/square/types/catalog_object_availability_period.py index df76f0bb..85898055 100644 --- a/src/square/types/catalog_object_availability_period.py +++ b/src/square/types/catalog_object_availability_period.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel from .catalog_availability_period import CatalogAvailabilityPeriod -from .catalog_custom_attribute_value import CatalogCustomAttributeValue -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectAvailabilityPeriod(UncheckedBaseModel): - type: typing.Literal["AVAILABILITY_PERIOD"] = "AVAILABILITY_PERIOD" +class CatalogObjectAvailabilityPeriod(CatalogObjectBase): availability_period_data: typing.Optional[CatalogAvailabilityPeriod] = pydantic.Field(default=None) """ Structured data for a `CatalogAvailabilityPeriod`, set for CatalogObjects of type `AVAILABILITY_PERIOD`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_base.py b/src/square/types/catalog_object_base.py index 467a19f3..f7b3fe01 100644 --- a/src/square/types/catalog_object_base.py +++ b/src/square/types/catalog_object_base.py @@ -8,18 +8,10 @@ from ..core.serialization import FieldMetadata from ..core.unchecked_base_model import UncheckedBaseModel from .catalog_custom_attribute_value import CatalogCustomAttributeValue -from .catalog_object_type import CatalogObjectType from .catalog_v1id import CatalogV1Id class CatalogObjectBase(UncheckedBaseModel): - type: CatalogObjectType = pydantic.Field() - """ - The type of this object. Each object type has expected - properties expressed in a structured format within its corresponding `*_data` field below. - See [CatalogObjectType](#type-catalogobjecttype) for possible values - """ - id: str = pydantic.Field() """ An identifier to reference this object in the catalog. When a new `CatalogObject` diff --git a/src/square/types/catalog_object_batch.py b/src/square/types/catalog_object_batch.py index d2c45b54..6f6115bd 100644 --- a/src/square/types/catalog_object_batch.py +++ b/src/square/types/catalog_object_batch.py @@ -29,16 +29,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( CatalogObjectBatch, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/catalog_object_category.py b/src/square/types/catalog_object_category.py index 99a35db2..82e0d6aa 100644 --- a/src/square/types/catalog_object_category.py +++ b/src/square/types/catalog_object_category.py @@ -30,7 +30,7 @@ class CatalogObjectCategory(UncheckedBaseModel): The order of the object within the context of the category. """ - type: typing.Literal["CATEGORY"] = "CATEGORY" + type: typing.Optional[typing.Literal["CATEGORY"]] = None category_data: typing.Optional["CatalogCategory"] = pydantic.Field(default=None) """ Structured data for a `CatalogCategory`, set for CatalogObjects of type `CATEGORY`. @@ -121,4 +121,4 @@ class Config: from .catalog_category import CatalogCategory # noqa: E402, I001 -update_forward_refs(CatalogObjectCategory) +update_forward_refs(CatalogObjectCategory, CatalogCategory=CatalogCategory) diff --git a/src/square/types/catalog_object_custom_attribute_definition.py b/src/square/types/catalog_object_custom_attribute_definition.py index aeb77ee6..d463ec0f 100644 --- a/src/square/types/catalog_object_custom_attribute_definition.py +++ b/src/square/types/catalog_object_custom_attribute_definition.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel from .catalog_custom_attribute_definition import CatalogCustomAttributeDefinition -from .catalog_custom_attribute_value import CatalogCustomAttributeValue -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectCustomAttributeDefinition(UncheckedBaseModel): - type: typing.Literal["CUSTOM_ATTRIBUTE_DEFINITION"] = "CUSTOM_ATTRIBUTE_DEFINITION" +class CatalogObjectCustomAttributeDefinition(CatalogObjectBase): custom_attribute_definition_data: typing.Optional[CatalogCustomAttributeDefinition] = pydantic.Field(default=None) """ Structured data for a `CatalogCustomAttributeDefinition`, set for CatalogObjects of type `CUSTOM_ATTRIBUTE_DEFINITION`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_discount.py b/src/square/types/catalog_object_discount.py index aae3de08..d8db6a50 100644 --- a/src/square/types/catalog_object_discount.py +++ b/src/square/types/catalog_object_discount.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue from .catalog_discount import CatalogDiscount -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectDiscount(UncheckedBaseModel): - type: typing.Literal["DISCOUNT"] = "DISCOUNT" +class CatalogObjectDiscount(CatalogObjectBase): discount_data: typing.Optional[CatalogDiscount] = pydantic.Field(default=None) """ Structured data for a `CatalogDiscount`, set for CatalogObjects of type `DISCOUNT`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_image.py b/src/square/types/catalog_object_image.py index be690e52..5e3977c8 100644 --- a/src/square/types/catalog_object_image.py +++ b/src/square/types/catalog_object_image.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue from .catalog_image import CatalogImage -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectImage(UncheckedBaseModel): - type: typing.Literal["IMAGE"] = "IMAGE" +class CatalogObjectImage(CatalogObjectBase): image_data: typing.Optional[CatalogImage] = pydantic.Field(default=None) """ Structured data for a `CatalogImage`, set for CatalogObjects of type `IMAGE`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_item.py b/src/square/types/catalog_object_item.py index 36e68c26..5e21a229 100644 --- a/src/square/types/catalog_object_item.py +++ b/src/square/types/catalog_object_item.py @@ -5,105 +5,16 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectItem(UncheckedBaseModel): - type: typing.Literal["ITEM"] = "ITEM" +class CatalogObjectItem(CatalogObjectBase): item_data: typing.Optional["CatalogItem"] = pydantic.Field(default=None) """ Structured data for a `CatalogItem`, set for CatalogObjects of type `ITEM`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: @@ -115,5 +26,22 @@ class Config: from .catalog_item import CatalogItem # noqa: E402, I001 - -update_forward_refs(CatalogObjectItem) +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 +from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 +from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 + +update_forward_refs( + CatalogObjectItem, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectItemOption=CatalogObjectItemOption, + CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, +) diff --git a/src/square/types/catalog_object_item_option.py b/src/square/types/catalog_object_item_option.py index 5abd62a9..558cd34f 100644 --- a/src/square/types/catalog_object_item_option.py +++ b/src/square/types/catalog_object_item_option.py @@ -5,105 +5,16 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectItemOption(UncheckedBaseModel): - type: typing.Literal["ITEM_OPTION"] = "ITEM_OPTION" +class CatalogObjectItemOption(CatalogObjectBase): item_option_data: typing.Optional["CatalogItemOption"] = pydantic.Field(default=None) """ Structured data for a `CatalogItemOption`, set for CatalogObjects of type `ITEM_OPTION`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: @@ -114,6 +25,23 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 from .catalog_item_option import CatalogItemOption # noqa: E402, I001 - -update_forward_refs(CatalogObjectItemOption) +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 +from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 +from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 + +update_forward_refs( + CatalogObjectItemOption, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectItem=CatalogObjectItem, + CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, +) diff --git a/src/square/types/catalog_object_item_option_value.py b/src/square/types/catalog_object_item_option_value.py index 87f53952..7c0a4e27 100644 --- a/src/square/types/catalog_object_item_option_value.py +++ b/src/square/types/catalog_object_item_option_value.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue from .catalog_item_option_value import CatalogItemOptionValue -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectItemOptionValue(UncheckedBaseModel): - type: typing.Literal["ITEM_OPTION_VAL"] = "ITEM_OPTION_VAL" +class CatalogObjectItemOptionValue(CatalogObjectBase): item_option_value_data: typing.Optional[CatalogItemOptionValue] = pydantic.Field(default=None) """ Structured data for a `CatalogItemOptionValue`, set for CatalogObjects of type `ITEM_OPTION_VAL`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_item_variation.py b/src/square/types/catalog_object_item_variation.py index 49c60c91..ab881326 100644 --- a/src/square/types/catalog_object_item_variation.py +++ b/src/square/types/catalog_object_item_variation.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue from .catalog_item_variation import CatalogItemVariation -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectItemVariation(UncheckedBaseModel): - type: typing.Literal["ITEM_VARIATION"] = "ITEM_VARIATION" +class CatalogObjectItemVariation(CatalogObjectBase): item_variation_data: typing.Optional[CatalogItemVariation] = pydantic.Field(default=None) """ Structured data for a `CatalogItemVariation`, set for CatalogObjects of type `ITEM_VARIATION`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_measurement_unit.py b/src/square/types/catalog_object_measurement_unit.py index e4c7eae9..016db932 100644 --- a/src/square/types/catalog_object_measurement_unit.py +++ b/src/square/types/catalog_object_measurement_unit.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue from .catalog_measurement_unit import CatalogMeasurementUnit -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectMeasurementUnit(UncheckedBaseModel): - type: typing.Literal["MEASUREMENT_UNIT"] = "MEASUREMENT_UNIT" +class CatalogObjectMeasurementUnit(CatalogObjectBase): measurement_unit_data: typing.Optional[CatalogMeasurementUnit] = pydantic.Field(default=None) """ Structured data for a `CatalogMeasurementUnit`, set for CatalogObjects of type `MEASUREMENT_UNIT`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_modifier.py b/src/square/types/catalog_object_modifier.py index 5f7759fc..af659ddd 100644 --- a/src/square/types/catalog_object_modifier.py +++ b/src/square/types/catalog_object_modifier.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue from .catalog_modifier import CatalogModifier -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectModifier(UncheckedBaseModel): - type: typing.Literal["MODIFIER"] = "MODIFIER" +class CatalogObjectModifier(CatalogObjectBase): modifier_data: typing.Optional[CatalogModifier] = pydantic.Field(default=None) """ Structured data for a `CatalogModifier`, set for CatalogObjects of type `MODIFIER`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_modifier_list.py b/src/square/types/catalog_object_modifier_list.py index 15634226..5f3a8516 100644 --- a/src/square/types/catalog_object_modifier_list.py +++ b/src/square/types/catalog_object_modifier_list.py @@ -5,105 +5,16 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectModifierList(UncheckedBaseModel): - type: typing.Literal["MODIFIER_LIST"] = "MODIFIER_LIST" +class CatalogObjectModifierList(CatalogObjectBase): modifier_list_data: typing.Optional["CatalogModifierList"] = pydantic.Field(default=None) """ Structured data for a `CatalogModifierList`, set for CatalogObjects of type `MODIFIER_LIST`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: @@ -114,6 +25,23 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 - -update_forward_refs(CatalogObjectModifierList) +from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 +from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 +from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 + +update_forward_refs( + CatalogObjectModifierList, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, +) diff --git a/src/square/types/catalog_object_pricing_rule.py b/src/square/types/catalog_object_pricing_rule.py index c80e2707..43024e81 100644 --- a/src/square/types/catalog_object_pricing_rule.py +++ b/src/square/types/catalog_object_pricing_rule.py @@ -3,107 +3,18 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue +from .catalog_object_base import CatalogObjectBase from .catalog_pricing_rule import CatalogPricingRule -from .catalog_v1id import CatalogV1Id -class CatalogObjectPricingRule(UncheckedBaseModel): - type: typing.Literal["PRICING_RULE"] = "PRICING_RULE" +class CatalogObjectPricingRule(CatalogObjectBase): pricing_rule_data: typing.Optional[CatalogPricingRule] = pydantic.Field(default=None) """ Structured data for a `CatalogPricingRule`, set for CatalogObjects of type `PRICING_RULE`. A `CatalogPricingRule` object often works with a `CatalogProductSet` object or a `CatalogTimePeriod` object. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_product_set.py b/src/square/types/catalog_object_product_set.py index c7b907e6..73833eb3 100644 --- a/src/square/types/catalog_object_product_set.py +++ b/src/square/types/catalog_object_product_set.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue +from .catalog_object_base import CatalogObjectBase from .catalog_product_set import CatalogProductSet -from .catalog_v1id import CatalogV1Id -class CatalogObjectProductSet(UncheckedBaseModel): - type: typing.Literal["PRODUCT_SET"] = "PRODUCT_SET" +class CatalogObjectProductSet(CatalogObjectBase): product_set_data: typing.Optional[CatalogProductSet] = pydantic.Field(default=None) """ Structured data for a `CatalogProductSet`, set for CatalogObjects of type `PRODUCT_SET`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_quick_amounts_settings.py b/src/square/types/catalog_object_quick_amounts_settings.py index da6de61f..7c923140 100644 --- a/src/square/types/catalog_object_quick_amounts_settings.py +++ b/src/square/types/catalog_object_quick_amounts_settings.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue +from .catalog_object_base import CatalogObjectBase from .catalog_quick_amounts_settings import CatalogQuickAmountsSettings -from .catalog_v1id import CatalogV1Id -class CatalogObjectQuickAmountsSettings(UncheckedBaseModel): - type: typing.Literal["QUICK_AMOUNTS_SETTINGS"] = "QUICK_AMOUNTS_SETTINGS" +class CatalogObjectQuickAmountsSettings(CatalogObjectBase): quick_amounts_settings_data: typing.Optional[CatalogQuickAmountsSettings] = pydantic.Field(default=None) """ Structured data for a `CatalogQuickAmountsSettings`, set for CatalogObjects of type `QUICK_AMOUNTS_SETTINGS`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_subscription_plan.py b/src/square/types/catalog_object_subscription_plan.py index 15849004..f97ec8fc 100644 --- a/src/square/types/catalog_object_subscription_plan.py +++ b/src/square/types/catalog_object_subscription_plan.py @@ -5,105 +5,16 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2, update_forward_refs -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue -from .catalog_v1id import CatalogV1Id +from .catalog_object_base import CatalogObjectBase -class CatalogObjectSubscriptionPlan(UncheckedBaseModel): - type: typing.Literal["SUBSCRIPTION_PLAN"] = "SUBSCRIPTION_PLAN" +class CatalogObjectSubscriptionPlan(CatalogObjectBase): subscription_plan_data: typing.Optional["CatalogSubscriptionPlan"] = pydantic.Field(default=None) """ Structured data for a `CatalogSubscriptionPlan`, set for CatalogObjects of type `SUBSCRIPTION_PLAN`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: @@ -114,6 +25,23 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 +from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 +from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 -update_forward_refs(CatalogObjectSubscriptionPlan) +update_forward_refs( + CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, + CatalogObjectModifierList=CatalogObjectModifierList, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, +) diff --git a/src/square/types/catalog_object_subscription_plan_variation.py b/src/square/types/catalog_object_subscription_plan_variation.py index eb2649f7..0911f231 100644 --- a/src/square/types/catalog_object_subscription_plan_variation.py +++ b/src/square/types/catalog_object_subscription_plan_variation.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue +from .catalog_object_base import CatalogObjectBase from .catalog_subscription_plan_variation import CatalogSubscriptionPlanVariation -from .catalog_v1id import CatalogV1Id -class CatalogObjectSubscriptionPlanVariation(UncheckedBaseModel): - type: typing.Literal["SUBSCRIPTION_PLAN_VARIATION"] = "SUBSCRIPTION_PLAN_VARIATION" +class CatalogObjectSubscriptionPlanVariation(CatalogObjectBase): subscription_plan_variation_data: typing.Optional[CatalogSubscriptionPlanVariation] = pydantic.Field(default=None) """ Structured data for a `CatalogSubscriptionPlanVariation`, set for CatalogObjects of type `SUBSCRIPTION_PLAN_VARIATION`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_tax.py b/src/square/types/catalog_object_tax.py index cfbbe611..82d6fe8d 100644 --- a/src/square/types/catalog_object_tax.py +++ b/src/square/types/catalog_object_tax.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue +from .catalog_object_base import CatalogObjectBase from .catalog_tax import CatalogTax -from .catalog_v1id import CatalogV1Id -class CatalogObjectTax(UncheckedBaseModel): - type: typing.Literal["TAX"] = "TAX" +class CatalogObjectTax(CatalogObjectBase): tax_data: typing.Optional[CatalogTax] = pydantic.Field(default=None) """ Structured data for a `CatalogTax`, set for CatalogObjects of type `TAX`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_object_time_period.py b/src/square/types/catalog_object_time_period.py index c307d930..11e0a809 100644 --- a/src/square/types/catalog_object_time_period.py +++ b/src/square/types/catalog_object_time_period.py @@ -3,106 +3,17 @@ import typing import pydantic -import typing_extensions from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.serialization import FieldMetadata -from ..core.unchecked_base_model import UncheckedBaseModel -from .catalog_custom_attribute_value import CatalogCustomAttributeValue +from .catalog_object_base import CatalogObjectBase from .catalog_time_period import CatalogTimePeriod -from .catalog_v1id import CatalogV1Id -class CatalogObjectTimePeriod(UncheckedBaseModel): - type: typing.Literal["TIME_PERIOD"] = "TIME_PERIOD" +class CatalogObjectTimePeriod(CatalogObjectBase): time_period_data: typing.Optional[CatalogTimePeriod] = pydantic.Field(default=None) """ Structured data for a `CatalogTimePeriod`, set for CatalogObjects of type `TIME_PERIOD`. """ - id: str = pydantic.Field() - """ - An identifier to reference this object in the catalog. When a new `CatalogObject` - is inserted, the client should set the id to a temporary identifier starting with - a "`#`" character. Other objects being inserted or updated within the same request - may use this identifier to refer to the new object. - - When the server receives the new object, it will supply a unique identifier that - replaces the temporary identifier for all future references. - """ - - updated_at: typing.Optional[str] = pydantic.Field(default=None) - """ - Last modification [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) in RFC 3339 format, e.g., `"2016-08-15T23:59:33.123Z"` - would indicate the UTC time (denoted by `Z`) of August 15, 2016 at 23:59:33 and 123 milliseconds. - """ - - version: typing.Optional[int] = pydantic.Field(default=None) - """ - The version of the object. When updating an object, the version supplied - must match the version in the database, otherwise the write will be rejected as conflicting. - """ - - is_deleted: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, the object has been deleted from the database. Must be `false` for new objects - being inserted. When deleted, the `updated_at` field will equal the deletion time. - """ - - custom_attribute_values: typing.Optional[typing.Dict[str, CatalogCustomAttributeValue]] = pydantic.Field( - default=None - ) - """ - A map (key-value pairs) of application-defined custom attribute values. The value of a key-value pair - is a [CatalogCustomAttributeValue](entity:CatalogCustomAttributeValue) object. The key is the `key` attribute - value defined in the associated [CatalogCustomAttributeDefinition](entity:CatalogCustomAttributeDefinition) - object defined by the application making the request. - - If the `CatalogCustomAttributeDefinition` object is - defined by another application, the `CatalogCustomAttributeDefinition`'s key attribute value is prefixed by - the defining application ID. For example, if the `CatalogCustomAttributeDefinition` has a `key` attribute of - `"cocoa_brand"` and the defining application ID is `"abcd1234"`, the key in the map is `"abcd1234:cocoa_brand"` - if the application making the request is different from the application defining the custom attribute definition. - Otherwise, the key used in the map is simply `"cocoa_brand"`. - - Application-defined custom attributes are set at a global (location-independent) level. - Custom attribute values are intended to store additional information about a catalog object - or associations with an entity in another system. Do not use custom attributes - to store any sensitive information (personally identifiable information, card details, etc.). - """ - - catalog_v1ids: typing_extensions.Annotated[ - typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) - """ - The Connect v1 IDs for this object at each location where it is present, where they - differ from the object's Connect V2 ID. The field will only be present for objects that - have been created or modified by legacy APIs. - """ - - present_at_all_locations: typing.Optional[bool] = pydantic.Field(default=None) - """ - If `true`, this object is present at all locations (including future locations), except where specified in - the `absent_at_location_ids` field. If `false`, this object is not present at any locations (including future locations), - except where specified in the `present_at_location_ids` field. If not specified, defaults to `true`. - """ - - present_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is present, even if `present_at_all_locations` is `false`. - This can include locations that are deactivated. - """ - - absent_at_location_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) - """ - A list of locations where the object is not present, even if `present_at_all_locations` is `true`. - This can include locations that are deactivated. - """ - - image_id: typing.Optional[str] = pydantic.Field(default=None) - """ - Identifies the `CatalogImage` attached to this `CatalogObject`. - """ - 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_subscription_plan.py b/src/square/types/catalog_subscription_plan.py index 833a772c..7815c7ba 100644 --- a/src/square/types/catalog_subscription_plan.py +++ b/src/square/types/catalog_subscription_plan.py @@ -57,16 +57,23 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 update_forward_refs( CatalogSubscriptionPlan, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, ) diff --git a/src/square/types/create_catalog_image_request.py b/src/square/types/create_catalog_image_request.py index 1473315f..c4790aab 100644 --- a/src/square/types/create_catalog_image_request.py +++ b/src/square/types/create_catalog_image_request.py @@ -49,16 +49,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( CreateCatalogImageRequest, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/create_catalog_image_response.py b/src/square/types/create_catalog_image_response.py index 7e2488f5..5f1a32c0 100644 --- a/src/square/types/create_catalog_image_response.py +++ b/src/square/types/create_catalog_image_response.py @@ -32,16 +32,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( CreateCatalogImageResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/get_catalog_object_response.py b/src/square/types/get_catalog_object_response.py index db646d15..93545680 100644 --- a/src/square/types/get_catalog_object_response.py +++ b/src/square/types/get_catalog_object_response.py @@ -36,16 +36,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( GetCatalogObjectResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/list_catalog_response.py b/src/square/types/list_catalog_response.py index c9c9e898..8610b157 100644 --- a/src/square/types/list_catalog_response.py +++ b/src/square/types/list_catalog_response.py @@ -37,16 +37,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( ListCatalogResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/payment_link_related_resources.py b/src/square/types/payment_link_related_resources.py index d7e4ebb8..159d741c 100644 --- a/src/square/types/payment_link_related_resources.py +++ b/src/square/types/payment_link_related_resources.py @@ -31,16 +31,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( PaymentLinkRelatedResources, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/search_catalog_items_response.py b/src/square/types/search_catalog_items_response.py index 1f8e338f..5abb5514 100644 --- a/src/square/types/search_catalog_items_response.py +++ b/src/square/types/search_catalog_items_response.py @@ -45,16 +45,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( SearchCatalogItemsResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/search_catalog_objects_response.py b/src/square/types/search_catalog_objects_response.py index e9af821e..6f5bebc6 100644 --- a/src/square/types/search_catalog_objects_response.py +++ b/src/square/types/search_catalog_objects_response.py @@ -48,16 +48,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( SearchCatalogObjectsResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/update_catalog_image_response.py b/src/square/types/update_catalog_image_response.py index a5d8d91f..05200a1d 100644 --- a/src/square/types/update_catalog_image_response.py +++ b/src/square/types/update_catalog_image_response.py @@ -32,16 +32,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( UpdateCatalogImageResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/upsert_catalog_object_response.py b/src/square/types/upsert_catalog_object_response.py index 2e34176e..9f386a8b 100644 --- a/src/square/types/upsert_catalog_object_response.py +++ b/src/square/types/upsert_catalog_object_response.py @@ -37,16 +37,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( UpsertCatalogObjectResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/tests/utils/test_http_client.py b/tests/utils/test_http_client.py index c172d0d9..add7f295 100644 --- a/tests/utils/test_http_client.py +++ b/tests/utils/test_http_client.py @@ -1,13 +1,51 @@ # This file was auto-generated by Fern from our API Definition. -from square.core.http_client import get_request_body +from typing import Any, Dict + +import pytest + +from square.core.http_client import AsyncHttpClient, HttpClient, get_request_body, remove_none_from_dict from square.core.request_options import RequestOptions +# Stub clients for testing HttpClient and AsyncHttpClient +class _DummySyncClient: + """A minimal stub for httpx.Client that records request arguments.""" + + def __init__(self) -> None: + self.last_request_kwargs: Dict[str, Any] = {} + + def request(self, **kwargs: Any) -> "_DummyResponse": + self.last_request_kwargs = kwargs + return _DummyResponse() + + +class _DummyAsyncClient: + """A minimal stub for httpx.AsyncClient that records request arguments.""" + + def __init__(self) -> None: + self.last_request_kwargs: Dict[str, Any] = {} + + async def request(self, **kwargs: Any) -> "_DummyResponse": + self.last_request_kwargs = kwargs + return _DummyResponse() + + +class _DummyResponse: + """A minimal stub for httpx.Response.""" + + status_code = 200 + headers: Dict[str, str] = {} + + def get_request_options() -> RequestOptions: return {"additional_body_parameters": {"see you": "later"}} +def get_request_options_with_none() -> RequestOptions: + return {"additional_body_parameters": {"see you": "later", "optional": None}} + + def test_get_json_request_body() -> None: json_body, data_body = get_request_body(json={"hello": "world"}, data=None, request_options=None, omit=None) assert json_body == {"hello": "world"} @@ -59,3 +97,157 @@ def test_get_empty_json_request_body() -> None: assert json_body_extras is None assert data_body_extras is None + + +def test_json_body_preserves_none_values() -> None: + """Test that JSON bodies preserve None values (they become JSON null).""" + json_body, data_body = get_request_body( + json={"hello": "world", "optional": None}, data=None, request_options=None, omit=None + ) + # JSON bodies should preserve None values + assert json_body == {"hello": "world", "optional": None} + assert data_body is None + + +def test_data_body_preserves_none_values_without_multipart() -> None: + """Test that data bodies preserve None values when not using multipart. + + The filtering of None values happens in HttpClient.request/stream methods, + not in get_request_body. This test verifies get_request_body doesn't filter None. + """ + json_body, data_body = get_request_body( + json=None, data={"hello": "world", "optional": None}, request_options=None, omit=None + ) + # get_request_body should preserve None values in data body + # The filtering happens later in HttpClient.request when multipart is detected + assert data_body == {"hello": "world", "optional": None} + assert json_body is None + + +def test_remove_none_from_dict_filters_none_values() -> None: + """Test that remove_none_from_dict correctly filters out None values.""" + original = {"hello": "world", "optional": None, "another": "value", "also_none": None} + filtered = remove_none_from_dict(original) + assert filtered == {"hello": "world", "another": "value"} + # Original should not be modified + assert original == {"hello": "world", "optional": None, "another": "value", "also_none": None} + + +def test_remove_none_from_dict_empty_dict() -> None: + """Test that remove_none_from_dict handles empty dict.""" + assert remove_none_from_dict({}) == {} + + +def test_remove_none_from_dict_all_none() -> None: + """Test that remove_none_from_dict handles dict with all None values.""" + assert remove_none_from_dict({"a": None, "b": None}) == {} + + +def test_http_client_does_not_pass_empty_params_list() -> None: + """Test that HttpClient passes params=None when params are empty. + + This prevents httpx from stripping existing query parameters from the URL, + which happens when params=[] or params={} is passed. + """ + dummy_client = _DummySyncClient() + http_client = HttpClient( + httpx_client=dummy_client, # type: ignore[arg-type] + base_timeout=lambda: None, + base_headers=lambda: {}, + base_url=lambda: "https://example.com", + ) + + # Use a path with query params (e.g., pagination cursor URL) + http_client.request( + path="resource?after=123", + method="GET", + params=None, + request_options=None, + ) + + # We care that httpx receives params=None, not [] or {} + assert "params" in dummy_client.last_request_kwargs + assert dummy_client.last_request_kwargs["params"] is None + + # Verify the query string in the URL is preserved + url = str(dummy_client.last_request_kwargs["url"]) + assert "after=123" in url, f"Expected query param 'after=123' in URL, got: {url}" + + +def test_http_client_passes_encoded_params_when_present() -> None: + """Test that HttpClient passes encoded params when params are provided.""" + dummy_client = _DummySyncClient() + http_client = HttpClient( + httpx_client=dummy_client, # type: ignore[arg-type] + base_timeout=lambda: None, + base_headers=lambda: {}, + base_url=lambda: "https://example.com/resource", + ) + + http_client.request( + path="", + method="GET", + params={"after": "456"}, + request_options=None, + ) + + params = dummy_client.last_request_kwargs["params"] + # For a simple dict, encode_query should give a single (key, value) tuple + assert params == [("after", "456")] + + +@pytest.mark.asyncio +async def test_async_http_client_does_not_pass_empty_params_list() -> None: + """Test that AsyncHttpClient passes params=None when params are empty. + + This prevents httpx from stripping existing query parameters from the URL, + which happens when params=[] or params={} is passed. + """ + dummy_client = _DummyAsyncClient() + http_client = AsyncHttpClient( + httpx_client=dummy_client, # type: ignore[arg-type] + base_timeout=lambda: None, + base_headers=lambda: {}, + base_url=lambda: "https://example.com", + async_base_headers=None, + ) + + # Use a path with query params (e.g., pagination cursor URL) + await http_client.request( + path="resource?after=123", + method="GET", + params=None, + request_options=None, + ) + + # We care that httpx receives params=None, not [] or {} + assert "params" in dummy_client.last_request_kwargs + assert dummy_client.last_request_kwargs["params"] is None + + # Verify the query string in the URL is preserved + url = str(dummy_client.last_request_kwargs["url"]) + assert "after=123" in url, f"Expected query param 'after=123' in URL, got: {url}" + + +@pytest.mark.asyncio +async def test_async_http_client_passes_encoded_params_when_present() -> None: + """Test that AsyncHttpClient passes encoded params when params are provided.""" + dummy_client = _DummyAsyncClient() + http_client = AsyncHttpClient( + httpx_client=dummy_client, # type: ignore[arg-type] + base_timeout=lambda: None, + base_headers=lambda: {}, + base_url=lambda: "https://example.com/resource", + async_base_headers=None, + ) + + await http_client.request( + path="", + method="GET", + params={"after": "456"}, + request_options=None, + ) + + params = dummy_client.last_request_kwargs["params"] + # For a simple dict, encode_query should give a single (key, value) tuple + assert params == [("after", "456")]