From caf973041d510a9af8610cc7deed70ec4628dcbd Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 22 Jan 2026 17:30:35 +0000 Subject: [PATCH] SDK regeneration --- .fern/metadata.json | 7 +- LICENSE | 2 +- poetry.lock | 103 +- pyproject.toml | 3 +- reference.md | 1035 ++++++++++------- src/square/bank_accounts/client.py | 223 +++- src/square/bank_accounts/raw_client.py | 225 +++- src/square/catalog/client.py | 64 +- src/square/catalog/object/client.py | 4 +- src/square/client.py | 36 +- src/square/core/client_wrapper.py | 16 +- src/square/core/http_client.py | 314 +++-- src/square/core/jsonable_encoder.py | 8 + src/square/core/pydantic_utilities.py | 103 +- src/square/mobile/client.py | 68 +- src/square/mobile/raw_client.py | 89 +- src/square/o_auth/client.py | 14 + src/square/o_auth/raw_client.py | 14 + src/square/payments/client.py | 4 + src/square/payments/raw_client.py | 4 + src/square/requests/bank_account.py | 5 + .../requests/buy_now_pay_later_details.py | 6 + src/square/requests/card.py | 10 + src/square/requests/catalog_item.py | 13 + .../catalog_item_modifier_list_info.py | 33 +- src/square/requests/catalog_item_variation.py | 8 + src/square/requests/catalog_modifier.py | 8 + .../requests/catalog_modifier_override.py | 21 +- 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 +- src/square/requests/catalog_product_set.py | 4 +- .../requests/create_bank_account_response.py | 23 + ...eate_mobile_authorization_code_response.py | 30 - .../requests/device_checkout_options.py | 8 + src/square/requests/digital_wallet_details.py | 8 +- .../requests/disable_bank_account_response.py | 23 + .../requests/fulfillment_delivery_details.py | 27 +- .../requests/fulfillment_pickup_details.py | 22 +- .../requests/get_bank_account_response.py | 8 +- .../requests/list_bank_accounts_response.py | 10 +- src/square/requests/order_line_item.py | 6 +- .../requests/order_line_item_applied_tax.py | 7 + .../order_line_item_pricing_blocklists.py | 13 + ...icing_blocklists_blocked_service_charge.py | 32 + src/square/requests/order_return.py | 4 +- .../requests/order_return_service_charge.py | 9 +- src/square/requests/order_service_charge.py | 4 +- .../requests/search_orders_source_filter.py | 16 + .../requests/subscription_test_result.py | 19 +- .../test_webhook_subscription_response.py | 26 +- src/square/transfer_orders/client.py | 8 +- src/square/types/address.py | 16 +- src/square/types/bank_account.py | 5 + .../batch_get_catalog_objects_response.py | 15 +- .../batch_upsert_catalog_objects_response.py | 15 +- src/square/types/buy_now_pay_later_details.py | 6 + src/square/types/card.py | 12 +- src/square/types/catalog_category.py | 2 +- src/square/types/catalog_item.py | 31 +- .../types/catalog_item_modifier_list_info.py | 33 +- src/square/types/catalog_item_option.py | 13 +- src/square/types/catalog_item_variation.py | 8 + src/square/types/catalog_modifier.py | 8 + src/square/types/catalog_modifier_list.py | 13 +- src/square/types/catalog_modifier_override.py | 21 +- .../catalog_modifier_toggle_override_type.py | 5 + src/square/types/catalog_object.py | 884 +++++++++++++- .../catalog_object_availability_period.py | 93 +- src/square/types/catalog_object_base.py | 10 +- src/square/types/catalog_object_batch.py | 15 +- src/square/types/catalog_object_category.py | 6 +- ...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_product_set.py | 4 +- src/square/types/catalog_subscription_plan.py | 13 +- src/square/types/catalog_v1id.py | 2 +- .../types/create_bank_account_response.py | 34 + .../types/create_catalog_image_request.py | 15 +- .../types/create_catalog_image_response.py | 15 +- ...eate_mobile_authorization_code_response.py | 41 - .../types/custom_attribute_definition.py | 2 +- src/square/types/device_checkout_options.py | 8 + src/square/types/digital_wallet_details.py | 8 +- .../types/disable_bank_account_response.py | 34 + src/square/types/error_code.py | 2 + src/square/types/filter_value.py | 2 +- .../types/fulfillment_delivery_details.py | 27 +- .../types/fulfillment_pickup_details.py | 22 +- src/square/types/get_bank_account_response.py | 8 +- .../types/get_catalog_object_response.py | 15 +- ...or_scheduled_shift_created_event_object.py | 2 +- ..._scheduled_shift_published_event_object.py | 2 +- ...or_scheduled_shift_updated_event_object.py | 2 +- .../types/list_bank_accounts_response.py | 10 +- src/square/types/list_catalog_response.py | 15 +- .../order_card_surcharge_treatment_type.py | 7 + src/square/types/order_line_item.py | 6 +- .../types/order_line_item_applied_tax.py | 7 + .../order_line_item_pricing_blocklists.py | 13 + ...icing_blocklists_blocked_service_charge.py | 43 + .../types/order_return_service_charge.py | 9 +- src/square/types/order_service_charge.py | 4 +- .../types/payment_link_related_resources.py | 15 +- .../types/search_catalog_items_response.py | 15 +- .../types/search_catalog_objects_response.py | 15 +- .../types/search_orders_source_filter.py | 16 + src/square/types/subscription_test_result.py | 19 +- .../test_webhook_subscription_response.py | 26 +- .../types/update_catalog_image_response.py | 15 +- .../types/upsert_catalog_object_response.py | 15 +- tests/utils/test_http_client.py | 249 +++- 145 files changed, 4006 insertions(+), 4418 deletions(-) create mode 100644 src/square/requests/create_bank_account_response.py delete mode 100644 src/square/requests/create_mobile_authorization_code_response.py create mode 100644 src/square/requests/disable_bank_account_response.py create mode 100644 src/square/requests/order_line_item_pricing_blocklists_blocked_service_charge.py create mode 100644 src/square/types/catalog_modifier_toggle_override_type.py create mode 100644 src/square/types/create_bank_account_response.py delete mode 100644 src/square/types/create_mobile_authorization_code_response.py create mode 100644 src/square/types/disable_bank_account_response.py create mode 100644 src/square/types/order_card_surcharge_treatment_type.py create mode 100644 src/square/types/order_line_item_pricing_blocklists_blocked_service_charge.py diff --git a/.fern/metadata.json b/.fern/metadata.json index d4b24802..844b1e55 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "2.2.5", + "cliVersion": "3.38.0", "generatorName": "fernapi/fern-python-sdk", - "generatorVersion": "4.38.4", + "generatorVersion": "4.46.14", "generatorConfig": { "client": { "class_name": "Square", @@ -13,5 +13,6 @@ "use_typeddict_requests": true, "use_typeddict_requests_for_file_upload": true, "exclude_types_from_init_exports": true - } + }, + "sdkVersion": "44.0.0.20260122" } \ No newline at end of file diff --git a/LICENSE b/LICENSE index f5669d1d..878ffc14 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Square. +Copyright (c) 2026 Square. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/poetry.lock b/poetry.lock index 9decbf87..2f8666b3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -38,13 +38,13 @@ trio = ["trio (>=0.26.1)"] [[package]] name = "certifi" -version = "2025.11.12" +version = "2026.1.4" description = "Python package for providing Mozilla's CA Bundle." optional = false python-versions = ">=3.7" files = [ - {file = "certifi-2025.11.12-py3-none-any.whl", hash = "sha256:97de8790030bbd5c2d96b7ec782fc2f7820ef8dba6db909ccf95449f2d062d4b"}, - {file = "certifi-2025.11.12.tar.gz", hash = "sha256:d8ab5478f2ecd78af242878415affce761ca6bc54a22a27e026d7c25357c3316"}, + {file = "certifi-2026.1.4-py3-none-any.whl", hash = "sha256:9943707519e4add1115f44c2bc244f782c0249876bf51b6599fee1ffbedd685c"}, + {file = "certifi-2026.1.4.tar.gz", hash = "sha256:ac726dd470482006e014ad384921ed6438c457018f4b3d204aea4281258b2120"}, ] [[package]] @@ -236,13 +236,13 @@ files = [ [[package]] name = "packaging" -version = "25.0" +version = "26.0" description = "Core utilities for Python packages" optional = false python-versions = ">=3.8" files = [ - {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, - {file = "packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f"}, + {file = "packaging-26.0-py3-none-any.whl", hash = "sha256:b36f1fef9334a5588b4166f8bcd26a14e521f2b55e6b9de3aaa80d3ff7a37529"}, + {file = "packaging-26.0.tar.gz", hash = "sha256:00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4"}, ] [[package]] @@ -517,53 +517,58 @@ files = [ [[package]] name = "tomli" -version = "2.3.0" +version = "2.4.0" description = "A lil' TOML parser" optional = false python-versions = ">=3.8" files = [ - {file = "tomli-2.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:88bd15eb972f3664f5ed4b57c1634a97153b4bac4479dcb6a495f41921eb7f45"}, - {file = "tomli-2.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:883b1c0d6398a6a9d29b508c331fa56adbcdff647f6ace4dfca0f50e90dfd0ba"}, - {file = "tomli-2.3.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d1381caf13ab9f300e30dd8feadb3de072aeb86f1d34a8569453ff32a7dea4bf"}, - {file = "tomli-2.3.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a0e285d2649b78c0d9027570d4da3425bdb49830a6156121360b3f8511ea3441"}, - {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:0a154a9ae14bfcf5d8917a59b51ffd5a3ac1fd149b71b47a3a104ca4edcfa845"}, - {file = "tomli-2.3.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:74bf8464ff93e413514fefd2be591c3b0b23231a77f901db1eb30d6f712fc42c"}, - {file = "tomli-2.3.0-cp311-cp311-win32.whl", hash = "sha256:00b5f5d95bbfc7d12f91ad8c593a1659b6387b43f054104cda404be6bda62456"}, - {file = "tomli-2.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:4dc4ce8483a5d429ab602f111a93a6ab1ed425eae3122032db7e9acf449451be"}, - {file = "tomli-2.3.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:d7d86942e56ded512a594786a5ba0a5e521d02529b3826e7761a05138341a2ac"}, - {file = "tomli-2.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:73ee0b47d4dad1c5e996e3cd33b8a76a50167ae5f96a2607cbe8cc773506ab22"}, - {file = "tomli-2.3.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:792262b94d5d0a466afb5bc63c7daa9d75520110971ee269152083270998316f"}, - {file = "tomli-2.3.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4f195fe57ecceac95a66a75ac24d9d5fbc98ef0962e09b2eddec5d39375aae52"}, - {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e31d432427dcbf4d86958c184b9bfd1e96b5b71f8eb17e6d02531f434fd335b8"}, - {file = "tomli-2.3.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b0882799624980785240ab732537fcfc372601015c00f7fc367c55308c186f6"}, - {file = "tomli-2.3.0-cp312-cp312-win32.whl", hash = "sha256:ff72b71b5d10d22ecb084d345fc26f42b5143c5533db5e2eaba7d2d335358876"}, - {file = "tomli-2.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:1cb4ed918939151a03f33d4242ccd0aa5f11b3547d0cf30f7c74a408a5b99878"}, - {file = "tomli-2.3.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5192f562738228945d7b13d4930baffda67b69425a7f0da96d360b0a3888136b"}, - {file = "tomli-2.3.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:be71c93a63d738597996be9528f4abe628d1adf5e6eb11607bc8fe1a510b5dae"}, - {file = "tomli-2.3.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c4665508bcbac83a31ff8ab08f424b665200c0e1e645d2bd9ab3d3e557b6185b"}, - {file = "tomli-2.3.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4021923f97266babc6ccab9f5068642a0095faa0a51a246a6a02fccbb3514eaf"}, - {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:a4ea38c40145a357d513bffad0ed869f13c1773716cf71ccaa83b0fa0cc4e42f"}, - {file = "tomli-2.3.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:ad805ea85eda330dbad64c7ea7a4556259665bdf9d2672f5dccc740eb9d3ca05"}, - {file = "tomli-2.3.0-cp313-cp313-win32.whl", hash = "sha256:97d5eec30149fd3294270e889b4234023f2c69747e555a27bd708828353ab606"}, - {file = "tomli-2.3.0-cp313-cp313-win_amd64.whl", hash = "sha256:0c95ca56fbe89e065c6ead5b593ee64b84a26fca063b5d71a1122bf26e533999"}, - {file = "tomli-2.3.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:cebc6fe843e0733ee827a282aca4999b596241195f43b4cc371d64fc6639da9e"}, - {file = "tomli-2.3.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:4c2ef0244c75aba9355561272009d934953817c49f47d768070c3c94355c2aa3"}, - {file = "tomli-2.3.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c22a8bf253bacc0cf11f35ad9808b6cb75ada2631c2d97c971122583b129afbc"}, - {file = "tomli-2.3.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0eea8cc5c5e9f89c9b90c4896a8deefc74f518db5927d0e0e8d4a80953d774d0"}, - {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:b74a0e59ec5d15127acdabd75ea17726ac4c5178ae51b85bfe39c4f8a278e879"}, - {file = "tomli-2.3.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:b5870b50c9db823c595983571d1296a6ff3e1b88f734a4c8f6fc6188397de005"}, - {file = "tomli-2.3.0-cp314-cp314-win32.whl", hash = "sha256:feb0dacc61170ed7ab602d3d972a58f14ee3ee60494292d384649a3dc38ef463"}, - {file = "tomli-2.3.0-cp314-cp314-win_amd64.whl", hash = "sha256:b273fcbd7fc64dc3600c098e39136522650c49bca95df2d11cf3b626422392c8"}, - {file = "tomli-2.3.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:940d56ee0410fa17ee1f12b817b37a4d4e4dc4d27340863cc67236c74f582e77"}, - {file = "tomli-2.3.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:f85209946d1fe94416debbb88d00eb92ce9cd5266775424ff81bc959e001acaf"}, - {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a56212bdcce682e56b0aaf79e869ba5d15a6163f88d5451cbde388d48b13f530"}, - {file = "tomli-2.3.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c5f3ffd1e098dfc032d4d3af5c0ac64f6d286d98bc148698356847b80fa4de1b"}, - {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e01decd096b1530d97d5d85cb4dff4af2d8347bd35686654a004f8dea20fc67"}, - {file = "tomli-2.3.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:8a35dd0e643bb2610f156cca8db95d213a90015c11fee76c946aa62b7ae7e02f"}, - {file = "tomli-2.3.0-cp314-cp314t-win32.whl", hash = "sha256:a1f7f282fe248311650081faafa5f4732bdbfef5d45fe3f2e702fbc6f2d496e0"}, - {file = "tomli-2.3.0-cp314-cp314t-win_amd64.whl", hash = "sha256:70a251f8d4ba2d9ac2542eecf008b3c8a9fc5c3f9f02c56a9d7952612be2fdba"}, - {file = "tomli-2.3.0-py3-none-any.whl", hash = "sha256:e95b1af3c5b07d9e643909b5abbec77cd9f1217e6d0bca72b0234736b9fb1f1b"}, - {file = "tomli-2.3.0.tar.gz", hash = "sha256:64be704a875d2a59753d80ee8a533c3fe183e3f06807ff7dc2232938ccb01549"}, + {file = "tomli-2.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b5ef256a3fd497d4973c11bf142e9ed78b150d36f5773f1ca6088c230ffc5867"}, + {file = "tomli-2.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5572e41282d5268eb09a697c89a7bee84fae66511f87533a6f88bd2f7b652da9"}, + {file = "tomli-2.4.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:551e321c6ba03b55676970b47cb1b73f14a0a4dce6a3e1a9458fd6d921d72e95"}, + {file = "tomli-2.4.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5e3f639a7a8f10069d0e15408c0b96a2a828cfdec6fca05296ebcdcc28ca7c76"}, + {file = "tomli-2.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1b168f2731796b045128c45982d3a4874057626da0e2ef1fdd722848b741361d"}, + {file = "tomli-2.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:133e93646ec4300d651839d382d63edff11d8978be23da4cc106f5a18b7d0576"}, + {file = "tomli-2.4.0-cp311-cp311-win32.whl", hash = "sha256:b6c78bdf37764092d369722d9946cb65b8767bfa4110f902a1b2542d8d173c8a"}, + {file = "tomli-2.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:d3d1654e11d724760cdb37a3d7691f0be9db5fbdaef59c9f532aabf87006dbaa"}, + {file = "tomli-2.4.0-cp311-cp311-win_arm64.whl", hash = "sha256:cae9c19ed12d4e8f3ebf46d1a75090e4c0dc16271c5bce1c833ac168f08fb614"}, + {file = "tomli-2.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:920b1de295e72887bafa3ad9f7a792f811847d57ea6b1215154030cf131f16b1"}, + {file = "tomli-2.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7d6d9a4aee98fac3eab4952ad1d73aee87359452d1c086b5ceb43ed02ddb16b8"}, + {file = "tomli-2.4.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:36b9d05b51e65b254ea6c2585b59d2c4cb91c8a3d91d0ed0f17591a29aaea54a"}, + {file = "tomli-2.4.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1c8a885b370751837c029ef9bc014f27d80840e48bac415f3412e6593bbc18c1"}, + {file = "tomli-2.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8768715ffc41f0008abe25d808c20c3d990f42b6e2e58305d5da280ae7d1fa3b"}, + {file = "tomli-2.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b438885858efd5be02a9a133caf5812b8776ee0c969fea02c45e8e3f296ba51"}, + {file = "tomli-2.4.0-cp312-cp312-win32.whl", hash = "sha256:0408e3de5ec77cc7f81960c362543cbbd91ef883e3138e81b729fc3eea5b9729"}, + {file = "tomli-2.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:685306e2cc7da35be4ee914fd34ab801a6acacb061b6a7abca922aaf9ad368da"}, + {file = "tomli-2.4.0-cp312-cp312-win_arm64.whl", hash = "sha256:5aa48d7c2356055feef06a43611fc401a07337d5b006be13a30f6c58f869e3c3"}, + {file = "tomli-2.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:84d081fbc252d1b6a982e1870660e7330fb8f90f676f6e78b052ad4e64714bf0"}, + {file = "tomli-2.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:9a08144fa4cba33db5255f9b74f0b89888622109bd2776148f2597447f92a94e"}, + {file = "tomli-2.4.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c73add4bb52a206fd0c0723432db123c0c75c280cbd67174dd9d2db228ebb1b4"}, + {file = "tomli-2.4.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1fb2945cbe303b1419e2706e711b7113da57b7db31ee378d08712d678a34e51e"}, + {file = "tomli-2.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:bbb1b10aa643d973366dc2cb1ad94f99c1726a02343d43cbc011edbfac579e7c"}, + {file = "tomli-2.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4cbcb367d44a1f0c2be408758b43e1ffb5308abe0ea222897d6bfc8e8281ef2f"}, + {file = "tomli-2.4.0-cp313-cp313-win32.whl", hash = "sha256:7d49c66a7d5e56ac959cb6fc583aff0651094ec071ba9ad43df785abc2320d86"}, + {file = "tomli-2.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:3cf226acb51d8f1c394c1b310e0e0e61fecdd7adcb78d01e294ac297dd2e7f87"}, + {file = "tomli-2.4.0-cp313-cp313-win_arm64.whl", hash = "sha256:d20b797a5c1ad80c516e41bc1fb0443ddb5006e9aaa7bda2d71978346aeb9132"}, + {file = "tomli-2.4.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:26ab906a1eb794cd4e103691daa23d95c6919cc2fa9160000ac02370cc9dd3f6"}, + {file = "tomli-2.4.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:20cedb4ee43278bc4f2fee6cb50daec836959aadaf948db5172e776dd3d993fc"}, + {file = "tomli-2.4.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:39b0b5d1b6dd03684b3fb276407ebed7090bbec989fa55838c98560c01113b66"}, + {file = "tomli-2.4.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a26d7ff68dfdb9f87a016ecfd1e1c2bacbe3108f4e0f8bcd2228ef9a766c787d"}, + {file = "tomli-2.4.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:20ffd184fb1df76a66e34bd1b36b4a4641bd2b82954befa32fe8163e79f1a702"}, + {file = "tomli-2.4.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:75c2f8bbddf170e8effc98f5e9084a8751f8174ea6ccf4fca5398436e0320bc8"}, + {file = "tomli-2.4.0-cp314-cp314-win32.whl", hash = "sha256:31d556d079d72db7c584c0627ff3a24c5d3fb4f730221d3444f3efb1b2514776"}, + {file = "tomli-2.4.0-cp314-cp314-win_amd64.whl", hash = "sha256:43e685b9b2341681907759cf3a04e14d7104b3580f808cfde1dfdb60ada85475"}, + {file = "tomli-2.4.0-cp314-cp314-win_arm64.whl", hash = "sha256:3d895d56bd3f82ddd6faaff993c275efc2ff38e52322ea264122d72729dca2b2"}, + {file = "tomli-2.4.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:5b5807f3999fb66776dbce568cc9a828544244a8eb84b84b9bafc080c99597b9"}, + {file = "tomli-2.4.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c084ad935abe686bd9c898e62a02a19abfc9760b5a79bc29644463eaf2840cb0"}, + {file = "tomli-2.4.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0f2e3955efea4d1cfbcb87bc321e00dc08d2bcb737fd1d5e398af111d86db5df"}, + {file = "tomli-2.4.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0e0fe8a0b8312acf3a88077a0802565cb09ee34107813bba1c7cd591fa6cfc8d"}, + {file = "tomli-2.4.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:413540dce94673591859c4c6f794dfeaa845e98bf35d72ed59636f869ef9f86f"}, + {file = "tomli-2.4.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0dc56fef0e2c1c470aeac5b6ca8cc7b640bb93e92d9803ddaf9ea03e198f5b0b"}, + {file = "tomli-2.4.0-cp314-cp314t-win32.whl", hash = "sha256:d878f2a6707cc9d53a1be1414bbb419e629c3d6e67f69230217bb663e76b5087"}, + {file = "tomli-2.4.0-cp314-cp314t-win_amd64.whl", hash = "sha256:2add28aacc7425117ff6364fe9e06a183bb0251b03f986df0e78e974047571fd"}, + {file = "tomli-2.4.0-cp314-cp314t-win_arm64.whl", hash = "sha256:2b1e3b80e1d5e52e40e9b924ec43d81570f0e7d09d11081b797bc4692765a3d4"}, + {file = "tomli-2.4.0-py3-none-any.whl", hash = "sha256:1f776e7d669ebceb01dee46484485f43a4048746235e683bcdffacdf1fb4785a"}, + {file = "tomli-2.4.0.tar.gz", hash = "sha256:aa89c3f6c277dd275d8e243ad24f3b5e701491a860d5121f2cdd399fbb31fc9c"}, ] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 64fe2625..89b1f7b7 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 = "44.0.0.20260122" description = "" readme = "README.md" authors = [] diff --git a/reference.md b/reference.md index d42bf0f8..12a1b0c9 100644 --- a/reference.md +++ b/reference.md @@ -1,91 +1,6 @@ # Reference -## Mobile -
client.mobile.authorization_code(...) -
-
- -#### 📝 Description - -
-
- -
-
- -__Note:__ This endpoint is used by the deprecated Reader SDK. -Developers should update their integration to use the [Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk), which includes its own authorization methods. - -Generates code to authorize a mobile application to connect to a Square card reader. - -Authorization codes are one-time-use codes and expire 60 minutes after being issued. - -The `Authorization` header you provide to this endpoint must have the following format: - -``` -Authorization: Bearer ACCESS_TOKEN -``` - -Replace `ACCESS_TOKEN` with a -[valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). -
-
-
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from square import Square - -client = Square( - token="YOUR_TOKEN", -) -client.mobile.authorization_code( - location_id="YOUR_LOCATION_ID", -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**location_id:** `typing.Optional[str]` — The Square location ID that the authorization code should be tied to. - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - -
-
-
- ## OAuth -
client.o_auth.revoke_token(...) +
client.o_auth.revoke_token(...) -> AsyncHttpResponse[RevokeTokenResponse]
@@ -206,7 +121,7 @@ Default: `false`
-
client.o_auth.obtain_token(...) +
client.o_auth.obtain_token(...) -> AsyncHttpResponse[ObtainTokenResponse]
@@ -417,6 +332,18 @@ Required for the PKCE flow if `grant_type` is `authorization_code`.
+**use_jwt:** `typing.Optional[bool]` + +Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. +When set to `true`, the OAuth flow returns a JWT to your application, used in the +same way as a regular token. The default value is `false`. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -429,7 +356,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 +429,7 @@ client.o_auth.retrieve_token_status()
-
client.o_auth.authorize() +
client.o_auth.authorize() -> AsyncHttpResponse[None]
@@ -549,7 +476,7 @@ client.o_auth.authorize()
## V1Transactions -
client.v1transactions.v1list_orders(...) +
client.v1transactions.v1list_orders(...) -> AsyncHttpResponse[typing.List[V1Order]]
@@ -649,7 +576,7 @@ original query to the endpoint.
-
client.v1transactions.v1retrieve_order(...) +
client.v1transactions.v1retrieve_order(...) -> AsyncHttpResponse[V1Order]
@@ -728,7 +655,7 @@ client.v1transactions.v1retrieve_order(
-
client.v1transactions.v1update_order(...) +
client.v1transactions.v1update_order(...) -> AsyncHttpResponse[V1Order]
@@ -852,7 +779,7 @@ See [V1UpdateOrderRequestAction](#type-v1updateorderrequestaction) for possible
## ApplePay -
client.apple_pay.register_domain(...) +
client.apple_pay.register_domain(...) -> AsyncHttpResponse[RegisterDomainResponse]
@@ -936,7 +863,7 @@ client.apple_pay.register_domain(
## BankAccounts -
client.bank_accounts.list(...) +
client.bank_accounts.list(...) -> AsyncPager[BankAccount, ListBankAccountsResponse]
@@ -972,6 +899,7 @@ response = client.bank_accounts.list( cursor="cursor", limit=1, location_id="location_id", + customer_id="customer_id", ) for item in response: yield item @@ -996,7 +924,7 @@ for page in response.iter_pages(): **cursor:** `typing.Optional[str]` The pagination cursor returned by a previous call to this endpoint. -Use it in the next `ListBankAccounts` request to retrieve the next set +Use it in the next `ListBankAccounts` request to retrieve the next set of results. See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagination) guide for more information. @@ -1009,8 +937,8 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin **limit:** `typing.Optional[int]` -Upper limit on the number of bank accounts to return in the response. -Currently, 1000 is the largest supported limit. You can specify a limit +Upper limit on the number of bank accounts to return in the response. +Currently, 1000 is the largest supported limit. You can specify a limit of up to 1000 bank accounts. This is also the default limit.
@@ -1021,7 +949,7 @@ of up to 1000 bank accounts. This is also the default limit. **location_id:** `typing.Optional[str]` -Location ID. You can specify this optional filter +Location ID. You can specify this optional filter to retrieve only the linked bank accounts belonging to a specific location. @@ -1030,6 +958,111 @@ to retrieve only the linked bank accounts belonging to a specific location.
+**customer_id:** `typing.Optional[str]` + +Customer ID. You can specify this optional filter +to retrieve only the linked bank accounts belonging to a specific customer. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+ +
+ + + + +
+ +
client.bank_accounts.create_bank_account(...) -> AsyncHttpResponse[CreateBankAccountResponse] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Store a bank account on file for a square account +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from square import Square + +client = Square( + token="YOUR_TOKEN", +) +client.bank_accounts.create_bank_account( + idempotency_key="4e43559a-f0fd-47d3-9da2-7ea1f97d94be", + source_id="bnon:CA4SEHsQwr0rx6DbWLD5BQaqMnoYAQ", + customer_id="HM3B2D5JKGZ69359BTEHXM2V8M", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**idempotency_key:** `str` + +Unique ID. For more information, see the +[Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + +
+
+ +
+
+ +**source_id:** `str` + +The ID of the source that represents the bank account information to be stored. This field +accepts the payment token created by WebSDK + +
+
+ +
+
+ +**customer_id:** `typing.Optional[str]` — The ID of the customer associated with the bank account to be stored. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -1042,7 +1075,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 +1148,7 @@ Connect V1 ID of the desired `BankAccount`. For more information, see
-
client.bank_accounts.get(...) +
client.bank_accounts.get(...) -> AsyncHttpResponse[GetBankAccountResponse]
@@ -1127,8 +1160,7 @@ Connect V1 ID of the desired `BankAccount`. For more information, see
-Returns details of a [BankAccount](entity:BankAccount) -linked to a Square account. +Retrieve details of a [BankAccount](entity:BankAccount) bank account linked to a Square account.
@@ -1182,12 +1214,82 @@ client.bank_accounts.get(
+ + +
+ +
client.bank_accounts.disable_bank_account(...) -> AsyncHttpResponse[DisableBankAccountResponse] +
+
+ +#### 📝 Description + +
+
+ +
+
+ +Disable a bank account. +
+
+
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from square import Square + +client = Square( + token="YOUR_TOKEN", +) +client.bank_accounts.disable_bank_account( + bank_account_id="bank_account_id", +) + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**bank_account_id:** `str` — The ID of the bank account to disable. + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
## Bookings -
client.bookings.list(...) +
client.bookings.list(...) -> AsyncPager[Booking, ListBookingsResponse]
@@ -1319,7 +1421,7 @@ for page in response.iter_pages():
-
client.bookings.create(...) +
client.bookings.create(...) -> AsyncHttpResponse[CreateBookingResponse]
@@ -1410,7 +1512,7 @@ client.bookings.create(
-
client.bookings.search_availability(...) +
client.bookings.search_availability(...) -> AsyncHttpResponse[SearchAvailabilityResponse]
@@ -1483,7 +1585,7 @@ client.bookings.search_availability(
-
client.bookings.bulk_retrieve_bookings(...) +
client.bookings.bulk_retrieve_bookings(...) -> AsyncHttpResponse[BulkRetrieveBookingsResponse]
@@ -1556,7 +1658,7 @@ client.bookings.bulk_retrieve_bookings(
-
client.bookings.get_business_profile() +
client.bookings.get_business_profile() -> AsyncHttpResponse[GetBusinessBookingProfileResponse]
@@ -1616,7 +1718,7 @@ client.bookings.get_business_profile()
-
client.bookings.retrieve_location_booking_profile(...) +
client.bookings.retrieve_location_booking_profile(...) -> AsyncHttpResponse[RetrieveLocationBookingProfileResponse]
@@ -1686,7 +1788,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 +1858,7 @@ client.bookings.bulk_retrieve_team_member_booking_profiles(
-
client.bookings.get(...) +
client.bookings.get(...) -> AsyncHttpResponse[GetBookingResponse]
@@ -1829,7 +1931,7 @@ client.bookings.get(
-
client.bookings.update(...) +
client.bookings.update(...) -> AsyncHttpResponse[UpdateBookingResponse]
@@ -1922,7 +2024,7 @@ client.bookings.update(
-
client.bookings.cancel(...) +
client.bookings.cancel(...) -> AsyncHttpResponse[CancelBookingResponse]
@@ -2015,7 +2117,7 @@ client.bookings.cancel(
## Cards -
client.cards.list(...) +
client.cards.list(...) -> AsyncPager[Card, ListCardsResponse]
@@ -2141,7 +2243,7 @@ This field defaults to ASC.
-
client.cards.create(...) +
client.cards.create(...) -> AsyncHttpResponse[CreateCardResponse]
@@ -2262,7 +2364,7 @@ See the [SCA Overview](https://developer.squareup.com/docs/sca-overview).
-
client.cards.get(...) +
client.cards.get(...) -> AsyncHttpResponse[GetCardResponse]
@@ -2332,7 +2434,7 @@ client.cards.get(
-
client.cards.disable(...) +
client.cards.disable(...) -> AsyncHttpResponse[DisableCardResponse]
@@ -2404,7 +2506,7 @@ client.cards.disable(
## Catalog -
client.catalog.batch_delete(...) +
client.catalog.batch_delete(...) -> AsyncHttpResponse[BatchDeleteCatalogObjectsResponse]
@@ -2491,7 +2593,7 @@ CatalogItem will delete its CatalogItemVariation.
-
client.catalog.batch_get(...) +
client.catalog.batch_get(...) -> AsyncHttpResponse[BatchGetCatalogObjectsResponse]
@@ -2624,7 +2726,7 @@ in the response payload.
-
client.catalog.batch_upsert(...) +
client.catalog.batch_upsert(...) -> AsyncHttpResponse[BatchUpsertCatalogObjectsResponse]
@@ -2673,34 +2775,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 +2858,7 @@ be inserted or updated.
-
client.catalog.info() +
client.catalog.info() -> AsyncHttpResponse[CatalogInfoResponse]
@@ -2841,7 +2919,7 @@ client.catalog.info()
-
client.catalog.list(...) +
client.catalog.list(...) -> AsyncPager[CatalogObject, ListCatalogResponse]
@@ -2965,7 +3043,7 @@ current version of the catalog.
-
client.catalog.search(...) +
client.catalog.search(...) -> AsyncHttpResponse[SearchCatalogObjectsResponse]
@@ -3145,7 +3223,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 +3406,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 +3505,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 +3605,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 +3719,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 +3789,7 @@ client.channels.bulk_retrieve(
-
client.channels.get(...) +
client.channels.get(...) -> AsyncHttpResponse[RetrieveChannelResponse]
@@ -3782,7 +3860,7 @@ client.channels.get(
## Customers -
client.customers.list(...) +
client.customers.list(...) -> AsyncPager[Customer, ListCustomersResponse]
@@ -3920,7 +3998,7 @@ The default value is `false`.
-
client.customers.create(...) +
client.customers.create(...) -> AsyncHttpResponse[CreateCustomerResponse]
@@ -4144,7 +4222,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 +4342,7 @@ customer profile.
-
client.customers.bulk_delete_customers(...) +
client.customers.bulk_delete_customers(...) -> AsyncHttpResponse[BulkDeleteCustomersResponse]
@@ -4340,7 +4418,7 @@ client.customers.bulk_delete_customers(
-
client.customers.bulk_retrieve_customers(...) +
client.customers.bulk_retrieve_customers(...) -> AsyncHttpResponse[BulkRetrieveCustomersResponse]
@@ -4416,7 +4494,7 @@ client.customers.bulk_retrieve_customers(
-
client.customers.bulk_update_customers(...) +
client.customers.bulk_update_customers(...) -> AsyncHttpResponse[BulkUpdateCustomersResponse]
@@ -4508,7 +4586,7 @@ update a field, specify the new value. To remove a field, specify `null`.
-
client.customers.search(...) +
client.customers.search(...) -> AsyncHttpResponse[SearchCustomersResponse]
@@ -4639,7 +4717,7 @@ The default value is `false`.
-
client.customers.get(...) +
client.customers.get(...) -> AsyncHttpResponse[GetCustomerResponse]
@@ -4709,7 +4787,7 @@ client.customers.get(
-
client.customers.update(...) +
client.customers.update(...) -> AsyncHttpResponse[UpdateCustomerResponse]
@@ -4927,7 +5005,7 @@ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it
-
client.customers.delete(...) +
client.customers.delete(...) -> AsyncHttpResponse[DeleteCustomerResponse]
@@ -5013,7 +5091,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 +5202,7 @@ The order in which results are listed.
-
client.devices.get(...) +
client.devices.get(...) -> AsyncHttpResponse[GetDeviceResponse]
@@ -5195,7 +5273,7 @@ client.devices.get(
## Disputes -
client.disputes.list(...) +
client.disputes.list(...) -> AsyncPager[Dispute, ListDisputesResponse]
@@ -5295,7 +5373,7 @@ If not specified, the endpoint returns disputes associated with all locations.
-
client.disputes.get(...) +
client.disputes.get(...) -> AsyncHttpResponse[GetDisputeResponse]
@@ -5365,7 +5443,7 @@ client.disputes.get(
-
client.disputes.accept(...) +
client.disputes.accept(...) -> AsyncHttpResponse[AcceptDisputeResponse]
@@ -5439,7 +5517,7 @@ client.disputes.accept(
-
client.disputes.create_evidence_file(...) +
client.disputes.create_evidence_file(...) -> AsyncHttpResponse[CreateDisputeEvidenceFileResponse]
@@ -5528,7 +5606,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 +5706,7 @@ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
-
client.disputes.submit_evidence(...) +
client.disputes.submit_evidence(...) -> AsyncHttpResponse[SubmitEvidenceResponse]
@@ -5705,7 +5783,7 @@ client.disputes.submit_evidence(
## Employees -
client.employees.list(...) +
client.employees.list(...) -> AsyncPager[Employee, ListEmployeesResponse]
@@ -5807,7 +5885,7 @@ for page in response.iter_pages():
-
client.employees.get(...) +
client.employees.get(...) -> AsyncHttpResponse[GetEmployeeResponse]
@@ -5878,7 +5956,7 @@ client.employees.get(
## Events -
client.events.search_events(...) +
client.events.search_events(...) -> AsyncHttpResponse[SearchEventsResponse]
@@ -5972,7 +6050,7 @@ Default: 100
-
client.events.disable_events() +
client.events.disable_events() -> AsyncHttpResponse[DisableEventsResponse]
@@ -6034,7 +6112,7 @@ client.events.disable_events()
-
client.events.enable_events() +
client.events.enable_events() -> AsyncHttpResponse[EnableEventsResponse]
@@ -6094,7 +6172,7 @@ client.events.enable_events()
-
client.events.list_event_types(...) +
client.events.list_event_types(...) -> AsyncHttpResponse[ListEventTypesResponse]
@@ -6165,7 +6243,7 @@ client.events.list_event_types(
## GiftCards -
client.gift_cards.list(...) +
client.gift_cards.list(...) -> AsyncPager[GiftCard, ListGiftCardsResponse]
@@ -6292,7 +6370,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/worki
-
client.gift_cards.create(...) +
client.gift_cards.create(...) -> AsyncHttpResponse[CreateGiftCardResponse]
@@ -6407,7 +6485,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 +6559,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 +6632,7 @@ Web Payments SDK or In-App Payments SDK.
-
client.gift_cards.link_customer(...) +
client.gift_cards.link_customer(...) -> AsyncHttpResponse[LinkCustomerToGiftCardResponse]
@@ -6633,7 +6711,7 @@ client.gift_cards.link_customer(
-
client.gift_cards.unlink_customer(...) +
client.gift_cards.unlink_customer(...) -> AsyncHttpResponse[UnlinkCustomerFromGiftCardResponse]
@@ -6712,7 +6790,7 @@ client.gift_cards.unlink_customer(
-
client.gift_cards.get(...) +
client.gift_cards.get(...) -> AsyncHttpResponse[GetGiftCardResponse]
@@ -6783,7 +6861,7 @@ client.gift_cards.get(
## Inventory -
client.inventory.deprecated_get_adjustment(...) +
client.inventory.deprecated_get_adjustment(...) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]
@@ -6854,7 +6932,7 @@ client.inventory.deprecated_get_adjustment(
-
client.inventory.get_adjustment(...) +
client.inventory.get_adjustment(...) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]
@@ -6925,7 +7003,7 @@ client.inventory.get_adjustment(
-
client.inventory.deprecated_batch_change(...) +
client.inventory.deprecated_batch_change(...) -> AsyncHttpResponse[BatchChangeInventoryResponse]
@@ -7041,7 +7119,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 +7277,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 +7409,7 @@ The default is null.
-
client.inventory.batch_create_changes(...) +
client.inventory.batch_create_changes(...) -> AsyncHttpResponse[BatchChangeInventoryResponse]
@@ -7450,7 +7528,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 +7697,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 +7843,7 @@ The default is null.
-
client.inventory.deprecated_get_physical_count(...) +
client.inventory.deprecated_get_physical_count(...) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]
@@ -7839,7 +7917,7 @@ ID of the
-
client.inventory.get_physical_count(...) +
client.inventory.get_physical_count(...) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]
@@ -7913,7 +7991,7 @@ ID of the
-
client.inventory.get_transfer(...) +
client.inventory.get_transfer(...) -> AsyncHttpResponse[GetInventoryTransferResponse]
@@ -7984,7 +8062,7 @@ client.inventory.get_transfer(
-
client.inventory.get(...) +
client.inventory.get(...) -> AsyncPager[InventoryCount, GetInventoryCountResponse]
@@ -8088,7 +8166,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.inventory.changes(...) +
client.inventory.changes(...) -> AsyncPager[InventoryChange, GetInventoryChangesResponse]
@@ -8202,7 +8280,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 +8383,7 @@ If not provided, the server uses a default limit of 100 invoices.
-
client.invoices.create(...) +
client.invoices.create(...) -> AsyncHttpResponse[CreateInvoiceResponse]
@@ -8438,7 +8516,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.invoices.search(...) +
client.invoices.search(...) -> AsyncHttpResponse[SearchInvoicesResponse]
@@ -8545,7 +8623,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.invoices.get(...) +
client.invoices.get(...) -> AsyncHttpResponse[GetInvoiceResponse]
@@ -8615,7 +8693,7 @@ client.invoices.get(
-
client.invoices.update(...) +
client.invoices.update(...) -> AsyncHttpResponse[UpdateInvoiceResponse]
@@ -8737,7 +8815,7 @@ recommend using null values or the `remove` field when possible. For examples, s
-
client.invoices.delete(...) +
client.invoices.delete(...) -> AsyncHttpResponse[DeleteInvoiceResponse]
@@ -8822,7 +8900,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 +8995,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 +9075,7 @@ client.invoices.delete_invoice_attachment(
-
client.invoices.cancel(...) +
client.invoices.cancel(...) -> AsyncHttpResponse[CancelInvoiceResponse]
@@ -9083,7 +9161,7 @@ If you do not know the version, you can call
-
client.invoices.publish(...) +
client.invoices.publish(...) -> AsyncHttpResponse[PublishInvoiceResponse]
@@ -9194,7 +9272,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 +9380,7 @@ of the operation.
-
client.labor.bulk_publish_scheduled_shifts(...) +
client.labor.bulk_publish_scheduled_shifts(...) -> AsyncHttpResponse[BulkPublishScheduledShiftsResponse]
@@ -9397,7 +9475,7 @@ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudienc
-
client.labor.search_scheduled_shifts(...) +
client.labor.search_scheduled_shifts(...) -> AsyncHttpResponse[SearchScheduledShiftsResponse]
@@ -9493,7 +9571,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 +9641,7 @@ client.labor.retrieve_scheduled_shift(
-
client.labor.update_scheduled_shift(...) +
client.labor.update_scheduled_shift(...) -> AsyncHttpResponse[UpdateScheduledShiftResponse]
@@ -9676,7 +9754,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 +9864,7 @@ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudienc
-
client.labor.create_timecard(...) +
client.labor.create_timecard(...) -> AsyncHttpResponse[CreateTimecardResponse]
@@ -9903,7 +9981,7 @@ client.labor.create_timecard(
-
client.labor.search_timecards(...) +
client.labor.search_timecards(...) -> AsyncHttpResponse[SearchTimecardsResponse]
@@ -10014,7 +10092,7 @@ client.labor.search_timecards(
-
client.labor.retrieve_timecard(...) +
client.labor.retrieve_timecard(...) -> AsyncHttpResponse[RetrieveTimecardResponse]
@@ -10084,7 +10162,7 @@ client.labor.retrieve_timecard(
-
client.labor.update_timecard(...) +
client.labor.update_timecard(...) -> AsyncHttpResponse[UpdateTimecardResponse]
@@ -10193,7 +10271,7 @@ client.labor.update_timecard(
-
client.labor.delete_timecard(...) +
client.labor.delete_timecard(...) -> AsyncHttpResponse[DeleteTimecardResponse]
@@ -10264,7 +10342,7 @@ client.labor.delete_timecard(
## Locations -
client.locations.list() +
client.locations.list() -> AsyncHttpResponse[ListLocationsResponse]
@@ -10325,7 +10403,7 @@ client.locations.list()
-
client.locations.create(...) +
client.locations.create(...) -> AsyncHttpResponse[CreateLocationResponse]
@@ -10414,7 +10492,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 +10566,7 @@ The ID of the location to retrieve. Specify the string
-
client.locations.update(...) +
client.locations.update(...) -> AsyncHttpResponse[UpdateLocationResponse]
@@ -10588,7 +10666,7 @@ client.locations.update(
-
client.locations.checkouts(...) +
client.locations.checkouts(...) -> AsyncHttpResponse[CreateCheckoutResponse]
@@ -10870,7 +10948,7 @@ This value cannot exceed 60 characters.
## Loyalty -
client.loyalty.search_events(...) +
client.loyalty.search_events(...) -> AsyncHttpResponse[SearchLoyaltyEventsResponse]
@@ -10982,7 +11060,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
## Merchants -
client.merchants.list(...) +
client.merchants.list(...) -> AsyncPager[Merchant, ListMerchantsResponse]
@@ -11066,7 +11144,7 @@ for page in response.iter_pages():
-
client.merchants.get(...) +
client.merchants.get(...) -> AsyncHttpResponse[GetMerchantResponse]
@@ -11140,7 +11218,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 +11288,7 @@ client.checkout.retrieve_location_settings(
-
client.checkout.update_location_settings(...) +
client.checkout.update_location_settings(...) -> AsyncHttpResponse[UpdateLocationSettingsResponse]
@@ -11289,7 +11367,7 @@ client.checkout.update_location_settings(
-
client.checkout.retrieve_merchant_settings() +
client.checkout.retrieve_merchant_settings() -> AsyncHttpResponse[RetrieveMerchantSettingsResponse]
@@ -11349,7 +11427,7 @@ client.checkout.retrieve_merchant_settings()
-
client.checkout.update_merchant_settings(...) +
client.checkout.update_merchant_settings(...) -> AsyncHttpResponse[UpdateMerchantSettingsResponse]
@@ -11420,7 +11498,7 @@ client.checkout.update_merchant_settings(
## Orders -
client.orders.create(...) +
client.orders.create(...) -> AsyncHttpResponse[CreateOrderResponse]
@@ -11562,7 +11640,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.batch_get(...) +
client.orders.batch_get(...) -> AsyncHttpResponse[BatchGetOrdersResponse]
@@ -11646,7 +11724,7 @@ orders within the scope of the current authorization's merchant ID.
-
client.orders.calculate(...) +
client.orders.calculate(...) -> AsyncHttpResponse[CalculateOrderResponse]
@@ -11747,7 +11825,7 @@ random strings used only to reference the reward tier.
-
client.orders.clone(...) +
client.orders.clone(...) -> AsyncHttpResponse[CloneOrderResponse]
@@ -11850,7 +11928,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.search(...) +
client.orders.search(...) -> AsyncHttpResponse[SearchOrdersResponse]
@@ -12005,7 +12083,7 @@ Default: `false`.
-
client.orders.get(...) +
client.orders.get(...) -> AsyncHttpResponse[GetOrderResponse]
@@ -12075,7 +12153,7 @@ client.orders.get(
-
client.orders.update(...) +
client.orders.update(...) -> AsyncHttpResponse[UpdateOrderResponse]
@@ -12214,7 +12292,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.pay(...) +
client.orders.pay(...) -> AsyncHttpResponse[PayOrderResponse]
@@ -12333,7 +12411,7 @@ The payment total must match the order total.
## Payments -
client.payments.list(...) +
client.payments.list(...) -> AsyncPager[Payment, ListPaymentsResponse]
@@ -12588,7 +12666,7 @@ range is determined using the `updated_at` field for each Payment.
-
client.payments.create(...) +
client.payments.create(...) -> AsyncHttpResponse[CreatePaymentResponse]
@@ -12710,6 +12788,8 @@ The amount must be specified in the smallest denomination of the applicable curr (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). +Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges. + The currency code must match the currency associated with the business that is accepting the payment. @@ -12996,7 +13076,7 @@ internal 1st-party callers only.
-
client.payments.cancel_by_idempotency_key(...) +
client.payments.cancel_by_idempotency_key(...) -> AsyncHttpResponse[CancelPaymentByIdempotencyKeyResponse]
@@ -13076,7 +13156,7 @@ client.payments.cancel_by_idempotency_key(
-
client.payments.get(...) +
client.payments.get(...) -> AsyncHttpResponse[GetPaymentResponse]
@@ -13146,7 +13226,7 @@ client.payments.get(
-
client.payments.update(...) +
client.payments.update(...) -> AsyncHttpResponse[UpdatePaymentResponse]
@@ -13244,7 +13324,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.payments.cancel(...) +
client.payments.cancel(...) -> AsyncHttpResponse[CancelPaymentResponse]
@@ -13315,7 +13395,7 @@ client.payments.cancel(
-
client.payments.complete(...) +
client.payments.complete(...) -> AsyncHttpResponse[CompletePaymentResponse]
@@ -13401,7 +13481,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 +13632,7 @@ Default: `100`
-
client.payouts.get(...) +
client.payouts.get(...) -> AsyncHttpResponse[GetPayoutResponse]
@@ -13623,7 +13703,7 @@ client.payouts.get(
-
client.payouts.list_entries(...) +
client.payouts.list_entries(...) -> AsyncPager[PayoutEntry, ListPayoutEntriesResponse]
@@ -13738,7 +13818,7 @@ Default: `100`
## Refunds -
client.refunds.list(...) +
client.refunds.list(...) -> AsyncPager[PaymentRefund, ListPaymentRefundsResponse]
@@ -13960,7 +14040,7 @@ Default: The current time.
-
client.refunds.refund_payment(...) +
client.refunds.refund_payment(...) -> AsyncHttpResponse[RefundPaymentResponse]
@@ -14197,7 +14277,7 @@ Additional details required when recording an unlinked external refund
-
client.refunds.get(...) +
client.refunds.get(...) -> AsyncHttpResponse[GetPaymentRefundResponse]
@@ -14268,7 +14348,7 @@ client.refunds.get(
## Sites -
client.sites.list() +
client.sites.list() -> AsyncHttpResponse[ListSitesResponse]
@@ -14332,7 +14412,7 @@ client.sites.list()
## Snippets -
client.snippets.get(...) +
client.snippets.get(...) -> AsyncHttpResponse[GetSnippetResponse]
@@ -14407,7 +14487,7 @@ client.snippets.get(
-
client.snippets.upsert(...) +
client.snippets.upsert(...) -> AsyncHttpResponse[UpsertSnippetResponse]
@@ -14492,7 +14572,7 @@ client.snippets.upsert(
-
client.snippets.delete(...) +
client.snippets.delete(...) -> AsyncHttpResponse[DeleteSnippetResponse]
@@ -14568,7 +14648,7 @@ client.snippets.delete(
## Subscriptions -
client.subscriptions.create(...) +
client.subscriptions.create(...) -> AsyncHttpResponse[CreateSubscriptionResponse]
@@ -14787,7 +14867,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 +14964,7 @@ day.
-
client.subscriptions.search(...) +
client.subscriptions.search(...) -> AsyncHttpResponse[SearchSubscriptionsResponse]
@@ -15016,7 +15096,7 @@ The supported values are:
-
client.subscriptions.get(...) +
client.subscriptions.get(...) -> AsyncHttpResponse[GetSubscriptionResponse]
@@ -15101,7 +15181,7 @@ The supported query parameter values are:
-
client.subscriptions.update(...) +
client.subscriptions.update(...) -> AsyncHttpResponse[UpdateSubscriptionResponse]
@@ -15185,7 +15265,7 @@ be treated as a request to clear the relevant data.
-
client.subscriptions.delete_action(...) +
client.subscriptions.delete_action(...) -> AsyncHttpResponse[DeleteSubscriptionActionResponse]
@@ -15264,7 +15344,7 @@ client.subscriptions.delete_action(
-
client.subscriptions.change_billing_anchor_date(...) +
client.subscriptions.change_billing_anchor_date(...) -> AsyncHttpResponse[ChangeBillingAnchorDateResponse]
@@ -15358,7 +15438,7 @@ is changed immediately.
-
client.subscriptions.cancel(...) +
client.subscriptions.cancel(...) -> AsyncHttpResponse[CancelSubscriptionResponse]
@@ -15430,7 +15510,7 @@ client.subscriptions.cancel(
-
client.subscriptions.list_events(...) +
client.subscriptions.list_events(...) -> AsyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]
@@ -15532,7 +15612,7 @@ in a paged response.
-
client.subscriptions.pause(...) +
client.subscriptions.pause(...) -> AsyncHttpResponse[PauseSubscriptionResponse]
@@ -15660,7 +15740,7 @@ See [ChangeTiming](#type-changetiming) for possible values
-
client.subscriptions.resume(...) +
client.subscriptions.resume(...) -> AsyncHttpResponse[ResumeSubscriptionResponse]
@@ -15750,7 +15830,7 @@ See [ChangeTiming](#type-changetiming) for possible values
-
client.subscriptions.swap_plan(...) +
client.subscriptions.swap_plan(...) -> AsyncHttpResponse[SwapPlanResponse]
@@ -15846,7 +15926,7 @@ This field is required.
## TeamMembers -
client.team_members.create(...) +
client.team_members.create(...) -> AsyncHttpResponse[CreateTeamMemberResponse]
@@ -15966,7 +16046,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 +16153,7 @@ call [ListJobs](api-endpoint:Team-ListJobs).
-
client.team_members.batch_update(...) +
client.team_members.batch_update(...) -> AsyncHttpResponse[BatchUpdateTeamMembersResponse]
@@ -16184,7 +16264,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 +16356,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 +16427,7 @@ client.team_members.get(
-
client.team_members.update(...) +
client.team_members.update(...) -> AsyncHttpResponse[UpdateTeamMemberResponse]
@@ -16459,7 +16539,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 +16613,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 +16697,7 @@ but must be unique for each request. For more information, see
-
client.team.retrieve_job(...) +
client.team.retrieve_job(...) -> AsyncHttpResponse[RetrieveJobResponse]
@@ -16687,7 +16767,7 @@ client.team.retrieve_job(
-
client.team.update_job(...) +
client.team.update_job(...) -> AsyncHttpResponse[UpdateJobResponse]
@@ -16772,7 +16852,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 +16924,7 @@ client.terminal.dismiss_terminal_action(
-
client.terminal.dismiss_terminal_checkout(...) +
client.terminal.dismiss_terminal_checkout(...) -> AsyncHttpResponse[DismissTerminalCheckoutResponse]
@@ -16914,7 +16994,7 @@ client.terminal.dismiss_terminal_checkout(
-
client.terminal.dismiss_terminal_refund(...) +
client.terminal.dismiss_terminal_refund(...) -> AsyncHttpResponse[DismissTerminalRefundResponse]
@@ -16985,7 +17065,7 @@ client.terminal.dismiss_terminal_refund(
## TransferOrders -
client.transfer_orders.create(...) +
client.transfer_orders.create(...) -> AsyncHttpResponse[CreateTransferOrderResponse]
@@ -17103,7 +17183,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 +17289,7 @@ for page in response.iter_pages():
-
client.transfer_orders.get(...) +
client.transfer_orders.get(...) -> AsyncHttpResponse[RetrieveTransferOrderResponse]
@@ -17285,7 +17365,7 @@ client.transfer_orders.get(
-
client.transfer_orders.update(...) +
client.transfer_orders.update(...) -> AsyncHttpResponse[UpdateTransferOrderResponse]
@@ -17399,7 +17479,7 @@ client.transfer_orders.update(
-
client.transfer_orders.delete(...) +
client.transfer_orders.delete(...) -> AsyncHttpResponse[DeleteTransferOrderResponse]
@@ -17482,7 +17562,7 @@ client.transfer_orders.delete(
-
client.transfer_orders.cancel(...) +
client.transfer_orders.cancel(...) -> AsyncHttpResponse[CancelTransferOrderResponse]
@@ -17582,7 +17662,7 @@ any valid string but must be unique for every UpdateTransferOrder request.
-
client.transfer_orders.receive(...) +
client.transfer_orders.receive(...) -> AsyncHttpResponse[ReceiveTransferOrderResponse]
@@ -17635,13 +17715,13 @@ client.transfer_orders.receive( receipt={ "line_items": [ { - "transfer_order_line_uid": "transfer_order_line_uid", + "transfer_order_line_uid": "1", "quantity_received": "3", "quantity_damaged": "1", "quantity_canceled": "1", }, { - "transfer_order_line_uid": "transfer_order_line_uid", + "transfer_order_line_uid": "2", "quantity_received": "2", "quantity_canceled": "1", }, @@ -17708,7 +17788,7 @@ client.transfer_orders.receive(
-
client.transfer_orders.start(...) +
client.transfer_orders.start(...) -> AsyncHttpResponse[StartTransferOrderResponse]
@@ -17807,7 +17887,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 +17979,7 @@ client.vendors.batch_create(
-
client.vendors.batch_get(...) +
client.vendors.batch_get(...) -> AsyncHttpResponse[BatchGetVendorsResponse]
@@ -17969,7 +18049,7 @@ client.vendors.batch_get(
-
client.vendors.batch_update(...) +
client.vendors.batch_update(...) -> AsyncHttpResponse[BatchUpdateVendorsResponse]
@@ -18045,7 +18125,7 @@ objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorReq
-
client.vendors.create(...) +
client.vendors.create(...) -> AsyncHttpResponse[CreateVendorResponse]
@@ -18150,7 +18230,7 @@ information.
-
client.vendors.search(...) +
client.vendors.search(...) -> AsyncHttpResponse[SearchVendorsResponse]
@@ -18239,7 +18319,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.vendors.get(...) +
client.vendors.get(...) -> AsyncHttpResponse[GetVendorResponse]
@@ -18309,7 +18389,7 @@ client.vendors.get(
-
client.vendors.update(...) +
client.vendors.update(...) -> AsyncHttpResponse[UpdateVendorResponse]
@@ -18405,12 +18485,61 @@ information.
+ + +
+ +## Mobile +
client.mobile.authorization_code() -> AsyncHttpResponse[None] +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```python +from square import Square + +client = Square( + token="YOUR_TOKEN", +) +client.mobile.authorization_code() + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. + +
+
+
+
+ +
## Bookings CustomAttributeDefinitions -
client.bookings.custom_attribute_definitions.list(...) +
client.bookings.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListBookingCustomAttributeDefinitionsResponse +]
@@ -18505,7 +18634,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 +18737,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 +18827,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 +18936,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 +19013,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 +19093,7 @@ information needed to delete a custom attribute.
-
client.bookings.custom_attributes.batch_upsert(...) +
client.bookings.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertBookingCustomAttributesResponse]
@@ -19044,7 +19173,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 +19290,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 +19403,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 +19521,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 +19611,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 +19696,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 +19798,7 @@ for page in response.iter_pages():
-
client.bookings.team_member_profiles.get(...) +
client.bookings.team_member_profiles.get(...) -> AsyncHttpResponse[GetTeamMemberBookingProfileResponse]
@@ -19740,7 +19869,7 @@ client.bookings.team_member_profiles.get(
## CashDrawers Shifts -
client.cash_drawers.shifts.list(...) +
client.cash_drawers.shifts.list(...) -> AsyncPager[CashDrawerShiftSummary, ListCashDrawerShiftsResponse]
@@ -19867,7 +19996,7 @@ default, 1000 max).
-
client.cash_drawers.shifts.get(...) +
client.cash_drawers.shifts.get(...) -> AsyncHttpResponse[GetCashDrawerShiftResponse]
@@ -19947,7 +20076,7 @@ client.cash_drawers.shifts.get(
-
client.cash_drawers.shifts.list_events(...) +
client.cash_drawers.shifts.list_events(...) -> AsyncPager[CashDrawerShiftEvent, ListCashDrawerShiftEventsResponse]
@@ -20053,7 +20182,7 @@ default, 1000 max).
## Catalog Images -
client.catalog.images.create(...) +
client.catalog.images.create(...) -> AsyncHttpResponse[CreateCatalogImageResponse]
@@ -20136,7 +20265,7 @@ typing.Optional[core.File]` — See core.File for more documentation
-
client.catalog.images.update(...) +
client.catalog.images.update(...) -> AsyncHttpResponse[UpdateCatalogImageResponse]
@@ -20228,7 +20357,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 +20395,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 +20456,7 @@ A CatalogObject to be created or updated.
-
client.catalog.object.get(...) +
client.catalog.object.get(...) -> AsyncHttpResponse[GetCatalogObjectResponse]
@@ -20455,7 +20584,7 @@ in the response payload.
-
client.catalog.object.delete(...) +
client.catalog.object.delete(...) -> AsyncHttpResponse[DeleteCatalogObjectResponse]
@@ -20539,7 +20668,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 +20763,7 @@ Default value: `100`
-
client.checkout.payment_links.create(...) +
client.checkout.payment_links.create(...) -> AsyncHttpResponse[CreatePaymentLinkResponse]
@@ -20781,7 +20910,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 +20980,7 @@ client.checkout.payment_links.get(
-
client.checkout.payment_links.update(...) +
client.checkout.payment_links.update(...) -> AsyncHttpResponse[UpdatePaymentLinkResponse]
@@ -20938,7 +21067,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 +21138,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 +21237,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 +21343,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 +21434,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 +21549,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 +21624,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 +21742,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 +21836,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.customers.groups.create(...) +
client.customers.groups.create(...) -> AsyncHttpResponse[CreateCustomerGroupResponse]
@@ -21785,7 +21916,7 @@ client.customers.groups.create(
-
client.customers.groups.get(...) +
client.customers.groups.get(...) -> AsyncHttpResponse[GetCustomerGroupResponse]
@@ -21855,7 +21986,7 @@ client.customers.groups.get(
-
client.customers.groups.update(...) +
client.customers.groups.update(...) -> AsyncHttpResponse[UpdateCustomerGroupResponse]
@@ -21934,7 +22065,7 @@ client.customers.groups.update(
-
client.customers.groups.delete(...) +
client.customers.groups.delete(...) -> AsyncHttpResponse[DeleteCustomerGroupResponse]
@@ -22004,7 +22135,7 @@ client.customers.groups.delete(
-
client.customers.groups.add(...) +
client.customers.groups.add(...) -> AsyncHttpResponse[AddGroupToCustomerResponse]
@@ -22086,7 +22217,7 @@ client.customers.groups.add(
-
client.customers.groups.remove(...) +
client.customers.groups.remove(...) -> AsyncHttpResponse[RemoveGroupFromCustomerResponse]
@@ -22169,7 +22300,7 @@ client.customers.groups.remove(
## Customers Segments -
client.customers.segments.list(...) +
client.customers.segments.list(...) -> AsyncPager[CustomerSegment, ListCustomerSegmentsResponse]
@@ -22263,7 +22394,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.customers.segments.get(...) +
client.customers.segments.get(...) -> AsyncHttpResponse[GetCustomerSegmentResponse]
@@ -22334,7 +22465,7 @@ client.customers.segments.get(
## Customers Cards -
client.customers.cards.create(...) +
client.customers.cards.create(...) -> AsyncHttpResponse[CreateCustomerCardResponse]
@@ -22469,7 +22600,7 @@ challenge results to indicate that Square has verified the buyer identity.
-
client.customers.cards.delete(...) +
client.customers.cards.delete(...) -> AsyncHttpResponse[DeleteCustomerCardResponse]
@@ -22549,7 +22680,7 @@ client.customers.cards.delete(
## Customers CustomAttributes -
client.customers.custom_attributes.list(...) +
client.customers.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]
@@ -22670,7 +22801,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 +22918,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 +23038,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 +23126,7 @@ definition owner, you must use the qualified key.
## Devices Codes -
client.devices.codes.list(...) +
client.devices.codes.list(...) -> AsyncPager[DeviceCode, ListDeviceCodesResponse]
@@ -23110,7 +23241,7 @@ Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty.
-
client.devices.codes.create(...) +
client.devices.codes.create(...) -> AsyncHttpResponse[CreateDeviceCodeResponse]
@@ -23199,7 +23330,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 +23401,7 @@ client.devices.codes.get(
## Disputes Evidence -
client.disputes.evidence.list(...) +
client.disputes.evidence.list(...) -> AsyncPager[DisputeEvidence, ListDisputeEvidenceResponse]
@@ -23358,7 +23489,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.disputes.evidence.get(...) +
client.disputes.evidence.get(...) -> AsyncHttpResponse[GetDisputeEvidenceResponse]
@@ -23439,7 +23570,7 @@ client.disputes.evidence.get(
-
client.disputes.evidence.delete(...) +
client.disputes.evidence.delete(...) -> AsyncHttpResponse[DeleteDisputeEvidenceResponse]
@@ -23520,7 +23651,7 @@ client.disputes.evidence.delete(
## GiftCards Activities -
client.gift_cards.activities.list(...) +
client.gift_cards.activities.list(...) -> AsyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]
@@ -23690,7 +23821,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 +23913,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 +24012,7 @@ and 200. The default is 200.
-
client.labor.break_types.create(...) +
client.labor.break_types.create(...) -> AsyncHttpResponse[CreateBreakTypeResponse]
@@ -23978,7 +24109,7 @@ client.labor.break_types.create(
-
client.labor.break_types.get(...) +
client.labor.break_types.get(...) -> AsyncHttpResponse[GetBreakTypeResponse]
@@ -24048,7 +24179,7 @@ client.labor.break_types.get(
-
client.labor.break_types.update(...) +
client.labor.break_types.update(...) -> AsyncHttpResponse[UpdateBreakTypeResponse]
@@ -24133,7 +24264,7 @@ client.labor.break_types.update(
-
client.labor.break_types.delete(...) +
client.labor.break_types.delete(...) -> AsyncHttpResponse[DeleteBreakTypeResponse]
@@ -24206,7 +24337,7 @@ client.labor.break_types.delete(
## Labor EmployeeWages -
client.labor.employee_wages.list(...) +
client.labor.employee_wages.list(...) -> AsyncPager[EmployeeWage, ListEmployeeWagesResponse]
@@ -24302,7 +24433,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 +24504,7 @@ client.labor.employee_wages.get(
## Labor Shifts -
client.labor.shifts.create(...) +
client.labor.shifts.create(...) -> AsyncHttpResponse[CreateShiftResponse]
@@ -24490,7 +24621,7 @@ client.labor.shifts.create(
-
client.labor.shifts.search(...) +
client.labor.shifts.search(...) -> AsyncHttpResponse[SearchShiftsResponse]
@@ -24601,7 +24732,7 @@ client.labor.shifts.search(
-
client.labor.shifts.get(...) +
client.labor.shifts.get(...) -> AsyncHttpResponse[GetShiftResponse]
@@ -24671,7 +24802,7 @@ client.labor.shifts.get(
-
client.labor.shifts.update(...) +
client.labor.shifts.update(...) -> AsyncHttpResponse[UpdateShiftResponse]
@@ -24779,7 +24910,7 @@ client.labor.shifts.update(
-
client.labor.shifts.delete(...) +
client.labor.shifts.delete(...) -> AsyncHttpResponse[DeleteShiftResponse]
@@ -24850,7 +24981,7 @@ client.labor.shifts.delete(
## Labor TeamMemberWages -
client.labor.team_member_wages.list(...) +
client.labor.team_member_wages.list(...) -> AsyncPager[TeamMemberWage, ListTeamMemberWagesResponse]
@@ -24949,7 +25080,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 +25151,7 @@ client.labor.team_member_wages.get(
## Labor WorkweekConfigs -
client.labor.workweek_configs.list(...) +
client.labor.workweek_configs.list(...) -> AsyncPager[WorkweekConfig, ListWorkweekConfigsResponse]
@@ -25104,7 +25235,7 @@ for page in response.iter_pages():
-
client.labor.workweek_configs.get(...) +
client.labor.workweek_configs.get(...) -> AsyncHttpResponse[UpdateWorkweekConfigResponse]
@@ -25188,7 +25319,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 +25425,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 +25526,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 +25615,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 +25726,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 +25800,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 +25882,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 +25987,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 +26115,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 +26229,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 +26344,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 +26430,7 @@ definition owner, you must use the qualified key.
## Locations Transactions -
client.locations.transactions.list(...) +
client.locations.transactions.list(...) -> AsyncHttpResponse[ListTransactionsResponse]
@@ -26430,7 +26563,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 +26642,7 @@ client.locations.transactions.get(
-
client.locations.transactions.capture(...) +
client.locations.transactions.capture(...) -> AsyncHttpResponse[CaptureTransactionResponse]
@@ -26593,7 +26726,7 @@ client.locations.transactions.capture(
-
client.locations.transactions.void(...) +
client.locations.transactions.void(...) -> AsyncHttpResponse[VoidTransactionResponse]
@@ -26678,7 +26811,7 @@ client.locations.transactions.void(
## Loyalty Accounts -
client.loyalty.accounts.create(...) +
client.loyalty.accounts.create(...) -> AsyncHttpResponse[CreateLoyaltyAccountResponse]
@@ -26763,7 +26896,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 +26994,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 +27064,7 @@ client.loyalty.accounts.get(
-
client.loyalty.accounts.accumulate_points(...) +
client.loyalty.accounts.accumulate_points(...) -> AsyncHttpResponse[AccumulateLoyaltyPointsResponse]
@@ -27048,7 +27181,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 +27292,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 +27356,7 @@ client.loyalty.programs.list()
-
client.loyalty.programs.get(...) +
client.loyalty.programs.get(...) -> AsyncHttpResponse[GetLoyaltyProgramResponse]
@@ -27295,7 +27428,7 @@ client.loyalty.programs.get(
-
client.loyalty.programs.calculate(...) +
client.loyalty.programs.calculate(...) -> AsyncHttpResponse[CalculateLoyaltyPointsResponse]
@@ -27423,7 +27556,7 @@ for regardless of the trigger limit.
## Loyalty Rewards -
client.loyalty.rewards.create(...) +
client.loyalty.rewards.create(...) -> AsyncHttpResponse[CreateLoyaltyRewardResponse]
@@ -27516,7 +27649,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 +27751,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 +27821,7 @@ client.loyalty.rewards.get(
-
client.loyalty.rewards.delete(...) +
client.loyalty.rewards.delete(...) -> AsyncHttpResponse[DeleteLoyaltyRewardResponse]
@@ -27766,7 +27899,7 @@ client.loyalty.rewards.delete(
-
client.loyalty.rewards.redeem(...) +
client.loyalty.rewards.redeem(...) -> AsyncHttpResponse[RedeemLoyaltyRewardResponse]
@@ -27868,7 +28001,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 +28119,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 +28233,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 +28315,7 @@ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using
-
client.loyalty.programs.promotions.cancel(...) +
client.loyalty.programs.promotions.cancel(...) -> AsyncHttpResponse[CancelLoyaltyPromotionResponse]
@@ -28270,7 +28403,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 +28509,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 +28610,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 +28699,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 +28809,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 +28883,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 +28964,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 +29062,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 +29190,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 +29304,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 +29419,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 +29505,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 +29614,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 +29715,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 +29801,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 +29904,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 +29977,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 +30071,7 @@ client.orders.custom_attributes.batch_delete(
-
client.orders.custom_attributes.batch_upsert(...) +
client.orders.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertOrderCustomAttributesResponse]
@@ -30036,7 +30173,7 @@ client.orders.custom_attributes.batch_upsert(
-
client.orders.custom_attributes.list(...) +
client.orders.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListOrderCustomAttributesResponse]
@@ -30167,7 +30304,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 +30418,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 +30536,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 +30623,7 @@ existing custom attribute definition.
## TeamMembers WageSetting -
client.team_members.wage_setting.get(...) +
client.team_members.wage_setting.get(...) -> AsyncHttpResponse[GetWageSettingResponse]
@@ -30561,7 +30698,7 @@ client.team_members.wage_setting.get(
-
client.team_members.wage_setting.update(...) +
client.team_members.wage_setting.update(...) -> AsyncHttpResponse[UpdateWageSettingResponse]
@@ -30669,7 +30806,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 +30899,7 @@ information.
-
client.terminal.actions.search(...) +
client.terminal.actions.search(...) -> AsyncHttpResponse[SearchTerminalActionsResponse]
@@ -30860,7 +30997,7 @@ information.
-
client.terminal.actions.get(...) +
client.terminal.actions.get(...) -> AsyncHttpResponse[GetTerminalActionResponse]
@@ -30930,7 +31067,7 @@ client.terminal.actions.get(
-
client.terminal.actions.cancel(...) +
client.terminal.actions.cancel(...) -> AsyncHttpResponse[CancelTerminalActionResponse]
@@ -31001,7 +31138,7 @@ client.terminal.actions.cancel(
## Terminal Checkouts -
client.terminal.checkouts.create(...) +
client.terminal.checkouts.create(...) -> AsyncHttpResponse[CreateTerminalCheckoutResponse]
@@ -31091,7 +31228,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 +31322,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 +31392,7 @@ client.terminal.checkouts.get(
-
client.terminal.checkouts.cancel(...) +
client.terminal.checkouts.cancel(...) -> AsyncHttpResponse[CancelTerminalCheckoutResponse]
@@ -31326,7 +31463,7 @@ client.terminal.checkouts.cancel(
## Terminal Refunds -
client.terminal.refunds.create(...) +
client.terminal.refunds.create(...) -> AsyncHttpResponse[CreateTerminalRefundResponse]
@@ -31415,7 +31552,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 +31646,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 +31716,7 @@ client.terminal.refunds.get(
-
client.terminal.refunds.cancel(...) +
client.terminal.refunds.cancel(...) -> AsyncHttpResponse[CancelTerminalRefundResponse]
@@ -31650,7 +31787,7 @@ client.terminal.refunds.cancel(
## Webhooks EventTypes -
client.webhooks.event_types.list(...) +
client.webhooks.event_types.list(...) -> AsyncHttpResponse[ListWebhookEventTypesResponse]
@@ -31721,7 +31858,7 @@ client.webhooks.event_types.list(
## Webhooks Subscriptions -
client.webhooks.subscriptions.list(...) +
client.webhooks.subscriptions.list(...) -> AsyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]
@@ -31840,7 +31977,7 @@ Default: 100
-
client.webhooks.subscriptions.create(...) +
client.webhooks.subscriptions.create(...) -> AsyncHttpResponse[CreateWebhookSubscriptionResponse]
@@ -31924,7 +32061,7 @@ client.webhooks.subscriptions.create(
-
client.webhooks.subscriptions.get(...) +
client.webhooks.subscriptions.get(...) -> AsyncHttpResponse[GetWebhookSubscriptionResponse]
@@ -31994,7 +32131,7 @@ client.webhooks.subscriptions.get(
-
client.webhooks.subscriptions.update(...) +
client.webhooks.subscriptions.update(...) -> AsyncHttpResponse[UpdateWebhookSubscriptionResponse]
@@ -32076,7 +32213,7 @@ client.webhooks.subscriptions.update(
-
client.webhooks.subscriptions.delete(...) +
client.webhooks.subscriptions.delete(...) -> AsyncHttpResponse[DeleteWebhookSubscriptionResponse]
@@ -32146,7 +32283,7 @@ client.webhooks.subscriptions.delete(
-
client.webhooks.subscriptions.update_signature_key(...) +
client.webhooks.subscriptions.update_signature_key(...) -> AsyncHttpResponse[UpdateWebhookSubscriptionSignatureKeyResponse]
@@ -32225,7 +32362,7 @@ client.webhooks.subscriptions.update_signature_key(
-
client.webhooks.subscriptions.test(...) +
client.webhooks.subscriptions.test(...) -> AsyncHttpResponse[TestWebhookSubscriptionResponse]
diff --git a/src/square/bank_accounts/client.py b/src/square/bank_accounts/client.py index bb738b1b..34c29a5b 100644 --- a/src/square/bank_accounts/client.py +++ b/src/square/bank_accounts/client.py @@ -6,11 +6,16 @@ from ..core.pagination import AsyncPager, SyncPager from ..core.request_options import RequestOptions from ..types.bank_account import BankAccount +from ..types.create_bank_account_response import CreateBankAccountResponse +from ..types.disable_bank_account_response import DisableBankAccountResponse from ..types.get_bank_account_by_v1id_response import GetBankAccountByV1IdResponse from ..types.get_bank_account_response import GetBankAccountResponse from ..types.list_bank_accounts_response import ListBankAccountsResponse from .raw_client import AsyncRawBankAccountsClient, RawBankAccountsClient +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + class BankAccountsClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -33,6 +38,7 @@ def list( cursor: typing.Optional[str] = None, limit: typing.Optional[int] = None, location_id: typing.Optional[str] = None, + customer_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[BankAccount, ListBankAccountsResponse]: """ @@ -56,6 +62,10 @@ def list( Location ID. You can specify this optional filter to retrieve only the linked bank accounts belonging to a specific location. + customer_id : typing.Optional[str] + Customer ID. You can specify this optional filter + to retrieve only the linked bank accounts belonging to a specific customer. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -75,6 +85,7 @@ def list( cursor="cursor", limit=1, location_id="location_id", + customer_id="customer_id", ) for item in response: yield item @@ -83,9 +94,66 @@ def list( yield page """ return self._raw_client.list( - cursor=cursor, limit=limit, location_id=location_id, request_options=request_options + cursor=cursor, + limit=limit, + location_id=location_id, + customer_id=customer_id, + request_options=request_options, ) + def create_bank_account( + self, + *, + idempotency_key: str, + source_id: str, + customer_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateBankAccountResponse: + """ + Store a bank account on file for a square account + + Parameters + ---------- + idempotency_key : str + Unique ID. For more information, see the + [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + + source_id : str + The ID of the source that represents the bank account information to be stored. This field + accepts the payment token created by WebSDK + + customer_id : typing.Optional[str] + The ID of the customer associated with the bank account to be stored. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateBankAccountResponse + Success + + Examples + -------- + from square import Square + + client = Square( + token="YOUR_TOKEN", + ) + client.bank_accounts.create_bank_account( + idempotency_key="4e43559a-f0fd-47d3-9da2-7ea1f97d94be", + source_id="bnon:CA4SEHsQwr0rx6DbWLD5BQaqMnoYAQ", + customer_id="HM3B2D5JKGZ69359BTEHXM2V8M", + ) + """ + _response = self._raw_client.create_bank_account( + idempotency_key=idempotency_key, + source_id=source_id, + customer_id=customer_id, + request_options=request_options, + ) + return _response.data + def get_by_v1id( self, v1bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> GetBankAccountByV1IdResponse: @@ -124,8 +192,7 @@ def get( self, bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> GetBankAccountResponse: """ - Returns details of a [BankAccount](entity:BankAccount) - linked to a Square account. + Retrieve details of a [BankAccount](entity:BankAccount) bank account linked to a Square account. Parameters ---------- @@ -154,6 +221,39 @@ def get( _response = self._raw_client.get(bank_account_id, request_options=request_options) return _response.data + def disable_bank_account( + self, bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DisableBankAccountResponse: + """ + Disable a bank account. + + Parameters + ---------- + bank_account_id : str + The ID of the bank account to disable. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DisableBankAccountResponse + Success + + Examples + -------- + from square import Square + + client = Square( + token="YOUR_TOKEN", + ) + client.bank_accounts.disable_bank_account( + bank_account_id="bank_account_id", + ) + """ + _response = self._raw_client.disable_bank_account(bank_account_id, request_options=request_options) + return _response.data + class AsyncBankAccountsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -176,6 +276,7 @@ async def list( cursor: typing.Optional[str] = None, limit: typing.Optional[int] = None, location_id: typing.Optional[str] = None, + customer_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[BankAccount, ListBankAccountsResponse]: """ @@ -199,6 +300,10 @@ async def list( Location ID. You can specify this optional filter to retrieve only the linked bank accounts belonging to a specific location. + customer_id : typing.Optional[str] + Customer ID. You can specify this optional filter + to retrieve only the linked bank accounts belonging to a specific customer. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -223,6 +328,7 @@ async def main() -> None: cursor="cursor", limit=1, location_id="location_id", + customer_id="customer_id", ) async for item in response: yield item @@ -235,9 +341,74 @@ async def main() -> None: asyncio.run(main()) """ return await self._raw_client.list( - cursor=cursor, limit=limit, location_id=location_id, request_options=request_options + cursor=cursor, + limit=limit, + location_id=location_id, + customer_id=customer_id, + request_options=request_options, ) + async def create_bank_account( + self, + *, + idempotency_key: str, + source_id: str, + customer_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> CreateBankAccountResponse: + """ + Store a bank account on file for a square account + + Parameters + ---------- + idempotency_key : str + Unique ID. For more information, see the + [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + + source_id : str + The ID of the source that represents the bank account information to be stored. This field + accepts the payment token created by WebSDK + + customer_id : typing.Optional[str] + The ID of the customer associated with the bank account to be stored. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + CreateBankAccountResponse + Success + + Examples + -------- + import asyncio + + from square import AsyncSquare + + client = AsyncSquare( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.bank_accounts.create_bank_account( + idempotency_key="4e43559a-f0fd-47d3-9da2-7ea1f97d94be", + source_id="bnon:CA4SEHsQwr0rx6DbWLD5BQaqMnoYAQ", + customer_id="HM3B2D5JKGZ69359BTEHXM2V8M", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.create_bank_account( + idempotency_key=idempotency_key, + source_id=source_id, + customer_id=customer_id, + request_options=request_options, + ) + return _response.data + async def get_by_v1id( self, v1bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> GetBankAccountByV1IdResponse: @@ -284,8 +455,7 @@ async def get( self, bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> GetBankAccountResponse: """ - Returns details of a [BankAccount](entity:BankAccount) - linked to a Square account. + Retrieve details of a [BankAccount](entity:BankAccount) bank account linked to a Square account. Parameters ---------- @@ -321,3 +491,44 @@ async def main() -> None: """ _response = await self._raw_client.get(bank_account_id, request_options=request_options) return _response.data + + async def disable_bank_account( + self, bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> DisableBankAccountResponse: + """ + Disable a bank account. + + Parameters + ---------- + bank_account_id : str + The ID of the bank account to disable. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DisableBankAccountResponse + Success + + Examples + -------- + import asyncio + + from square import AsyncSquare + + client = AsyncSquare( + token="YOUR_TOKEN", + ) + + + async def main() -> None: + await client.bank_accounts.disable_bank_account( + bank_account_id="bank_account_id", + ) + + + asyncio.run(main()) + """ + _response = await self._raw_client.disable_bank_account(bank_account_id, request_options=request_options) + return _response.data diff --git a/src/square/bank_accounts/raw_client.py b/src/square/bank_accounts/raw_client.py index 0b79ce9b..18b1bd4d 100644 --- a/src/square/bank_accounts/raw_client.py +++ b/src/square/bank_accounts/raw_client.py @@ -11,10 +11,15 @@ from ..core.request_options import RequestOptions from ..core.unchecked_base_model import construct_type from ..types.bank_account import BankAccount +from ..types.create_bank_account_response import CreateBankAccountResponse +from ..types.disable_bank_account_response import DisableBankAccountResponse from ..types.get_bank_account_by_v1id_response import GetBankAccountByV1IdResponse from ..types.get_bank_account_response import GetBankAccountResponse from ..types.list_bank_accounts_response import ListBankAccountsResponse +# this is used as the default value for optional parameters +OMIT = typing.cast(typing.Any, ...) + class RawBankAccountsClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -26,6 +31,7 @@ def list( cursor: typing.Optional[str] = None, limit: typing.Optional[int] = None, location_id: typing.Optional[str] = None, + customer_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[BankAccount, ListBankAccountsResponse]: """ @@ -49,6 +55,10 @@ def list( Location ID. You can specify this optional filter to retrieve only the linked bank accounts belonging to a specific location. + customer_id : typing.Optional[str] + Customer ID. You can specify this optional filter + to retrieve only the linked bank accounts belonging to a specific customer. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -64,6 +74,7 @@ def list( "cursor": cursor, "limit": limit, "location_id": location_id, + "customer_id": customer_id, }, request_options=request_options, ) @@ -83,6 +94,7 @@ def list( cursor=_parsed_next, limit=limit, location_id=location_id, + customer_id=customer_id, request_options=request_options, ) return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response) @@ -91,6 +103,67 @@ def list( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + def create_bank_account( + self, + *, + idempotency_key: str, + source_id: str, + customer_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> HttpResponse[CreateBankAccountResponse]: + """ + Store a bank account on file for a square account + + Parameters + ---------- + idempotency_key : str + Unique ID. For more information, see the + [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + + source_id : str + The ID of the source that represents the bank account information to be stored. This field + accepts the payment token created by WebSDK + + customer_id : typing.Optional[str] + The ID of the customer associated with the bank account to be stored. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[CreateBankAccountResponse] + Success + """ + _response = self._client_wrapper.httpx_client.request( + "v2/bank-accounts", + method="POST", + json={ + "idempotency_key": idempotency_key, + "source_id": source_id, + "customer_id": customer_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateBankAccountResponse, + construct_type( + type_=CreateBankAccountResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + def get_by_v1id( self, v1bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[GetBankAccountByV1IdResponse]: @@ -135,8 +208,7 @@ def get( self, bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> HttpResponse[GetBankAccountResponse]: """ - Returns details of a [BankAccount](entity:BankAccount) - linked to a Square account. + Retrieve details of a [BankAccount](entity:BankAccount) bank account linked to a Square account. Parameters ---------- @@ -171,6 +243,45 @@ def get( raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + def disable_bank_account( + self, bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> HttpResponse[DisableBankAccountResponse]: + """ + Disable a bank account. + + Parameters + ---------- + bank_account_id : str + The ID of the bank account to disable. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + HttpResponse[DisableBankAccountResponse] + Success + """ + _response = self._client_wrapper.httpx_client.request( + f"v2/bank-accounts/{jsonable_encoder(bank_account_id)}/disable", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DisableBankAccountResponse, + construct_type( + type_=DisableBankAccountResponse, # type: ignore + object_=_response.json(), + ), + ) + return HttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + class AsyncRawBankAccountsClient: def __init__(self, *, client_wrapper: AsyncClientWrapper): @@ -182,6 +293,7 @@ async def list( cursor: typing.Optional[str] = None, limit: typing.Optional[int] = None, location_id: typing.Optional[str] = None, + customer_id: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[BankAccount, ListBankAccountsResponse]: """ @@ -205,6 +317,10 @@ async def list( Location ID. You can specify this optional filter to retrieve only the linked bank accounts belonging to a specific location. + customer_id : typing.Optional[str] + Customer ID. You can specify this optional filter + to retrieve only the linked bank accounts belonging to a specific customer. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -220,6 +336,7 @@ async def list( "cursor": cursor, "limit": limit, "location_id": location_id, + "customer_id": customer_id, }, request_options=request_options, ) @@ -241,6 +358,7 @@ async def _get_next(): cursor=_parsed_next, limit=limit, location_id=location_id, + customer_id=customer_id, request_options=request_options, ) @@ -250,6 +368,67 @@ async def _get_next(): raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + async def create_bank_account( + self, + *, + idempotency_key: str, + source_id: str, + customer_id: typing.Optional[str] = OMIT, + request_options: typing.Optional[RequestOptions] = None, + ) -> AsyncHttpResponse[CreateBankAccountResponse]: + """ + Store a bank account on file for a square account + + Parameters + ---------- + idempotency_key : str + Unique ID. For more information, see the + [Idempotency](https://developer.squareup.com/docs/working-with-apis/idempotency). + + source_id : str + The ID of the source that represents the bank account information to be stored. This field + accepts the payment token created by WebSDK + + customer_id : typing.Optional[str] + The ID of the customer associated with the bank account to be stored. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[CreateBankAccountResponse] + Success + """ + _response = await self._client_wrapper.httpx_client.request( + "v2/bank-accounts", + method="POST", + json={ + "idempotency_key": idempotency_key, + "source_id": source_id, + "customer_id": customer_id, + }, + headers={ + "content-type": "application/json", + }, + request_options=request_options, + omit=OMIT, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + CreateBankAccountResponse, + construct_type( + type_=CreateBankAccountResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + async def get_by_v1id( self, v1bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[GetBankAccountByV1IdResponse]: @@ -294,8 +473,7 @@ async def get( self, bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> AsyncHttpResponse[GetBankAccountResponse]: """ - Returns details of a [BankAccount](entity:BankAccount) - linked to a Square account. + Retrieve details of a [BankAccount](entity:BankAccount) bank account linked to a Square account. Parameters ---------- @@ -329,3 +507,42 @@ async def get( except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) + + async def disable_bank_account( + self, bank_account_id: str, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[DisableBankAccountResponse]: + """ + Disable a bank account. + + Parameters + ---------- + bank_account_id : str + The ID of the bank account to disable. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AsyncHttpResponse[DisableBankAccountResponse] + Success + """ + _response = await self._client_wrapper.httpx_client.request( + f"v2/bank-accounts/{jsonable_encoder(bank_account_id)}/disable", + method="POST", + request_options=request_options, + ) + try: + if 200 <= _response.status_code < 300: + _data = typing.cast( + DisableBankAccountResponse, + construct_type( + type_=DisableBankAccountResponse, # type: ignore + object_=_response.json(), + ), + ) + return AsyncHttpResponse(response=_response, data=_data) + _response_json = _response.json() + except JSONDecodeError: + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) + raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json) 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/client.py b/src/square/client.py index be23db98..b7a806d4 100644 --- a/src/square/client.py +++ b/src/square/client.py @@ -116,7 +116,6 @@ def __init__( timeout=_defaulted_timeout, version=version, ) - self._mobile: typing.Optional[MobileClient] = None self._o_auth: typing.Optional[OAuthClient] = None self._v1transactions: typing.Optional[V1TransactionsClient] = None self._apple_pay: typing.Optional[ApplePayClient] = None @@ -150,17 +149,10 @@ def __init__( self._terminal: typing.Optional[TerminalClient] = None self._transfer_orders: typing.Optional[TransferOrdersClient] = None self._vendors: typing.Optional[VendorsClient] = None + self._mobile: typing.Optional[MobileClient] = None self._cash_drawers: typing.Optional[CashDrawersClient] = None self._webhooks: typing.Optional[WebhooksClient] = None - @property - def mobile(self): - if self._mobile is None: - from .mobile.client import MobileClient # noqa: E402 - - self._mobile = MobileClient(client_wrapper=self._client_wrapper) - return self._mobile - @property def o_auth(self): if self._o_auth is None: @@ -425,6 +417,14 @@ def vendors(self): self._vendors = VendorsClient(client_wrapper=self._client_wrapper) return self._vendors + @property + def mobile(self): + if self._mobile is None: + from .mobile.client import MobileClient # noqa: E402 + + self._mobile = MobileClient(client_wrapper=self._client_wrapper) + return self._mobile + @property def cash_drawers(self): if self._cash_drawers is None: @@ -510,7 +510,6 @@ def __init__( timeout=_defaulted_timeout, version=version, ) - self._mobile: typing.Optional[AsyncMobileClient] = None self._o_auth: typing.Optional[AsyncOAuthClient] = None self._v1transactions: typing.Optional[AsyncV1TransactionsClient] = None self._apple_pay: typing.Optional[AsyncApplePayClient] = None @@ -544,17 +543,10 @@ def __init__( self._terminal: typing.Optional[AsyncTerminalClient] = None self._transfer_orders: typing.Optional[AsyncTransferOrdersClient] = None self._vendors: typing.Optional[AsyncVendorsClient] = None + self._mobile: typing.Optional[AsyncMobileClient] = None self._cash_drawers: typing.Optional[AsyncCashDrawersClient] = None self._webhooks: typing.Optional[AsyncWebhooksClient] = None - @property - def mobile(self): - if self._mobile is None: - from .mobile.client import AsyncMobileClient # noqa: E402 - - self._mobile = AsyncMobileClient(client_wrapper=self._client_wrapper) - return self._mobile - @property def o_auth(self): if self._o_auth is None: @@ -819,6 +811,14 @@ def vendors(self): self._vendors = AsyncVendorsClient(client_wrapper=self._client_wrapper) return self._vendors + @property + def mobile(self): + if self._mobile is None: + from .mobile.client import AsyncMobileClient # noqa: E402 + + self._mobile = AsyncMobileClient(client_wrapper=self._client_wrapper) + return self._mobile + @property def cash_drawers(self): if self._cash_drawers is None: diff --git a/src/square/core/client_wrapper.py b/src/square/core/client_wrapper.py index 7f6e80d4..a58b9b46 100644 --- a/src/square/core/client_wrapper.py +++ b/src/square/core/client_wrapper.py @@ -24,16 +24,16 @@ 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/44.0.0.20260122", "X-Fern-Language": "Python", "X-Fern-SDK-Name": "squareup", - "X-Fern-SDK-Version": "43.2.1.20251016", + "X-Fern-SDK-Version": "44.0.0.20260122", **(self.get_custom_headers() or {}), } token = self._get_token() if token is not None: headers["Authorization"] = f"Bearer {token}" - headers["Square-Version"] = self._version if self._version is not None else "2025-10-16" + headers["Square-Version"] = self._version if self._version is not None else "2026-01-22" return headers def _get_token(self) -> typing.Optional[str]: @@ -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..7c6c936f 100644 --- a/src/square/core/http_client.py +++ b/src/square/core/http_client.py @@ -5,7 +5,6 @@ import re import time import typing -import urllib.parse from contextlib import asynccontextmanager, contextmanager from random import random @@ -14,13 +13,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 +63,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 +102,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 +122,45 @@ def _should_retry(response: httpx.Response) -> bool: return response.status_code >= 500 or response.status_code in retryable_400s +def _build_url(base_url: str, path: typing.Optional[str]) -> str: + """ + Build a full URL by joining a base URL with a path. + + This function correctly handles base URLs that contain path prefixes (e.g., tenant-based URLs) + by using string concatenation instead of urllib.parse.urljoin(), which would incorrectly + strip path components when the path starts with '/'. + + Example: + >>> _build_url("https://cloud.example.com/org/tenant/api", "/users") + 'https://cloud.example.com/org/tenant/api/users' + + Args: + base_url: The base URL, which may contain path prefixes. + path: The path to append. Can be None or empty string. + + Returns: + The full URL with base_url and path properly joined. + """ + if not path: + return base_url + return f"{base_url.rstrip('/')}/{path.lstrip('/')}" + + +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], @@ -143,8 +215,19 @@ def get_request_body( # If both data and json are None, we send json data in the event extra properties are specified json_body = maybe_filter_request_body(json, request_options, omit) - # If you have an empty JSON body, you should just send None - return (json_body if json_body != {} else None), data_body if data_body != {} else None + has_additional_body_parameters = bool( + request_options is not None and request_options.get("additional_body_parameters") + ) + + # Only collapse empty dict to None when the body was not explicitly provided + # and there are no additional body parameters. This preserves explicit empty + # bodies (e.g., when an endpoint has a request body type but all fields are optional). + if json_body == {} and json is None and not has_additional_body_parameters: + json_body = None + if data_body == {} and data is None and not has_additional_body_parameters: + data_body = None + + return json_body, data_body class HttpClient: @@ -188,7 +271,7 @@ def request( ] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 2, + retries: int = 0, omit: typing.Optional[typing.Any] = None, force_multipart: typing.Optional[bool] = None, ) -> httpx.Response: @@ -210,9 +293,31 @@ 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), + url=_build_url(base_url, path), headers=jsonable_encoder( remove_none_from_dict( { @@ -222,23 +327,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, @@ -246,9 +335,9 @@ def request( timeout=timeout, ) - max_retries: int = request_options.get("max_retries", 0) if request_options is not None else 0 + max_retries: int = request_options.get("max_retries", 2) if request_options is not None else 2 if _should_retry(response=response): - if max_retries > retries: + if retries < max_retries: time.sleep(_retry_timeout(response=response, retries=retries)) return self.request( path=path, @@ -285,7 +374,7 @@ def stream( ] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 2, + retries: int = 0, omit: typing.Optional[typing.Any] = None, force_multipart: typing.Optional[bool] = None, ) -> typing.Iterator[httpx.Response]: @@ -307,9 +396,31 @@ 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), + url=_build_url(base_url, path), headers=jsonable_encoder( remove_none_from_dict( { @@ -319,23 +430,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 +448,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: @@ -386,7 +488,7 @@ async def request( ] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 2, + retries: int = 0, omit: typing.Optional[typing.Any] = None, force_multipart: typing.Optional[bool] = None, ) -> httpx.Response: @@ -408,36 +510,45 @@ 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, - url=urllib.parse.urljoin(f"{base_url}/", path), + url=_build_url(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", {}) 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, @@ -445,9 +556,9 @@ async def request( timeout=timeout, ) - max_retries: int = request_options.get("max_retries", 0) if request_options is not None else 0 + max_retries: int = request_options.get("max_retries", 2) if request_options is not None else 2 if _should_retry(response=response): - if max_retries > retries: + if retries < max_retries: await asyncio.sleep(_retry_timeout(response=response, retries=retries)) return await self.request( path=path, @@ -483,7 +594,7 @@ async def stream( ] = None, headers: typing.Optional[typing.Dict[str, typing.Any]] = None, request_options: typing.Optional[RequestOptions] = None, - retries: int = 2, + retries: int = 0, omit: typing.Optional[typing.Any] = None, force_multipart: typing.Optional[bool] = None, ) -> typing.AsyncIterator[httpx.Response]: @@ -505,35 +616,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), + url=_build_url(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/jsonable_encoder.py b/src/square/core/jsonable_encoder.py index afee3662..f8beaeaf 100644 --- a/src/square/core/jsonable_encoder.py +++ b/src/square/core/jsonable_encoder.py @@ -30,6 +30,10 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any], Any]]] = None) -> Any: custom_encoder = custom_encoder or {} + # Generated SDKs use Ellipsis (`...`) as the sentinel value for "OMIT". + # OMIT values should be excluded from serialized payloads. + if obj is Ellipsis: + return None if custom_encoder: if type(obj) in custom_encoder: return custom_encoder[type(obj)](obj) @@ -70,6 +74,8 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any] allowed_keys = set(obj.keys()) for key, value in obj.items(): if key in allowed_keys: + if value is Ellipsis: + continue encoded_key = jsonable_encoder(key, custom_encoder=custom_encoder) encoded_value = jsonable_encoder(value, custom_encoder=custom_encoder) encoded_dict[encoded_key] = encoded_value @@ -77,6 +83,8 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any] if isinstance(obj, (list, set, frozenset, GeneratorType, tuple)): encoded_list = [] for item in obj: + if item is Ellipsis: + continue encoded_list.append(jsonable_encoder(item, custom_encoder=custom_encoder)) return encoded_list diff --git a/src/square/core/pydantic_utilities.py b/src/square/core/pydantic_utilities.py index 185e5c4f..12dc057b 100644 --- a/src/square/core/pydantic_utilities.py +++ b/src/square/core/pydantic_utilities.py @@ -2,6 +2,7 @@ # nopycln: file import datetime as dt +import inspect from collections import defaultdict from typing import Any, Callable, ClassVar, Dict, List, Mapping, Optional, Set, Tuple, Type, TypeVar, Union, cast @@ -37,7 +38,36 @@ def parse_obj_as(type_: Type[T], object_: Any) -> T: - dealiased_object = convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read") + # convert_and_respect_annotation_metadata is required for TypedDict aliasing. + # + # For Pydantic models, whether we should pre-dealias depends on how the model encodes aliasing: + # - If the model uses real Pydantic aliases (pydantic.Field(alias=...)), then we must pass wire keys through + # unchanged so Pydantic can validate them. + # - If the model encodes aliasing only via FieldMetadata annotations, then we MUST pre-dealias because Pydantic + # will not recognize those aliases during validation. + if inspect.isclass(type_) and issubclass(type_, pydantic.BaseModel): + has_pydantic_aliases = False + if IS_PYDANTIC_V2: + for field_name, field_info in getattr(type_, "model_fields", {}).items(): # type: ignore[attr-defined] + alias = getattr(field_info, "alias", None) + if alias is not None and alias != field_name: + has_pydantic_aliases = True + break + else: + for field in getattr(type_, "__fields__", {}).values(): + alias = getattr(field, "alias", None) + name = getattr(field, "name", None) + if alias is not None and name is not None and alias != name: + has_pydantic_aliases = True + break + + dealiased_object = ( + object_ + if has_pydantic_aliases + else convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read") + ) + else: + dealiased_object = convert_and_respect_annotation_metadata(object_=object_, annotation=type_, direction="read") if IS_PYDANTIC_V2: adapter = pydantic.TypeAdapter(type_) # type: ignore[attr-defined] return adapter.validate_python(dealiased_object) @@ -59,6 +89,43 @@ class UniversalBaseModel(pydantic.BaseModel): protected_namespaces=(), ) + @pydantic.model_validator(mode="before") # type: ignore[attr-defined] + @classmethod + def _coerce_field_names_to_aliases(cls, data: Any) -> Any: + """ + Accept Python field names in input by rewriting them to their Pydantic aliases, + while avoiding silent collisions when a key could refer to multiple fields. + """ + if not isinstance(data, Mapping): + return data + + fields = getattr(cls, "model_fields", {}) # type: ignore[attr-defined] + name_to_alias: Dict[str, str] = {} + alias_to_name: Dict[str, str] = {} + + for name, field_info in fields.items(): + alias = getattr(field_info, "alias", None) or name + name_to_alias[name] = alias + if alias != name: + alias_to_name[alias] = name + + # Detect ambiguous keys: a key that is an alias for one field and a name for another. + ambiguous_keys = set(alias_to_name.keys()).intersection(set(name_to_alias.keys())) + for key in ambiguous_keys: + if key in data and name_to_alias[key] not in data: + raise ValueError( + f"Ambiguous input key '{key}': it is both a field name and an alias. " + "Provide the explicit alias key to disambiguate." + ) + + original_keys = set(data.keys()) + rewritten: Dict[str, Any] = dict(data) + for name, alias in name_to_alias.items(): + if alias != name and name in original_keys and alias not in rewritten: + rewritten[alias] = rewritten.pop(name) + + return rewritten + @pydantic.model_serializer(mode="plain", when_used="json") # type: ignore[attr-defined] def serialize_model(self) -> Any: # type: ignore[name-defined] serialized = self.dict() # type: ignore[attr-defined] @@ -71,6 +138,40 @@ class Config: smart_union = True json_encoders = {dt.datetime: serialize_datetime} + @pydantic.root_validator(pre=True) + def _coerce_field_names_to_aliases(cls, values: Any) -> Any: + """ + Pydantic v1 equivalent of _coerce_field_names_to_aliases. + """ + if not isinstance(values, Mapping): + return values + + fields = getattr(cls, "__fields__", {}) + name_to_alias: Dict[str, str] = {} + alias_to_name: Dict[str, str] = {} + + for name, field in fields.items(): + alias = getattr(field, "alias", None) or name + name_to_alias[name] = alias + if alias != name: + alias_to_name[alias] = name + + ambiguous_keys = set(alias_to_name.keys()).intersection(set(name_to_alias.keys())) + for key in ambiguous_keys: + if key in values and name_to_alias[key] not in values: + raise ValueError( + f"Ambiguous input key '{key}': it is both a field name and an alias. " + "Provide the explicit alias key to disambiguate." + ) + + original_keys = set(values.keys()) + rewritten: Dict[str, Any] = dict(values) + for name, alias in name_to_alias.items(): + if alias != name and name in original_keys and alias not in rewritten: + rewritten[alias] = rewritten.pop(name) + + return rewritten + @classmethod def model_construct(cls: Type["Model"], _fields_set: Optional[Set[str]] = None, **values: Any) -> "Model": dealiased_object = convert_and_respect_annotation_metadata(object_=values, annotation=cls, direction="read") diff --git a/src/square/mobile/client.py b/src/square/mobile/client.py index 877eb5fe..bdcdec90 100644 --- a/src/square/mobile/client.py +++ b/src/square/mobile/client.py @@ -4,12 +4,8 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.request_options import RequestOptions -from ..types.create_mobile_authorization_code_response import CreateMobileAuthorizationCodeResponse from .raw_client import AsyncRawMobileClient, RawMobileClient -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - class MobileClient: def __init__(self, *, client_wrapper: SyncClientWrapper): @@ -26,38 +22,16 @@ def with_raw_response(self) -> RawMobileClient: """ return self._raw_client - def authorization_code( - self, *, location_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None - ) -> CreateMobileAuthorizationCodeResponse: + def authorization_code(self, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - __Note:__ This endpoint is used by the deprecated Reader SDK. - Developers should update their integration to use the [Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk), which includes its own authorization methods. - - Generates code to authorize a mobile application to connect to a Square card reader. - - Authorization codes are one-time-use codes and expire 60 minutes after being issued. - - The `Authorization` header you provide to this endpoint must have the following format: - - ``` - Authorization: Bearer ACCESS_TOKEN - ``` - - Replace `ACCESS_TOKEN` with a - [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). - Parameters ---------- - location_id : typing.Optional[str] - The Square location ID that the authorization code should be tied to. - request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - CreateMobileAuthorizationCodeResponse - Success + None Examples -------- @@ -66,11 +40,9 @@ def authorization_code( client = Square( token="YOUR_TOKEN", ) - client.mobile.authorization_code( - location_id="YOUR_LOCATION_ID", - ) + client.mobile.authorization_code() """ - _response = self._raw_client.authorization_code(location_id=location_id, request_options=request_options) + _response = self._raw_client.authorization_code(request_options=request_options) return _response.data @@ -89,38 +61,16 @@ def with_raw_response(self) -> AsyncRawMobileClient: """ return self._raw_client - async def authorization_code( - self, *, location_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None - ) -> CreateMobileAuthorizationCodeResponse: + async def authorization_code(self, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - __Note:__ This endpoint is used by the deprecated Reader SDK. - Developers should update their integration to use the [Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk), which includes its own authorization methods. - - Generates code to authorize a mobile application to connect to a Square card reader. - - Authorization codes are one-time-use codes and expire 60 minutes after being issued. - - The `Authorization` header you provide to this endpoint must have the following format: - - ``` - Authorization: Bearer ACCESS_TOKEN - ``` - - Replace `ACCESS_TOKEN` with a - [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). - Parameters ---------- - location_id : typing.Optional[str] - The Square location ID that the authorization code should be tied to. - request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - CreateMobileAuthorizationCodeResponse - Success + None Examples -------- @@ -134,12 +84,10 @@ async def authorization_code( async def main() -> None: - await client.mobile.authorization_code( - location_id="YOUR_LOCATION_ID", - ) + await client.mobile.authorization_code() asyncio.run(main()) """ - _response = await self._raw_client.authorization_code(location_id=location_id, request_options=request_options) + _response = await self._raw_client.authorization_code(request_options=request_options) return _response.data diff --git a/src/square/mobile/raw_client.py b/src/square/mobile/raw_client.py index cda6a717..99a005a2 100644 --- a/src/square/mobile/raw_client.py +++ b/src/square/mobile/raw_client.py @@ -7,72 +7,31 @@ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper from ..core.http_response import AsyncHttpResponse, HttpResponse from ..core.request_options import RequestOptions -from ..core.unchecked_base_model import construct_type -from ..types.create_mobile_authorization_code_response import CreateMobileAuthorizationCodeResponse - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) class RawMobileClient: def __init__(self, *, client_wrapper: SyncClientWrapper): self._client_wrapper = client_wrapper - def authorization_code( - self, *, location_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None - ) -> HttpResponse[CreateMobileAuthorizationCodeResponse]: + def authorization_code(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]: """ - __Note:__ This endpoint is used by the deprecated Reader SDK. - Developers should update their integration to use the [Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk), which includes its own authorization methods. - - Generates code to authorize a mobile application to connect to a Square card reader. - - Authorization codes are one-time-use codes and expire 60 minutes after being issued. - - The `Authorization` header you provide to this endpoint must have the following format: - - ``` - Authorization: Bearer ACCESS_TOKEN - ``` - - Replace `ACCESS_TOKEN` with a - [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). - Parameters ---------- - location_id : typing.Optional[str] - The Square location ID that the authorization code should be tied to. - request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - HttpResponse[CreateMobileAuthorizationCodeResponse] - Success + HttpResponse[None] """ _response = self._client_wrapper.httpx_client.request( "mobile/authorization-code", method="POST", - json={ - "location_id": location_id, - }, - headers={ - "content-type": "application/json", - }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: - _data = typing.cast( - CreateMobileAuthorizationCodeResponse, - construct_type( - type_=CreateMobileAuthorizationCodeResponse, # type: ignore - object_=_response.json(), - ), - ) - return HttpResponse(response=_response, data=_data) + return HttpResponse(response=_response, data=None) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) @@ -84,60 +43,26 @@ def __init__(self, *, client_wrapper: AsyncClientWrapper): self._client_wrapper = client_wrapper async def authorization_code( - self, *, location_id: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None - ) -> AsyncHttpResponse[CreateMobileAuthorizationCodeResponse]: + self, *, request_options: typing.Optional[RequestOptions] = None + ) -> AsyncHttpResponse[None]: """ - __Note:__ This endpoint is used by the deprecated Reader SDK. - Developers should update their integration to use the [Mobile Payments SDK](https://developer.squareup.com/docs/mobile-payments-sdk), which includes its own authorization methods. - - Generates code to authorize a mobile application to connect to a Square card reader. - - Authorization codes are one-time-use codes and expire 60 minutes after being issued. - - The `Authorization` header you provide to this endpoint must have the following format: - - ``` - Authorization: Bearer ACCESS_TOKEN - ``` - - Replace `ACCESS_TOKEN` with a - [valid production authorization credential](https://developer.squareup.com/docs/build-basics/access-tokens). - Parameters ---------- - location_id : typing.Optional[str] - The Square location ID that the authorization code should be tied to. - request_options : typing.Optional[RequestOptions] Request-specific configuration. Returns ------- - AsyncHttpResponse[CreateMobileAuthorizationCodeResponse] - Success + AsyncHttpResponse[None] """ _response = await self._client_wrapper.httpx_client.request( "mobile/authorization-code", method="POST", - json={ - "location_id": location_id, - }, - headers={ - "content-type": "application/json", - }, request_options=request_options, - omit=OMIT, ) try: if 200 <= _response.status_code < 300: - _data = typing.cast( - CreateMobileAuthorizationCodeResponse, - construct_type( - type_=CreateMobileAuthorizationCodeResponse, # type: ignore - object_=_response.json(), - ), - ) - return AsyncHttpResponse(response=_response, data=_data) + return AsyncHttpResponse(response=_response, data=None) _response_json = _response.json() except JSONDecodeError: raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text) diff --git a/src/square/o_auth/client.py b/src/square/o_auth/client.py index ccafdc01..26fabf91 100644 --- a/src/square/o_auth/client.py +++ b/src/square/o_auth/client.py @@ -114,6 +114,7 @@ def obtain_token( scopes: typing.Optional[typing.Sequence[str]] = OMIT, short_lived: typing.Optional[bool] = OMIT, code_verifier: typing.Optional[str] = OMIT, + use_jwt: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ObtainTokenResponse: """ @@ -209,6 +210,11 @@ def obtain_token( Required for the PKCE flow if `grant_type` is `authorization_code`. + use_jwt : typing.Optional[bool] + Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + When set to `true`, the OAuth flow returns a JWT to your application, used in the + same way as a regular token. The default value is `false`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -242,6 +248,7 @@ def obtain_token( scopes=scopes, short_lived=short_lived, code_verifier=code_verifier, + use_jwt=use_jwt, request_options=request_options, ) return _response.data @@ -420,6 +427,7 @@ async def obtain_token( scopes: typing.Optional[typing.Sequence[str]] = OMIT, short_lived: typing.Optional[bool] = OMIT, code_verifier: typing.Optional[str] = OMIT, + use_jwt: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> ObtainTokenResponse: """ @@ -515,6 +523,11 @@ async def obtain_token( Required for the PKCE flow if `grant_type` is `authorization_code`. + use_jwt : typing.Optional[bool] + Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + When set to `true`, the OAuth flow returns a JWT to your application, used in the + same way as a regular token. The default value is `false`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -556,6 +569,7 @@ async def main() -> None: scopes=scopes, short_lived=short_lived, code_verifier=code_verifier, + use_jwt=use_jwt, request_options=request_options, ) return _response.data diff --git a/src/square/o_auth/raw_client.py b/src/square/o_auth/raw_client.py index 1433ca30..06b05d6f 100644 --- a/src/square/o_auth/raw_client.py +++ b/src/square/o_auth/raw_client.py @@ -115,6 +115,7 @@ def obtain_token( scopes: typing.Optional[typing.Sequence[str]] = OMIT, short_lived: typing.Optional[bool] = OMIT, code_verifier: typing.Optional[str] = OMIT, + use_jwt: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> HttpResponse[ObtainTokenResponse]: """ @@ -210,6 +211,11 @@ def obtain_token( Required for the PKCE flow if `grant_type` is `authorization_code`. + use_jwt : typing.Optional[bool] + Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + When set to `true`, the OAuth flow returns a JWT to your application, used in the + same way as a regular token. The default value is `false`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -232,6 +238,7 @@ def obtain_token( "scopes": scopes, "short_lived": short_lived, "code_verifier": code_verifier, + "use_jwt": use_jwt, }, headers={ "content-type": "application/json", @@ -427,6 +434,7 @@ async def obtain_token( scopes: typing.Optional[typing.Sequence[str]] = OMIT, short_lived: typing.Optional[bool] = OMIT, code_verifier: typing.Optional[str] = OMIT, + use_jwt: typing.Optional[bool] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncHttpResponse[ObtainTokenResponse]: """ @@ -522,6 +530,11 @@ async def obtain_token( Required for the PKCE flow if `grant_type` is `authorization_code`. + use_jwt : typing.Optional[bool] + Indicates whether to use a JWT (JSON Web Token) as the OAuth access token. + When set to `true`, the OAuth flow returns a JWT to your application, used in the + same way as a regular token. The default value is `false`. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -544,6 +557,7 @@ async def obtain_token( "scopes": scopes, "short_lived": short_lived, "code_verifier": code_verifier, + "use_jwt": use_jwt, }, headers={ "content-type": "application/json", diff --git a/src/square/payments/client.py b/src/square/payments/client.py index 5110abfe..58d6535c 100644 --- a/src/square/payments/client.py +++ b/src/square/payments/client.py @@ -280,6 +280,8 @@ def create( (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges. + The currency code must match the currency associated with the business that is accepting the payment. @@ -948,6 +950,8 @@ async def create( (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges. + The currency code must match the currency associated with the business that is accepting the payment. diff --git a/src/square/payments/raw_client.py b/src/square/payments/raw_client.py index e20751dd..fd59722f 100644 --- a/src/square/payments/raw_client.py +++ b/src/square/payments/raw_client.py @@ -283,6 +283,8 @@ def create( (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges. + The currency code must match the currency associated with the business that is accepting the payment. @@ -1009,6 +1011,8 @@ async def create( (for example, US dollar amounts are specified in cents). For more information, see [Working with Monetary Amounts](https://developer.squareup.com/docs/build-basics/working-with-monetary-amounts). + Tips for external vendors such as a 3rd party delivery courier must be recorded using Order.service_charges. + The currency code must match the currency associated with the business that is accepting the payment. diff --git a/src/square/requests/bank_account.py b/src/square/requests/bank_account.py index d5623f0e..e23c72e4 100644 --- a/src/square/requests/bank_account.py +++ b/src/square/requests/bank_account.py @@ -115,3 +115,8 @@ class BankAccountParams(typing_extensions.TypedDict): Read only. Name of actual financial institution. For example "Bank of America". """ + + customer_id: typing_extensions.NotRequired[str] + """ + The ID of the customer who owns the bank account + """ diff --git a/src/square/requests/buy_now_pay_later_details.py b/src/square/requests/buy_now_pay_later_details.py index ebb5c7d0..2e550bc4 100644 --- a/src/square/requests/buy_now_pay_later_details.py +++ b/src/square/requests/buy_now_pay_later_details.py @@ -5,6 +5,7 @@ import typing_extensions from .afterpay_details import AfterpayDetailsParams from .clearpay_details import ClearpayDetailsParams +from .error import ErrorParams class BuyNowPayLaterDetailsParams(typing_extensions.TypedDict): @@ -29,3 +30,8 @@ class BuyNowPayLaterDetailsParams(typing_extensions.TypedDict): Details about a Clearpay payment. These details are only populated if the `brand` is `CLEARPAY`. """ + + errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] + """ + Information about errors encountered during the payment. + """ diff --git a/src/square/requests/card.py b/src/square/requests/card.py index b7168e59..7649ca24 100644 --- a/src/square/requests/card.py +++ b/src/square/requests/card.py @@ -104,6 +104,16 @@ class CardParams(typing_extensions.TypedDict): returns this field. """ + created_at: typing_extensions.NotRequired[str] + """ + Timestamp for when the card object was created on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". + """ + + disabled_at: typing_extensions.NotRequired[str] + """ + Timestamp for when the card object was disabled on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". + """ + version: typing_extensions.NotRequired[int] """ Current version number of the card. Increments with each card update. Requests to update an diff --git a/src/square/requests/catalog_item.py b/src/square/requests/catalog_item.py index 633abbf1..957f3078 100644 --- a/src/square/requests/catalog_item.py +++ b/src/square/requests/catalog_item.py @@ -58,6 +58,11 @@ class CatalogItemParams(typing_extensions.TypedDict): The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead. """ + buyer_facing_name: typing_extensions.NotRequired[typing.Optional[str]] + """ + The override to a product name to display to users + """ + tax_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]] """ A set of IDs indicating the taxes enabled for @@ -173,6 +178,14 @@ class CatalogItemParams(typing_extensions.TypedDict): A server-generated plaintext version of the `description_html` field, without formatting tags. """ + kitchen_name: typing_extensions.NotRequired[typing.Optional[str]] + """ + (Optional) Name that the restaurant wants to display to their kitchen workers + instead of the customer-facing name. + e.g., customer name might be "Big John's Mega Burger" and the + kitchen name is "12oz beef burger" + """ + channels: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]] """ A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. diff --git a/src/square/requests/catalog_item_modifier_list_info.py b/src/square/requests/catalog_item_modifier_list_info.py index ad9652f9..c9e00e63 100644 --- a/src/square/requests/catalog_item_modifier_list_info.py +++ b/src/square/requests/catalog_item_modifier_list_info.py @@ -3,6 +3,7 @@ import typing import typing_extensions +from ..types.catalog_modifier_toggle_override_type import CatalogModifierToggleOverrideType from .catalog_modifier_override import CatalogModifierOverrideParams @@ -57,6 +58,32 @@ class CatalogItemModifierListInfoParams(typing_extensions.TypedDict): to a `CatalogItem` instance. """ - allow_quantities: typing_extensions.NotRequired[typing.Any] - is_conversational: typing_extensions.NotRequired[typing.Any] - hidden_from_customer_override: typing_extensions.NotRequired[typing.Any] + allow_quantities: typing_extensions.NotRequired[CatalogModifierToggleOverrideType] + """ + Controls whether multiple quantities of the same modifier can be selected for this item. + - `YES` means that every modifier in the `CatalogModifierList` can have multiple quantities + selected for this item. + - `NO` means that each modifier in the `CatalogModifierList` can be selected only once for this item. + - `NOT_SET` means that the `allow_quantities` setting on the `CatalogModifierList` is obeyed. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ + + is_conversational: typing_extensions.NotRequired[CatalogModifierToggleOverrideType] + """ + Controls whether conversational mode is enabled for modifiers on this item. + + - `YES` means conversational mode is enabled for every modifier in the `CatalogModifierList`. + - `NO` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`. + - `NOT_SET` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ + + hidden_from_customer_override: typing_extensions.NotRequired[CatalogModifierToggleOverrideType] + """ + Controls whether all modifiers for this item are hidden from customer receipts. + - `YES` means that all modifiers in the `CatalogModifierList` are hidden from customer + receipts for this item. + - `NO` means that all modifiers in the `CatalogModifierList` are visible on customer receipts for this item. + - `NOT_SET` means that the `hidden_from_customer` setting on the `CatalogModifierList` is obeyed. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ diff --git a/src/square/requests/catalog_item_variation.py b/src/square/requests/catalog_item_variation.py index c819bfdf..e688de9b 100644 --- a/src/square/requests/catalog_item_variation.py +++ b/src/square/requests/catalog_item_variation.py @@ -168,3 +168,11 @@ class CatalogItemVariationParams(typing_extensions.TypedDict): you can accurately track inventory when an item variation is sold in one unit, but stocked in another unit. """ + + kitchen_name: typing_extensions.NotRequired[typing.Optional[str]] + """ + (Optional) Name that the restaurant wants to display to their kitchen workers + instead of the customer-facing name. + e.g., customer name might be "Mega-Jumbo Triplesized" and the + kitchen name is "Large container" + """ diff --git a/src/square/requests/catalog_modifier.py b/src/square/requests/catalog_modifier.py index e6567414..9b3a5318 100644 --- a/src/square/requests/catalog_modifier.py +++ b/src/square/requests/catalog_modifier.py @@ -43,6 +43,14 @@ class CatalogModifierParams(typing_extensions.TypedDict): Location-specific price overrides. """ + kitchen_name: typing_extensions.NotRequired[typing.Optional[str]] + """ + (Optional) Name that the restaurant wants to display to their kitchen workers + instead of the customer-facing name. + e.g., customer name might be "Double Baconize" and the + kitchen name is "Add 2x bacon" + """ + image_id: typing_extensions.NotRequired[typing.Optional[str]] """ The ID of the image associated with this `CatalogModifier` instance. diff --git a/src/square/requests/catalog_modifier_override.py b/src/square/requests/catalog_modifier_override.py index dd042fb2..fb231113 100644 --- a/src/square/requests/catalog_modifier_override.py +++ b/src/square/requests/catalog_modifier_override.py @@ -3,6 +3,7 @@ import typing import typing_extensions +from ..types.catalog_modifier_toggle_override_type import CatalogModifierToggleOverrideType class CatalogModifierOverrideParams(typing_extensions.TypedDict): @@ -20,5 +21,21 @@ class CatalogModifierOverrideParams(typing_extensions.TypedDict): __Deprecated__: Use `on_by_default_override` instead. """ - hidden_online_override: typing_extensions.NotRequired[typing.Any] - on_by_default_override: typing_extensions.NotRequired[typing.Any] + hidden_online_override: typing_extensions.NotRequired[CatalogModifierToggleOverrideType] + """ + If `YES`, this setting overrides the `hidden_online` setting on the `CatalogModifier` object, + and the modifier is always hidden from online sales channels. + If `NO`, the modifier is not hidden. It is always visible in online sales channels for this catalog item. + `NOT_SET` means the `hidden_online` setting on the `CatalogModifier` object is obeyed. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ + + on_by_default_override: typing_extensions.NotRequired[CatalogModifierToggleOverrideType] + """ + If `YES`, this setting overrides the `on_by_default` setting on the `CatalogModifier` object, + and the modifier is always selected by default for the catalog item. + + If `NO`, the modifier is not selected by default for this catalog item. + `NOT_SET` means the `on_by_default` setting on the `CatalogModifier` object is obeyed. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ 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/requests/catalog_product_set.py b/src/square/requests/catalog_product_set.py index a023184f..9145f9ea 100644 --- a/src/square/requests/catalog_product_set.py +++ b/src/square/requests/catalog_product_set.py @@ -31,7 +31,7 @@ class CatalogProductSetParams(typing_extensions.TypedDict): Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. - Max: 500 catalog object IDs. + Max: 5000 catalog object IDs. """ product_ids_all: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]] @@ -41,7 +41,7 @@ class CatalogProductSetParams(typing_extensions.TypedDict): Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. - Max: 500 catalog object IDs. + Max: 5000 catalog object IDs. """ quantity_exact: typing_extensions.NotRequired[typing.Optional[int]] diff --git a/src/square/requests/create_bank_account_response.py b/src/square/requests/create_bank_account_response.py new file mode 100644 index 00000000..54bb9b34 --- /dev/null +++ b/src/square/requests/create_bank_account_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .bank_account import BankAccountParams +from .error import ErrorParams + + +class CreateBankAccountResponseParams(typing_extensions.TypedDict): + """ + Response object returned by CreateBankAccount. + """ + + bank_account: typing_extensions.NotRequired[BankAccountParams] + """ + The 'BankAccount' that was created. + """ + + errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] + """ + Information on errors encountered during the request. + """ diff --git a/src/square/requests/create_mobile_authorization_code_response.py b/src/square/requests/create_mobile_authorization_code_response.py deleted file mode 100644 index d75b37cd..00000000 --- a/src/square/requests/create_mobile_authorization_code_response.py +++ /dev/null @@ -1,30 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import typing_extensions -from .error import ErrorParams - - -class CreateMobileAuthorizationCodeResponseParams(typing_extensions.TypedDict): - """ - Defines the fields that are included in the response body of - a request to the `CreateMobileAuthorizationCode` endpoint. - """ - - authorization_code: typing_extensions.NotRequired[str] - """ - The generated authorization code that connects a mobile application instance - to a Square account. - """ - - expires_at: typing_extensions.NotRequired[str] - """ - The timestamp when `authorization_code` expires, in - [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, "2016-09-04T23:59:33.123Z"). - """ - - errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] - """ - Any errors that occurred during the request. - """ diff --git a/src/square/requests/device_checkout_options.py b/src/square/requests/device_checkout_options.py index 75b53644..a9737d4b 100644 --- a/src/square/requests/device_checkout_options.py +++ b/src/square/requests/device_checkout_options.py @@ -34,3 +34,11 @@ class DeviceCheckoutOptionsParams(typing_extensions.TypedDict): Show the itemization screen prior to taking a payment. This field is only meaningful when the checkout includes an order ID. Defaults to true. """ + + allow_auto_card_surcharge: typing_extensions.NotRequired[typing.Optional[bool]] + """ + Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout. + If true, ACS is applied based on Dashboard configuration. + If false, ACS is not applied regardless of that configuration. + For more information, see [Add a Card Surcharge](https://developer.squareupstaging.com/docs/terminal-api/additional-payment-checkout-features#add-a-card-surcharge). + """ diff --git a/src/square/requests/digital_wallet_details.py b/src/square/requests/digital_wallet_details.py index 3f1de07b..77209f0d 100644 --- a/src/square/requests/digital_wallet_details.py +++ b/src/square/requests/digital_wallet_details.py @@ -4,6 +4,7 @@ import typing_extensions from .cash_app_details import CashAppDetailsParams +from .error import ErrorParams class DigitalWalletDetailsParams(typing_extensions.TypedDict): @@ -20,10 +21,15 @@ class DigitalWalletDetailsParams(typing_extensions.TypedDict): brand: typing_extensions.NotRequired[typing.Optional[str]] """ The brand used for the `WALLET` payment. The brand can be `CASH_APP`, `PAYPAY`, `ALIPAY`, - `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY` or `UNKNOWN`. + `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY`, `LIGHTNING` or `UNKNOWN`. """ cash_app_details: typing_extensions.NotRequired[CashAppDetailsParams] """ Brand-specific details for payments with the `brand` of `CASH_APP`. """ + + errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] + """ + Information about errors encountered during the payment. + """ diff --git a/src/square/requests/disable_bank_account_response.py b/src/square/requests/disable_bank_account_response.py new file mode 100644 index 00000000..34634ebf --- /dev/null +++ b/src/square/requests/disable_bank_account_response.py @@ -0,0 +1,23 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions +from .bank_account import BankAccountParams +from .error import ErrorParams + + +class DisableBankAccountResponseParams(typing_extensions.TypedDict): + """ + Response object returned by `DisableBankAccount`. + """ + + bank_account: typing_extensions.NotRequired[BankAccountParams] + """ + The disabled 'BankAccount' + """ + + errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] + """ + Information on errors encountered during the request. + """ diff --git a/src/square/requests/fulfillment_delivery_details.py b/src/square/requests/fulfillment_delivery_details.py index e014e586..95c40140 100644 --- a/src/square/requests/fulfillment_delivery_details.py +++ b/src/square/requests/fulfillment_delivery_details.py @@ -22,7 +22,7 @@ class FulfillmentDeliveryDetailsParams(typing_extensions.TypedDict): schedule_type: typing_extensions.NotRequired[FulfillmentDeliveryDetailsOrderFulfillmentDeliveryDetailsScheduleType] """ Indicates the fulfillment delivery schedule type. If `SCHEDULED`, then - `deliver_at` is required. If `ASAP`, then `prep_time_duration` is required. The default is `SCHEDULED`. + `deliver_at` is required. The default is `SCHEDULED`. See [OrderFulfillmentDeliveryDetailsScheduleType](#type-orderfulfillmentdeliverydetailsscheduletype) for possible values """ @@ -39,30 +39,35 @@ class FulfillmentDeliveryDetailsParams(typing_extensions.TypedDict): """ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) that represents the start of the delivery period. - When the fulfillment `schedule_type` is `ASAP`, the field is automatically - set to the current time plus the `prep_time_duration`. - Otherwise, the application can set this field while the fulfillment `state` is + The application can set this field while the fulfillment `state` is `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + + For fulfillments with the schedule type `ASAP`, this is automatically set + to the current time plus `prep_time_duration`, if available. """ prep_time_duration: typing_extensions.NotRequired[typing.Optional[str]] """ - The duration of time it takes to prepare and deliver this fulfillment. - The duration must be in RFC 3339 format (for example, "P1W3D"). + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + needed to prepare and deliver this fulfillment. + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. """ delivery_window_duration: typing_extensions.NotRequired[typing.Optional[str]] """ - The time period after `deliver_at` in which to deliver the order. + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + after `deliver_at` in which to deliver the order. Applications can set this field when the fulfillment `state` is `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). - The duration must be in RFC 3339 format (for example, "P1W3D"). + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. """ note: typing_extensions.NotRequired[typing.Optional[str]] @@ -134,8 +139,10 @@ class FulfillmentDeliveryDetailsParams(typing_extensions.TypedDict): courier_pickup_window_duration: typing_extensions.NotRequired[typing.Optional[str]] """ - The time period after `courier_pickup_at` in which the courier should pick up the order. - The duration must be in RFC 3339 format (for example, "P1W3D"). + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + after `courier_pickup_at` in which the courier should pick up the order. + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. """ is_no_contact_delivery: typing_extensions.NotRequired[typing.Optional[bool]] diff --git a/src/square/requests/fulfillment_pickup_details.py b/src/square/requests/fulfillment_pickup_details.py index 5c248bef..0e0cc084 100644 --- a/src/square/requests/fulfillment_pickup_details.py +++ b/src/square/requests/fulfillment_pickup_details.py @@ -30,8 +30,9 @@ class FulfillmentPickupDetailsParams(typing_extensions.TypedDict): auto_complete_duration: typing_extensions.NotRequired[typing.Optional[str]] """ - The duration of time after which an in progress pickup fulfillment is automatically moved - to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + after which an in-progress pickup fulfillment is automatically moved + to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "PT4H" for 4 hours). If not set, this pickup fulfillment remains in progress until it is canceled or completed. """ @@ -49,20 +50,25 @@ class FulfillmentPickupDetailsParams(typing_extensions.TypedDict): "2016-09-04T23:59:33.123Z". For fulfillments with the schedule type `ASAP`, this is automatically set - to the current time plus the expected duration to prepare the fulfillment. + to the current time plus `prep_time_duration`, if available. """ pickup_window_duration: typing_extensions.NotRequired[typing.Optional[str]] """ - The window of time in which the order should be picked up after the `pickup_at` timestamp. - Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an - informational guideline for merchants. + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + in which the order should be picked up after the `pickup_at` timestamp. + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. + + Can be used as an informational guideline for merchants. """ prep_time_duration: typing_extensions.NotRequired[typing.Optional[str]] """ - The duration of time it takes to prepare this fulfillment. - The duration must be in RFC 3339 format (for example, "P1W3D"). + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + needed to prepare this fulfillment. + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. """ note: typing_extensions.NotRequired[typing.Optional[str]] diff --git a/src/square/requests/get_bank_account_response.py b/src/square/requests/get_bank_account_response.py index 787673f8..053c4a89 100644 --- a/src/square/requests/get_bank_account_response.py +++ b/src/square/requests/get_bank_account_response.py @@ -12,12 +12,12 @@ class GetBankAccountResponseParams(typing_extensions.TypedDict): Response object returned by `GetBankAccount`. """ - errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] + bank_account: typing_extensions.NotRequired[BankAccountParams] """ - Information on errors encountered during the request. + The requested `BankAccount` object. """ - bank_account: typing_extensions.NotRequired[BankAccountParams] + errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] """ - The requested `BankAccount` object. + Information on errors encountered during the request. """ diff --git a/src/square/requests/list_bank_accounts_response.py b/src/square/requests/list_bank_accounts_response.py index 4ecadd3b..af1cc875 100644 --- a/src/square/requests/list_bank_accounts_response.py +++ b/src/square/requests/list_bank_accounts_response.py @@ -12,19 +12,19 @@ class ListBankAccountsResponseParams(typing_extensions.TypedDict): Response object returned by ListBankAccounts. """ - errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] + bank_accounts: typing_extensions.NotRequired[typing.Sequence[BankAccountParams]] """ - Information on errors encountered during the request. + List of BankAccounts associated with this account. """ - bank_accounts: typing_extensions.NotRequired[typing.Sequence[BankAccountParams]] + errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] """ - List of BankAccounts associated with this account. + Information on errors encountered during the request. """ cursor: typing_extensions.NotRequired[str] """ - When a response is truncated, it includes a cursor that you can + When a response is truncated, it includes a cursor that you can use in a subsequent request to fetch next set of bank accounts. If empty, this is the final response. diff --git a/src/square/requests/order_line_item.py b/src/square/requests/order_line_item.py index 8a19c25c..334fbaa4 100644 --- a/src/square/requests/order_line_item.py +++ b/src/square/requests/order_line_item.py @@ -148,14 +148,16 @@ class OrderLineItemParams(typing_extensions.TypedDict): base_price_money: typing_extensions.NotRequired[MoneyParams] """ - The base price for a single unit of the line item. + The base price for a single unit of the line item. Note - If inclusive tax is set on + this item it will be included in this value. """ variation_total_price_money: typing_extensions.NotRequired[MoneyParams] """ The total price of all item variations sold in this line item. The price is calculated as `base_price_money` multiplied by `quantity`. - It does not include modifiers. + It does not include modifiers. Note - If inclusive tax is set on + this item it will be included in this value. """ gross_sales_money: typing_extensions.NotRequired[MoneyParams] diff --git a/src/square/requests/order_line_item_applied_tax.py b/src/square/requests/order_line_item_applied_tax.py index ede2bf53..6e4a64e9 100644 --- a/src/square/requests/order_line_item_applied_tax.py +++ b/src/square/requests/order_line_item_applied_tax.py @@ -34,3 +34,10 @@ class OrderLineItemAppliedTaxParams(typing_extensions.TypedDict): """ The amount of money applied by the tax to the line item. """ + + auto_applied: typing_extensions.NotRequired[bool] + """ + Indicates whether the tax was automatically applied to the order based on + the catalog configuration. For an example, see + [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes). + """ diff --git a/src/square/requests/order_line_item_pricing_blocklists.py b/src/square/requests/order_line_item_pricing_blocklists.py index 4dcd7cbf..9a30044d 100644 --- a/src/square/requests/order_line_item_pricing_blocklists.py +++ b/src/square/requests/order_line_item_pricing_blocklists.py @@ -4,6 +4,9 @@ import typing_extensions from .order_line_item_pricing_blocklists_blocked_discount import OrderLineItemPricingBlocklistsBlockedDiscountParams +from .order_line_item_pricing_blocklists_blocked_service_charge import ( + OrderLineItemPricingBlocklistsBlockedServiceChargeParams, +) from .order_line_item_pricing_blocklists_blocked_tax import OrderLineItemPricingBlocklistsBlockedTaxParams @@ -31,3 +34,13 @@ class OrderLineItemPricingBlocklistsParams(typing_extensions.TypedDict): Taxes can be blocked by the `tax_uid` (for ad hoc taxes) or the `tax_catalog_object_id` (for catalog taxes). """ + + blocked_service_charges: typing_extensions.NotRequired[ + typing.Optional[typing.Sequence[OrderLineItemPricingBlocklistsBlockedServiceChargeParams]] + ] + """ + A list of service charges blocked from applying to the line item. + Service charges can be blocked by the `service_charge_uid` (for ad hoc + service charges) or the `service_charge_catalog_object_id` (for catalog + service charges). + """ diff --git a/src/square/requests/order_line_item_pricing_blocklists_blocked_service_charge.py b/src/square/requests/order_line_item_pricing_blocklists_blocked_service_charge.py new file mode 100644 index 00000000..36a6875c --- /dev/null +++ b/src/square/requests/order_line_item_pricing_blocklists_blocked_service_charge.py @@ -0,0 +1,32 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import typing_extensions + + +class OrderLineItemPricingBlocklistsBlockedServiceChargeParams(typing_extensions.TypedDict): + """ + A service charge to block from applying to a line item. The service charge + must be identified by either `service_charge_uid` or + `service_charge_catalog_object_id`, but not both. + """ + + uid: typing_extensions.NotRequired[typing.Optional[str]] + """ + A unique ID of the `BlockedServiceCharge` within the order. + """ + + service_charge_uid: typing_extensions.NotRequired[typing.Optional[str]] + """ + The `uid` of the service charge that should be blocked. Use this field to + block ad hoc service charges. For catalog service charges, use the + `service_charge_catalog_object_id` field. + """ + + service_charge_catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]] + """ + The `catalog_object_id` of the service charge that should be blocked. + Use this field to block catalog service charges. For ad hoc service charges, + use the `service_charge_uid` field. + """ diff --git a/src/square/requests/order_return.py b/src/square/requests/order_return.py index add4328c..3cad710a 100644 --- a/src/square/requests/order_return.py +++ b/src/square/requests/order_return.py @@ -40,14 +40,14 @@ class OrderReturnParams(typing_extensions.TypedDict): A collection of service charges that are being returned. """ - return_taxes: typing_extensions.NotRequired[typing.Sequence[OrderReturnTaxParams]] + return_taxes: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderReturnTaxParams]]] """ A collection of references to taxes being returned for an order, including the total applied tax amount to be returned. The taxes must reference a top-level tax ID from the source order. """ - return_discounts: typing_extensions.NotRequired[typing.Sequence[OrderReturnDiscountParams]] + return_discounts: typing_extensions.NotRequired[typing.Optional[typing.Sequence[OrderReturnDiscountParams]]] """ A collection of references to discounts being returned for an order, including the total applied discount amount to be returned. The discounts must reference a top-level discount ID diff --git a/src/square/requests/order_return_service_charge.py b/src/square/requests/order_return_service_charge.py index c3b72a5e..69c9ea05 100644 --- a/src/square/requests/order_return_service_charge.py +++ b/src/square/requests/order_return_service_charge.py @@ -6,6 +6,7 @@ from ..types.order_service_charge_calculation_phase import OrderServiceChargeCalculationPhase from ..types.order_service_charge_scope import OrderServiceChargeScope from ..types.order_service_charge_treatment_type import OrderServiceChargeTreatmentType +from ..types.order_service_charge_type import OrderServiceChargeType from .money import MoneyParams from .order_line_item_applied_tax import OrderLineItemAppliedTaxParams @@ -104,7 +105,7 @@ class OrderReturnServiceChargeParams(typing_extensions.TypedDict): treatment_type: typing_extensions.NotRequired[OrderServiceChargeTreatmentType] """ - The treatment type of the service charge. + Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values """ @@ -120,3 +121,9 @@ class OrderReturnServiceChargeParams(typing_extensions.TypedDict): the apportioned service charge and re-add it as a new apportioned service charge. See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values """ + + type: typing_extensions.NotRequired[OrderServiceChargeType] + """ + The type of the service charge. + See [OrderServiceChargeType](#type-orderservicechargetype) for possible values + """ diff --git a/src/square/requests/order_service_charge.py b/src/square/requests/order_service_charge.py index 9355890f..0e7aee12 100644 --- a/src/square/requests/order_service_charge.py +++ b/src/square/requests/order_service_charge.py @@ -23,7 +23,7 @@ class OrderServiceChargeParams(typing_extensions.TypedDict): name: typing_extensions.NotRequired[typing.Optional[str]] """ - The name of the service charge. + The name of the service charge. This is unused and null for AUTO_GRATUITY to match the behavior on Bills. """ catalog_object_id: typing_extensions.NotRequired[typing.Optional[str]] @@ -135,7 +135,7 @@ class OrderServiceChargeParams(typing_extensions.TypedDict): treatment_type: typing_extensions.NotRequired[OrderServiceChargeTreatmentType] """ - The treatment type of the service charge. + Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values """ diff --git a/src/square/requests/search_orders_source_filter.py b/src/square/requests/search_orders_source_filter.py index 673d6535..b71b9fc7 100644 --- a/src/square/requests/search_orders_source_filter.py +++ b/src/square/requests/search_orders_source_filter.py @@ -17,3 +17,19 @@ class SearchOrdersSourceFilterParams(typing_extensions.TypedDict): Max: 10 source names. """ + + source_application_ids: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]] + """ + Filters by the [Source](entity:OrderSource) `applicationId`. The filter returns any orders + with a `source.applicationId` that matches any of the listed source applicationIds. + + Max: 100 source applicationIds. + """ + + source_client_ous: typing_extensions.NotRequired[typing.Optional[typing.Sequence[str]]] + """ + Filters by the [Source](entity:OrderSource) `clientOu`. The filter returns any orders + with a `source.clientOu` that matches any of the listed source clientOus. + + Max: 100 source clientOus. + """ diff --git a/src/square/requests/subscription_test_result.py b/src/square/requests/subscription_test_result.py index 055c636b..5c4a0d16 100644 --- a/src/square/requests/subscription_test_result.py +++ b/src/square/requests/subscription_test_result.py @@ -7,8 +7,7 @@ class SubscriptionTestResultParams(typing_extensions.TypedDict): """ - Represents the details of a webhook subscription, including notification URL, - event types, and signature key. + Represents the result of testing a webhook subscription. Note: The actual API returns these fields at the root level of TestWebhookSubscriptionResponse, not nested under this object. """ id: typing_extensions.NotRequired[str] @@ -18,12 +17,12 @@ class SubscriptionTestResultParams(typing_extensions.TypedDict): status_code: typing_extensions.NotRequired[typing.Optional[int]] """ - The status code returned by the subscription notification URL. + The HTTP status code returned by the notification URL. """ - payload: typing_extensions.NotRequired[typing.Optional[str]] + payload: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Any]]] """ - An object containing the payload of the test event. For example, a `payment.created` event. + The payload that was sent in the test notification. """ created_at: typing_extensions.NotRequired[str] @@ -37,3 +36,13 @@ class SubscriptionTestResultParams(typing_extensions.TypedDict): The timestamp of when the subscription was updated, in RFC 3339 format. For example, "2016-09-04T23:59:33.123Z". Because a subscription test result is unique, this field is the same as the `created_at` field. """ + + notification_url: typing_extensions.NotRequired[str] + """ + The URL that was used for the webhook notification test. + """ + + passes_filter: typing_extensions.NotRequired[typing.Optional[bool]] + """ + Whether the notification passed any configured filters. + """ diff --git a/src/square/requests/test_webhook_subscription_response.py b/src/square/requests/test_webhook_subscription_response.py index bf5bdeb1..6ecffec2 100644 --- a/src/square/requests/test_webhook_subscription_response.py +++ b/src/square/requests/test_webhook_subscription_response.py @@ -9,11 +9,7 @@ class TestWebhookSubscriptionResponseParams(typing_extensions.TypedDict): """ - Defines the fields that are included in the response body of - a request to the [TestWebhookSubscription](api-endpoint:WebhookSubscriptions-TestWebhookSubscription) endpoint. - - Note: If there are errors processing the request, the [SubscriptionTestResult](entity:SubscriptionTestResult) field is not - present. + Defines the fields that are included in the response body of a request to the TestWebhookSubscription endpoint. """ errors: typing_extensions.NotRequired[typing.Sequence[ErrorParams]] @@ -25,3 +21,23 @@ class TestWebhookSubscriptionResponseParams(typing_extensions.TypedDict): """ The [SubscriptionTestResult](entity:SubscriptionTestResult). """ + + notification_url: typing_extensions.NotRequired[str] + """ + The URL that was used for the webhook notification test. + """ + + status_code: typing_extensions.NotRequired[typing.Optional[int]] + """ + The HTTP status code returned by the notification URL. + """ + + passes_filter: typing_extensions.NotRequired[typing.Optional[bool]] + """ + Whether the notification passed any configured filters. + """ + + payload: typing_extensions.NotRequired[typing.Optional[typing.Dict[str, typing.Any]]] + """ + The payload that was sent in the test notification. + """ diff --git a/src/square/transfer_orders/client.py b/src/square/transfer_orders/client.py index fee6a89e..cec61a34 100644 --- a/src/square/transfer_orders/client.py +++ b/src/square/transfer_orders/client.py @@ -460,13 +460,13 @@ def receive( receipt={ "line_items": [ { - "transfer_order_line_uid": "transfer_order_line_uid", + "transfer_order_line_uid": "1", "quantity_received": "3", "quantity_damaged": "1", "quantity_canceled": "1", }, { - "transfer_order_line_uid": "transfer_order_line_uid", + "transfer_order_line_uid": "2", "quantity_received": "2", "quantity_canceled": "1", }, @@ -1031,13 +1031,13 @@ async def main() -> None: receipt={ "line_items": [ { - "transfer_order_line_uid": "transfer_order_line_uid", + "transfer_order_line_uid": "1", "quantity_received": "3", "quantity_damaged": "1", "quantity_canceled": "1", }, { - "transfer_order_line_uid": "transfer_order_line_uid", + "transfer_order_line_uid": "2", "quantity_received": "2", "quantity_canceled": "1", }, diff --git a/src/square/types/address.py b/src/square/types/address.py index 2a521d93..e3c2d728 100644 --- a/src/square/types/address.py +++ b/src/square/types/address.py @@ -17,7 +17,7 @@ class Address(UncheckedBaseModel): """ address_line1: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="address_line_1")] = ( - pydantic.Field(default=None) + pydantic.Field(alias="address_line_1", default=None) ) """ The first line of the address. @@ -29,14 +29,14 @@ class Address(UncheckedBaseModel): """ address_line2: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="address_line_2")] = ( - pydantic.Field(default=None) + pydantic.Field(alias="address_line_2", default=None) ) """ The second line of the address, if any. """ address_line3: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="address_line_3")] = ( - pydantic.Field(default=None) + pydantic.Field(alias="address_line_3", default=None) ) """ The third line of the address, if any. @@ -53,14 +53,14 @@ class Address(UncheckedBaseModel): """ sublocality2: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="sublocality_2")] = ( - pydantic.Field(default=None) + pydantic.Field(alias="sublocality_2", default=None) ) """ A civil region within the address's `sublocality`, if any. """ sublocality3: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="sublocality_3")] = ( - pydantic.Field(default=None) + pydantic.Field(alias="sublocality_3", default=None) ) """ A civil region within the address's `sublocality_2`, if any. @@ -68,7 +68,7 @@ class Address(UncheckedBaseModel): administrative_district_level1: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="administrative_district_level_1") - ] = pydantic.Field(default=None) + ] = pydantic.Field(alias="administrative_district_level_1", default=None) """ A civil entity within the address's country. In the US, this is the state. For a full list of field meanings by country, see [Working with Addresses](https://developer.squareup.com/docs/build-basics/working-with-addresses). @@ -76,7 +76,7 @@ class Address(UncheckedBaseModel): administrative_district_level2: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="administrative_district_level_2") - ] = pydantic.Field(default=None) + ] = pydantic.Field(alias="administrative_district_level_2", default=None) """ A civil entity within the address's `administrative_district_level_1`. In the US, this is the county. @@ -84,7 +84,7 @@ class Address(UncheckedBaseModel): administrative_district_level3: typing_extensions.Annotated[ typing.Optional[str], FieldMetadata(alias="administrative_district_level_3") - ] = pydantic.Field(default=None) + ] = pydantic.Field(alias="administrative_district_level_3", default=None) """ A civil entity within the address's `administrative_district_level_2`, if any. diff --git a/src/square/types/bank_account.py b/src/square/types/bank_account.py index 6ded1ce9..412d783c 100644 --- a/src/square/types/bank_account.py +++ b/src/square/types/bank_account.py @@ -118,6 +118,11 @@ class BankAccount(UncheckedBaseModel): For example "Bank of America". """ + customer_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The ID of the customer who owns the bank account + """ + if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 else: diff --git a/src/square/types/batch_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/buy_now_pay_later_details.py b/src/square/types/buy_now_pay_later_details.py index bcc219c5..159ef743 100644 --- a/src/square/types/buy_now_pay_later_details.py +++ b/src/square/types/buy_now_pay_later_details.py @@ -7,6 +7,7 @@ from ..core.unchecked_base_model import UncheckedBaseModel from .afterpay_details import AfterpayDetails from .clearpay_details import ClearpayDetails +from .error import Error class BuyNowPayLaterDetails(UncheckedBaseModel): @@ -32,6 +33,11 @@ class BuyNowPayLaterDetails(UncheckedBaseModel): `CLEARPAY`. """ + errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) + """ + Information about errors encountered during the payment. + """ + 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/card.py b/src/square/types/card.py index e959ab2a..9f61115e 100644 --- a/src/square/types/card.py +++ b/src/square/types/card.py @@ -33,7 +33,7 @@ class Card(UncheckedBaseModel): """ last4: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="last_4")] = pydantic.Field( - default=None + alias="last_4", default=None ) """ The last 4 digits of the card number. @@ -109,6 +109,16 @@ class Card(UncheckedBaseModel): returns this field. """ + created_at: typing.Optional[str] = pydantic.Field(default=None) + """ + Timestamp for when the card object was created on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". + """ + + disabled_at: typing.Optional[str] = pydantic.Field(default=None) + """ + Timestamp for when the card object was disabled on Square’s servers. In RFC 3339 format, e.g., "2016-09-04T23:59:33.123Z". + """ + version: typing.Optional[int] = pydantic.Field(default=None) """ Current version number of the card. Increments with each card update. Requests to update an 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..d064ae80 100644 --- a/src/square/types/catalog_item.py +++ b/src/square/types/catalog_item.py @@ -56,6 +56,11 @@ class CatalogItem(UncheckedBaseModel): The ID of the item's category, if any. Deprecated since 2023-12-13. Use `CatalogItem.categories`, instead. """ + buyer_facing_name: typing.Optional[str] = pydantic.Field(default=None) + """ + The override to a product name to display to users + """ + tax_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) """ A set of IDs indicating the taxes enabled for @@ -169,6 +174,14 @@ class CatalogItem(UncheckedBaseModel): A server-generated plaintext version of the `description_html` field, without formatting tags. """ + kitchen_name: typing.Optional[str] = pydantic.Field(default=None) + """ + (Optional) Name that the restaurant wants to display to their kitchen workers + instead of the customer-facing name. + e.g., customer name might be "Big John's Mega Burger" and the + kitchen name is "12oz beef burger" + """ + channels: typing.Optional[typing.List[str]] = pydantic.Field(default=None) """ A list of IDs representing channels, such as a Square Online site, where the item can be made visible or available. @@ -210,17 +223,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_modifier_list_info.py b/src/square/types/catalog_item_modifier_list_info.py index 2af03cb9..7f09ff44 100644 --- a/src/square/types/catalog_item_modifier_list_info.py +++ b/src/square/types/catalog_item_modifier_list_info.py @@ -6,6 +6,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel from .catalog_modifier_override import CatalogModifierOverride +from .catalog_modifier_toggle_override_type import CatalogModifierToggleOverrideType class CatalogItemModifierListInfo(UncheckedBaseModel): @@ -59,9 +60,35 @@ class CatalogItemModifierListInfo(UncheckedBaseModel): to a `CatalogItem` instance. """ - allow_quantities: typing.Optional[typing.Any] = None - is_conversational: typing.Optional[typing.Any] = None - hidden_from_customer_override: typing.Optional[typing.Any] = None + allow_quantities: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None) + """ + Controls whether multiple quantities of the same modifier can be selected for this item. + - `YES` means that every modifier in the `CatalogModifierList` can have multiple quantities + selected for this item. + - `NO` means that each modifier in the `CatalogModifierList` can be selected only once for this item. + - `NOT_SET` means that the `allow_quantities` setting on the `CatalogModifierList` is obeyed. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ + + is_conversational: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None) + """ + Controls whether conversational mode is enabled for modifiers on this item. + + - `YES` means conversational mode is enabled for every modifier in the `CatalogModifierList`. + - `NO` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`. + - `NOT_SET` means that conversational mode is not enabled for any modifier in the `CatalogModifierList`. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ + + hidden_from_customer_override: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None) + """ + Controls whether all modifiers for this item are hidden from customer receipts. + - `YES` means that all modifiers in the `CatalogModifierList` are hidden from customer + receipts for this item. + - `NO` means that all modifiers in the `CatalogModifierList` are visible on customer receipts for this item. + - `NOT_SET` means that the `hidden_from_customer` setting on the `CatalogModifierList` is obeyed. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 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_item_variation.py b/src/square/types/catalog_item_variation.py index ff638fd5..21a657a8 100644 --- a/src/square/types/catalog_item_variation.py +++ b/src/square/types/catalog_item_variation.py @@ -169,6 +169,14 @@ class CatalogItemVariation(UncheckedBaseModel): another unit. """ + kitchen_name: typing.Optional[str] = pydantic.Field(default=None) + """ + (Optional) Name that the restaurant wants to display to their kitchen workers + instead of the customer-facing name. + e.g., customer name might be "Mega-Jumbo Triplesized" and the + kitchen name is "Large container" + """ + 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_modifier.py b/src/square/types/catalog_modifier.py index 196f8267..03584ba2 100644 --- a/src/square/types/catalog_modifier.py +++ b/src/square/types/catalog_modifier.py @@ -45,6 +45,14 @@ class CatalogModifier(UncheckedBaseModel): Location-specific price overrides. """ + kitchen_name: typing.Optional[str] = pydantic.Field(default=None) + """ + (Optional) Name that the restaurant wants to display to their kitchen workers + instead of the customer-facing name. + e.g., customer name might be "Double Baconize" and the + kitchen name is "Add 2x bacon" + """ + image_id: typing.Optional[str] = pydantic.Field(default=None) """ The ID of the image associated with this `CatalogModifier` instance. 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_modifier_override.py b/src/square/types/catalog_modifier_override.py index 1a704f45..141bb027 100644 --- a/src/square/types/catalog_modifier_override.py +++ b/src/square/types/catalog_modifier_override.py @@ -5,6 +5,7 @@ import pydantic from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel +from .catalog_modifier_toggle_override_type import CatalogModifierToggleOverrideType class CatalogModifierOverride(UncheckedBaseModel): @@ -22,8 +23,24 @@ class CatalogModifierOverride(UncheckedBaseModel): __Deprecated__: Use `on_by_default_override` instead. """ - hidden_online_override: typing.Optional[typing.Any] = None - on_by_default_override: typing.Optional[typing.Any] = None + hidden_online_override: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None) + """ + If `YES`, this setting overrides the `hidden_online` setting on the `CatalogModifier` object, + and the modifier is always hidden from online sales channels. + If `NO`, the modifier is not hidden. It is always visible in online sales channels for this catalog item. + `NOT_SET` means the `hidden_online` setting on the `CatalogModifier` object is obeyed. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ + + on_by_default_override: typing.Optional[CatalogModifierToggleOverrideType] = pydantic.Field(default=None) + """ + If `YES`, this setting overrides the `on_by_default` setting on the `CatalogModifier` object, + and the modifier is always selected by default for the catalog item. + + If `NO`, the modifier is not selected by default for this catalog item. + `NOT_SET` means the `on_by_default` setting on the `CatalogModifier` object is obeyed. + See [CatalogModifierToggleOverrideType](#type-catalogmodifiertoggleoverridetype) for possible values + """ if IS_PYDANTIC_V2: model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 diff --git a/src/square/types/catalog_modifier_toggle_override_type.py b/src/square/types/catalog_modifier_toggle_override_type.py new file mode 100644 index 00000000..40497f28 --- /dev/null +++ b/src/square/types/catalog_modifier_toggle_override_type.py @@ -0,0 +1,5 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +CatalogModifierToggleOverrideType = typing.Union[typing.Literal["NO", "YES", "NOT_SET"], typing.Any] diff --git a/src/square/types/catalog_object.py b/src/square/types/catalog_object.py index 167f2f54..e3eb0fb7 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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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") + ] = pydantic.Field(alias="catalog_v1_ids", default=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..6280ff58 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` @@ -73,7 +65,7 @@ class CatalogObjectBase(UncheckedBaseModel): catalog_v1ids: typing_extensions.Annotated[ typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) + ] = pydantic.Field(alias="catalog_v1_ids", 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 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..34a1a771 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`. @@ -78,7 +78,7 @@ class CatalogObjectCategory(UncheckedBaseModel): catalog_v1ids: typing_extensions.Annotated[ typing.Optional[typing.List[CatalogV1Id]], FieldMetadata(alias="catalog_v1_ids") - ] = pydantic.Field(default=None) + ] = pydantic.Field(alias="catalog_v1_ids", 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 @@ -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_product_set.py b/src/square/types/catalog_product_set.py index a2bbe4d9..3ebd03f3 100644 --- a/src/square/types/catalog_product_set.py +++ b/src/square/types/catalog_product_set.py @@ -33,7 +33,7 @@ class CatalogProductSet(UncheckedBaseModel): Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. - Max: 500 catalog object IDs. + Max: 5000 catalog object IDs. """ product_ids_all: typing.Optional[typing.List[str]] = pydantic.Field(default=None) @@ -43,7 +43,7 @@ class CatalogProductSet(UncheckedBaseModel): Only one of `product_ids_all`, `product_ids_any`, or `all_products` can be set. - Max: 500 catalog object IDs. + Max: 5000 catalog object IDs. """ quantity_exact: typing.Optional[int] = pydantic.Field(default=None) 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/catalog_v1id.py b/src/square/types/catalog_v1id.py index 955ca24e..96975fd4 100644 --- a/src/square/types/catalog_v1id.py +++ b/src/square/types/catalog_v1id.py @@ -15,7 +15,7 @@ class CatalogV1Id(UncheckedBaseModel): """ catalog_v1id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="catalog_v1_id")] = ( - pydantic.Field(default=None) + pydantic.Field(alias="catalog_v1_id", default=None) ) """ The ID for an object used in the Square API V1, if the object ID differs from the Square API V2 object ID. diff --git a/src/square/types/create_bank_account_response.py b/src/square/types/create_bank_account_response.py new file mode 100644 index 00000000..b7cd46f4 --- /dev/null +++ b/src/square/types/create_bank_account_response.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .bank_account import BankAccount +from .error import Error + + +class CreateBankAccountResponse(UncheckedBaseModel): + """ + Response object returned by CreateBankAccount. + """ + + bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None) + """ + The 'BankAccount' that was created. + """ + + errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) + """ + Information on errors encountered during the request. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/square/types/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/create_mobile_authorization_code_response.py b/src/square/types/create_mobile_authorization_code_response.py deleted file mode 100644 index 3507adae..00000000 --- a/src/square/types/create_mobile_authorization_code_response.py +++ /dev/null @@ -1,41 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -import pydantic -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -from ..core.unchecked_base_model import UncheckedBaseModel -from .error import Error - - -class CreateMobileAuthorizationCodeResponse(UncheckedBaseModel): - """ - Defines the fields that are included in the response body of - a request to the `CreateMobileAuthorizationCode` endpoint. - """ - - authorization_code: typing.Optional[str] = pydantic.Field(default=None) - """ - The generated authorization code that connects a mobile application instance - to a Square account. - """ - - expires_at: typing.Optional[str] = pydantic.Field(default=None) - """ - The timestamp when `authorization_code` expires, in - [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, "2016-09-04T23:59:33.123Z"). - """ - - errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) - """ - Any errors that occurred during the request. - """ - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/square/types/custom_attribute_definition.py b/src/square/types/custom_attribute_definition.py index 9e4687de..5d5ce648 100644 --- a/src/square/types/custom_attribute_definition.py +++ b/src/square/types/custom_attribute_definition.py @@ -37,7 +37,7 @@ class CustomAttributeDefinition(UncheckedBaseModel): schema_: typing_extensions.Annotated[ typing.Optional[typing.Dict[str, typing.Any]], FieldMetadata(alias="schema") - ] = pydantic.Field(default=None) + ] = pydantic.Field(alias="schema", default=None) """ The JSON schema for the custom attribute definition, which determines the data type of the corresponding custom attributes. For more information, see [Custom Attributes Overview](https://developer.squareup.com/docs/devtools/customattributes/overview). This field is required when creating a definition. diff --git a/src/square/types/device_checkout_options.py b/src/square/types/device_checkout_options.py index 3d35290d..c9c2b7d7 100644 --- a/src/square/types/device_checkout_options.py +++ b/src/square/types/device_checkout_options.py @@ -37,6 +37,14 @@ class DeviceCheckoutOptions(UncheckedBaseModel): checkout includes an order ID. Defaults to true. """ + allow_auto_card_surcharge: typing.Optional[bool] = pydantic.Field(default=None) + """ + Controls whether the mobile client applies Auto Card Surcharge (ACS) during checkout. + If true, ACS is applied based on Dashboard configuration. + If false, ACS is not applied regardless of that configuration. + For more information, see [Add a Card Surcharge](https://developer.squareupstaging.com/docs/terminal-api/additional-payment-checkout-features#add-a-card-surcharge). + """ + 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/digital_wallet_details.py b/src/square/types/digital_wallet_details.py index 9c64d6ae..b5df032a 100644 --- a/src/square/types/digital_wallet_details.py +++ b/src/square/types/digital_wallet_details.py @@ -6,6 +6,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel from .cash_app_details import CashAppDetails +from .error import Error class DigitalWalletDetails(UncheckedBaseModel): @@ -22,7 +23,7 @@ class DigitalWalletDetails(UncheckedBaseModel): brand: typing.Optional[str] = pydantic.Field(default=None) """ The brand used for the `WALLET` payment. The brand can be `CASH_APP`, `PAYPAY`, `ALIPAY`, - `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY` or `UNKNOWN`. + `RAKUTEN_PAY`, `AU_PAY`, `D_BARAI`, `MERPAY`, `WECHAT_PAY`, `LIGHTNING` or `UNKNOWN`. """ cash_app_details: typing.Optional[CashAppDetails] = pydantic.Field(default=None) @@ -30,6 +31,11 @@ class DigitalWalletDetails(UncheckedBaseModel): Brand-specific details for payments with the `brand` of `CASH_APP`. """ + errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) + """ + Information about errors encountered during the payment. + """ + 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/disable_bank_account_response.py b/src/square/types/disable_bank_account_response.py new file mode 100644 index 00000000..f084c0dc --- /dev/null +++ b/src/square/types/disable_bank_account_response.py @@ -0,0 +1,34 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel +from .bank_account import BankAccount +from .error import Error + + +class DisableBankAccountResponse(UncheckedBaseModel): + """ + Response object returned by `DisableBankAccount`. + """ + + bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None) + """ + The disabled 'BankAccount' + """ + + errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) + """ + Information on errors encountered during the request. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/square/types/error_code.py b/src/square/types/error_code.py index 77ba54db..326c4878 100644 --- a/src/square/types/error_code.py +++ b/src/square/types/error_code.py @@ -116,6 +116,7 @@ "UNSUPPORTED_LOYALTY_REWARD_TIER", "LOCATION_MISMATCH", "ORDER_UNPAID_NOT_RETURNABLE", + "PARTIAL_PAYMENT_DELAY_CAPTURE_NOT_SUPPORTED", "IDEMPOTENCY_KEY_REUSED", "UNEXPECTED_VALUE", "SANDBOX_NOT_SUPPORTED", @@ -131,6 +132,7 @@ "PLAID_ERROR", "PLAID_ERROR_ITEM_LOGIN_REQUIRED", "PLAID_ERROR_RATE_LIMIT", + "PAYMENT_SOURCE_NOT_ENABLED_FOR_TARGET", "CARD_DECLINED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", diff --git a/src/square/types/filter_value.py b/src/square/types/filter_value.py index c54867cb..c6386412 100644 --- a/src/square/types/filter_value.py +++ b/src/square/types/filter_value.py @@ -19,7 +19,7 @@ class FilterValue(UncheckedBaseModel): """ all_: typing_extensions.Annotated[typing.Optional[typing.List[str]], FieldMetadata(alias="all")] = pydantic.Field( - default=None + alias="all", default=None ) """ A list of terms that must be present on the field of the resource. diff --git a/src/square/types/fulfillment_delivery_details.py b/src/square/types/fulfillment_delivery_details.py index f30c51eb..2b652078 100644 --- a/src/square/types/fulfillment_delivery_details.py +++ b/src/square/types/fulfillment_delivery_details.py @@ -26,7 +26,7 @@ class FulfillmentDeliveryDetails(UncheckedBaseModel): ) """ Indicates the fulfillment delivery schedule type. If `SCHEDULED`, then - `deliver_at` is required. If `ASAP`, then `prep_time_duration` is required. The default is `SCHEDULED`. + `deliver_at` is required. The default is `SCHEDULED`. See [OrderFulfillmentDeliveryDetailsScheduleType](#type-orderfulfillmentdeliverydetailsscheduletype) for possible values """ @@ -43,30 +43,35 @@ class FulfillmentDeliveryDetails(UncheckedBaseModel): """ The [timestamp](https://developer.squareup.com/docs/build-basics/working-with-dates) that represents the start of the delivery period. - When the fulfillment `schedule_type` is `ASAP`, the field is automatically - set to the current time plus the `prep_time_duration`. - Otherwise, the application can set this field while the fulfillment `state` is + The application can set this field while the fulfillment `state` is `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). The timestamp must be in RFC 3339 format (for example, "2016-09-04T23:59:33.123Z"). + + For fulfillments with the schedule type `ASAP`, this is automatically set + to the current time plus `prep_time_duration`, if available. """ prep_time_duration: typing.Optional[str] = pydantic.Field(default=None) """ - The duration of time it takes to prepare and deliver this fulfillment. - The duration must be in RFC 3339 format (for example, "P1W3D"). + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + needed to prepare and deliver this fulfillment. + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. """ delivery_window_duration: typing.Optional[str] = pydantic.Field(default=None) """ - The time period after `deliver_at` in which to deliver the order. + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + after `deliver_at` in which to deliver the order. Applications can set this field when the fulfillment `state` is `PROPOSED`, `RESERVED`, or `PREPARED` (any time before the terminal state such as `COMPLETED`, `CANCELED`, and `FAILED`). - The duration must be in RFC 3339 format (for example, "P1W3D"). + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. """ note: typing.Optional[str] = pydantic.Field(default=None) @@ -138,8 +143,10 @@ class FulfillmentDeliveryDetails(UncheckedBaseModel): courier_pickup_window_duration: typing.Optional[str] = pydantic.Field(default=None) """ - The time period after `courier_pickup_at` in which the courier should pick up the order. - The duration must be in RFC 3339 format (for example, "P1W3D"). + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + after `courier_pickup_at` in which the courier should pick up the order. + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. """ is_no_contact_delivery: typing.Optional[bool] = pydantic.Field(default=None) diff --git a/src/square/types/fulfillment_pickup_details.py b/src/square/types/fulfillment_pickup_details.py index 4a9eaa38..fc378083 100644 --- a/src/square/types/fulfillment_pickup_details.py +++ b/src/square/types/fulfillment_pickup_details.py @@ -32,8 +32,9 @@ class FulfillmentPickupDetails(UncheckedBaseModel): auto_complete_duration: typing.Optional[str] = pydantic.Field(default=None) """ - The duration of time after which an in progress pickup fulfillment is automatically moved - to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "P1W3D"). + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + after which an in-progress pickup fulfillment is automatically moved + to the `COMPLETED` state. The duration must be in RFC 3339 format (for example, "PT4H" for 4 hours). If not set, this pickup fulfillment remains in progress until it is canceled or completed. """ @@ -51,20 +52,25 @@ class FulfillmentPickupDetails(UncheckedBaseModel): "2016-09-04T23:59:33.123Z". For fulfillments with the schedule type `ASAP`, this is automatically set - to the current time plus the expected duration to prepare the fulfillment. + to the current time plus `prep_time_duration`, if available. """ pickup_window_duration: typing.Optional[str] = pydantic.Field(default=None) """ - The window of time in which the order should be picked up after the `pickup_at` timestamp. - Must be in RFC 3339 duration format, e.g., "P1W3D". Can be used as an - informational guideline for merchants. + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + in which the order should be picked up after the `pickup_at` timestamp. + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. + + Can be used as an informational guideline for merchants. """ prep_time_duration: typing.Optional[str] = pydantic.Field(default=None) """ - The duration of time it takes to prepare this fulfillment. - The duration must be in RFC 3339 format (for example, "P1W3D"). + The [duration](https://developer.squareup.com/docs/build-basics/working-with-dates) + needed to prepare this fulfillment. + The duration must be in RFC 3339 format (for example, "PT30M" for 30 minutes). Don't confuse + "M" for months with "M" for minutes. "P5M" means 5 months, while "PT5M" means 5 minutes. """ note: typing.Optional[str] = pydantic.Field(default=None) diff --git a/src/square/types/get_bank_account_response.py b/src/square/types/get_bank_account_response.py index f6392365..81cfb0b4 100644 --- a/src/square/types/get_bank_account_response.py +++ b/src/square/types/get_bank_account_response.py @@ -14,14 +14,14 @@ class GetBankAccountResponse(UncheckedBaseModel): Response object returned by `GetBankAccount`. """ - errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) + bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None) """ - Information on errors encountered during the request. + The requested `BankAccount` object. """ - bank_account: typing.Optional[BankAccount] = pydantic.Field(default=None) + errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) """ - The requested `BankAccount` object. + Information on errors encountered during the request. """ if IS_PYDANTIC_V2: 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/labor_scheduled_shift_created_event_object.py b/src/square/types/labor_scheduled_shift_created_event_object.py index 4e77f28c..e16e7464 100644 --- a/src/square/types/labor_scheduled_shift_created_event_object.py +++ b/src/square/types/labor_scheduled_shift_created_event_object.py @@ -13,7 +13,7 @@ class LaborScheduledShiftCreatedEventObject(UncheckedBaseModel): scheduled_shift: typing_extensions.Annotated[ typing.Optional[ScheduledShift], FieldMetadata(alias="ScheduledShift") - ] = pydantic.Field(default=None) + ] = pydantic.Field(alias="ScheduledShift", default=None) """ The new `ScheduledShift`. """ diff --git a/src/square/types/labor_scheduled_shift_published_event_object.py b/src/square/types/labor_scheduled_shift_published_event_object.py index 7937baac..8b49dc09 100644 --- a/src/square/types/labor_scheduled_shift_published_event_object.py +++ b/src/square/types/labor_scheduled_shift_published_event_object.py @@ -13,7 +13,7 @@ class LaborScheduledShiftPublishedEventObject(UncheckedBaseModel): scheduled_shift: typing_extensions.Annotated[ typing.Optional[ScheduledShift], FieldMetadata(alias="ScheduledShift") - ] = pydantic.Field(default=None) + ] = pydantic.Field(alias="ScheduledShift", default=None) """ The published `ScheduledShift`. """ diff --git a/src/square/types/labor_scheduled_shift_updated_event_object.py b/src/square/types/labor_scheduled_shift_updated_event_object.py index ff8b712a..56a032f9 100644 --- a/src/square/types/labor_scheduled_shift_updated_event_object.py +++ b/src/square/types/labor_scheduled_shift_updated_event_object.py @@ -13,7 +13,7 @@ class LaborScheduledShiftUpdatedEventObject(UncheckedBaseModel): scheduled_shift: typing_extensions.Annotated[ typing.Optional[ScheduledShift], FieldMetadata(alias="ScheduledShift") - ] = pydantic.Field(default=None) + ] = pydantic.Field(alias="ScheduledShift", default=None) """ The updated `ScheduledShift`. """ diff --git a/src/square/types/list_bank_accounts_response.py b/src/square/types/list_bank_accounts_response.py index 50e22a50..b853a5a1 100644 --- a/src/square/types/list_bank_accounts_response.py +++ b/src/square/types/list_bank_accounts_response.py @@ -14,19 +14,19 @@ class ListBankAccountsResponse(UncheckedBaseModel): Response object returned by ListBankAccounts. """ - errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) + bank_accounts: typing.Optional[typing.List[BankAccount]] = pydantic.Field(default=None) """ - Information on errors encountered during the request. + List of BankAccounts associated with this account. """ - bank_accounts: typing.Optional[typing.List[BankAccount]] = pydantic.Field(default=None) + errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) """ - List of BankAccounts associated with this account. + Information on errors encountered during the request. """ cursor: typing.Optional[str] = pydantic.Field(default=None) """ - When a response is truncated, it includes a cursor that you can + When a response is truncated, it includes a cursor that you can use in a subsequent request to fetch next set of bank accounts. If empty, this is the final response. 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/order_card_surcharge_treatment_type.py b/src/square/types/order_card_surcharge_treatment_type.py new file mode 100644 index 00000000..2fdc7367 --- /dev/null +++ b/src/square/types/order_card_surcharge_treatment_type.py @@ -0,0 +1,7 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +OrderCardSurchargeTreatmentType = typing.Union[ + typing.Literal["LINE_ITEM_TREATMENT", "APPORTIONED_TREATMENT"], typing.Any +] diff --git a/src/square/types/order_line_item.py b/src/square/types/order_line_item.py index 050df018..9a13671b 100644 --- a/src/square/types/order_line_item.py +++ b/src/square/types/order_line_item.py @@ -148,14 +148,16 @@ class OrderLineItem(UncheckedBaseModel): base_price_money: typing.Optional[Money] = pydantic.Field(default=None) """ - The base price for a single unit of the line item. + The base price for a single unit of the line item. Note - If inclusive tax is set on + this item it will be included in this value. """ variation_total_price_money: typing.Optional[Money] = pydantic.Field(default=None) """ The total price of all item variations sold in this line item. The price is calculated as `base_price_money` multiplied by `quantity`. - It does not include modifiers. + It does not include modifiers. Note - If inclusive tax is set on + this item it will be included in this value. """ gross_sales_money: typing.Optional[Money] = pydantic.Field(default=None) diff --git a/src/square/types/order_line_item_applied_tax.py b/src/square/types/order_line_item_applied_tax.py index 1db03f60..bc6e10f7 100644 --- a/src/square/types/order_line_item_applied_tax.py +++ b/src/square/types/order_line_item_applied_tax.py @@ -37,6 +37,13 @@ class OrderLineItemAppliedTax(UncheckedBaseModel): The amount of money applied by the tax to the line item. """ + auto_applied: typing.Optional[bool] = pydantic.Field(default=None) + """ + Indicates whether the tax was automatically applied to the order based on + the catalog configuration. For an example, see + [Automatically Apply Taxes to an Order](https://developer.squareup.com/docs/orders-api/apply-taxes-and-discounts/auto-apply-taxes). + """ + 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/order_line_item_pricing_blocklists.py b/src/square/types/order_line_item_pricing_blocklists.py index e978da0f..29ce8dad 100644 --- a/src/square/types/order_line_item_pricing_blocklists.py +++ b/src/square/types/order_line_item_pricing_blocklists.py @@ -6,6 +6,9 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2 from ..core.unchecked_base_model import UncheckedBaseModel from .order_line_item_pricing_blocklists_blocked_discount import OrderLineItemPricingBlocklistsBlockedDiscount +from .order_line_item_pricing_blocklists_blocked_service_charge import ( + OrderLineItemPricingBlocklistsBlockedServiceCharge, +) from .order_line_item_pricing_blocklists_blocked_tax import OrderLineItemPricingBlocklistsBlockedTax @@ -32,6 +35,16 @@ class OrderLineItemPricingBlocklists(UncheckedBaseModel): the `tax_catalog_object_id` (for catalog taxes). """ + blocked_service_charges: typing.Optional[typing.List[OrderLineItemPricingBlocklistsBlockedServiceCharge]] = ( + pydantic.Field(default=None) + ) + """ + A list of service charges blocked from applying to the line item. + Service charges can be blocked by the `service_charge_uid` (for ad hoc + service charges) or the `service_charge_catalog_object_id` (for catalog + service charges). + """ + 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/order_line_item_pricing_blocklists_blocked_service_charge.py b/src/square/types/order_line_item_pricing_blocklists_blocked_service_charge.py new file mode 100644 index 00000000..9d89a4ca --- /dev/null +++ b/src/square/types/order_line_item_pricing_blocklists_blocked_service_charge.py @@ -0,0 +1,43 @@ +# This file was auto-generated by Fern from our API Definition. + +import typing + +import pydantic +from ..core.pydantic_utilities import IS_PYDANTIC_V2 +from ..core.unchecked_base_model import UncheckedBaseModel + + +class OrderLineItemPricingBlocklistsBlockedServiceCharge(UncheckedBaseModel): + """ + A service charge to block from applying to a line item. The service charge + must be identified by either `service_charge_uid` or + `service_charge_catalog_object_id`, but not both. + """ + + uid: typing.Optional[str] = pydantic.Field(default=None) + """ + A unique ID of the `BlockedServiceCharge` within the order. + """ + + service_charge_uid: typing.Optional[str] = pydantic.Field(default=None) + """ + The `uid` of the service charge that should be blocked. Use this field to + block ad hoc service charges. For catalog service charges, use the + `service_charge_catalog_object_id` field. + """ + + service_charge_catalog_object_id: typing.Optional[str] = pydantic.Field(default=None) + """ + The `catalog_object_id` of the service charge that should be blocked. + Use this field to block catalog service charges. For ad hoc service charges, + use the `service_charge_uid` field. + """ + + if IS_PYDANTIC_V2: + model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 + else: + + class Config: + frozen = True + smart_union = True + extra = pydantic.Extra.allow diff --git a/src/square/types/order_return_service_charge.py b/src/square/types/order_return_service_charge.py index 05897ff3..dccc6eaf 100644 --- a/src/square/types/order_return_service_charge.py +++ b/src/square/types/order_return_service_charge.py @@ -10,6 +10,7 @@ from .order_service_charge_calculation_phase import OrderServiceChargeCalculationPhase from .order_service_charge_scope import OrderServiceChargeScope from .order_service_charge_treatment_type import OrderServiceChargeTreatmentType +from .order_service_charge_type import OrderServiceChargeType class OrderReturnServiceCharge(UncheckedBaseModel): @@ -106,7 +107,7 @@ class OrderReturnServiceCharge(UncheckedBaseModel): treatment_type: typing.Optional[OrderServiceChargeTreatmentType] = pydantic.Field(default=None) """ - The treatment type of the service charge. + Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values """ @@ -123,6 +124,12 @@ class OrderReturnServiceCharge(UncheckedBaseModel): See [OrderServiceChargeScope](#type-orderservicechargescope) for possible values """ + type: typing.Optional[OrderServiceChargeType] = pydantic.Field(default=None) + """ + The type of the service charge. + See [OrderServiceChargeType](#type-orderservicechargetype) for possible values + """ + 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/order_service_charge.py b/src/square/types/order_service_charge.py index ed4d657d..fa5c5a58 100644 --- a/src/square/types/order_service_charge.py +++ b/src/square/types/order_service_charge.py @@ -25,7 +25,7 @@ class OrderServiceCharge(UncheckedBaseModel): name: typing.Optional[str] = pydantic.Field(default=None) """ - The name of the service charge. + The name of the service charge. This is unused and null for AUTO_GRATUITY to match the behavior on Bills. """ catalog_object_id: typing.Optional[str] = pydantic.Field(default=None) @@ -137,7 +137,7 @@ class OrderServiceCharge(UncheckedBaseModel): treatment_type: typing.Optional[OrderServiceChargeTreatmentType] = pydantic.Field(default=None) """ - The treatment type of the service charge. + Indicates whether the service charge will be treated as a value-holding line item or apportioned toward a line item. See [OrderServiceChargeTreatmentType](#type-orderservicechargetreatmenttype) for possible values """ 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/search_orders_source_filter.py b/src/square/types/search_orders_source_filter.py index 4dd471bf..6e2f6c3a 100644 --- a/src/square/types/search_orders_source_filter.py +++ b/src/square/types/search_orders_source_filter.py @@ -20,6 +20,22 @@ class SearchOrdersSourceFilter(UncheckedBaseModel): Max: 10 source names. """ + source_application_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Filters by the [Source](entity:OrderSource) `applicationId`. The filter returns any orders + with a `source.applicationId` that matches any of the listed source applicationIds. + + Max: 100 source applicationIds. + """ + + source_client_ous: typing.Optional[typing.List[str]] = pydantic.Field(default=None) + """ + Filters by the [Source](entity:OrderSource) `clientOu`. The filter returns any orders + with a `source.clientOu` that matches any of the listed source clientOus. + + Max: 100 source clientOus. + """ + 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/subscription_test_result.py b/src/square/types/subscription_test_result.py index cd82b2a1..8285d133 100644 --- a/src/square/types/subscription_test_result.py +++ b/src/square/types/subscription_test_result.py @@ -9,8 +9,7 @@ class SubscriptionTestResult(UncheckedBaseModel): """ - Represents the details of a webhook subscription, including notification URL, - event types, and signature key. + Represents the result of testing a webhook subscription. Note: The actual API returns these fields at the root level of TestWebhookSubscriptionResponse, not nested under this object. """ id: typing.Optional[str] = pydantic.Field(default=None) @@ -20,12 +19,12 @@ class SubscriptionTestResult(UncheckedBaseModel): status_code: typing.Optional[int] = pydantic.Field(default=None) """ - The status code returned by the subscription notification URL. + The HTTP status code returned by the notification URL. """ - payload: typing.Optional[str] = pydantic.Field(default=None) + payload: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) """ - An object containing the payload of the test event. For example, a `payment.created` event. + The payload that was sent in the test notification. """ created_at: typing.Optional[str] = pydantic.Field(default=None) @@ -40,6 +39,16 @@ class SubscriptionTestResult(UncheckedBaseModel): Because a subscription test result is unique, this field is the same as the `created_at` field. """ + notification_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The URL that was used for the webhook notification test. + """ + + passes_filter: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the notification passed any configured filters. + """ + 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/test_webhook_subscription_response.py b/src/square/types/test_webhook_subscription_response.py index 8443a290..68e189b0 100644 --- a/src/square/types/test_webhook_subscription_response.py +++ b/src/square/types/test_webhook_subscription_response.py @@ -11,11 +11,7 @@ class TestWebhookSubscriptionResponse(UncheckedBaseModel): """ - Defines the fields that are included in the response body of - a request to the [TestWebhookSubscription](api-endpoint:WebhookSubscriptions-TestWebhookSubscription) endpoint. - - Note: If there are errors processing the request, the [SubscriptionTestResult](entity:SubscriptionTestResult) field is not - present. + Defines the fields that are included in the response body of a request to the TestWebhookSubscription endpoint. """ errors: typing.Optional[typing.List[Error]] = pydantic.Field(default=None) @@ -28,6 +24,26 @@ class TestWebhookSubscriptionResponse(UncheckedBaseModel): The [SubscriptionTestResult](entity:SubscriptionTestResult). """ + notification_url: typing.Optional[str] = pydantic.Field(default=None) + """ + The URL that was used for the webhook notification test. + """ + + status_code: typing.Optional[int] = pydantic.Field(default=None) + """ + The HTTP status code returned by the notification URL. + """ + + passes_filter: typing.Optional[bool] = pydantic.Field(default=None) + """ + Whether the notification passed any configured filters. + """ + + payload: typing.Optional[typing.Dict[str, typing.Any]] = pydantic.Field(default=None) + """ + The payload that was sent in the test notification. + """ + 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/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..92d9e8df 100644 --- a/tests/utils/test_http_client.py +++ b/tests/utils/test_http_client.py @@ -1,13 +1,57 @@ # 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, + _build_url, + 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"} @@ -48,14 +92,209 @@ def test_get_none_request_body() -> None: def test_get_empty_json_request_body() -> None: + """Test that implicit empty bodies (json=None) are collapsed to None.""" unrelated_request_options: RequestOptions = {"max_retries": 3} json_body, data_body = get_request_body(json=None, data=None, request_options=unrelated_request_options, omit=None) assert json_body is None assert data_body is None - json_body_extras, data_body_extras = get_request_body( - json={}, data=None, request_options=unrelated_request_options, omit=None + +def test_explicit_empty_json_body_is_preserved() -> None: + """Test that explicit empty bodies (json={}) are preserved and sent as {}. + + This is important for endpoints where the request body is required but all + fields are optional. The server expects valid JSON ({}) not an empty body. + """ + unrelated_request_options: RequestOptions = {"max_retries": 3} + + # Explicit json={} should be preserved + json_body, data_body = get_request_body(json={}, data=None, request_options=unrelated_request_options, omit=None) + assert json_body == {} + assert data_body is None + + # Explicit data={} should also be preserved + json_body2, data_body2 = get_request_body(json=None, data={}, request_options=unrelated_request_options, omit=None) + assert json_body2 is None + assert data_body2 == {} + + +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 - assert json_body_extras is None - assert data_body_extras 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")] + + +def test_basic_url_joining() -> None: + """Test basic URL joining with a simple base URL and path.""" + result = _build_url("https://api.example.com", "/users") + assert result == "https://api.example.com/users" + + +def test_basic_url_joining_trailing_slash() -> None: + """Test basic URL joining with a simple base URL and path.""" + result = _build_url("https://api.example.com/", "/users") + assert result == "https://api.example.com/users" + + +def test_preserves_base_url_path_prefix() -> None: + """Test that path prefixes in base URL are preserved. + + This is the critical bug fix - urllib.parse.urljoin() would strip + the path prefix when the path starts with '/'. + """ + result = _build_url("https://cloud.example.com/org/tenant/api", "/users") + assert result == "https://cloud.example.com/org/tenant/api/users" + + +def test_preserves_base_url_path_prefix_trailing_slash() -> None: + """Test that path prefixes in base URL are preserved.""" + result = _build_url("https://cloud.example.com/org/tenant/api/", "/users") + assert result == "https://cloud.example.com/org/tenant/api/users"