From fd57aedf9e20aa30cbad049564213de487bee76c Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 22:26:46 +0000 Subject: [PATCH] SDK regeneration --- .fern/metadata.json | 7 +- LICENSE | 2 +- poetry.lock | 97 +- pyproject.toml | 1 + reference.md | 700 +++++++------- src/square/catalog/client.py | 64 +- src/square/catalog/object/client.py | 4 +- src/square/core/client_wrapper.py | 10 + src/square/core/http_client.py | 314 +++++-- src/square/core/jsonable_encoder.py | 8 + src/square/core/pydantic_utilities.py | 103 +- 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 +- .../requests/subscription_test_result.py | 19 +- .../test_webhook_subscription_response.py | 26 +- src/square/types/address.py | 16 +- .../batch_get_catalog_objects_response.py | 15 +- .../batch_upsert_catalog_objects_response.py | 15 +- src/square/types/card.py | 2 +- src/square/types/catalog_category.py | 2 +- src/square/types/catalog_item.py | 18 +- src/square/types/catalog_item_option.py | 13 +- src/square/types/catalog_modifier_list.py | 13 +- src/square/types/catalog_object.py | 884 +++++++++++++++++- .../catalog_object_availability_period.py | 93 +- src/square/types/catalog_object_base.py | 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_subscription_plan.py | 13 +- src/square/types/catalog_v1id.py | 2 +- .../types/create_catalog_image_request.py | 15 +- .../types/create_catalog_image_response.py | 15 +- .../types/custom_attribute_definition.py | 2 +- src/square/types/filter_value.py | 2 +- .../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 +- src/square/types/list_catalog_response.py | 15 +- .../types/payment_link_related_resources.py | 15 +- .../types/search_catalog_items_response.py | 15 +- .../types/search_catalog_objects_response.py | 15 +- 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 ++++- 83 files changed, 2628 insertions(+), 3992 deletions(-) diff --git a/.fern/metadata.json b/.fern/metadata.json index d4b24802..60b2fd5b 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": "43.2.1.20251016" } \ 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..ea0fda47 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]] @@ -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..4ebcdf7a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [project] name = "squareup" +dynamic = ["version"] [tool.poetry] name = "squareup" diff --git a/reference.md b/reference.md index d42bf0f8..e037bb9e 100644 --- a/reference.md +++ b/reference.md @@ -1,6 +1,6 @@ # Reference ## Mobile -
client.mobile.authorization_code(...) +
client.mobile.authorization_code(...) -> AsyncHttpResponse[CreateMobileAuthorizationCodeResponse]
@@ -85,7 +85,7 @@ client.mobile.authorization_code(
## OAuth -
client.o_auth.revoke_token(...) +
client.o_auth.revoke_token(...) -> AsyncHttpResponse[RevokeTokenResponse]
@@ -206,7 +206,7 @@ Default: `false`
-
client.o_auth.obtain_token(...) +
client.o_auth.obtain_token(...) -> AsyncHttpResponse[ObtainTokenResponse]
@@ -429,7 +429,7 @@ Required for the PKCE flow if `grant_type` is `authorization_code`.
-
client.o_auth.retrieve_token_status() +
client.o_auth.retrieve_token_status() -> AsyncHttpResponse[RetrieveTokenStatusResponse]
@@ -502,7 +502,7 @@ client.o_auth.retrieve_token_status()
-
client.o_auth.authorize() +
client.o_auth.authorize() -> AsyncHttpResponse[None]
@@ -549,7 +549,7 @@ client.o_auth.authorize()
## V1Transactions -
client.v1transactions.v1list_orders(...) +
client.v1transactions.v1list_orders(...) -> AsyncHttpResponse[typing.List[V1Order]]
@@ -649,7 +649,7 @@ original query to the endpoint.
-
client.v1transactions.v1retrieve_order(...) +
client.v1transactions.v1retrieve_order(...) -> AsyncHttpResponse[V1Order]
@@ -728,7 +728,7 @@ client.v1transactions.v1retrieve_order(
-
client.v1transactions.v1update_order(...) +
client.v1transactions.v1update_order(...) -> AsyncHttpResponse[V1Order]
@@ -852,7 +852,7 @@ See [V1UpdateOrderRequestAction](#type-v1updateorderrequestaction) for possible
## ApplePay -
client.apple_pay.register_domain(...) +
client.apple_pay.register_domain(...) -> AsyncHttpResponse[RegisterDomainResponse]
@@ -936,7 +936,7 @@ client.apple_pay.register_domain(
## BankAccounts -
client.bank_accounts.list(...) +
client.bank_accounts.list(...) -> AsyncPager[BankAccount, ListBankAccountsResponse]
@@ -1042,7 +1042,7 @@ to retrieve only the linked bank accounts belonging to a specific location.
-
client.bank_accounts.get_by_v1id(...) +
client.bank_accounts.get_by_v1id(...) -> AsyncHttpResponse[GetBankAccountByV1IdResponse]
@@ -1115,7 +1115,7 @@ Connect V1 ID of the desired `BankAccount`. For more information, see
-
client.bank_accounts.get(...) +
client.bank_accounts.get(...) -> AsyncHttpResponse[GetBankAccountResponse]
@@ -1187,7 +1187,7 @@ client.bank_accounts.get(
## Bookings -
client.bookings.list(...) +
client.bookings.list(...) -> AsyncPager[Booking, ListBookingsResponse]
@@ -1319,7 +1319,7 @@ for page in response.iter_pages():
-
client.bookings.create(...) +
client.bookings.create(...) -> AsyncHttpResponse[CreateBookingResponse]
@@ -1410,7 +1410,7 @@ client.bookings.create(
-
client.bookings.search_availability(...) +
client.bookings.search_availability(...) -> AsyncHttpResponse[SearchAvailabilityResponse]
@@ -1483,7 +1483,7 @@ client.bookings.search_availability(
-
client.bookings.bulk_retrieve_bookings(...) +
client.bookings.bulk_retrieve_bookings(...) -> AsyncHttpResponse[BulkRetrieveBookingsResponse]
@@ -1556,7 +1556,7 @@ client.bookings.bulk_retrieve_bookings(
-
client.bookings.get_business_profile() +
client.bookings.get_business_profile() -> AsyncHttpResponse[GetBusinessBookingProfileResponse]
@@ -1616,7 +1616,7 @@ client.bookings.get_business_profile()
-
client.bookings.retrieve_location_booking_profile(...) +
client.bookings.retrieve_location_booking_profile(...) -> AsyncHttpResponse[RetrieveLocationBookingProfileResponse]
@@ -1686,7 +1686,7 @@ client.bookings.retrieve_location_booking_profile(
-
client.bookings.bulk_retrieve_team_member_booking_profiles(...) +
client.bookings.bulk_retrieve_team_member_booking_profiles(...) -> AsyncHttpResponse[BulkRetrieveTeamMemberBookingProfilesResponse]
@@ -1756,7 +1756,7 @@ client.bookings.bulk_retrieve_team_member_booking_profiles(
-
client.bookings.get(...) +
client.bookings.get(...) -> AsyncHttpResponse[GetBookingResponse]
@@ -1829,7 +1829,7 @@ client.bookings.get(
-
client.bookings.update(...) +
client.bookings.update(...) -> AsyncHttpResponse[UpdateBookingResponse]
@@ -1922,7 +1922,7 @@ client.bookings.update(
-
client.bookings.cancel(...) +
client.bookings.cancel(...) -> AsyncHttpResponse[CancelBookingResponse]
@@ -2015,7 +2015,7 @@ client.bookings.cancel(
## Cards -
client.cards.list(...) +
client.cards.list(...) -> AsyncPager[Card, ListCardsResponse]
@@ -2141,7 +2141,7 @@ This field defaults to ASC.
-
client.cards.create(...) +
client.cards.create(...) -> AsyncHttpResponse[CreateCardResponse]
@@ -2262,7 +2262,7 @@ See the [SCA Overview](https://developer.squareup.com/docs/sca-overview).
-
client.cards.get(...) +
client.cards.get(...) -> AsyncHttpResponse[GetCardResponse]
@@ -2332,7 +2332,7 @@ client.cards.get(
-
client.cards.disable(...) +
client.cards.disable(...) -> AsyncHttpResponse[DisableCardResponse]
@@ -2404,7 +2404,7 @@ client.cards.disable(
## Catalog -
client.catalog.batch_delete(...) +
client.catalog.batch_delete(...) -> AsyncHttpResponse[BatchDeleteCatalogObjectsResponse]
@@ -2491,7 +2491,7 @@ CatalogItem will delete its CatalogItemVariation.
-
client.catalog.batch_get(...) +
client.catalog.batch_get(...) -> AsyncHttpResponse[BatchGetCatalogObjectsResponse]
@@ -2624,7 +2624,7 @@ in the response payload.
-
client.catalog.batch_upsert(...) +
client.catalog.batch_upsert(...) -> AsyncHttpResponse[BatchUpsertCatalogObjectsResponse]
@@ -2673,34 +2673,10 @@ client.catalog.batch_upsert( batches=[ { "objects": [ - { - "type": "IMAGE", - "id": "#Tea", - "present_at_all_locations": True, - }, - { - "type": "IMAGE", - "id": "#Coffee", - "present_at_all_locations": True, - }, - { - "type": "ITEM", - "id": "#Beverages", - "present_at_all_locations": True, - }, - { - "type": "TAX", - "id": "#SalesTax", - "present_at_all_locations": True, - "tax_data": { - "name": "Sales Tax", - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "inclusion_type": "ADDITIVE", - "percentage": "5.0", - "applies_to_custom_amounts": True, - "enabled": True, - }, - }, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "TAX"}, ] } ], @@ -2780,7 +2756,7 @@ be inserted or updated.
-
client.catalog.info() +
client.catalog.info() -> AsyncHttpResponse[CatalogInfoResponse]
@@ -2841,7 +2817,7 @@ client.catalog.info()
-
client.catalog.list(...) +
client.catalog.list(...) -> AsyncPager[CatalogObject, ListCatalogResponse]
@@ -2965,7 +2941,7 @@ current version of the catalog.
-
client.catalog.search(...) +
client.catalog.search(...) -> AsyncHttpResponse[SearchCatalogObjectsResponse]
@@ -3145,7 +3121,7 @@ is higher than the maximum limit of 1,000, it will be ignored.
-
client.catalog.search_items(...) +
client.catalog.search_items(...) -> AsyncHttpResponse[SearchCatalogItemsResponse]
@@ -3328,7 +3304,7 @@ a single call to the [SearchCatalogItems](api-endpoint:Catalog-SearchCatalogItem
-
client.catalog.update_item_modifier_lists(...) +
client.catalog.update_item_modifier_lists(...) -> AsyncHttpResponse[UpdateItemModifierListsResponse]
@@ -3427,7 +3403,7 @@ At least one of `modifier_lists_to_enable` or `modifier_lists_to_disable` must b
-
client.catalog.update_item_taxes(...) +
client.catalog.update_item_taxes(...) -> AsyncHttpResponse[UpdateItemTaxesResponse]
@@ -3527,7 +3503,7 @@ At least one of `taxes_to_enable` or `taxes_to_disable` must be specified.
## Channels -
client.channels.list(...) +
client.channels.list(...) -> AsyncPager[Channel, ListChannelsResponse]
@@ -3641,7 +3617,7 @@ When not provided the returned results will be cap at 100 channels.
-
client.channels.bulk_retrieve(...) +
client.channels.bulk_retrieve(...) -> AsyncHttpResponse[BulkRetrieveChannelsResponse]
@@ -3711,7 +3687,7 @@ client.channels.bulk_retrieve(
-
client.channels.get(...) +
client.channels.get(...) -> AsyncHttpResponse[RetrieveChannelResponse]
@@ -3782,7 +3758,7 @@ client.channels.get(
## Customers -
client.customers.list(...) +
client.customers.list(...) -> AsyncPager[Customer, ListCustomersResponse]
@@ -3920,7 +3896,7 @@ The default value is `false`.
-
client.customers.create(...) +
client.customers.create(...) -> AsyncHttpResponse[CreateCustomerResponse]
@@ -4144,7 +4120,7 @@ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it
-
client.customers.batch_create(...) +
client.customers.batch_create(...) -> AsyncHttpResponse[BulkCreateCustomersResponse]
@@ -4264,7 +4240,7 @@ customer profile.
-
client.customers.bulk_delete_customers(...) +
client.customers.bulk_delete_customers(...) -> AsyncHttpResponse[BulkDeleteCustomersResponse]
@@ -4340,7 +4316,7 @@ client.customers.bulk_delete_customers(
-
client.customers.bulk_retrieve_customers(...) +
client.customers.bulk_retrieve_customers(...) -> AsyncHttpResponse[BulkRetrieveCustomersResponse]
@@ -4416,7 +4392,7 @@ client.customers.bulk_retrieve_customers(
-
client.customers.bulk_update_customers(...) +
client.customers.bulk_update_customers(...) -> AsyncHttpResponse[BulkUpdateCustomersResponse]
@@ -4508,7 +4484,7 @@ update a field, specify the new value. To remove a field, specify `null`.
-
client.customers.search(...) +
client.customers.search(...) -> AsyncHttpResponse[SearchCustomersResponse]
@@ -4639,7 +4615,7 @@ The default value is `false`.
-
client.customers.get(...) +
client.customers.get(...) -> AsyncHttpResponse[GetCustomerResponse]
@@ -4709,7 +4685,7 @@ client.customers.get(
-
client.customers.update(...) +
client.customers.update(...) -> AsyncHttpResponse[UpdateCustomerResponse]
@@ -4927,7 +4903,7 @@ see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it
-
client.customers.delete(...) +
client.customers.delete(...) -> AsyncHttpResponse[DeleteCustomerResponse]
@@ -5013,7 +4989,7 @@ As a best practice, you should include this parameter to enable [optimistic conc
## Devices -
client.devices.list(...) +
client.devices.list(...) -> AsyncPager[Device, ListDevicesResponse]
@@ -5124,7 +5100,7 @@ The order in which results are listed.
-
client.devices.get(...) +
client.devices.get(...) -> AsyncHttpResponse[GetDeviceResponse]
@@ -5195,7 +5171,7 @@ client.devices.get(
## Disputes -
client.disputes.list(...) +
client.disputes.list(...) -> AsyncPager[Dispute, ListDisputesResponse]
@@ -5295,7 +5271,7 @@ If not specified, the endpoint returns disputes associated with all locations.
-
client.disputes.get(...) +
client.disputes.get(...) -> AsyncHttpResponse[GetDisputeResponse]
@@ -5365,7 +5341,7 @@ client.disputes.get(
-
client.disputes.accept(...) +
client.disputes.accept(...) -> AsyncHttpResponse[AcceptDisputeResponse]
@@ -5439,7 +5415,7 @@ client.disputes.accept(
-
client.disputes.create_evidence_file(...) +
client.disputes.create_evidence_file(...) -> AsyncHttpResponse[CreateDisputeEvidenceFileResponse]
@@ -5528,7 +5504,7 @@ typing.Optional[core.File]` — See core.File for more documentation
-
client.disputes.create_evidence_text(...) +
client.disputes.create_evidence_text(...) -> AsyncHttpResponse[CreateDisputeEvidenceTextResponse]
@@ -5628,7 +5604,7 @@ See [DisputeEvidenceType](#type-disputeevidencetype) for possible values
-
client.disputes.submit_evidence(...) +
client.disputes.submit_evidence(...) -> AsyncHttpResponse[SubmitEvidenceResponse]
@@ -5705,7 +5681,7 @@ client.disputes.submit_evidence(
## Employees -
client.employees.list(...) +
client.employees.list(...) -> AsyncPager[Employee, ListEmployeesResponse]
@@ -5807,7 +5783,7 @@ for page in response.iter_pages():
-
client.employees.get(...) +
client.employees.get(...) -> AsyncHttpResponse[GetEmployeeResponse]
@@ -5878,7 +5854,7 @@ client.employees.get(
## Events -
client.events.search_events(...) +
client.events.search_events(...) -> AsyncHttpResponse[SearchEventsResponse]
@@ -5972,7 +5948,7 @@ Default: 100
-
client.events.disable_events() +
client.events.disable_events() -> AsyncHttpResponse[DisableEventsResponse]
@@ -6034,7 +6010,7 @@ client.events.disable_events()
-
client.events.enable_events() +
client.events.enable_events() -> AsyncHttpResponse[EnableEventsResponse]
@@ -6094,7 +6070,7 @@ client.events.enable_events()
-
client.events.list_event_types(...) +
client.events.list_event_types(...) -> AsyncHttpResponse[ListEventTypesResponse]
@@ -6165,7 +6141,7 @@ client.events.list_event_types(
## GiftCards -
client.gift_cards.list(...) +
client.gift_cards.list(...) -> AsyncPager[GiftCard, ListGiftCardsResponse]
@@ -6292,7 +6268,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/worki
-
client.gift_cards.create(...) +
client.gift_cards.create(...) -> AsyncHttpResponse[CreateGiftCardResponse]
@@ -6407,7 +6383,7 @@ include `gan` and provide the GAN that is printed on the gift card.
-
client.gift_cards.get_from_gan(...) +
client.gift_cards.get_from_gan(...) -> AsyncHttpResponse[GetGiftCardFromGanResponse]
@@ -6481,7 +6457,7 @@ Square-issued gift cards have 16-digit GANs.
-
client.gift_cards.get_from_nonce(...) +
client.gift_cards.get_from_nonce(...) -> AsyncHttpResponse[GetGiftCardFromNonceResponse]
@@ -6554,7 +6530,7 @@ Web Payments SDK or In-App Payments SDK.
-
client.gift_cards.link_customer(...) +
client.gift_cards.link_customer(...) -> AsyncHttpResponse[LinkCustomerToGiftCardResponse]
@@ -6633,7 +6609,7 @@ client.gift_cards.link_customer(
-
client.gift_cards.unlink_customer(...) +
client.gift_cards.unlink_customer(...) -> AsyncHttpResponse[UnlinkCustomerFromGiftCardResponse]
@@ -6712,7 +6688,7 @@ client.gift_cards.unlink_customer(
-
client.gift_cards.get(...) +
client.gift_cards.get(...) -> AsyncHttpResponse[GetGiftCardResponse]
@@ -6783,7 +6759,7 @@ client.gift_cards.get(
## Inventory -
client.inventory.deprecated_get_adjustment(...) +
client.inventory.deprecated_get_adjustment(...) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]
@@ -6854,7 +6830,7 @@ client.inventory.deprecated_get_adjustment(
-
client.inventory.get_adjustment(...) +
client.inventory.get_adjustment(...) -> AsyncHttpResponse[GetInventoryAdjustmentResponse]
@@ -6925,7 +6901,7 @@ client.inventory.get_adjustment(
-
client.inventory.deprecated_batch_change(...) +
client.inventory.deprecated_batch_change(...) -> AsyncHttpResponse[BatchChangeInventoryResponse]
@@ -7041,7 +7017,7 @@ the quantity is unchanged since the last physical count. Default: `true`.
-
client.inventory.deprecated_batch_get_changes(...) +
client.inventory.deprecated_batch_get_changes(...) -> AsyncHttpResponse[BatchGetInventoryChangesResponse]
@@ -7199,7 +7175,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.inventory.deprecated_batch_get_counts(...) +
client.inventory.deprecated_batch_get_counts(...) -> AsyncHttpResponse[BatchGetInventoryCountsResponse]
@@ -7331,7 +7307,7 @@ The default is null.
-
client.inventory.batch_create_changes(...) +
client.inventory.batch_create_changes(...) -> AsyncHttpResponse[BatchChangeInventoryResponse]
@@ -7450,7 +7426,7 @@ the quantity is unchanged since the last physical count. Default: `true`.
-
client.inventory.batch_get_changes(...) +
client.inventory.batch_get_changes(...) -> AsyncPager[InventoryChange, BatchGetInventoryChangesResponse]
@@ -7619,7 +7595,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.inventory.batch_get_counts(...) +
client.inventory.batch_get_counts(...) -> AsyncPager[InventoryCount, BatchGetInventoryCountsResponse]
@@ -7765,7 +7741,7 @@ The default is null.
-
client.inventory.deprecated_get_physical_count(...) +
client.inventory.deprecated_get_physical_count(...) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]
@@ -7839,7 +7815,7 @@ ID of the
-
client.inventory.get_physical_count(...) +
client.inventory.get_physical_count(...) -> AsyncHttpResponse[GetInventoryPhysicalCountResponse]
@@ -7913,7 +7889,7 @@ ID of the
-
client.inventory.get_transfer(...) +
client.inventory.get_transfer(...) -> AsyncHttpResponse[GetInventoryTransferResponse]
@@ -7984,7 +7960,7 @@ client.inventory.get_transfer(
-
client.inventory.get(...) +
client.inventory.get(...) -> AsyncPager[InventoryCount, GetInventoryCountResponse]
@@ -8088,7 +8064,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.inventory.changes(...) +
client.inventory.changes(...) -> AsyncPager[InventoryChange, GetInventoryChangesResponse]
@@ -8202,7 +8178,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
## Invoices -
client.invoices.list(...) +
client.invoices.list(...) -> AsyncPager[Invoice, ListInvoicesResponse]
@@ -8305,7 +8281,7 @@ If not provided, the server uses a default limit of 100 invoices.
-
client.invoices.create(...) +
client.invoices.create(...) -> AsyncHttpResponse[CreateInvoiceResponse]
@@ -8438,7 +8414,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.invoices.search(...) +
client.invoices.search(...) -> AsyncHttpResponse[SearchInvoicesResponse]
@@ -8545,7 +8521,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.invoices.get(...) +
client.invoices.get(...) -> AsyncHttpResponse[GetInvoiceResponse]
@@ -8615,7 +8591,7 @@ client.invoices.get(
-
client.invoices.update(...) +
client.invoices.update(...) -> AsyncHttpResponse[UpdateInvoiceResponse]
@@ -8737,7 +8713,7 @@ recommend using null values or the `remove` field when possible. For examples, s
-
client.invoices.delete(...) +
client.invoices.delete(...) -> AsyncHttpResponse[DeleteInvoiceResponse]
@@ -8822,7 +8798,7 @@ If you do not know the version, you can call [GetInvoice](api-endpoint:Invoices-
-
client.invoices.create_invoice_attachment(...) +
client.invoices.create_invoice_attachment(...) -> AsyncHttpResponse[CreateInvoiceAttachmentResponse]
@@ -8917,7 +8893,7 @@ typing.Optional[core.File]` — See core.File for more documentation
-
client.invoices.delete_invoice_attachment(...) +
client.invoices.delete_invoice_attachment(...) -> AsyncHttpResponse[DeleteInvoiceAttachmentResponse]
@@ -8997,7 +8973,7 @@ client.invoices.delete_invoice_attachment(
-
client.invoices.cancel(...) +
client.invoices.cancel(...) -> AsyncHttpResponse[CancelInvoiceResponse]
@@ -9083,7 +9059,7 @@ If you do not know the version, you can call
-
client.invoices.publish(...) +
client.invoices.publish(...) -> AsyncHttpResponse[PublishInvoiceResponse]
@@ -9194,7 +9170,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
## Labor -
client.labor.create_scheduled_shift(...) +
client.labor.create_scheduled_shift(...) -> AsyncHttpResponse[CreateScheduledShiftResponse]
@@ -9302,7 +9278,7 @@ of the operation.
-
client.labor.bulk_publish_scheduled_shifts(...) +
client.labor.bulk_publish_scheduled_shifts(...) -> AsyncHttpResponse[BulkPublishScheduledShiftsResponse]
@@ -9397,7 +9373,7 @@ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudienc
-
client.labor.search_scheduled_shifts(...) +
client.labor.search_scheduled_shifts(...) -> AsyncHttpResponse[SearchScheduledShiftsResponse]
@@ -9493,7 +9469,7 @@ information, see [Pagination](https://developer.squareup.com/docs/build-basics/c
-
client.labor.retrieve_scheduled_shift(...) +
client.labor.retrieve_scheduled_shift(...) -> AsyncHttpResponse[RetrieveScheduledShiftResponse]
@@ -9563,7 +9539,7 @@ client.labor.retrieve_scheduled_shift(
-
client.labor.update_scheduled_shift(...) +
client.labor.update_scheduled_shift(...) -> AsyncHttpResponse[UpdateScheduledShiftResponse]
@@ -9676,7 +9652,7 @@ omitted, Square executes a blind write, potentially overwriting data from anothe
-
client.labor.publish_scheduled_shift(...) +
client.labor.publish_scheduled_shift(...) -> AsyncHttpResponse[PublishScheduledShiftResponse]
@@ -9786,7 +9762,7 @@ See [ScheduledShiftNotificationAudience](#type-scheduledshiftnotificationaudienc
-
client.labor.create_timecard(...) +
client.labor.create_timecard(...) -> AsyncHttpResponse[CreateTimecardResponse]
@@ -9903,7 +9879,7 @@ client.labor.create_timecard(
-
client.labor.search_timecards(...) +
client.labor.search_timecards(...) -> AsyncHttpResponse[SearchTimecardsResponse]
@@ -10014,7 +9990,7 @@ client.labor.search_timecards(
-
client.labor.retrieve_timecard(...) +
client.labor.retrieve_timecard(...) -> AsyncHttpResponse[RetrieveTimecardResponse]
@@ -10084,7 +10060,7 @@ client.labor.retrieve_timecard(
-
client.labor.update_timecard(...) +
client.labor.update_timecard(...) -> AsyncHttpResponse[UpdateTimecardResponse]
@@ -10193,7 +10169,7 @@ client.labor.update_timecard(
-
client.labor.delete_timecard(...) +
client.labor.delete_timecard(...) -> AsyncHttpResponse[DeleteTimecardResponse]
@@ -10264,7 +10240,7 @@ client.labor.delete_timecard(
## Locations -
client.locations.list() +
client.locations.list() -> AsyncHttpResponse[ListLocationsResponse]
@@ -10325,7 +10301,7 @@ client.locations.list()
-
client.locations.create(...) +
client.locations.create(...) -> AsyncHttpResponse[CreateLocationResponse]
@@ -10414,7 +10390,7 @@ The remaining fields are automatically added based on the data from the [main lo
-
client.locations.get(...) +
client.locations.get(...) -> AsyncHttpResponse[GetLocationResponse]
@@ -10488,7 +10464,7 @@ The ID of the location to retrieve. Specify the string
-
client.locations.update(...) +
client.locations.update(...) -> AsyncHttpResponse[UpdateLocationResponse]
@@ -10588,7 +10564,7 @@ client.locations.update(
-
client.locations.checkouts(...) +
client.locations.checkouts(...) -> AsyncHttpResponse[CreateCheckoutResponse]
@@ -10870,7 +10846,7 @@ This value cannot exceed 60 characters.
## Loyalty -
client.loyalty.search_events(...) +
client.loyalty.search_events(...) -> AsyncHttpResponse[SearchLoyaltyEventsResponse]
@@ -10982,7 +10958,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
## Merchants -
client.merchants.list(...) +
client.merchants.list(...) -> AsyncPager[Merchant, ListMerchantsResponse]
@@ -11066,7 +11042,7 @@ for page in response.iter_pages():
-
client.merchants.get(...) +
client.merchants.get(...) -> AsyncHttpResponse[GetMerchantResponse]
@@ -11140,7 +11116,7 @@ then retrieve the merchant that is currently accessible to this call.
## Checkout -
client.checkout.retrieve_location_settings(...) +
client.checkout.retrieve_location_settings(...) -> AsyncHttpResponse[RetrieveLocationSettingsResponse]
@@ -11210,7 +11186,7 @@ client.checkout.retrieve_location_settings(
-
client.checkout.update_location_settings(...) +
client.checkout.update_location_settings(...) -> AsyncHttpResponse[UpdateLocationSettingsResponse]
@@ -11289,7 +11265,7 @@ client.checkout.update_location_settings(
-
client.checkout.retrieve_merchant_settings() +
client.checkout.retrieve_merchant_settings() -> AsyncHttpResponse[RetrieveMerchantSettingsResponse]
@@ -11349,7 +11325,7 @@ client.checkout.retrieve_merchant_settings()
-
client.checkout.update_merchant_settings(...) +
client.checkout.update_merchant_settings(...) -> AsyncHttpResponse[UpdateMerchantSettingsResponse]
@@ -11420,7 +11396,7 @@ client.checkout.update_merchant_settings(
## Orders -
client.orders.create(...) +
client.orders.create(...) -> AsyncHttpResponse[CreateOrderResponse]
@@ -11562,7 +11538,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.batch_get(...) +
client.orders.batch_get(...) -> AsyncHttpResponse[BatchGetOrdersResponse]
@@ -11646,7 +11622,7 @@ orders within the scope of the current authorization's merchant ID.
-
client.orders.calculate(...) +
client.orders.calculate(...) -> AsyncHttpResponse[CalculateOrderResponse]
@@ -11747,7 +11723,7 @@ random strings used only to reference the reward tier.
-
client.orders.clone(...) +
client.orders.clone(...) -> AsyncHttpResponse[CloneOrderResponse]
@@ -11850,7 +11826,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.search(...) +
client.orders.search(...) -> AsyncHttpResponse[SearchOrdersResponse]
@@ -12005,7 +11981,7 @@ Default: `false`.
-
client.orders.get(...) +
client.orders.get(...) -> AsyncHttpResponse[GetOrderResponse]
@@ -12075,7 +12051,7 @@ client.orders.get(
-
client.orders.update(...) +
client.orders.update(...) -> AsyncHttpResponse[UpdateOrderResponse]
@@ -12214,7 +12190,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.pay(...) +
client.orders.pay(...) -> AsyncHttpResponse[PayOrderResponse]
@@ -12333,7 +12309,7 @@ The payment total must match the order total.
## Payments -
client.payments.list(...) +
client.payments.list(...) -> AsyncPager[Payment, ListPaymentsResponse]
@@ -12588,7 +12564,7 @@ range is determined using the `updated_at` field for each Payment.
-
client.payments.create(...) +
client.payments.create(...) -> AsyncHttpResponse[CreatePaymentResponse]
@@ -12996,7 +12972,7 @@ internal 1st-party callers only.
-
client.payments.cancel_by_idempotency_key(...) +
client.payments.cancel_by_idempotency_key(...) -> AsyncHttpResponse[CancelPaymentByIdempotencyKeyResponse]
@@ -13076,7 +13052,7 @@ client.payments.cancel_by_idempotency_key(
-
client.payments.get(...) +
client.payments.get(...) -> AsyncHttpResponse[GetPaymentResponse]
@@ -13146,7 +13122,7 @@ client.payments.get(
-
client.payments.update(...) +
client.payments.update(...) -> AsyncHttpResponse[UpdatePaymentResponse]
@@ -13244,7 +13220,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.payments.cancel(...) +
client.payments.cancel(...) -> AsyncHttpResponse[CancelPaymentResponse]
@@ -13315,7 +13291,7 @@ client.payments.cancel(
-
client.payments.complete(...) +
client.payments.complete(...) -> AsyncHttpResponse[CompletePaymentResponse]
@@ -13401,7 +13377,7 @@ the update fails and a response with a VERSION_MISMATCH error is returned.
## Payouts -
client.payouts.list(...) +
client.payouts.list(...) -> AsyncPager[Payout, ListPayoutsResponse]
@@ -13552,7 +13528,7 @@ Default: `100`
-
client.payouts.get(...) +
client.payouts.get(...) -> AsyncHttpResponse[GetPayoutResponse]
@@ -13623,7 +13599,7 @@ client.payouts.get(
-
client.payouts.list_entries(...) +
client.payouts.list_entries(...) -> AsyncPager[PayoutEntry, ListPayoutEntriesResponse]
@@ -13738,7 +13714,7 @@ Default: `100`
## Refunds -
client.refunds.list(...) +
client.refunds.list(...) -> AsyncPager[PaymentRefund, ListPaymentRefundsResponse]
@@ -13960,7 +13936,7 @@ Default: The current time.
-
client.refunds.refund_payment(...) +
client.refunds.refund_payment(...) -> AsyncHttpResponse[RefundPaymentResponse]
@@ -14197,7 +14173,7 @@ Additional details required when recording an unlinked external refund
-
client.refunds.get(...) +
client.refunds.get(...) -> AsyncHttpResponse[GetPaymentRefundResponse]
@@ -14268,7 +14244,7 @@ client.refunds.get(
## Sites -
client.sites.list() +
client.sites.list() -> AsyncHttpResponse[ListSitesResponse]
@@ -14332,7 +14308,7 @@ client.sites.list()
## Snippets -
client.snippets.get(...) +
client.snippets.get(...) -> AsyncHttpResponse[GetSnippetResponse]
@@ -14407,7 +14383,7 @@ client.snippets.get(
-
client.snippets.upsert(...) +
client.snippets.upsert(...) -> AsyncHttpResponse[UpsertSnippetResponse]
@@ -14492,7 +14468,7 @@ client.snippets.upsert(
-
client.snippets.delete(...) +
client.snippets.delete(...) -> AsyncHttpResponse[DeleteSnippetResponse]
@@ -14568,7 +14544,7 @@ client.snippets.delete(
## Subscriptions -
client.subscriptions.create(...) +
client.subscriptions.create(...) -> AsyncHttpResponse[CreateSubscriptionResponse]
@@ -14787,7 +14763,7 @@ a list of time zones, see [List of tz database time zones](https://en.wikipedia.
-
client.subscriptions.bulk_swap_plan(...) +
client.subscriptions.bulk_swap_plan(...) -> AsyncHttpResponse[BulkSwapPlanResponse]
@@ -14884,7 +14860,7 @@ day.
-
client.subscriptions.search(...) +
client.subscriptions.search(...) -> AsyncHttpResponse[SearchSubscriptionsResponse]
@@ -15016,7 +14992,7 @@ The supported values are:
-
client.subscriptions.get(...) +
client.subscriptions.get(...) -> AsyncHttpResponse[GetSubscriptionResponse]
@@ -15101,7 +15077,7 @@ The supported query parameter values are:
-
client.subscriptions.update(...) +
client.subscriptions.update(...) -> AsyncHttpResponse[UpdateSubscriptionResponse]
@@ -15185,7 +15161,7 @@ be treated as a request to clear the relevant data.
-
client.subscriptions.delete_action(...) +
client.subscriptions.delete_action(...) -> AsyncHttpResponse[DeleteSubscriptionActionResponse]
@@ -15264,7 +15240,7 @@ client.subscriptions.delete_action(
-
client.subscriptions.change_billing_anchor_date(...) +
client.subscriptions.change_billing_anchor_date(...) -> AsyncHttpResponse[ChangeBillingAnchorDateResponse]
@@ -15358,7 +15334,7 @@ is changed immediately.
-
client.subscriptions.cancel(...) +
client.subscriptions.cancel(...) -> AsyncHttpResponse[CancelSubscriptionResponse]
@@ -15430,7 +15406,7 @@ client.subscriptions.cancel(
-
client.subscriptions.list_events(...) +
client.subscriptions.list_events(...) -> AsyncPager[SubscriptionEvent, ListSubscriptionEventsResponse]
@@ -15532,7 +15508,7 @@ in a paged response.
-
client.subscriptions.pause(...) +
client.subscriptions.pause(...) -> AsyncHttpResponse[PauseSubscriptionResponse]
@@ -15660,7 +15636,7 @@ See [ChangeTiming](#type-changetiming) for possible values
-
client.subscriptions.resume(...) +
client.subscriptions.resume(...) -> AsyncHttpResponse[ResumeSubscriptionResponse]
@@ -15750,7 +15726,7 @@ See [ChangeTiming](#type-changetiming) for possible values
-
client.subscriptions.swap_plan(...) +
client.subscriptions.swap_plan(...) -> AsyncHttpResponse[SwapPlanResponse]
@@ -15846,7 +15822,7 @@ This field is required.
## TeamMembers -
client.team_members.create(...) +
client.team_members.create(...) -> AsyncHttpResponse[CreateTeamMemberResponse]
@@ -15966,7 +15942,7 @@ The minimum length is 1 and the maximum length is 45.
-
client.team_members.batch_create(...) +
client.team_members.batch_create(...) -> AsyncHttpResponse[BatchCreateTeamMembersResponse]
@@ -16073,7 +16049,7 @@ call [ListJobs](api-endpoint:Team-ListJobs).
-
client.team_members.batch_update(...) +
client.team_members.batch_update(...) -> AsyncHttpResponse[BatchUpdateTeamMembersResponse]
@@ -16184,7 +16160,7 @@ call [ListJobs](api-endpoint:Team-ListJobs) to get the required `job_id` values.
-
client.team_members.search(...) +
client.team_members.search(...) -> AsyncHttpResponse[SearchTeamMembersResponse]
@@ -16276,7 +16252,7 @@ The opaque cursor for fetching the next page. For more information, see
-
client.team_members.get(...) +
client.team_members.get(...) -> AsyncHttpResponse[GetTeamMemberResponse]
@@ -16347,7 +16323,7 @@ client.team_members.get(
-
client.team_members.update(...) +
client.team_members.update(...) -> AsyncHttpResponse[UpdateTeamMemberResponse]
@@ -16459,7 +16435,7 @@ The team member fields to add, change, or clear. Fields can be cleared using a n
## Team -
client.team.list_jobs(...) +
client.team.list_jobs(...) -> AsyncHttpResponse[ListJobsResponse]
@@ -16533,7 +16509,7 @@ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-pat
-
client.team.create_job(...) +
client.team.create_job(...) -> AsyncHttpResponse[CreateJobResponse]
@@ -16617,7 +16593,7 @@ but must be unique for each request. For more information, see
-
client.team.retrieve_job(...) +
client.team.retrieve_job(...) -> AsyncHttpResponse[RetrieveJobResponse]
@@ -16687,7 +16663,7 @@ client.team.retrieve_job(
-
client.team.update_job(...) +
client.team.update_job(...) -> AsyncHttpResponse[UpdateJobResponse]
@@ -16772,7 +16748,7 @@ to be included in the request. Optionally include `version` to enable optimistic
## Terminal -
client.terminal.dismiss_terminal_action(...) +
client.terminal.dismiss_terminal_action(...) -> AsyncHttpResponse[DismissTerminalActionResponse]
@@ -16844,7 +16820,7 @@ client.terminal.dismiss_terminal_action(
-
client.terminal.dismiss_terminal_checkout(...) +
client.terminal.dismiss_terminal_checkout(...) -> AsyncHttpResponse[DismissTerminalCheckoutResponse]
@@ -16914,7 +16890,7 @@ client.terminal.dismiss_terminal_checkout(
-
client.terminal.dismiss_terminal_refund(...) +
client.terminal.dismiss_terminal_refund(...) -> AsyncHttpResponse[DismissTerminalRefundResponse]
@@ -16985,7 +16961,7 @@ client.terminal.dismiss_terminal_refund(
## TransferOrders -
client.transfer_orders.create(...) +
client.transfer_orders.create(...) -> AsyncHttpResponse[CreateTransferOrderResponse]
@@ -17103,7 +17079,7 @@ any valid string but must be unique for every CreateTransferOrder request.
-
client.transfer_orders.search(...) +
client.transfer_orders.search(...) -> AsyncPager[TransferOrder, SearchTransferOrdersResponse]
@@ -17209,7 +17185,7 @@ for page in response.iter_pages():
-
client.transfer_orders.get(...) +
client.transfer_orders.get(...) -> AsyncHttpResponse[RetrieveTransferOrderResponse]
@@ -17285,7 +17261,7 @@ client.transfer_orders.get(
-
client.transfer_orders.update(...) +
client.transfer_orders.update(...) -> AsyncHttpResponse[UpdateTransferOrderResponse]
@@ -17399,7 +17375,7 @@ client.transfer_orders.update(
-
client.transfer_orders.delete(...) +
client.transfer_orders.delete(...) -> AsyncHttpResponse[DeleteTransferOrderResponse]
@@ -17482,7 +17458,7 @@ client.transfer_orders.delete(
-
client.transfer_orders.cancel(...) +
client.transfer_orders.cancel(...) -> AsyncHttpResponse[CancelTransferOrderResponse]
@@ -17582,7 +17558,7 @@ any valid string but must be unique for every UpdateTransferOrder request.
-
client.transfer_orders.receive(...) +
client.transfer_orders.receive(...) -> AsyncHttpResponse[ReceiveTransferOrderResponse]
@@ -17708,7 +17684,7 @@ client.transfer_orders.receive(
-
client.transfer_orders.start(...) +
client.transfer_orders.start(...) -> AsyncHttpResponse[StartTransferOrderResponse]
@@ -17807,7 +17783,7 @@ any valid string but must be unique for every UpdateTransferOrder request.
## Vendors -
client.vendors.batch_create(...) +
client.vendors.batch_create(...) -> AsyncHttpResponse[BatchCreateVendorsResponse]
@@ -17899,7 +17875,7 @@ client.vendors.batch_create(
-
client.vendors.batch_get(...) +
client.vendors.batch_get(...) -> AsyncHttpResponse[BatchGetVendorsResponse]
@@ -17969,7 +17945,7 @@ client.vendors.batch_get(
-
client.vendors.batch_update(...) +
client.vendors.batch_update(...) -> AsyncHttpResponse[BatchUpdateVendorsResponse]
@@ -18045,7 +18021,7 @@ objects. The set is represented by a collection of `Vendor`-ID/`UpdateVendorReq
-
client.vendors.create(...) +
client.vendors.create(...) -> AsyncHttpResponse[CreateVendorResponse]
@@ -18150,7 +18126,7 @@ information.
-
client.vendors.search(...) +
client.vendors.search(...) -> AsyncHttpResponse[SearchVendorsResponse]
@@ -18239,7 +18215,7 @@ See the [Pagination](https://developer.squareup.com/docs/working-with-apis/pagin
-
client.vendors.get(...) +
client.vendors.get(...) -> AsyncHttpResponse[GetVendorResponse]
@@ -18309,7 +18285,7 @@ client.vendors.get(
-
client.vendors.update(...) +
client.vendors.update(...) -> AsyncHttpResponse[UpdateVendorResponse]
@@ -18410,7 +18386,9 @@ information.
## Bookings CustomAttributeDefinitions -
client.bookings.custom_attribute_definitions.list(...) +
client.bookings.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListBookingCustomAttributeDefinitionsResponse +]
@@ -18505,7 +18483,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.bookings.custom_attribute_definitions.create(...) +
client.bookings.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateBookingCustomAttributeDefinitionResponse]
@@ -18608,7 +18586,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.bookings.custom_attribute_definitions.get(...) +
client.bookings.custom_attribute_definitions.get(...) -> AsyncHttpResponse[RetrieveBookingCustomAttributeDefinitionResponse]
@@ -18698,7 +18676,7 @@ is higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.bookings.custom_attribute_definitions.update(...) +
client.bookings.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateBookingCustomAttributeDefinitionResponse]
@@ -18807,7 +18785,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.bookings.custom_attribute_definitions.delete(...) +
client.bookings.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteBookingCustomAttributeDefinitionResponse]
@@ -18884,7 +18862,7 @@ client.bookings.custom_attribute_definitions.delete(
## Bookings CustomAttributes -
client.bookings.custom_attributes.batch_delete(...) +
client.bookings.custom_attributes.batch_delete(...) -> AsyncHttpResponse[BulkDeleteBookingCustomAttributesResponse]
@@ -18964,7 +18942,7 @@ information needed to delete a custom attribute.
-
client.bookings.custom_attributes.batch_upsert(...) +
client.bookings.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertBookingCustomAttributesResponse]
@@ -19044,7 +19022,7 @@ information needed to create or update a custom attribute.
-
client.bookings.custom_attributes.list(...) +
client.bookings.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListBookingCustomAttributesResponse]
@@ -19161,7 +19139,7 @@ attribute, information about the data type, or other definition details. The def
-
client.bookings.custom_attributes.get(...) +
client.bookings.custom_attributes.get(...) -> AsyncHttpResponse[RetrieveBookingCustomAttributeResponse]
@@ -19274,7 +19252,7 @@ higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.bookings.custom_attributes.upsert(...) +
client.bookings.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertBookingCustomAttributeResponse]
@@ -19392,7 +19370,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.bookings.custom_attributes.delete(...) +
client.bookings.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteBookingCustomAttributeResponse]
@@ -19482,7 +19460,7 @@ definition owner, you must use the qualified key.
## Bookings LocationProfiles -
client.bookings.location_profiles.list(...) +
client.bookings.location_profiles.list(...) -> AsyncPager[LocationBookingProfile, ListLocationBookingProfilesResponse]
@@ -19567,7 +19545,7 @@ for page in response.iter_pages():
## Bookings TeamMemberProfiles -
client.bookings.team_member_profiles.list(...) +
client.bookings.team_member_profiles.list(...) -> AsyncPager[TeamMemberBookingProfile, ListTeamMemberBookingProfilesResponse]
@@ -19669,7 +19647,7 @@ for page in response.iter_pages():
-
client.bookings.team_member_profiles.get(...) +
client.bookings.team_member_profiles.get(...) -> AsyncHttpResponse[GetTeamMemberBookingProfileResponse]
@@ -19740,7 +19718,7 @@ client.bookings.team_member_profiles.get(
## CashDrawers Shifts -
client.cash_drawers.shifts.list(...) +
client.cash_drawers.shifts.list(...) -> AsyncPager[CashDrawerShiftSummary, ListCashDrawerShiftsResponse]
@@ -19867,7 +19845,7 @@ default, 1000 max).
-
client.cash_drawers.shifts.get(...) +
client.cash_drawers.shifts.get(...) -> AsyncHttpResponse[GetCashDrawerShiftResponse]
@@ -19947,7 +19925,7 @@ client.cash_drawers.shifts.get(
-
client.cash_drawers.shifts.list_events(...) +
client.cash_drawers.shifts.list_events(...) -> AsyncPager[CashDrawerShiftEvent, ListCashDrawerShiftEventsResponse]
@@ -20053,7 +20031,7 @@ default, 1000 max).
## Catalog Images -
client.catalog.images.create(...) +
client.catalog.images.create(...) -> AsyncHttpResponse[CreateCatalogImageResponse]
@@ -20136,7 +20114,7 @@ typing.Optional[core.File]` — See core.File for more documentation
-
client.catalog.images.update(...) +
client.catalog.images.update(...) -> AsyncHttpResponse[UpdateCatalogImageResponse]
@@ -20228,7 +20206,7 @@ typing.Optional[core.File]` — See core.File for more documentation
## Catalog Object -
client.catalog.object.upsert(...) +
client.catalog.object.upsert(...) -> AsyncHttpResponse[UpsertCatalogObjectResponse]
@@ -20266,7 +20244,7 @@ client = Square( ) client.catalog.object.upsert( idempotency_key="af3d1afc-7212-4300-b463-0bfc5314a5ae", - object={"type": "IMAGE", "id": "#Cocoa"}, + object={"id": "id", "type": "ITEM"}, ) ``` @@ -20327,7 +20305,7 @@ A CatalogObject to be created or updated.
-
client.catalog.object.get(...) +
client.catalog.object.get(...) -> AsyncHttpResponse[GetCatalogObjectResponse]
@@ -20455,7 +20433,7 @@ in the response payload.
-
client.catalog.object.delete(...) +
client.catalog.object.delete(...) -> AsyncHttpResponse[DeleteCatalogObjectResponse]
@@ -20539,7 +20517,7 @@ catalog item will delete its catalog item variations).
## Checkout PaymentLinks -
client.checkout.payment_links.list(...) +
client.checkout.payment_links.list(...) -> AsyncPager[PaymentLink, ListPaymentLinksResponse]
@@ -20634,7 +20612,7 @@ Default value: `100`
-
client.checkout.payment_links.create(...) +
client.checkout.payment_links.create(...) -> AsyncHttpResponse[CreatePaymentLinkResponse]
@@ -20781,7 +20759,7 @@ For more information, see [Prepopulate the shipping address](https://developer.s
-
client.checkout.payment_links.get(...) +
client.checkout.payment_links.get(...) -> AsyncHttpResponse[GetPaymentLinkResponse]
@@ -20851,7 +20829,7 @@ client.checkout.payment_links.get(
-
client.checkout.payment_links.update(...) +
client.checkout.payment_links.update(...) -> AsyncHttpResponse[UpdatePaymentLinkResponse]
@@ -20938,7 +20916,7 @@ For more information, see [Update a payment link](https://developer.squareup.com
-
client.checkout.payment_links.delete(...) +
client.checkout.payment_links.delete(...) -> AsyncHttpResponse[DeletePaymentLinkResponse]
@@ -21009,7 +20987,9 @@ client.checkout.payment_links.delete(
## Customers CustomAttributeDefinitions -
client.customers.custom_attribute_definitions.list(...) +
client.customers.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListCustomerCustomAttributeDefinitionsResponse +]
@@ -21106,7 +21086,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.customers.custom_attribute_definitions.create(...) +
client.customers.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateCustomerCustomAttributeDefinitionResponse]
@@ -21212,7 +21192,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.customers.custom_attribute_definitions.get(...) +
client.customers.custom_attribute_definitions.get(...) -> AsyncHttpResponse[GetCustomerCustomAttributeDefinitionResponse]
@@ -21303,7 +21283,7 @@ is higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.customers.custom_attribute_definitions.update(...) +
client.customers.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateCustomerCustomAttributeDefinitionResponse]
@@ -21418,7 +21398,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.customers.custom_attribute_definitions.delete(...) +
client.customers.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteCustomerCustomAttributeDefinitionResponse]
@@ -21493,7 +21473,7 @@ client.customers.custom_attribute_definitions.delete(
-
client.customers.custom_attribute_definitions.batch_upsert(...) +
client.customers.custom_attribute_definitions.batch_upsert(...) -> AsyncHttpResponse[BatchUpsertCustomerCustomAttributesResponse]
@@ -21611,7 +21591,7 @@ information needed to create or update a custom attribute.
## Customers Groups -
client.customers.groups.list(...) +
client.customers.groups.list(...) -> AsyncPager[CustomerGroup, ListCustomerGroupsResponse]
@@ -21705,7 +21685,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.customers.groups.create(...) +
client.customers.groups.create(...) -> AsyncHttpResponse[CreateCustomerGroupResponse]
@@ -21785,7 +21765,7 @@ client.customers.groups.create(
-
client.customers.groups.get(...) +
client.customers.groups.get(...) -> AsyncHttpResponse[GetCustomerGroupResponse]
@@ -21855,7 +21835,7 @@ client.customers.groups.get(
-
client.customers.groups.update(...) +
client.customers.groups.update(...) -> AsyncHttpResponse[UpdateCustomerGroupResponse]
@@ -21934,7 +21914,7 @@ client.customers.groups.update(
-
client.customers.groups.delete(...) +
client.customers.groups.delete(...) -> AsyncHttpResponse[DeleteCustomerGroupResponse]
@@ -22004,7 +21984,7 @@ client.customers.groups.delete(
-
client.customers.groups.add(...) +
client.customers.groups.add(...) -> AsyncHttpResponse[AddGroupToCustomerResponse]
@@ -22086,7 +22066,7 @@ client.customers.groups.add(
-
client.customers.groups.remove(...) +
client.customers.groups.remove(...) -> AsyncHttpResponse[RemoveGroupFromCustomerResponse]
@@ -22169,7 +22149,7 @@ client.customers.groups.remove(
## Customers Segments -
client.customers.segments.list(...) +
client.customers.segments.list(...) -> AsyncPager[CustomerSegment, ListCustomerSegmentsResponse]
@@ -22263,7 +22243,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.customers.segments.get(...) +
client.customers.segments.get(...) -> AsyncHttpResponse[GetCustomerSegmentResponse]
@@ -22334,7 +22314,7 @@ client.customers.segments.get(
## Customers Cards -
client.customers.cards.create(...) +
client.customers.cards.create(...) -> AsyncHttpResponse[CreateCustomerCardResponse]
@@ -22469,7 +22449,7 @@ challenge results to indicate that Square has verified the buyer identity.
-
client.customers.cards.delete(...) +
client.customers.cards.delete(...) -> AsyncHttpResponse[DeleteCustomerCardResponse]
@@ -22549,7 +22529,7 @@ client.customers.cards.delete(
## Customers CustomAttributes -
client.customers.custom_attributes.list(...) +
client.customers.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListCustomerCustomAttributesResponse]
@@ -22670,7 +22650,7 @@ attribute, information about the data type, or other definition details. The def
-
client.customers.custom_attributes.get(...) +
client.customers.custom_attributes.get(...) -> AsyncHttpResponse[GetCustomerCustomAttributeResponse]
@@ -22787,7 +22767,7 @@ higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.customers.custom_attributes.upsert(...) +
client.customers.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertCustomerCustomAttributeResponse]
@@ -22907,7 +22887,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.customers.custom_attributes.delete(...) +
client.customers.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteCustomerCustomAttributeResponse]
@@ -22995,7 +22975,7 @@ definition owner, you must use the qualified key.
## Devices Codes -
client.devices.codes.list(...) +
client.devices.codes.list(...) -> AsyncPager[DeviceCode, ListDeviceCodesResponse]
@@ -23110,7 +23090,7 @@ Returns DeviceCodes of status `PAIRED` and `UNPAIRED` if empty.
-
client.devices.codes.create(...) +
client.devices.codes.create(...) -> AsyncHttpResponse[CreateDeviceCodeResponse]
@@ -23199,7 +23179,7 @@ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-a
-
client.devices.codes.get(...) +
client.devices.codes.get(...) -> AsyncHttpResponse[GetDeviceCodeResponse]
@@ -23270,7 +23250,7 @@ client.devices.codes.get(
## Disputes Evidence -
client.disputes.evidence.list(...) +
client.disputes.evidence.list(...) -> AsyncPager[DisputeEvidence, ListDisputeEvidenceResponse]
@@ -23358,7 +23338,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.disputes.evidence.get(...) +
client.disputes.evidence.get(...) -> AsyncHttpResponse[GetDisputeEvidenceResponse]
@@ -23439,7 +23419,7 @@ client.disputes.evidence.get(
-
client.disputes.evidence.delete(...) +
client.disputes.evidence.delete(...) -> AsyncHttpResponse[DeleteDisputeEvidenceResponse]
@@ -23520,7 +23500,7 @@ client.disputes.evidence.delete(
## GiftCards Activities -
client.gift_cards.activities.list(...) +
client.gift_cards.activities.list(...) -> AsyncPager[GiftCardActivity, ListGiftCardActivitiesResponse]
@@ -23690,7 +23670,7 @@ The order in which the endpoint returns the activities, based on `created_at`.
-
client.gift_cards.activities.create(...) +
client.gift_cards.activities.create(...) -> AsyncHttpResponse[CreateGiftCardActivityResponse]
@@ -23782,7 +23762,7 @@ gift card, the `location_id` where the activity occurred, and the activity `type
## Labor BreakTypes -
client.labor.break_types.list(...) +
client.labor.break_types.list(...) -> AsyncPager[BreakType, ListBreakTypesResponse]
@@ -23881,7 +23861,7 @@ and 200. The default is 200.
-
client.labor.break_types.create(...) +
client.labor.break_types.create(...) -> AsyncHttpResponse[CreateBreakTypeResponse]
@@ -23978,7 +23958,7 @@ client.labor.break_types.create(
-
client.labor.break_types.get(...) +
client.labor.break_types.get(...) -> AsyncHttpResponse[GetBreakTypeResponse]
@@ -24048,7 +24028,7 @@ client.labor.break_types.get(
-
client.labor.break_types.update(...) +
client.labor.break_types.update(...) -> AsyncHttpResponse[UpdateBreakTypeResponse]
@@ -24133,7 +24113,7 @@ client.labor.break_types.update(
-
client.labor.break_types.delete(...) +
client.labor.break_types.delete(...) -> AsyncHttpResponse[DeleteBreakTypeResponse]
@@ -24206,7 +24186,7 @@ client.labor.break_types.delete(
## Labor EmployeeWages -
client.labor.employee_wages.list(...) +
client.labor.employee_wages.list(...) -> AsyncPager[EmployeeWage, ListEmployeeWagesResponse]
@@ -24302,7 +24282,7 @@ The maximum number of `EmployeeWage` results to return per page. The number can
-
client.labor.employee_wages.get(...) +
client.labor.employee_wages.get(...) -> AsyncHttpResponse[GetEmployeeWageResponse]
@@ -24373,7 +24353,7 @@ client.labor.employee_wages.get(
## Labor Shifts -
client.labor.shifts.create(...) +
client.labor.shifts.create(...) -> AsyncHttpResponse[CreateShiftResponse]
@@ -24490,7 +24470,7 @@ client.labor.shifts.create(
-
client.labor.shifts.search(...) +
client.labor.shifts.search(...) -> AsyncHttpResponse[SearchShiftsResponse]
@@ -24601,7 +24581,7 @@ client.labor.shifts.search(
-
client.labor.shifts.get(...) +
client.labor.shifts.get(...) -> AsyncHttpResponse[GetShiftResponse]
@@ -24671,7 +24651,7 @@ client.labor.shifts.get(
-
client.labor.shifts.update(...) +
client.labor.shifts.update(...) -> AsyncHttpResponse[UpdateShiftResponse]
@@ -24779,7 +24759,7 @@ client.labor.shifts.update(
-
client.labor.shifts.delete(...) +
client.labor.shifts.delete(...) -> AsyncHttpResponse[DeleteShiftResponse]
@@ -24850,7 +24830,7 @@ client.labor.shifts.delete(
## Labor TeamMemberWages -
client.labor.team_member_wages.list(...) +
client.labor.team_member_wages.list(...) -> AsyncPager[TeamMemberWage, ListTeamMemberWagesResponse]
@@ -24949,7 +24929,7 @@ The maximum number of `TeamMemberWage` results to return per page. The number ca
-
client.labor.team_member_wages.get(...) +
client.labor.team_member_wages.get(...) -> AsyncHttpResponse[GetTeamMemberWageResponse]
@@ -25020,7 +25000,7 @@ client.labor.team_member_wages.get(
## Labor WorkweekConfigs -
client.labor.workweek_configs.list(...) +
client.labor.workweek_configs.list(...) -> AsyncPager[WorkweekConfig, ListWorkweekConfigsResponse]
@@ -25104,7 +25084,7 @@ for page in response.iter_pages():
-
client.labor.workweek_configs.get(...) +
client.labor.workweek_configs.get(...) -> AsyncHttpResponse[UpdateWorkweekConfigResponse]
@@ -25188,7 +25168,9 @@ client.labor.workweek_configs.get(
## Locations CustomAttributeDefinitions -
client.locations.custom_attribute_definitions.list(...) +
client.locations.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListLocationCustomAttributeDefinitionsResponse +]
@@ -25292,7 +25274,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.locations.custom_attribute_definitions.create(...) +
client.locations.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateLocationCustomAttributeDefinitionResponse]
@@ -25393,7 +25375,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.locations.custom_attribute_definitions.get(...) +
client.locations.custom_attribute_definitions.get(...) -> AsyncHttpResponse[RetrieveLocationCustomAttributeDefinitionResponse]
@@ -25482,7 +25464,7 @@ is higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.locations.custom_attribute_definitions.update(...) +
client.locations.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateLocationCustomAttributeDefinitionResponse]
@@ -25593,7 +25575,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.locations.custom_attribute_definitions.delete(...) +
client.locations.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteLocationCustomAttributeDefinitionResponse]
@@ -25667,7 +25649,7 @@ client.locations.custom_attribute_definitions.delete(
## Locations CustomAttributes -
client.locations.custom_attributes.batch_delete(...) +
client.locations.custom_attributes.batch_delete(...) -> AsyncHttpResponse[BulkDeleteLocationCustomAttributesResponse]
@@ -25749,7 +25731,7 @@ The keys must be unique and are used to map to the corresponding response.
-
client.locations.custom_attributes.batch_upsert(...) +
client.locations.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertLocationCustomAttributesResponse]
@@ -25854,7 +25836,7 @@ information needed to create or update a custom attribute.
-
client.locations.custom_attributes.list(...) +
client.locations.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListLocationCustomAttributesResponse]
@@ -25982,7 +25964,7 @@ attribute, information about the data type, or other definition details. The def
-
client.locations.custom_attributes.get(...) +
client.locations.custom_attributes.get(...) -> AsyncHttpResponse[RetrieveLocationCustomAttributeResponse]
@@ -26096,7 +26078,7 @@ higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.locations.custom_attributes.upsert(...) +
client.locations.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertLocationCustomAttributeResponse]
@@ -26211,7 +26193,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.locations.custom_attributes.delete(...) +
client.locations.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteLocationCustomAttributeResponse]
@@ -26297,7 +26279,7 @@ definition owner, you must use the qualified key.
## Locations Transactions -
client.locations.transactions.list(...) +
client.locations.transactions.list(...) -> AsyncHttpResponse[ListTransactionsResponse]
@@ -26430,7 +26412,7 @@ See [Paginating results](https://developer.squareup.com/docs/working-with-apis/p
-
client.locations.transactions.get(...) +
client.locations.transactions.get(...) -> AsyncHttpResponse[GetTransactionResponse]
@@ -26509,7 +26491,7 @@ client.locations.transactions.get(
-
client.locations.transactions.capture(...) +
client.locations.transactions.capture(...) -> AsyncHttpResponse[CaptureTransactionResponse]
@@ -26593,7 +26575,7 @@ client.locations.transactions.capture(
-
client.locations.transactions.void(...) +
client.locations.transactions.void(...) -> AsyncHttpResponse[VoidTransactionResponse]
@@ -26678,7 +26660,7 @@ client.locations.transactions.void(
## Loyalty Accounts -
client.loyalty.accounts.create(...) +
client.loyalty.accounts.create(...) -> AsyncHttpResponse[CreateLoyaltyAccountResponse]
@@ -26763,7 +26745,7 @@ Keys can be any valid string, but must be unique for every request.
-
client.loyalty.accounts.search(...) +
client.loyalty.accounts.search(...) -> AsyncHttpResponse[SearchLoyaltyAccountsResponse]
@@ -26861,7 +26843,7 @@ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-pat
-
client.loyalty.accounts.get(...) +
client.loyalty.accounts.get(...) -> AsyncHttpResponse[GetLoyaltyAccountResponse]
@@ -26931,7 +26913,7 @@ client.loyalty.accounts.get(
-
client.loyalty.accounts.accumulate_points(...) +
client.loyalty.accounts.accumulate_points(...) -> AsyncHttpResponse[AccumulateLoyaltyPointsResponse]
@@ -27048,7 +27030,7 @@ Keys can be any valid string but must be unique for every request.
-
client.loyalty.accounts.adjust(...) +
client.loyalty.accounts.adjust(...) -> AsyncHttpResponse[AdjustLoyaltyPointsResponse]
@@ -27159,7 +27141,7 @@ the specified number of points would result in a negative balance. The default v
## Loyalty Programs -
client.loyalty.programs.list() +
client.loyalty.programs.list() -> AsyncHttpResponse[ListLoyaltyProgramsResponse]
@@ -27223,7 +27205,7 @@ client.loyalty.programs.list()
-
client.loyalty.programs.get(...) +
client.loyalty.programs.get(...) -> AsyncHttpResponse[GetLoyaltyProgramResponse]
@@ -27295,7 +27277,7 @@ client.loyalty.programs.get(
-
client.loyalty.programs.calculate(...) +
client.loyalty.programs.calculate(...) -> AsyncHttpResponse[CalculateLoyaltyPointsResponse]
@@ -27423,7 +27405,7 @@ for regardless of the trigger limit.
## Loyalty Rewards -
client.loyalty.rewards.create(...) +
client.loyalty.rewards.create(...) -> AsyncHttpResponse[CreateLoyaltyRewardResponse]
@@ -27516,7 +27498,7 @@ Keys can be any valid string, but must be unique for every request.
-
client.loyalty.rewards.search(...) +
client.loyalty.rewards.search(...) -> AsyncHttpResponse[SearchLoyaltyRewardsResponse]
@@ -27618,7 +27600,7 @@ see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-pat
-
client.loyalty.rewards.get(...) +
client.loyalty.rewards.get(...) -> AsyncHttpResponse[GetLoyaltyRewardResponse]
@@ -27688,7 +27670,7 @@ client.loyalty.rewards.get(
-
client.loyalty.rewards.delete(...) +
client.loyalty.rewards.delete(...) -> AsyncHttpResponse[DeleteLoyaltyRewardResponse]
@@ -27766,7 +27748,7 @@ client.loyalty.rewards.delete(
-
client.loyalty.rewards.redeem(...) +
client.loyalty.rewards.redeem(...) -> AsyncHttpResponse[RedeemLoyaltyRewardResponse]
@@ -27868,7 +27850,7 @@ Keys can be any valid string, but must be unique for every request.
## Loyalty Programs Promotions -
client.loyalty.programs.promotions.list(...) +
client.loyalty.programs.promotions.list(...) -> AsyncPager[LoyaltyPromotion, ListLoyaltyPromotionsResponse]
@@ -27986,7 +27968,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.loyalty.programs.promotions.create(...) +
client.loyalty.programs.promotions.create(...) -> AsyncHttpResponse[CreateLoyaltyPromotionResponse]
@@ -28100,7 +28082,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.loyalty.programs.promotions.get(...) +
client.loyalty.programs.promotions.get(...) -> AsyncHttpResponse[GetLoyaltyPromotionResponse]
@@ -28182,7 +28164,7 @@ call [RetrieveLoyaltyProgram](api-endpoint:Loyalty-RetrieveLoyaltyProgram) using
-
client.loyalty.programs.promotions.cancel(...) +
client.loyalty.programs.promotions.cancel(...) -> AsyncHttpResponse[CancelLoyaltyPromotionResponse]
@@ -28270,7 +28252,9 @@ promotion that has an `ACTIVE` or `SCHEDULED` status.
## Merchants CustomAttributeDefinitions -
client.merchants.custom_attribute_definitions.list(...) +
client.merchants.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListMerchantCustomAttributeDefinitionsResponse +]
@@ -28374,7 +28358,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/build
-
client.merchants.custom_attribute_definitions.create(...) +
client.merchants.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateMerchantCustomAttributeDefinitionResponse]
@@ -28475,7 +28459,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.merchants.custom_attribute_definitions.get(...) +
client.merchants.custom_attribute_definitions.get(...) -> AsyncHttpResponse[RetrieveMerchantCustomAttributeDefinitionResponse]
@@ -28564,7 +28548,7 @@ is higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.merchants.custom_attribute_definitions.update(...) +
client.merchants.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateMerchantCustomAttributeDefinitionResponse]
@@ -28674,7 +28658,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.merchants.custom_attribute_definitions.delete(...) +
client.merchants.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteMerchantCustomAttributeDefinitionResponse]
@@ -28748,7 +28732,7 @@ client.merchants.custom_attribute_definitions.delete(
## Merchants CustomAttributes -
client.merchants.custom_attributes.batch_delete(...) +
client.merchants.custom_attributes.batch_delete(...) -> AsyncHttpResponse[BulkDeleteMerchantCustomAttributesResponse]
@@ -28829,7 +28813,7 @@ The keys must be unique and are used to map to the corresponding response.
-
client.merchants.custom_attributes.batch_upsert(...) +
client.merchants.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertMerchantCustomAttributesResponse]
@@ -28927,7 +28911,7 @@ information needed to create or update a custom attribute.
-
client.merchants.custom_attributes.list(...) +
client.merchants.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListMerchantCustomAttributesResponse]
@@ -29055,7 +29039,7 @@ attribute, information about the data type, or other definition details. The def
-
client.merchants.custom_attributes.get(...) +
client.merchants.custom_attributes.get(...) -> AsyncHttpResponse[RetrieveMerchantCustomAttributeResponse]
@@ -29169,7 +29153,7 @@ higher than the current version, Square returns a `BAD_REQUEST` error.
-
client.merchants.custom_attributes.upsert(...) +
client.merchants.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertMerchantCustomAttributeResponse]
@@ -29284,7 +29268,7 @@ see [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-pa
-
client.merchants.custom_attributes.delete(...) +
client.merchants.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteMerchantCustomAttributeResponse]
@@ -29370,7 +29354,9 @@ definition owner, you must use the qualified key.
## Orders CustomAttributeDefinitions -
client.orders.custom_attribute_definitions.list(...) +
client.orders.custom_attribute_definitions.list(...) -> AsyncPager[ + CustomAttributeDefinition, ListOrderCustomAttributeDefinitionsResponse +]
@@ -29477,7 +29463,7 @@ For more information, see [Pagination](https://developer.squareup.com/docs/worki
-
client.orders.custom_attribute_definitions.create(...) +
client.orders.custom_attribute_definitions.create(...) -> AsyncHttpResponse[CreateOrderCustomAttributeDefinitionResponse]
@@ -29578,7 +29564,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.custom_attribute_definitions.get(...) +
client.orders.custom_attribute_definitions.get(...) -> AsyncHttpResponse[RetrieveOrderCustomAttributeDefinitionResponse]
@@ -29664,7 +29650,7 @@ control, include this optional field and specify the current version of the cust
-
client.orders.custom_attribute_definitions.update(...) +
client.orders.custom_attribute_definitions.update(...) -> AsyncHttpResponse[UpdateOrderCustomAttributeDefinitionResponse]
@@ -29767,7 +29753,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.custom_attribute_definitions.delete(...) +
client.orders.custom_attribute_definitions.delete(...) -> AsyncHttpResponse[DeleteOrderCustomAttributeDefinitionResponse]
@@ -29840,7 +29826,7 @@ client.orders.custom_attribute_definitions.delete(
## Orders CustomAttributes -
client.orders.custom_attributes.batch_delete(...) +
client.orders.custom_attributes.batch_delete(...) -> AsyncHttpResponse[BulkDeleteOrderCustomAttributesResponse]
@@ -29934,7 +29920,7 @@ client.orders.custom_attributes.batch_delete(
-
client.orders.custom_attributes.batch_upsert(...) +
client.orders.custom_attributes.batch_upsert(...) -> AsyncHttpResponse[BulkUpsertOrderCustomAttributesResponse]
@@ -30036,7 +30022,7 @@ client.orders.custom_attributes.batch_upsert(
-
client.orders.custom_attributes.list(...) +
client.orders.custom_attributes.list(...) -> AsyncPager[CustomAttribute, ListOrderCustomAttributesResponse]
@@ -30167,7 +30153,7 @@ information about the data type, or other definition details. The default value
-
client.orders.custom_attributes.get(...) +
client.orders.custom_attributes.get(...) -> AsyncHttpResponse[RetrieveOrderCustomAttributeResponse]
@@ -30281,7 +30267,7 @@ information about the data type, or other definition details. The default value
-
client.orders.custom_attributes.upsert(...) +
client.orders.custom_attributes.upsert(...) -> AsyncHttpResponse[UpsertOrderCustomAttributeResponse]
@@ -30399,7 +30385,7 @@ For more information, see [Idempotency](https://developer.squareup.com/docs/buil
-
client.orders.custom_attributes.delete(...) +
client.orders.custom_attributes.delete(...) -> AsyncHttpResponse[DeleteOrderCustomAttributeResponse]
@@ -30486,7 +30472,7 @@ existing custom attribute definition.
## TeamMembers WageSetting -
client.team_members.wage_setting.get(...) +
client.team_members.wage_setting.get(...) -> AsyncHttpResponse[GetWageSettingResponse]
@@ -30561,7 +30547,7 @@ client.team_members.wage_setting.get(
-
client.team_members.wage_setting.update(...) +
client.team_members.wage_setting.update(...) -> AsyncHttpResponse[UpdateWageSettingResponse]
@@ -30669,7 +30655,7 @@ This value is ignored if `job_id` is also provided.
## Terminal Actions -
client.terminal.actions.create(...) +
client.terminal.actions.create(...) -> AsyncHttpResponse[CreateTerminalActionResponse]
@@ -30762,7 +30748,7 @@ information.
-
client.terminal.actions.search(...) +
client.terminal.actions.search(...) -> AsyncHttpResponse[SearchTerminalActionsResponse]
@@ -30860,7 +30846,7 @@ information.
-
client.terminal.actions.get(...) +
client.terminal.actions.get(...) -> AsyncHttpResponse[GetTerminalActionResponse]
@@ -30930,7 +30916,7 @@ client.terminal.actions.get(
-
client.terminal.actions.cancel(...) +
client.terminal.actions.cancel(...) -> AsyncHttpResponse[CancelTerminalActionResponse]
@@ -31001,7 +30987,7 @@ client.terminal.actions.cancel(
## Terminal Checkouts -
client.terminal.checkouts.create(...) +
client.terminal.checkouts.create(...) -> AsyncHttpResponse[CreateTerminalCheckoutResponse]
@@ -31091,7 +31077,7 @@ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-a
-
client.terminal.checkouts.search(...) +
client.terminal.checkouts.search(...) -> AsyncHttpResponse[SearchTerminalCheckoutsResponse]
@@ -31185,7 +31171,7 @@ See [Pagination](https://developer.squareup.com/docs/build-basics/common-api-pat
-
client.terminal.checkouts.get(...) +
client.terminal.checkouts.get(...) -> AsyncHttpResponse[GetTerminalCheckoutResponse]
@@ -31255,7 +31241,7 @@ client.terminal.checkouts.get(
-
client.terminal.checkouts.cancel(...) +
client.terminal.checkouts.cancel(...) -> AsyncHttpResponse[CancelTerminalCheckoutResponse]
@@ -31326,7 +31312,7 @@ client.terminal.checkouts.cancel(
## Terminal Refunds -
client.terminal.refunds.create(...) +
client.terminal.refunds.create(...) -> AsyncHttpResponse[CreateTerminalRefundResponse]
@@ -31415,7 +31401,7 @@ See [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-a
-
client.terminal.refunds.search(...) +
client.terminal.refunds.search(...) -> AsyncHttpResponse[SearchTerminalRefundsResponse]
@@ -31509,7 +31495,7 @@ Provide this cursor to retrieve the next set of results for the original query.
-
client.terminal.refunds.get(...) +
client.terminal.refunds.get(...) -> AsyncHttpResponse[GetTerminalRefundResponse]
@@ -31579,7 +31565,7 @@ client.terminal.refunds.get(
-
client.terminal.refunds.cancel(...) +
client.terminal.refunds.cancel(...) -> AsyncHttpResponse[CancelTerminalRefundResponse]
@@ -31650,7 +31636,7 @@ client.terminal.refunds.cancel(
## Webhooks EventTypes -
client.webhooks.event_types.list(...) +
client.webhooks.event_types.list(...) -> AsyncHttpResponse[ListWebhookEventTypesResponse]
@@ -31721,7 +31707,7 @@ client.webhooks.event_types.list(
## Webhooks Subscriptions -
client.webhooks.subscriptions.list(...) +
client.webhooks.subscriptions.list(...) -> AsyncPager[WebhookSubscription, ListWebhookSubscriptionsResponse]
@@ -31840,7 +31826,7 @@ Default: 100
-
client.webhooks.subscriptions.create(...) +
client.webhooks.subscriptions.create(...) -> AsyncHttpResponse[CreateWebhookSubscriptionResponse]
@@ -31924,7 +31910,7 @@ client.webhooks.subscriptions.create(
-
client.webhooks.subscriptions.get(...) +
client.webhooks.subscriptions.get(...) -> AsyncHttpResponse[GetWebhookSubscriptionResponse]
@@ -31994,7 +31980,7 @@ client.webhooks.subscriptions.get(
-
client.webhooks.subscriptions.update(...) +
client.webhooks.subscriptions.update(...) -> AsyncHttpResponse[UpdateWebhookSubscriptionResponse]
@@ -32076,7 +32062,7 @@ client.webhooks.subscriptions.update(
-
client.webhooks.subscriptions.delete(...) +
client.webhooks.subscriptions.delete(...) -> AsyncHttpResponse[DeleteWebhookSubscriptionResponse]
@@ -32146,7 +32132,7 @@ client.webhooks.subscriptions.delete(
-
client.webhooks.subscriptions.update_signature_key(...) +
client.webhooks.subscriptions.update_signature_key(...) -> AsyncHttpResponse[UpdateWebhookSubscriptionSignatureKeyResponse]
@@ -32225,7 +32211,7 @@ client.webhooks.subscriptions.update_signature_key(
-
client.webhooks.subscriptions.test(...) +
client.webhooks.subscriptions.test(...) -> AsyncHttpResponse[TestWebhookSubscriptionResponse]
diff --git a/src/square/catalog/client.py b/src/square/catalog/client.py index b644e1c9..4bd63686 100644 --- a/src/square/catalog/client.py +++ b/src/square/catalog/client.py @@ -262,34 +262,10 @@ def batch_upsert( batches=[ { "objects": [ - { - "type": "IMAGE", - "id": "#Tea", - "present_at_all_locations": True, - }, - { - "type": "IMAGE", - "id": "#Coffee", - "present_at_all_locations": True, - }, - { - "type": "ITEM", - "id": "#Beverages", - "present_at_all_locations": True, - }, - { - "type": "TAX", - "id": "#SalesTax", - "present_at_all_locations": True, - "tax_data": { - "name": "Sales Tax", - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "inclusion_type": "ADDITIVE", - "percentage": "5.0", - "applies_to_custom_amounts": True, - "enabled": True, - }, - }, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "TAX"}, ] } ], @@ -1019,34 +995,10 @@ async def main() -> None: batches=[ { "objects": [ - { - "type": "IMAGE", - "id": "#Tea", - "present_at_all_locations": True, - }, - { - "type": "IMAGE", - "id": "#Coffee", - "present_at_all_locations": True, - }, - { - "type": "ITEM", - "id": "#Beverages", - "present_at_all_locations": True, - }, - { - "type": "TAX", - "id": "#SalesTax", - "present_at_all_locations": True, - "tax_data": { - "name": "Sales Tax", - "calculation_phase": "TAX_SUBTOTAL_PHASE", - "inclusion_type": "ADDITIVE", - "percentage": "5.0", - "applies_to_custom_amounts": True, - "enabled": True, - }, - }, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "ITEM"}, + {"id": "id", "type": "TAX"}, ] } ], diff --git a/src/square/catalog/object/client.py b/src/square/catalog/object/client.py index 62f923fb..fd591707 100644 --- a/src/square/catalog/object/client.py +++ b/src/square/catalog/object/client.py @@ -80,7 +80,7 @@ def upsert( ) client.catalog.object.upsert( idempotency_key="af3d1afc-7212-4300-b463-0bfc5314a5ae", - object={"type": "IMAGE", "id": "#Cocoa"}, + object={"id": "id", "type": "ITEM"}, ) """ _response = self._raw_client.upsert( @@ -286,7 +286,7 @@ async def upsert( async def main() -> None: await client.catalog.object.upsert( idempotency_key="af3d1afc-7212-4300-b463-0bfc5314a5ae", - object={"type": "IMAGE", "id": "#Cocoa"}, + object={"id": "id", "type": "ITEM"}, ) diff --git a/src/square/core/client_wrapper.py b/src/square/core/client_wrapper.py index 7f6e80d4..2f41887d 100644 --- a/src/square/core/client_wrapper.py +++ b/src/square/core/client_wrapper.py @@ -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/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/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/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/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/card.py b/src/square/types/card.py index e959ab2a..b67f5116 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. diff --git a/src/square/types/catalog_category.py b/src/square/types/catalog_category.py index 3c69e61c..3c2a4813 100644 --- a/src/square/types/catalog_category.py +++ b/src/square/types/catalog_category.py @@ -87,4 +87,4 @@ class Config: from .catalog_object_category import CatalogObjectCategory # noqa: E402, I001 -update_forward_refs(CatalogCategory) +update_forward_refs(CatalogCategory, CatalogObjectCategory=CatalogObjectCategory) diff --git a/src/square/types/catalog_item.py b/src/square/types/catalog_item.py index 08b5c2a6..6bba4f46 100644 --- a/src/square/types/catalog_item.py +++ b/src/square/types/catalog_item.py @@ -210,17 +210,27 @@ class Config: extra = pydantic.Extra.allow -from .catalog_object_category import CatalogObjectCategory # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 +from .catalog_category import CatalogCategory # noqa: E402, I001 +from .catalog_object_category import CatalogObjectCategory # noqa: E402, I001 update_forward_refs( CatalogItem, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogCategory=CatalogCategory, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, + CatalogObjectCategory=CatalogObjectCategory, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/catalog_item_option.py b/src/square/types/catalog_item_option.py index af0cf3ca..2b8c1710 100644 --- a/src/square/types/catalog_item_option.py +++ b/src/square/types/catalog_item_option.py @@ -53,16 +53,23 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( CatalogItemOption, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/catalog_modifier_list.py b/src/square/types/catalog_modifier_list.py index 36be51b2..3b678716 100644 --- a/src/square/types/catalog_modifier_list.py +++ b/src/square/types/catalog_modifier_list.py @@ -141,16 +141,23 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( CatalogModifierList, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/catalog_object.py b/src/square/types/catalog_object.py index 167f2f54..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_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_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/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/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/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_catalog_response.py b/src/square/types/list_catalog_response.py index c9c9e898..8610b157 100644 --- a/src/square/types/list_catalog_response.py +++ b/src/square/types/list_catalog_response.py @@ -37,16 +37,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( ListCatalogResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/payment_link_related_resources.py b/src/square/types/payment_link_related_resources.py index d7e4ebb8..159d741c 100644 --- a/src/square/types/payment_link_related_resources.py +++ b/src/square/types/payment_link_related_resources.py @@ -31,16 +31,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( PaymentLinkRelatedResources, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/search_catalog_items_response.py b/src/square/types/search_catalog_items_response.py index 1f8e338f..5abb5514 100644 --- a/src/square/types/search_catalog_items_response.py +++ b/src/square/types/search_catalog_items_response.py @@ -45,16 +45,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( SearchCatalogItemsResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/search_catalog_objects_response.py b/src/square/types/search_catalog_objects_response.py index e9af821e..6f5bebc6 100644 --- a/src/square/types/search_catalog_objects_response.py +++ b/src/square/types/search_catalog_objects_response.py @@ -48,16 +48,25 @@ class Config: extra = pydantic.Extra.allow +from .catalog_item import CatalogItem # noqa: E402, I001 +from .catalog_item_option import CatalogItemOption # noqa: E402, I001 +from .catalog_modifier_list import CatalogModifierList # noqa: E402, I001 +from .catalog_object import CatalogObject # noqa: E402, I001 from .catalog_object_item import CatalogObjectItem # noqa: E402, I001 from .catalog_object_item_option import CatalogObjectItemOption # noqa: E402, I001 from .catalog_object_modifier_list import CatalogObjectModifierList # noqa: E402, I001 from .catalog_object_subscription_plan import CatalogObjectSubscriptionPlan # noqa: E402, I001 -from .catalog_object import CatalogObject # noqa: E402, I001 +from .catalog_subscription_plan import CatalogSubscriptionPlan # noqa: E402, I001 update_forward_refs( SearchCatalogObjectsResponse, - CatalogObjectItemOption=CatalogObjectItemOption, - CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogItem=CatalogItem, + CatalogItemOption=CatalogItemOption, + CatalogModifierList=CatalogModifierList, + CatalogObject=CatalogObject, CatalogObjectItem=CatalogObjectItem, + CatalogObjectItemOption=CatalogObjectItemOption, CatalogObjectModifierList=CatalogObjectModifierList, + CatalogObjectSubscriptionPlan=CatalogObjectSubscriptionPlan, + CatalogSubscriptionPlan=CatalogSubscriptionPlan, ) diff --git a/src/square/types/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"