From 77b12bae91cefdf505ad207c9817bee0ffa727f0 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 1 May 2024 02:45:50 +0000 Subject: [PATCH] SDK regeneration --- poetry.lock | 170 +++---- pyproject.toml | 4 +- src/courier/audiences/client.py | 232 ++++++--- src/courier/audit_events/client.py | 84 +++- src/courier/auth_tokens/client.py | 54 +- src/courier/automations/client.py | 106 ++-- .../types/automation_add_to_batch_retain.py | 4 +- .../types/automation_add_to_batch_step.py | 2 + .../types/automation_add_to_digest_step.py | 2 + .../types/automation_fetch_data_step.py | 2 + .../types/automation_throttle_step.py | 2 + src/courier/brands/client.py | 232 ++++++--- src/courier/bulk/client.py | 246 ++++++--- src/courier/client.py | 114 +++-- .../commons/types/user_tenant_association.py | 9 +- src/courier/core/client_wrapper.py | 2 +- src/courier/lists/client.py | 470 ++++++++++++------ src/courier/messages/client.py | 350 +++++++++---- src/courier/notifications/client.py | 352 ++++++++----- src/courier/profiles/client.py | 348 +++++++++---- src/courier/templates/client.py | 42 +- src/courier/tenants/client.py | 288 ++++++++--- .../tenants/types/default_preferences.py | 2 +- src/courier/translations/client.py | 102 ++-- src/courier/users/preferences/client.py | 142 ++++-- src/courier/users/tenants/client.py | 285 +++++++---- ...d_user_to_single_tenants_params_profile.py | 4 + src/courier/users/tokens/client.py | 236 ++++++--- 28 files changed, 2680 insertions(+), 1206 deletions(-) diff --git a/poetry.lock b/poetry.lock index 56b5522..397785f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -236,18 +236,18 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pydantic" -version = "2.7.0" +version = "2.7.1" description = "Data validation using Python type hints" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic-2.7.0-py3-none-any.whl", hash = "sha256:9dee74a271705f14f9a1567671d144a851c675b072736f0a7b2608fd9e495352"}, - {file = "pydantic-2.7.0.tar.gz", hash = "sha256:b5ecdd42262ca2462e2624793551e80911a1e989f462910bb81aef974b4bb383"}, + {file = "pydantic-2.7.1-py3-none-any.whl", hash = "sha256:e029badca45266732a9a79898a15ae2e8b14840b1eabbb25844be28f0b33f3d5"}, + {file = "pydantic-2.7.1.tar.gz", hash = "sha256:e9dbb5eada8abe4d9ae5f46b9939aead650cd2b68f249bb3a8139dbe125803cc"}, ] [package.dependencies] annotated-types = ">=0.4.0" -pydantic-core = "2.18.1" +pydantic-core = "2.18.2" typing-extensions = ">=4.6.1" [package.extras] @@ -255,90 +255,90 @@ email = ["email-validator (>=2.0.0)"] [[package]] name = "pydantic-core" -version = "2.18.1" +version = "2.18.2" description = "Core functionality for Pydantic validation and serialization" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic_core-2.18.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:ee9cf33e7fe14243f5ca6977658eb7d1042caaa66847daacbd2117adb258b226"}, - {file = "pydantic_core-2.18.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:6b7bbb97d82659ac8b37450c60ff2e9f97e4eb0f8a8a3645a5568b9334b08b50"}, - {file = "pydantic_core-2.18.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:df4249b579e75094f7e9bb4bd28231acf55e308bf686b952f43100a5a0be394c"}, - {file = "pydantic_core-2.18.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:d0491006a6ad20507aec2be72e7831a42efc93193d2402018007ff827dc62926"}, - {file = "pydantic_core-2.18.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2ae80f72bb7a3e397ab37b53a2b49c62cc5496412e71bc4f1277620a7ce3f52b"}, - {file = "pydantic_core-2.18.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:58aca931bef83217fca7a390e0486ae327c4af9c3e941adb75f8772f8eeb03a1"}, - {file = "pydantic_core-2.18.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1be91ad664fc9245404a789d60cba1e91c26b1454ba136d2a1bf0c2ac0c0505a"}, - {file = "pydantic_core-2.18.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:667880321e916a8920ef49f5d50e7983792cf59f3b6079f3c9dac2b88a311d17"}, - {file = "pydantic_core-2.18.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:f7054fdc556f5421f01e39cbb767d5ec5c1139ea98c3e5b350e02e62201740c7"}, - {file = "pydantic_core-2.18.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:030e4f9516f9947f38179249778709a460a3adb516bf39b5eb9066fcfe43d0e6"}, - {file = "pydantic_core-2.18.1-cp310-none-win32.whl", hash = "sha256:2e91711e36e229978d92642bfc3546333a9127ecebb3f2761372e096395fc649"}, - {file = "pydantic_core-2.18.1-cp310-none-win_amd64.whl", hash = "sha256:9a29726f91c6cb390b3c2338f0df5cd3e216ad7a938762d11c994bb37552edb0"}, - {file = "pydantic_core-2.18.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:9ece8a49696669d483d206b4474c367852c44815fca23ac4e48b72b339807f80"}, - {file = "pydantic_core-2.18.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7a5d83efc109ceddb99abd2c1316298ced2adb4570410defe766851a804fcd5b"}, - {file = "pydantic_core-2.18.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5f7973c381283783cd1043a8c8f61ea5ce7a3a58b0369f0ee0ee975eaf2f2a1b"}, - {file = "pydantic_core-2.18.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:54c7375c62190a7845091f521add19b0f026bcf6ae674bdb89f296972272e86d"}, - {file = "pydantic_core-2.18.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dd63cec4e26e790b70544ae5cc48d11b515b09e05fdd5eff12e3195f54b8a586"}, - {file = "pydantic_core-2.18.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:561cf62c8a3498406495cfc49eee086ed2bb186d08bcc65812b75fda42c38294"}, - {file = "pydantic_core-2.18.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:68717c38a68e37af87c4da20e08f3e27d7e4212e99e96c3d875fbf3f4812abfc"}, - {file = "pydantic_core-2.18.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2d5728e93d28a3c63ee513d9ffbac9c5989de8c76e049dbcb5bfe4b923a9739d"}, - {file = "pydantic_core-2.18.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:f0f17814c505f07806e22b28856c59ac80cee7dd0fbb152aed273e116378f519"}, - {file = "pydantic_core-2.18.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d816f44a51ba5175394bc6c7879ca0bd2be560b2c9e9f3411ef3a4cbe644c2e9"}, - {file = "pydantic_core-2.18.1-cp311-none-win32.whl", hash = "sha256:09f03dfc0ef8c22622eaa8608caa4a1e189cfb83ce847045eca34f690895eccb"}, - {file = "pydantic_core-2.18.1-cp311-none-win_amd64.whl", hash = "sha256:27f1009dc292f3b7ca77feb3571c537276b9aad5dd4efb471ac88a8bd09024e9"}, - {file = "pydantic_core-2.18.1-cp311-none-win_arm64.whl", hash = "sha256:48dd883db92e92519201f2b01cafa881e5f7125666141a49ffba8b9facc072b0"}, - {file = "pydantic_core-2.18.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:b6b0e4912030c6f28bcb72b9ebe4989d6dc2eebcd2a9cdc35fefc38052dd4fe8"}, - {file = "pydantic_core-2.18.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:f3202a429fe825b699c57892d4371c74cc3456d8d71b7f35d6028c96dfecad31"}, - {file = "pydantic_core-2.18.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a3982b0a32d0a88b3907e4b0dc36809fda477f0757c59a505d4e9b455f384b8b"}, - {file = "pydantic_core-2.18.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:25595ac311f20e5324d1941909b0d12933f1fd2171075fcff763e90f43e92a0d"}, - {file = "pydantic_core-2.18.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:14fe73881cf8e4cbdaded8ca0aa671635b597e42447fec7060d0868b52d074e6"}, - {file = "pydantic_core-2.18.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ca976884ce34070799e4dfc6fbd68cb1d181db1eefe4a3a94798ddfb34b8867f"}, - {file = "pydantic_core-2.18.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:684d840d2c9ec5de9cb397fcb3f36d5ebb6fa0d94734f9886032dd796c1ead06"}, - {file = "pydantic_core-2.18.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:54764c083bbe0264f0f746cefcded6cb08fbbaaf1ad1d78fb8a4c30cff999a90"}, - {file = "pydantic_core-2.18.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:201713f2f462e5c015b343e86e68bd8a530a4f76609b33d8f0ec65d2b921712a"}, - {file = "pydantic_core-2.18.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fd1a9edb9dd9d79fbeac1ea1f9a8dd527a6113b18d2e9bcc0d541d308dae639b"}, - {file = "pydantic_core-2.18.1-cp312-none-win32.whl", hash = "sha256:d5e6b7155b8197b329dc787356cfd2684c9d6a6b1a197f6bbf45f5555a98d411"}, - {file = "pydantic_core-2.18.1-cp312-none-win_amd64.whl", hash = "sha256:9376d83d686ec62e8b19c0ac3bf8d28d8a5981d0df290196fb6ef24d8a26f0d6"}, - {file = "pydantic_core-2.18.1-cp312-none-win_arm64.whl", hash = "sha256:c562b49c96906b4029b5685075fe1ebd3b5cc2601dfa0b9e16c2c09d6cbce048"}, - {file = "pydantic_core-2.18.1-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:3e352f0191d99fe617371096845070dee295444979efb8f27ad941227de6ad09"}, - {file = "pydantic_core-2.18.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:c0295d52b012cbe0d3059b1dba99159c3be55e632aae1999ab74ae2bd86a33d7"}, - {file = "pydantic_core-2.18.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:56823a92075780582d1ffd4489a2e61d56fd3ebb4b40b713d63f96dd92d28144"}, - {file = "pydantic_core-2.18.1-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:dd3f79e17b56741b5177bcc36307750d50ea0698df6aa82f69c7db32d968c1c2"}, - {file = "pydantic_core-2.18.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:38a5024de321d672a132b1834a66eeb7931959c59964b777e8f32dbe9523f6b1"}, - {file = "pydantic_core-2.18.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d2ce426ee691319d4767748c8e0895cfc56593d725594e415f274059bcf3cb76"}, - {file = "pydantic_core-2.18.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2adaeea59849ec0939af5c5d476935f2bab4b7f0335b0110f0f069a41024278e"}, - {file = "pydantic_core-2.18.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:9b6431559676a1079eac0f52d6d0721fb8e3c5ba43c37bc537c8c83724031feb"}, - {file = "pydantic_core-2.18.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:85233abb44bc18d16e72dc05bf13848a36f363f83757541f1a97db2f8d58cfd9"}, - {file = "pydantic_core-2.18.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:641a018af4fe48be57a2b3d7a1f0f5dbca07c1d00951d3d7463f0ac9dac66622"}, - {file = "pydantic_core-2.18.1-cp38-none-win32.whl", hash = "sha256:63d7523cd95d2fde0d28dc42968ac731b5bb1e516cc56b93a50ab293f4daeaad"}, - {file = "pydantic_core-2.18.1-cp38-none-win_amd64.whl", hash = "sha256:907a4d7720abfcb1c81619863efd47c8a85d26a257a2dbebdb87c3b847df0278"}, - {file = "pydantic_core-2.18.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:aad17e462f42ddbef5984d70c40bfc4146c322a2da79715932cd8976317054de"}, - {file = "pydantic_core-2.18.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:94b9769ba435b598b547c762184bcfc4783d0d4c7771b04a3b45775c3589ca44"}, - {file = "pydantic_core-2.18.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:80e0e57cc704a52fb1b48f16d5b2c8818da087dbee6f98d9bf19546930dc64b5"}, - {file = "pydantic_core-2.18.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:76b86e24039c35280ceee6dce7e62945eb93a5175d43689ba98360ab31eebc4a"}, - {file = "pydantic_core-2.18.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:12a05db5013ec0ca4a32cc6433f53faa2a014ec364031408540ba858c2172bb0"}, - {file = "pydantic_core-2.18.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:250ae39445cb5475e483a36b1061af1bc233de3e9ad0f4f76a71b66231b07f88"}, - {file = "pydantic_core-2.18.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a32204489259786a923e02990249c65b0f17235073149d0033efcebe80095570"}, - {file = "pydantic_core-2.18.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6395a4435fa26519fd96fdccb77e9d00ddae9dd6c742309bd0b5610609ad7fb2"}, - {file = "pydantic_core-2.18.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:2533ad2883f001efa72f3d0e733fb846710c3af6dcdd544fe5bf14fa5fe2d7db"}, - {file = "pydantic_core-2.18.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:b560b72ed4816aee52783c66854d96157fd8175631f01ef58e894cc57c84f0f6"}, - {file = "pydantic_core-2.18.1-cp39-none-win32.whl", hash = "sha256:582cf2cead97c9e382a7f4d3b744cf0ef1a6e815e44d3aa81af3ad98762f5a9b"}, - {file = "pydantic_core-2.18.1-cp39-none-win_amd64.whl", hash = "sha256:ca71d501629d1fa50ea7fa3b08ba884fe10cefc559f5c6c8dfe9036c16e8ae89"}, - {file = "pydantic_core-2.18.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:e178e5b66a06ec5bf51668ec0d4ac8cfb2bdcb553b2c207d58148340efd00143"}, - {file = "pydantic_core-2.18.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:72722ce529a76a4637a60be18bd789d8fb871e84472490ed7ddff62d5fed620d"}, - {file = "pydantic_core-2.18.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2fe0c1ce5b129455e43f941f7a46f61f3d3861e571f2905d55cdbb8b5c6f5e2c"}, - {file = "pydantic_core-2.18.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d4284c621f06a72ce2cb55f74ea3150113d926a6eb78ab38340c08f770eb9b4d"}, - {file = "pydantic_core-2.18.1-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:1a0c3e718f4e064efde68092d9d974e39572c14e56726ecfaeebbe6544521f47"}, - {file = "pydantic_core-2.18.1-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:2027493cc44c23b598cfaf200936110433d9caa84e2c6cf487a83999638a96ac"}, - {file = "pydantic_core-2.18.1-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:76909849d1a6bffa5a07742294f3fa1d357dc917cb1fe7b470afbc3a7579d539"}, - {file = "pydantic_core-2.18.1-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:ee7ccc7fb7e921d767f853b47814c3048c7de536663e82fbc37f5eb0d532224b"}, - {file = "pydantic_core-2.18.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:ee2794111c188548a4547eccc73a6a8527fe2af6cf25e1a4ebda2fd01cdd2e60"}, - {file = "pydantic_core-2.18.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:a139fe9f298dc097349fb4f28c8b81cc7a202dbfba66af0e14be5cfca4ef7ce5"}, - {file = "pydantic_core-2.18.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d074b07a10c391fc5bbdcb37b2f16f20fcd9e51e10d01652ab298c0d07908ee2"}, - {file = "pydantic_core-2.18.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c69567ddbac186e8c0aadc1f324a60a564cfe25e43ef2ce81bcc4b8c3abffbae"}, - {file = "pydantic_core-2.18.1-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:baf1c7b78cddb5af00971ad5294a4583188bda1495b13760d9f03c9483bb6203"}, - {file = "pydantic_core-2.18.1-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:2684a94fdfd1b146ff10689c6e4e815f6a01141781c493b97342cdc5b06f4d5d"}, - {file = "pydantic_core-2.18.1-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:73c1bc8a86a5c9e8721a088df234265317692d0b5cd9e86e975ce3bc3db62a59"}, - {file = "pydantic_core-2.18.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:e60defc3c15defb70bb38dd605ff7e0fae5f6c9c7cbfe0ad7868582cb7e844a6"}, - {file = "pydantic_core-2.18.1.tar.gz", hash = "sha256:de9d3e8717560eb05e28739d1b35e4eac2e458553a52a301e51352a7ffc86a35"}, + {file = "pydantic_core-2.18.2-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:9e08e867b306f525802df7cd16c44ff5ebbe747ff0ca6cf3fde7f36c05a59a81"}, + {file = "pydantic_core-2.18.2-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f0a21cbaa69900cbe1a2e7cad2aa74ac3cf21b10c3efb0fa0b80305274c0e8a2"}, + {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0680b1f1f11fda801397de52c36ce38ef1c1dc841a0927a94f226dea29c3ae3d"}, + {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:95b9d5e72481d3780ba3442eac863eae92ae43a5f3adb5b4d0a1de89d42bb250"}, + {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c4fcf5cd9c4b655ad666ca332b9a081112cd7a58a8b5a6ca7a3104bc950f2038"}, + {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b5155ff768083cb1d62f3e143b49a8a3432e6789a3abee8acd005c3c7af1c74"}, + {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:553ef617b6836fc7e4df130bb851e32fe357ce36336d897fd6646d6058d980af"}, + {file = "pydantic_core-2.18.2-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b89ed9eb7d616ef5714e5590e6cf7f23b02d0d539767d33561e3675d6f9e3857"}, + {file = "pydantic_core-2.18.2-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:75f7e9488238e920ab6204399ded280dc4c307d034f3924cd7f90a38b1829563"}, + {file = "pydantic_core-2.18.2-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:ef26c9e94a8c04a1b2924149a9cb081836913818e55681722d7f29af88fe7b38"}, + {file = "pydantic_core-2.18.2-cp310-none-win32.whl", hash = "sha256:182245ff6b0039e82b6bb585ed55a64d7c81c560715d1bad0cbad6dfa07b4027"}, + {file = "pydantic_core-2.18.2-cp310-none-win_amd64.whl", hash = "sha256:e23ec367a948b6d812301afc1b13f8094ab7b2c280af66ef450efc357d2ae543"}, + {file = "pydantic_core-2.18.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:219da3f096d50a157f33645a1cf31c0ad1fe829a92181dd1311022f986e5fbe3"}, + {file = "pydantic_core-2.18.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:cc1cfd88a64e012b74e94cd00bbe0f9c6df57049c97f02bb07d39e9c852e19a4"}, + {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:05b7133a6e6aeb8df37d6f413f7705a37ab4031597f64ab56384c94d98fa0e90"}, + {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:224c421235f6102e8737032483f43c1a8cfb1d2f45740c44166219599358c2cd"}, + {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:b14d82cdb934e99dda6d9d60dc84a24379820176cc4a0d123f88df319ae9c150"}, + {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2728b01246a3bba6de144f9e3115b532ee44bd6cf39795194fb75491824a1413"}, + {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:470b94480bb5ee929f5acba6995251ada5e059a5ef3e0dfc63cca287283ebfa6"}, + {file = "pydantic_core-2.18.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:997abc4df705d1295a42f95b4eec4950a37ad8ae46d913caeee117b6b198811c"}, + {file = "pydantic_core-2.18.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:75250dbc5290e3f1a0f4618db35e51a165186f9034eff158f3d490b3fed9f8a0"}, + {file = "pydantic_core-2.18.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:4456f2dca97c425231d7315737d45239b2b51a50dc2b6f0c2bb181fce6207664"}, + {file = "pydantic_core-2.18.2-cp311-none-win32.whl", hash = "sha256:269322dcc3d8bdb69f054681edff86276b2ff972447863cf34c8b860f5188e2e"}, + {file = "pydantic_core-2.18.2-cp311-none-win_amd64.whl", hash = "sha256:800d60565aec896f25bc3cfa56d2277d52d5182af08162f7954f938c06dc4ee3"}, + {file = "pydantic_core-2.18.2-cp311-none-win_arm64.whl", hash = "sha256:1404c69d6a676245199767ba4f633cce5f4ad4181f9d0ccb0577e1f66cf4c46d"}, + {file = "pydantic_core-2.18.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:fb2bd7be70c0fe4dfd32c951bc813d9fe6ebcbfdd15a07527796c8204bd36242"}, + {file = "pydantic_core-2.18.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6132dd3bd52838acddca05a72aafb6eab6536aa145e923bb50f45e78b7251043"}, + {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7d904828195733c183d20a54230c0df0eb46ec746ea1a666730787353e87182"}, + {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c9bd70772c720142be1020eac55f8143a34ec9f82d75a8e7a07852023e46617f"}, + {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:2b8ed04b3582771764538f7ee7001b02e1170223cf9b75dff0bc698fadb00cf3"}, + {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e6dac87ddb34aaec85f873d737e9d06a3555a1cc1a8e0c44b7f8d5daeb89d86f"}, + {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7ca4ae5a27ad7a4ee5170aebce1574b375de390bc01284f87b18d43a3984df72"}, + {file = "pydantic_core-2.18.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:886eec03591b7cf058467a70a87733b35f44707bd86cf64a615584fd72488b7c"}, + {file = "pydantic_core-2.18.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:ca7b0c1f1c983e064caa85f3792dd2fe3526b3505378874afa84baf662e12241"}, + {file = "pydantic_core-2.18.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:4b4356d3538c3649337df4074e81b85f0616b79731fe22dd11b99499b2ebbdf3"}, + {file = "pydantic_core-2.18.2-cp312-none-win32.whl", hash = "sha256:8b172601454f2d7701121bbec3425dd71efcb787a027edf49724c9cefc14c038"}, + {file = "pydantic_core-2.18.2-cp312-none-win_amd64.whl", hash = "sha256:b1bd7e47b1558ea872bd16c8502c414f9e90dcf12f1395129d7bb42a09a95438"}, + {file = "pydantic_core-2.18.2-cp312-none-win_arm64.whl", hash = "sha256:98758d627ff397e752bc339272c14c98199c613f922d4a384ddc07526c86a2ec"}, + {file = "pydantic_core-2.18.2-cp38-cp38-macosx_10_12_x86_64.whl", hash = "sha256:9fdad8e35f278b2c3eb77cbdc5c0a49dada440657bf738d6905ce106dc1de439"}, + {file = "pydantic_core-2.18.2-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:1d90c3265ae107f91a4f279f4d6f6f1d4907ac76c6868b27dc7fb33688cfb347"}, + {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:390193c770399861d8df9670fb0d1874f330c79caaca4642332df7c682bf6b91"}, + {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:82d5d4d78e4448683cb467897fe24e2b74bb7b973a541ea1dcfec1d3cbce39fb"}, + {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4774f3184d2ef3e14e8693194f661dea5a4d6ca4e3dc8e39786d33a94865cefd"}, + {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d4d938ec0adf5167cb335acb25a4ee69a8107e4984f8fbd2e897021d9e4ca21b"}, + {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e0e8b1be28239fc64a88a8189d1df7fad8be8c1ae47fcc33e43d4be15f99cc70"}, + {file = "pydantic_core-2.18.2-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:868649da93e5a3d5eacc2b5b3b9235c98ccdbfd443832f31e075f54419e1b96b"}, + {file = "pydantic_core-2.18.2-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:78363590ef93d5d226ba21a90a03ea89a20738ee5b7da83d771d283fd8a56761"}, + {file = "pydantic_core-2.18.2-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:852e966fbd035a6468fc0a3496589b45e2208ec7ca95c26470a54daed82a0788"}, + {file = "pydantic_core-2.18.2-cp38-none-win32.whl", hash = "sha256:6a46e22a707e7ad4484ac9ee9f290f9d501df45954184e23fc29408dfad61350"}, + {file = "pydantic_core-2.18.2-cp38-none-win_amd64.whl", hash = "sha256:d91cb5ea8b11607cc757675051f61b3d93f15eca3cefb3e6c704a5d6e8440f4e"}, + {file = "pydantic_core-2.18.2-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:ae0a8a797a5e56c053610fa7be147993fe50960fa43609ff2a9552b0e07013e8"}, + {file = "pydantic_core-2.18.2-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:042473b6280246b1dbf530559246f6842b56119c2926d1e52b631bdc46075f2a"}, + {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1a388a77e629b9ec814c1b1e6b3b595fe521d2cdc625fcca26fbc2d44c816804"}, + {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e25add29b8f3b233ae90ccef2d902d0ae0432eb0d45370fe315d1a5cf231004b"}, + {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f459a5ce8434614dfd39bbebf1041952ae01da6bed9855008cb33b875cb024c0"}, + {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eff2de745698eb46eeb51193a9f41d67d834d50e424aef27df2fcdee1b153845"}, + {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a8309f67285bdfe65c372ea3722b7a5642680f3dba538566340a9d36e920b5f0"}, + {file = "pydantic_core-2.18.2-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f93a8a2e3938ff656a7c1bc57193b1319960ac015b6e87d76c76bf14fe0244b4"}, + {file = "pydantic_core-2.18.2-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:22057013c8c1e272eb8d0eebc796701167d8377441ec894a8fed1af64a0bf399"}, + {file = "pydantic_core-2.18.2-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:cfeecd1ac6cc1fb2692c3d5110781c965aabd4ec5d32799773ca7b1456ac636b"}, + {file = "pydantic_core-2.18.2-cp39-none-win32.whl", hash = "sha256:0d69b4c2f6bb3e130dba60d34c0845ba31b69babdd3f78f7c0c8fae5021a253e"}, + {file = "pydantic_core-2.18.2-cp39-none-win_amd64.whl", hash = "sha256:d9319e499827271b09b4e411905b24a426b8fb69464dfa1696258f53a3334641"}, + {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:a1874c6dd4113308bd0eb568418e6114b252afe44319ead2b4081e9b9521fe75"}, + {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:ccdd111c03bfd3666bd2472b674c6899550e09e9f298954cfc896ab92b5b0e6d"}, + {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e18609ceaa6eed63753037fc06ebb16041d17d28199ae5aba0052c51449650a9"}, + {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6e5c584d357c4e2baf0ff7baf44f4994be121e16a2c88918a5817331fc7599d7"}, + {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:43f0f463cf89ace478de71a318b1b4f05ebc456a9b9300d027b4b57c1a2064fb"}, + {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:e1b395e58b10b73b07b7cf740d728dd4ff9365ac46c18751bf8b3d8cca8f625a"}, + {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:0098300eebb1c837271d3d1a2cd2911e7c11b396eac9661655ee524a7f10587b"}, + {file = "pydantic_core-2.18.2-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:36789b70d613fbac0a25bb07ab3d9dba4d2e38af609c020cf4d888d165ee0bf3"}, + {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:3f9a801e7c8f1ef8718da265bba008fa121243dfe37c1cea17840b0944dfd72c"}, + {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:3a6515ebc6e69d85502b4951d89131ca4e036078ea35533bb76327f8424531ce"}, + {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:20aca1e2298c56ececfd8ed159ae4dde2df0781988c97ef77d5c16ff4bd5b400"}, + {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:223ee893d77a310a0391dca6df00f70bbc2f36a71a895cecd9a0e762dc37b349"}, + {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2334ce8c673ee93a1d6a65bd90327588387ba073c17e61bf19b4fd97d688d63c"}, + {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:cbca948f2d14b09d20268cda7b0367723d79063f26c4ffc523af9042cad95592"}, + {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:b3ef08e20ec49e02d5c6717a91bb5af9b20f1805583cb0adfe9ba2c6b505b5ae"}, + {file = "pydantic_core-2.18.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:c6fdc8627910eed0c01aed6a390a252fe3ea6d472ee70fdde56273f198938374"}, + {file = "pydantic_core-2.18.2.tar.gz", hash = "sha256:2e29d20810dfc3043ee13ac7d9e25105799817683348823f305ab3f349b9386e"}, ] [package.dependencies] @@ -445,4 +445,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "9265776813ab39c8f5195d29e52270d0eaaeaef435e30903307bd1b52dd0eb95" +content-hash = "6f0b8d5044d8d4461b9850fcdfd7c382335fc9481fcfd5bd42e760121c1e1450" diff --git a/pyproject.toml b/pyproject.toml index 2bb8bdb..c9510bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "trycourier" -version = "v6.0.2" +version = "v6.0.3" description = "" readme = "README.md" authors = [] @@ -15,7 +15,7 @@ pydantic = ">= 1.9.2" typing_extensions = ">= 4.0.0" [tool.poetry.dev-dependencies] -mypy = "^1.8.0" +mypy = "1.9.0" pytest = "^7.4.0" pytest-asyncio = "^0.23.5" python-dateutil = "^2.9.0" diff --git a/src/courier/audiences/client.py b/src/courier/audiences/client.py index 793623d..3a0c6c0 100644 --- a/src/courier/audiences/client.py +++ b/src/courier/audiences/client.py @@ -30,11 +30,20 @@ def get(self, audience_id: str, *, request_options: typing.Optional[RequestOptio """ Returns the specified audience by id. - Parameters: - - audience_id: str. A unique identifier representing the audience_id + Parameters + ---------- + audience_id : str + A unique identifier representing the audience_id - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Audience + + Examples + -------- from courier.client import Courier client = Courier( @@ -45,8 +54,8 @@ def get(self, audience_id: str, *, request_options: typing.Optional[RequestOptio ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}" ), params=jsonable_encoder( @@ -86,17 +95,28 @@ def update( """ Creates or updates audience. - Parameters: - - audience_id: str. A unique identifier representing the audience id + Parameters + ---------- + audience_id : str + A unique identifier representing the audience id + + name : typing.Optional[str] + The name of the audience - - name: typing.Optional[str]. The name of the audience + description : typing.Optional[str] + A description of the audience - - description: typing.Optional[str]. A description of the audience + filter : typing.Optional[Filter] - - filter: typing.Optional[Filter]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + AudienceUpdateResponse + + Examples + -------- from courier import SingleFilterConfig from courier.client import Courier @@ -122,8 +142,8 @@ def update( if filter is not OMIT: _request["filter"] = filter _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}" ), params=jsonable_encoder( @@ -161,11 +181,20 @@ def delete(self, audience_id: str, *, request_options: typing.Optional[RequestOp """ Deletes the specified audience. - Parameters: - - audience_id: str. A unique identifier representing the audience id + Parameters + ---------- + audience_id : str + A unique identifier representing the audience id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import Courier client = Courier( @@ -176,8 +205,8 @@ def delete(self, audience_id: str, *, request_options: typing.Optional[RequestOp ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}" ), params=jsonable_encoder( @@ -215,13 +244,23 @@ def list_members( """ Get list of members of an audience. - Parameters: - - audience_id: str. A unique identifier representing the audience id + Parameters + ---------- + audience_id : str + A unique identifier representing the audience id + + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of members + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of members + Returns + ------- + AudienceMemberListResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -233,8 +272,8 @@ def list_members( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}/members" ), params=jsonable_encoder( @@ -279,11 +318,20 @@ def list_audiences( """ Get the audiences associated with the authorization token. - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of audiences + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of audiences + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudienceListResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -294,8 +342,8 @@ def list_audiences( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audiences"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audiences"), params=jsonable_encoder( remove_none_from_dict( { @@ -341,11 +389,20 @@ async def get(self, audience_id: str, *, request_options: typing.Optional[Reques """ Returns the specified audience by id. - Parameters: - - audience_id: str. A unique identifier representing the audience_id + Parameters + ---------- + audience_id : str + A unique identifier representing the audience_id - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Audience + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -356,8 +413,8 @@ async def get(self, audience_id: str, *, request_options: typing.Optional[Reques ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}" ), params=jsonable_encoder( @@ -397,17 +454,28 @@ async def update( """ Creates or updates audience. - Parameters: - - audience_id: str. A unique identifier representing the audience id + Parameters + ---------- + audience_id : str + A unique identifier representing the audience id + + name : typing.Optional[str] + The name of the audience - - name: typing.Optional[str]. The name of the audience + description : typing.Optional[str] + A description of the audience - - description: typing.Optional[str]. A description of the audience + filter : typing.Optional[Filter] - - filter: typing.Optional[Filter]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + AudienceUpdateResponse + + Examples + -------- from courier import SingleFilterConfig from courier.client import AsyncCourier @@ -433,8 +501,8 @@ async def update( if filter is not OMIT: _request["filter"] = filter _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}" ), params=jsonable_encoder( @@ -472,11 +540,20 @@ async def delete(self, audience_id: str, *, request_options: typing.Optional[Req """ Deletes the specified audience. - Parameters: - - audience_id: str. A unique identifier representing the audience id + Parameters + ---------- + audience_id : str + A unique identifier representing the audience id + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -487,8 +564,8 @@ async def delete(self, audience_id: str, *, request_options: typing.Optional[Req ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}" ), params=jsonable_encoder( @@ -526,13 +603,23 @@ async def list_members( """ Get list of members of an audience. - Parameters: - - audience_id: str. A unique identifier representing the audience id + Parameters + ---------- + audience_id : str + A unique identifier representing the audience id + + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of members + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of members + Returns + ------- + AudienceMemberListResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -544,8 +631,8 @@ async def list_members( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audiences/{jsonable_encoder(audience_id)}/members" ), params=jsonable_encoder( @@ -590,11 +677,20 @@ async def list_audiences( """ Get the audiences associated with the authorization token. - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of audiences + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of audiences + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AudienceListResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -605,8 +701,8 @@ async def list_audiences( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audiences"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audiences"), params=jsonable_encoder( remove_none_from_dict( { diff --git a/src/courier/audit_events/client.py b/src/courier/audit_events/client.py index 25d415e..ada01ac 100644 --- a/src/courier/audit_events/client.py +++ b/src/courier/audit_events/client.py @@ -24,11 +24,20 @@ def list( """ Fetch the list of audit events - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of audit events. + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of audit events. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListAuditEventsResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -39,8 +48,8 @@ def list( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audit-events"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audit-events"), params=jsonable_encoder( remove_none_from_dict( { @@ -79,11 +88,20 @@ def get(self, audit_event_id: str, *, request_options: typing.Optional[RequestOp """ Fetch a specific audit event by ID. - Parameters: - - audit_event_id: str. A unique identifier associated with the audit event you wish to retrieve + Parameters + ---------- + audit_event_id : str + A unique identifier associated with the audit event you wish to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AuditEvent - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -94,8 +112,8 @@ def get(self, audit_event_id: str, *, request_options: typing.Optional[RequestOp ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audit-events/{jsonable_encoder(audit_event_id)}" ), params=jsonable_encoder( @@ -134,11 +152,20 @@ async def list( """ Fetch the list of audit events - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of audit events. + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of audit events. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListAuditEventsResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -149,8 +176,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audit-events"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "audit-events"), params=jsonable_encoder( remove_none_from_dict( { @@ -189,11 +216,20 @@ async def get(self, audit_event_id: str, *, request_options: typing.Optional[Req """ Fetch a specific audit event by ID. - Parameters: - - audit_event_id: str. A unique identifier associated with the audit event you wish to retrieve + Parameters + ---------- + audit_event_id : str + A unique identifier associated with the audit event you wish to retrieve + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AuditEvent - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -204,8 +240,8 @@ async def get(self, audit_event_id: str, *, request_options: typing.Optional[Req ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"audit-events/{jsonable_encoder(audit_event_id)}" ), params=jsonable_encoder( diff --git a/src/courier/auth_tokens/client.py b/src/courier/auth_tokens/client.py index a199b47..549e573 100644 --- a/src/courier/auth_tokens/client.py +++ b/src/courier/auth_tokens/client.py @@ -32,17 +32,26 @@ def issue_token( """ Returns a new access token. - Parameters: - - scope: str. + Parameters + ---------- + scope : str - - expires_in: str. + expires_in : str - - idempotency_key: typing.Optional[str]. + idempotency_key : typing.Optional[str] - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + IssueTokenResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -54,8 +63,8 @@ def issue_token( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "auth/issue-token"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "auth/issue-token"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -106,17 +115,26 @@ async def issue_token( """ Returns a new access token. - Parameters: - - scope: str. + Parameters + ---------- + scope : str + + expires_in : str + + idempotency_key : typing.Optional[str] - - expires_in: str. + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + IssueTokenResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -128,8 +146,8 @@ async def issue_token( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "auth/issue-token"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "auth/issue-token"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), diff --git a/src/courier/automations/client.py b/src/courier/automations/client.py index be8eab8..c93f081 100644 --- a/src/courier/automations/client.py +++ b/src/courier/automations/client.py @@ -34,17 +34,27 @@ def invoke_automation_template( """ Invoke an automation run from an automation template. - Parameters: - - template_id: str. A unique identifier representing the automation template to be invoked. This could be the Automation Template ID or the Automation Template Alias. + Parameters + ---------- + template_id : str + A unique identifier representing the automation template to be invoked. This could be the Automation Template ID or the Automation Template Alias. - - request: AutomationInvokeParams. + request : AutomationInvokeParams - - idempotency_key: typing.Optional[str]. + idempotency_key : typing.Optional[str] - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AutomationInvokeResponse + + Examples + -------- from courier import AutomationInvokeParams from courier.client import Courier @@ -63,8 +73,8 @@ def invoke_automation_template( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"automations/{jsonable_encoder(template_id)}/invoke" ), params=jsonable_encoder( @@ -111,15 +121,24 @@ def invoke_ad_hoc_automation( """ Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a series of automation steps. For information about what steps are available, checkout the ad hoc automation guide [here](https://www.courier.com/docs/automations/steps/). - Parameters: - - request: AutomationAdHocInvokeParams. + Parameters + ---------- + request : AutomationAdHocInvokeParams + + idempotency_key : typing.Optional[str] + + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + AutomationInvokeResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( Automation, AutomationAdHocInvokeParams, @@ -153,8 +172,8 @@ def invoke_ad_hoc_automation( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "automations/invoke"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "automations/invoke"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -205,17 +224,27 @@ async def invoke_automation_template( """ Invoke an automation run from an automation template. - Parameters: - - template_id: str. A unique identifier representing the automation template to be invoked. This could be the Automation Template ID or the Automation Template Alias. + Parameters + ---------- + template_id : str + A unique identifier representing the automation template to be invoked. This could be the Automation Template ID or the Automation Template Alias. - - request: AutomationInvokeParams. + request : AutomationInvokeParams - - idempotency_key: typing.Optional[str]. + idempotency_key : typing.Optional[str] - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + AutomationInvokeResponse + + Examples + -------- from courier import AutomationInvokeParams from courier.client import AsyncCourier @@ -234,8 +263,8 @@ async def invoke_automation_template( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"automations/{jsonable_encoder(template_id)}/invoke" ), params=jsonable_encoder( @@ -282,15 +311,24 @@ async def invoke_ad_hoc_automation( """ Invoke an ad hoc automation run. This endpoint accepts a JSON payload with a series of automation steps. For information about what steps are available, checkout the ad hoc automation guide [here](https://www.courier.com/docs/automations/steps/). - Parameters: - - request: AutomationAdHocInvokeParams. + Parameters + ---------- + request : AutomationAdHocInvokeParams + + idempotency_key : typing.Optional[str] + + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + AutomationInvokeResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( Automation, AutomationAdHocInvokeParams, @@ -324,8 +362,8 @@ async def invoke_ad_hoc_automation( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "automations/invoke"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "automations/invoke"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), diff --git a/src/courier/automations/types/automation_add_to_batch_retain.py b/src/courier/automations/types/automation_add_to_batch_retain.py index 091d8ff..a4ec80d 100644 --- a/src/courier/automations/types/automation_add_to_batch_retain.py +++ b/src/courier/automations/types/automation_add_to_batch_retain.py @@ -11,7 +11,9 @@ class AutomationAddToBatchRetain(pydantic_v1.BaseModel): """ Defines what items should be retained and passed along to the next steps when the batch is released - --- + + Examples + -------- from courier import AutomationAddToBatchRetain AutomationAddToBatchRetain( diff --git a/src/courier/automations/types/automation_add_to_batch_step.py b/src/courier/automations/types/automation_add_to_batch_step.py index 5aacd68..e0746a8 100644 --- a/src/courier/automations/types/automation_add_to_batch_step.py +++ b/src/courier/automations/types/automation_add_to_batch_step.py @@ -13,6 +13,8 @@ class AutomationAddToBatchStep(AutomationStep): """ + Examples + -------- from courier import AutomationAddToBatchRetain, AutomationAddToBatchStep AutomationAddToBatchStep( diff --git a/src/courier/automations/types/automation_add_to_digest_step.py b/src/courier/automations/types/automation_add_to_digest_step.py index 8d68909..07e2c11 100644 --- a/src/courier/automations/types/automation_add_to_digest_step.py +++ b/src/courier/automations/types/automation_add_to_digest_step.py @@ -10,6 +10,8 @@ class AutomationAddToDigestStep(AutomationStep): """ + Examples + -------- from courier import AutomationAddToDigestStep AutomationAddToDigestStep( diff --git a/src/courier/automations/types/automation_fetch_data_step.py b/src/courier/automations/types/automation_fetch_data_step.py index 60fbf31..197e3dd 100644 --- a/src/courier/automations/types/automation_fetch_data_step.py +++ b/src/courier/automations/types/automation_fetch_data_step.py @@ -12,6 +12,8 @@ class AutomationFetchDataStep(AutomationStep): """ + Examples + -------- from courier import AutomationFetchDataStep, AutomationFetchDataWebhook AutomationFetchDataStep( diff --git a/src/courier/automations/types/automation_throttle_step.py b/src/courier/automations/types/automation_throttle_step.py index 888d2da..548b4f9 100644 --- a/src/courier/automations/types/automation_throttle_step.py +++ b/src/courier/automations/types/automation_throttle_step.py @@ -12,6 +12,8 @@ class AutomationThrottleStep(AutomationStep): """ + Examples + -------- from courier import AutomationThrottleOnThrottle, AutomationThrottleStep AutomationThrottleStep( diff --git a/src/courier/brands/client.py b/src/courier/brands/client.py index a54e70a..de86d0b 100644 --- a/src/courier/brands/client.py +++ b/src/courier/brands/client.py @@ -41,15 +41,24 @@ def create( request_options: typing.Optional[RequestOptions] = None, ) -> Brand: """ - Parameters: - - request: BrandParameters. + Parameters + ---------- + request : BrandParameters - - idempotency_key: typing.Optional[str]. + idempotency_key : typing.Optional[str] - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Brand + + Examples + -------- from courier import BrandParameters, BrandSettings, BrandSnippets from courier.client import Courier @@ -66,8 +75,8 @@ def create( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "brands"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "brands"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -111,11 +120,20 @@ def get(self, brand_id: str, *, request_options: typing.Optional[RequestOptions] """ Fetch a specific brand by brand ID. - Parameters: - - brand_id: str. A unique identifier associated with the brand you wish to retrieve. + Parameters + ---------- + brand_id : str + A unique identifier associated with the brand you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + Brand + + Examples + -------- from courier.client import Courier client = Courier( @@ -126,8 +144,8 @@ def get(self, brand_id: str, *, request_options: typing.Optional[RequestOptions] ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -159,11 +177,20 @@ def list( """ Get the list of brands. - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of brands. + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of brands. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + BrandsResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -174,8 +201,8 @@ def list( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "brands"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "brands"), params=jsonable_encoder( remove_none_from_dict( { @@ -214,11 +241,20 @@ def delete(self, brand_id: str, *, request_options: typing.Optional[RequestOptio """ Delete a brand by brand ID. - Parameters: - - brand_id: str. A unique identifier associated with the brand you wish to retrieve. + Parameters + ---------- + brand_id : str + A unique identifier associated with the brand you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -229,8 +265,8 @@ def delete(self, brand_id: str, *, request_options: typing.Optional[RequestOptio ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), + method="DELETE", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -270,17 +306,27 @@ def replace( """ Replace an existing brand with the supplied values. - Parameters: - - brand_id: str. A unique identifier associated with the brand you wish to update. + Parameters + ---------- + brand_id : str + A unique identifier associated with the brand you wish to update. + + name : str + The name of the brand. + + settings : typing.Optional[BrandSettings] - - name: str. The name of the brand. + snippets : typing.Optional[BrandSnippets] - - settings: typing.Optional[BrandSettings]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - snippets: typing.Optional[BrandSnippets]. + Returns + ------- + Brand - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( BrandColors, BrandSettings, @@ -318,8 +364,8 @@ def replace( if snippets is not OMIT: _request["snippets"] = snippets _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), + method="PUT", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -365,15 +411,24 @@ async def create( request_options: typing.Optional[RequestOptions] = None, ) -> Brand: """ - Parameters: - - request: BrandParameters. + Parameters + ---------- + request : BrandParameters - - idempotency_key: typing.Optional[str]. + idempotency_key : typing.Optional[str] - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Brand + + Examples + -------- from courier import BrandParameters, BrandSettings, BrandSnippets from courier.client import AsyncCourier @@ -390,8 +445,8 @@ async def create( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "brands"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "brands"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -435,11 +490,20 @@ async def get(self, brand_id: str, *, request_options: typing.Optional[RequestOp """ Fetch a specific brand by brand ID. - Parameters: - - brand_id: str. A unique identifier associated with the brand you wish to retrieve. + Parameters + ---------- + brand_id : str + A unique identifier associated with the brand you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + Brand + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -450,8 +514,8 @@ async def get(self, brand_id: str, *, request_options: typing.Optional[RequestOp ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -483,11 +547,20 @@ async def list( """ Get the list of brands. - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of brands. + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of brands. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + BrandsResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -498,8 +571,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "brands"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "brands"), params=jsonable_encoder( remove_none_from_dict( { @@ -538,11 +611,20 @@ async def delete(self, brand_id: str, *, request_options: typing.Optional[Reques """ Delete a brand by brand ID. - Parameters: - - brand_id: str. A unique identifier associated with the brand you wish to retrieve. + Parameters + ---------- + brand_id : str + A unique identifier associated with the brand you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -553,8 +635,8 @@ async def delete(self, brand_id: str, *, request_options: typing.Optional[Reques ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), + method="DELETE", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -594,17 +676,27 @@ async def replace( """ Replace an existing brand with the supplied values. - Parameters: - - brand_id: str. A unique identifier associated with the brand you wish to update. + Parameters + ---------- + brand_id : str + A unique identifier associated with the brand you wish to update. + + name : str + The name of the brand. + + settings : typing.Optional[BrandSettings] - - name: str. The name of the brand. + snippets : typing.Optional[BrandSnippets] - - settings: typing.Optional[BrandSettings]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - snippets: typing.Optional[BrandSnippets]. + Returns + ------- + Brand - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( BrandColors, BrandSettings, @@ -642,8 +734,8 @@ async def replace( if snippets is not OMIT: _request["snippets"] = snippets _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), + method="PUT", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"brands/{jsonable_encoder(brand_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), diff --git a/src/courier/bulk/client.py b/src/courier/bulk/client.py index d11a02e..960d684 100644 --- a/src/courier/bulk/client.py +++ b/src/courier/bulk/client.py @@ -35,15 +35,24 @@ def create_job( request_options: typing.Optional[RequestOptions] = None, ) -> BulkCreateJobResponse: """ - Parameters: - - message: InboundBulkMessage. + Parameters + ---------- + message : InboundBulkMessage - - idempotency_key: typing.Optional[str]. + idempotency_key : typing.Optional[str] - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BulkCreateJobResponse + + Examples + -------- from courier import InboundBulkMessage, InboundBulkTemplateMessage from courier.client import Courier @@ -62,8 +71,8 @@ def create_job( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "bulk"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "bulk"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -111,17 +120,27 @@ def ingest_users( """ Ingest user data into a Bulk Job - Parameters: - - job_id: str. A unique identifier representing the bulk job + Parameters + ---------- + job_id : str + A unique identifier representing the bulk job + + request : BulkIngestUsersParams - - request: BulkIngestUsersParams. + idempotency_key : typing.Optional[str] - - idempotency_key: typing.Optional[str]. + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier import ( BulkIngestUsersParams, InboundBulkMessageUser, @@ -149,8 +168,8 @@ def ingest_users( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -195,15 +214,25 @@ def run_job( """ Run a bulk job - Parameters: - - job_id: str. A unique identifier representing the bulk job + Parameters + ---------- + job_id : str + A unique identifier representing the bulk job + + idempotency_key : typing.Optional[str] + + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -214,8 +243,8 @@ def run_job( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}/run"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}/run"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -252,11 +281,20 @@ def get_job(self, job_id: str, *, request_options: typing.Optional[RequestOption """ Get a bulk job - Parameters: - - job_id: str. A unique identifier representing the bulk job + Parameters + ---------- + job_id : str + A unique identifier representing the bulk job - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BulkGetJobResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -267,8 +305,8 @@ def get_job(self, job_id: str, *, request_options: typing.Optional[RequestOption ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -302,11 +340,20 @@ def get_users( """ Get Bulk Job Users - Parameters: - - job_id: str. A unique identifier representing the bulk job + Parameters + ---------- + job_id : str + A unique identifier representing the bulk job + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + BulkGetJobUsersResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -317,8 +364,10 @@ def get_users( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}/users"), + method="GET", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}/users" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -360,15 +409,24 @@ async def create_job( request_options: typing.Optional[RequestOptions] = None, ) -> BulkCreateJobResponse: """ - Parameters: - - message: InboundBulkMessage. + Parameters + ---------- + message : InboundBulkMessage - - idempotency_key: typing.Optional[str]. + idempotency_key : typing.Optional[str] - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BulkCreateJobResponse + + Examples + -------- from courier import InboundBulkMessage, InboundBulkTemplateMessage from courier.client import AsyncCourier @@ -387,8 +445,8 @@ async def create_job( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "bulk"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "bulk"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -436,17 +494,27 @@ async def ingest_users( """ Ingest user data into a Bulk Job - Parameters: - - job_id: str. A unique identifier representing the bulk job + Parameters + ---------- + job_id : str + A unique identifier representing the bulk job + + request : BulkIngestUsersParams - - request: BulkIngestUsersParams. + idempotency_key : typing.Optional[str] - - idempotency_key: typing.Optional[str]. + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier import ( BulkIngestUsersParams, InboundBulkMessageUser, @@ -474,8 +542,8 @@ async def ingest_users( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -520,15 +588,25 @@ async def run_job( """ Run a bulk job - Parameters: - - job_id: str. A unique identifier representing the bulk job + Parameters + ---------- + job_id : str + A unique identifier representing the bulk job + + idempotency_key : typing.Optional[str] + + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -539,8 +617,8 @@ async def run_job( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}/run"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}/run"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -579,11 +657,20 @@ async def get_job( """ Get a bulk job - Parameters: - - job_id: str. A unique identifier representing the bulk job + Parameters + ---------- + job_id : str + A unique identifier representing the bulk job - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + BulkGetJobResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -594,8 +681,8 @@ async def get_job( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -629,11 +716,20 @@ async def get_users( """ Get Bulk Job Users - Parameters: - - job_id: str. A unique identifier representing the bulk job + Parameters + ---------- + job_id : str + A unique identifier representing the bulk job + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + BulkGetJobUsersResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -644,8 +740,10 @@ async def get_users( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}/users"), + method="GET", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"bulk/{jsonable_encoder(job_id)}/users" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), diff --git a/src/courier/client.py b/src/courier/client.py index 5966c1c..69401ca 100644 --- a/src/courier/client.py +++ b/src/courier/client.py @@ -39,21 +39,32 @@ class Courier: """ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions. - Parameters: - - base_url: typing.Optional[str]. The base url to use for requests from the client. + Parameters + ---------- + base_url : typing.Optional[str] + The base url to use for requests from the client. - - environment: CourierEnvironment. The environment to use for requests from the client. from .environment import CourierEnvironment + environment : CourierEnvironment + The environment to use for requests from the client. from .environment import CourierEnvironment - Defaults to CourierEnvironment.PRODUCTION - - authorization_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]]. - - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set. + Defaults to CourierEnvironment.PRODUCTION - - follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. - - httpx_client: typing.Optional[httpx.Client]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. - --- + + authorization_token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] + timeout : typing.Optional[float] + The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set. + + follow_redirects : typing.Optional[bool] + Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. + + httpx_client : typing.Optional[httpx.Client] + The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. + + Examples + -------- from courier.client import Courier client = Courier( @@ -70,7 +81,7 @@ def __init__( "COURIER_AUTH_TOKEN" ), timeout: typing.Optional[float] = None, - follow_redirects: typing.Optional[bool] = None, + follow_redirects: typing.Optional[bool] = True, httpx_client: typing.Optional[httpx.Client] = None, ): _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None @@ -114,15 +125,25 @@ def send( """ Use the send API to send a message to one or more recipients. - Parameters: - - message: Message. Defines the message to be delivered + Parameters + ---------- + message : Message + Defines the message to be delivered + + idempotency_key : typing.Optional[str] + + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + SendMessageResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( AudienceRecipient, Channel, @@ -159,8 +180,8 @@ def send( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "send"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "send"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -199,21 +220,32 @@ class AsyncCourier: """ Use this class to access the different functions within the SDK. You can instantiate any number of clients with different configuration that will propogate to these functions. - Parameters: - - base_url: typing.Optional[str]. The base url to use for requests from the client. + Parameters + ---------- + base_url : typing.Optional[str] + The base url to use for requests from the client. - - environment: CourierEnvironment. The environment to use for requests from the client. from .environment import CourierEnvironment + environment : CourierEnvironment + The environment to use for requests from the client. from .environment import CourierEnvironment - Defaults to CourierEnvironment.PRODUCTION - - authorization_token: typing.Optional[typing.Union[str, typing.Callable[[], str]]]. - - timeout: typing.Optional[float]. The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set. + Defaults to CourierEnvironment.PRODUCTION - - follow_redirects: typing.Optional[bool]. Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. - - httpx_client: typing.Optional[httpx.AsyncClient]. The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. - --- + + authorization_token : typing.Optional[typing.Union[str, typing.Callable[[], str]]] + timeout : typing.Optional[float] + The timeout to be used, in seconds, for requests by default the timeout is 60 seconds, unless a custom httpx client is used, in which case a default is not set. + + follow_redirects : typing.Optional[bool] + Whether the default httpx client follows redirects or not, this is irrelevant if a custom httpx client is passed in. + + httpx_client : typing.Optional[httpx.AsyncClient] + The httpx client to use for making requests, a preconfigured client is used by default, however this is useful should you want to pass in any custom httpx configuration. + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -230,7 +262,7 @@ def __init__( "COURIER_AUTH_TOKEN" ), timeout: typing.Optional[float] = None, - follow_redirects: typing.Optional[bool] = None, + follow_redirects: typing.Optional[bool] = True, httpx_client: typing.Optional[httpx.AsyncClient] = None, ): _defaulted_timeout = timeout if timeout is not None else 60 if httpx_client is None else None @@ -274,15 +306,25 @@ async def send( """ Use the send API to send a message to one or more recipients. - Parameters: - - message: Message. Defines the message to be delivered + Parameters + ---------- + message : Message + Defines the message to be delivered + + idempotency_key : typing.Optional[str] + + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + SendMessageResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( AudienceRecipient, Channel, @@ -319,8 +361,8 @@ async def send( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "send"), + method="POST", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "send"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), diff --git a/src/courier/commons/types/user_tenant_association.py b/src/courier/commons/types/user_tenant_association.py index dabe043..8a0f168 100644 --- a/src/courier/commons/types/user_tenant_association.py +++ b/src/courier/commons/types/user_tenant_association.py @@ -8,18 +8,21 @@ class UserTenantAssociation(pydantic_v1.BaseModel): - user_id: str = pydantic_v1.Field() + user_id: typing.Optional[str] = pydantic_v1.Field(default=None) """ User ID for the assocation between tenant and user """ - type: typing.Literal["user"] + type: typing.Optional[typing.Literal["user"]] = None tenant_id: str = pydantic_v1.Field() """ Tenant ID for the assocation between tenant and user """ - profile: typing.Dict[str, typing.Any] + profile: typing.Optional[typing.Dict[str, typing.Any]] = pydantic_v1.Field(default=None) + """ + Additional metadata to be applied to a user profile when used in a tenant context + """ def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/courier/core/client_wrapper.py b/src/courier/core/client_wrapper.py index e3be472..f369b0c 100644 --- a/src/courier/core/client_wrapper.py +++ b/src/courier/core/client_wrapper.py @@ -23,7 +23,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "trycourier", - "X-Fern-SDK-Version": "v6.0.2", + "X-Fern-SDK-Version": "v6.0.3", } headers["Authorization"] = f"Bearer {self._get_authorization_token()}" return headers diff --git a/src/courier/lists/client.py b/src/courier/lists/client.py index 0e1673b..a3585e0 100644 --- a/src/courier/lists/client.py +++ b/src/courier/lists/client.py @@ -39,13 +39,23 @@ def list( """ Returns all of the lists, with the ability to filter based on a pattern. - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next page of lists. + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next page of lists. - - pattern: typing.Optional[str]. "A pattern used to filter the list items returned. Pattern types supported: exact match on `list_id` or a pattern of one or more pattern parts. you may replace a part with either: `*` to match all parts in that position, or `**` to signify a wildcard `endsWith` pattern match." + pattern : typing.Optional[str] + "A pattern used to filter the list items returned. Pattern types supported: exact match on `list_id` or a pattern of one or more pattern parts. you may replace a part with either: `*` to match all parts in that position, or `**` to signify a wildcard `endsWith` pattern match." - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListGetAllResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -57,8 +67,8 @@ def list( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "lists"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "lists"), params=jsonable_encoder( remove_none_from_dict( { @@ -100,11 +110,20 @@ def get(self, list_id: str, *, request_options: typing.Optional[RequestOptions] """ Returns a list based on the list ID provided. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + List + + Examples + -------- from courier.client import Courier client = Courier( @@ -115,8 +134,8 @@ def get(self, list_id: str, *, request_options: typing.Optional[RequestOptions] ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -150,13 +169,22 @@ def update( """ Create or replace an existing list with the supplied values. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request : ListPutParams - - request: ListPutParams. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + List + + Examples + -------- from courier import ( ChannelPreference, ListPutParams, @@ -211,8 +239,8 @@ def update( ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), + method="PUT", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -248,11 +276,20 @@ def delete(self, list_id: str, *, request_options: typing.Optional[RequestOption """ Delete a list by list ID. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -263,8 +300,8 @@ def delete(self, list_id: str, *, request_options: typing.Optional[RequestOption ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), + method="DELETE", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -294,11 +331,20 @@ def restore(self, list_id: str, *, request_options: typing.Optional[RequestOptio """ Restore a previously deleted list. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -309,8 +355,8 @@ def restore(self, list_id: str, *, request_options: typing.Optional[RequestOptio ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/restore" ), params=jsonable_encoder( @@ -351,13 +397,23 @@ def get_subscribers( """ Get the list's subscriptions. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of list subscriptions + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of list subscriptions - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListGetSubscriptionsResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -369,8 +425,8 @@ def get_subscribers( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions" ), params=jsonable_encoder( @@ -419,13 +475,22 @@ def update_subscribers( """ Subscribes the users to the list, overwriting existing subscriptions. If the list does not exist, it will be automatically created. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request : typing.Sequence[PutSubscriptionsRecipient] - - request: typing.Sequence[PutSubscriptionsRecipient]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier import ( ChannelPreference, NotificationPreferenceDetails, @@ -482,8 +547,8 @@ def update_subscribers( ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions" ), params=jsonable_encoder( @@ -531,17 +596,27 @@ def add_subscribers( """ Subscribes additional users to the list, without modifying existing subscriptions. If the list does not exist, it will be automatically created. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request : typing.Sequence[PutSubscriptionsRecipient] - - request: typing.Sequence[PutSubscriptionsRecipient]. + idempotency_key : typing.Optional[str] - - idempotency_key: typing.Optional[str]. + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier import ( ChannelPreference, NotificationPreferenceDetails, @@ -598,8 +673,8 @@ def add_subscribers( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions" ), params=jsonable_encoder( @@ -648,15 +723,25 @@ def subscribe( """ Subscribe a user to an existing list (note: if the List does not exist, it will be automatically created). - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + user_id : str + A unique identifier representing the recipient associated with the list + + preferences : typing.Optional[RecipientPreferences] - - user_id: str. A unique identifier representing the recipient associated with the list + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - preferences: typing.Optional[RecipientPreferences]. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( ChannelPreference, NotificationPreferenceDetails, @@ -711,8 +796,8 @@ def subscribe( if preferences is not OMIT: _request["preferences"] = preferences _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions/{jsonable_encoder(user_id)}", ), @@ -753,13 +838,23 @@ def unsubscribe( """ Delete a subscription to a list by list ID and user ID. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + user_id : str + A unique identifier representing the recipient associated with the list + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - user_id: str. A unique identifier representing the recipient associated with the list + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -771,8 +866,8 @@ def unsubscribe( ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions/{jsonable_encoder(user_id)}", ), @@ -818,13 +913,23 @@ async def list( """ Returns all of the lists, with the ability to filter based on a pattern. - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next page of lists. + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next page of lists. - - pattern: typing.Optional[str]. "A pattern used to filter the list items returned. Pattern types supported: exact match on `list_id` or a pattern of one or more pattern parts. you may replace a part with either: `*` to match all parts in that position, or `**` to signify a wildcard `endsWith` pattern match." + pattern : typing.Optional[str] + "A pattern used to filter the list items returned. Pattern types supported: exact match on `list_id` or a pattern of one or more pattern parts. you may replace a part with either: `*` to match all parts in that position, or `**` to signify a wildcard `endsWith` pattern match." - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListGetAllResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -836,8 +941,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "lists"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "lists"), params=jsonable_encoder( remove_none_from_dict( { @@ -879,11 +984,20 @@ async def get(self, list_id: str, *, request_options: typing.Optional[RequestOpt """ Returns a list based on the list ID provided. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + List + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -894,8 +1008,8 @@ async def get(self, list_id: str, *, request_options: typing.Optional[RequestOpt ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -929,13 +1043,22 @@ async def update( """ Create or replace an existing list with the supplied values. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request : ListPutParams - - request: ListPutParams. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + List + + Examples + -------- from courier import ( ChannelPreference, ListPutParams, @@ -990,8 +1113,8 @@ async def update( ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), + method="PUT", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -1027,11 +1150,20 @@ async def delete(self, list_id: str, *, request_options: typing.Optional[Request """ Delete a list by list ID. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -1042,8 +1174,8 @@ async def delete(self, list_id: str, *, request_options: typing.Optional[Request ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), + method="DELETE", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}"), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -1073,11 +1205,20 @@ async def restore(self, list_id: str, *, request_options: typing.Optional[Reques """ Restore a previously deleted list. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -1088,8 +1229,8 @@ async def restore(self, list_id: str, *, request_options: typing.Optional[Reques ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/restore" ), params=jsonable_encoder( @@ -1130,13 +1271,23 @@ async def get_subscribers( """ Get the list's subscriptions. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of list subscriptions + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of list subscriptions - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListGetSubscriptionsResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -1148,8 +1299,8 @@ async def get_subscribers( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions" ), params=jsonable_encoder( @@ -1198,13 +1349,22 @@ async def update_subscribers( """ Subscribes the users to the list, overwriting existing subscriptions. If the list does not exist, it will be automatically created. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request : typing.Sequence[PutSubscriptionsRecipient] - - request: typing.Sequence[PutSubscriptionsRecipient]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier import ( ChannelPreference, NotificationPreferenceDetails, @@ -1261,8 +1421,8 @@ async def update_subscribers( ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions" ), params=jsonable_encoder( @@ -1310,17 +1470,27 @@ async def add_subscribers( """ Subscribes additional users to the list, without modifying existing subscriptions. If the list does not exist, it will be automatically created. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + request : typing.Sequence[PutSubscriptionsRecipient] - - request: typing.Sequence[PutSubscriptionsRecipient]. + idempotency_key : typing.Optional[str] - - idempotency_key: typing.Optional[str]. + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier import ( ChannelPreference, NotificationPreferenceDetails, @@ -1377,8 +1547,8 @@ async def add_subscribers( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions" ), params=jsonable_encoder( @@ -1427,15 +1597,25 @@ async def subscribe( """ Subscribe a user to an existing list (note: if the List does not exist, it will be automatically created). - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + user_id : str + A unique identifier representing the recipient associated with the list + + preferences : typing.Optional[RecipientPreferences] - - user_id: str. A unique identifier representing the recipient associated with the list + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - preferences: typing.Optional[RecipientPreferences]. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( ChannelPreference, NotificationPreferenceDetails, @@ -1490,8 +1670,8 @@ async def subscribe( if preferences is not OMIT: _request["preferences"] = preferences _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions/{jsonable_encoder(user_id)}", ), @@ -1532,13 +1712,23 @@ async def unsubscribe( """ Delete a subscription to a list by list ID and user ID. - Parameters: - - list_id: str. A unique identifier representing the list you wish to retrieve. + Parameters + ---------- + list_id : str + A unique identifier representing the list you wish to retrieve. + + user_id : str + A unique identifier representing the recipient associated with the list + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - user_id: str. A unique identifier representing the recipient associated with the list + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -1550,8 +1740,8 @@ async def unsubscribe( ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"lists/{jsonable_encoder(list_id)}/subscriptions/{jsonable_encoder(user_id)}", ), diff --git a/src/courier/messages/client.py b/src/courier/messages/client.py index a6dc2b3..016a7db 100644 --- a/src/courier/messages/client.py +++ b/src/courier/messages/client.py @@ -46,37 +46,59 @@ def list( """ Fetch the statuses of messages you've previously sent. - Parameters: - - archived: typing.Optional[bool]. A boolean value that indicates whether archived messages should be included in the response. + Parameters + ---------- + archived : typing.Optional[bool] + A boolean value that indicates whether archived messages should be included in the response. - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of messages. + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of messages. - - event: typing.Optional[str]. A unique identifier representing the event that was used to send the event. + event : typing.Optional[str] + A unique identifier representing the event that was used to send the event. - - list_: typing.Optional[str]. A unique identifier representing the list the message was sent to. + list_ : typing.Optional[str] + A unique identifier representing the list the message was sent to. - - message_id: typing.Optional[str]. A unique identifier representing the message_id returned from either /send or /send/list. + message_id : typing.Optional[str] + A unique identifier representing the message_id returned from either /send or /send/list. - - notification: typing.Optional[str]. A unique identifier representing the notification that was used to send the event. + notification : typing.Optional[str] + A unique identifier representing the notification that was used to send the event. - - provider: typing.Optional[typing.Union[str, typing.Sequence[str]]]. The key assocated to the provider you want to filter on. E.g., sendgrid, inbox, twilio, slack, msteams, etc. Allows multiple values to be set in query parameters. + provider : typing.Optional[typing.Union[str, typing.Sequence[str]]] + The key assocated to the provider you want to filter on. E.g., sendgrid, inbox, twilio, slack, msteams, etc. Allows multiple values to be set in query parameters. - - recipient: typing.Optional[str]. A unique identifier representing the recipient associated with the requested profile. + recipient : typing.Optional[str] + A unique identifier representing the recipient associated with the requested profile. - - status: typing.Optional[typing.Union[str, typing.Sequence[str]]]. An indicator of the current status of the message. Allows multiple values to be set in query parameters. + status : typing.Optional[typing.Union[str, typing.Sequence[str]]] + An indicator of the current status of the message. Allows multiple values to be set in query parameters. - - tag: typing.Optional[typing.Union[str, typing.Sequence[str]]]. A tag placed in the metadata.tags during a notification send. Allows multiple values to be set in query parameters. + tag : typing.Optional[typing.Union[str, typing.Sequence[str]]] + A tag placed in the metadata.tags during a notification send. Allows multiple values to be set in query parameters. - - tags: typing.Optional[str]. A comma delimited list of 'tags'. Messages will be returned if they match any of the tags passed in. + tags : typing.Optional[str] + A comma delimited list of 'tags'. Messages will be returned if they match any of the tags passed in. - - tenant_id: typing.Optional[str]. Messages sent with the context of a Tenant + tenant_id : typing.Optional[str] + Messages sent with the context of a Tenant - - enqueued_after: typing.Optional[str]. The enqueued datetime of a message to filter out messages received before. + enqueued_after : typing.Optional[str] + The enqueued datetime of a message to filter out messages received before. - - trace_id: typing.Optional[str]. The unique identifier used to trace the requests + trace_id : typing.Optional[str] + The unique identifier used to trace the requests - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListMessagesResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -100,8 +122,8 @@ def list( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "messages"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "messages"), params=jsonable_encoder( remove_none_from_dict( { @@ -153,11 +175,20 @@ def get(self, message_id: str, *, request_options: typing.Optional[RequestOption """ Fetch the status of a message you've previously sent. - Parameters: - - message_id: str. A unique identifier associated with the message you wish to retrieve (results from a send). + Parameters + ---------- + message_id : str + A unique identifier associated with the message you wish to retrieve (results from a send). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MessageDetails - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -168,8 +199,10 @@ def get(self, message_id: str, *, request_options: typing.Optional[RequestOption ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}"), + method="GET", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -210,15 +243,25 @@ def cancel( """ Cancel a message that is currently in the process of being delivered. A well-formatted API call to the cancel message API will return either `200` status code for a successful cancellation or `409` status code for an unsuccessful cancellation. Both cases will include the actual message record in the response body (see details below). - Parameters: - - message_id: str. A unique identifier representing the message ID + Parameters + ---------- + message_id : str + A unique identifier representing the message ID + + idempotency_key : typing.Optional[str] + + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + MessageDetails - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -229,8 +272,8 @@ def cancel( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}/cancel" ), params=jsonable_encoder( @@ -273,13 +316,23 @@ def get_history( """ Fetch the array of events of a message you've previously sent. - Parameters: - - message_id: str. A unique identifier representing the message ID + Parameters + ---------- + message_id : str + A unique identifier representing the message ID - - type: typing.Optional[str]. A supported Message History type that will filter the events returned. + type : typing.Optional[str] + A supported Message History type that will filter the events returned. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MessageHistoryResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -291,8 +344,8 @@ def get_history( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}/history" ), params=jsonable_encoder( @@ -337,11 +390,20 @@ def get_content( self, message_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> RenderOutputResponse: """ - Parameters: - - message_id: str. A unique identifier associated with the message you wish to retrieve (results from a send). + Parameters + ---------- + message_id : str + A unique identifier associated with the message you wish to retrieve (results from a send). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + RenderOutputResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -352,8 +414,8 @@ def get_content( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}/output" ), params=jsonable_encoder( @@ -387,11 +449,20 @@ def get_content( def archive(self, request_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - Parameters: - - request_id: str. A unique identifier representing the request ID + Parameters + ---------- + request_id : str + A unique identifier representing the request ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -402,8 +473,8 @@ def archive(self, request_id: str, *, request_options: typing.Optional[RequestOp ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"requests/{jsonable_encoder(request_id)}/archive" ), params=jsonable_encoder( @@ -461,37 +532,59 @@ async def list( """ Fetch the statuses of messages you've previously sent. - Parameters: - - archived: typing.Optional[bool]. A boolean value that indicates whether archived messages should be included in the response. + Parameters + ---------- + archived : typing.Optional[bool] + A boolean value that indicates whether archived messages should be included in the response. - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of messages. + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of messages. - - event: typing.Optional[str]. A unique identifier representing the event that was used to send the event. + event : typing.Optional[str] + A unique identifier representing the event that was used to send the event. - - list_: typing.Optional[str]. A unique identifier representing the list the message was sent to. + list_ : typing.Optional[str] + A unique identifier representing the list the message was sent to. - - message_id: typing.Optional[str]. A unique identifier representing the message_id returned from either /send or /send/list. + message_id : typing.Optional[str] + A unique identifier representing the message_id returned from either /send or /send/list. - - notification: typing.Optional[str]. A unique identifier representing the notification that was used to send the event. + notification : typing.Optional[str] + A unique identifier representing the notification that was used to send the event. - - provider: typing.Optional[typing.Union[str, typing.Sequence[str]]]. The key assocated to the provider you want to filter on. E.g., sendgrid, inbox, twilio, slack, msteams, etc. Allows multiple values to be set in query parameters. + provider : typing.Optional[typing.Union[str, typing.Sequence[str]]] + The key assocated to the provider you want to filter on. E.g., sendgrid, inbox, twilio, slack, msteams, etc. Allows multiple values to be set in query parameters. - - recipient: typing.Optional[str]. A unique identifier representing the recipient associated with the requested profile. + recipient : typing.Optional[str] + A unique identifier representing the recipient associated with the requested profile. - - status: typing.Optional[typing.Union[str, typing.Sequence[str]]]. An indicator of the current status of the message. Allows multiple values to be set in query parameters. + status : typing.Optional[typing.Union[str, typing.Sequence[str]]] + An indicator of the current status of the message. Allows multiple values to be set in query parameters. - - tag: typing.Optional[typing.Union[str, typing.Sequence[str]]]. A tag placed in the metadata.tags during a notification send. Allows multiple values to be set in query parameters. + tag : typing.Optional[typing.Union[str, typing.Sequence[str]]] + A tag placed in the metadata.tags during a notification send. Allows multiple values to be set in query parameters. - - tags: typing.Optional[str]. A comma delimited list of 'tags'. Messages will be returned if they match any of the tags passed in. + tags : typing.Optional[str] + A comma delimited list of 'tags'. Messages will be returned if they match any of the tags passed in. - - tenant_id: typing.Optional[str]. Messages sent with the context of a Tenant + tenant_id : typing.Optional[str] + Messages sent with the context of a Tenant - - enqueued_after: typing.Optional[str]. The enqueued datetime of a message to filter out messages received before. + enqueued_after : typing.Optional[str] + The enqueued datetime of a message to filter out messages received before. - - trace_id: typing.Optional[str]. The unique identifier used to trace the requests + trace_id : typing.Optional[str] + The unique identifier used to trace the requests - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListMessagesResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -515,8 +608,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "messages"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "messages"), params=jsonable_encoder( remove_none_from_dict( { @@ -568,11 +661,20 @@ async def get(self, message_id: str, *, request_options: typing.Optional[Request """ Fetch the status of a message you've previously sent. - Parameters: - - message_id: str. A unique identifier associated with the message you wish to retrieve (results from a send). + Parameters + ---------- + message_id : str + A unique identifier associated with the message you wish to retrieve (results from a send). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MessageDetails - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -583,8 +685,10 @@ async def get(self, message_id: str, *, request_options: typing.Optional[Request ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}"), + method="GET", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -625,15 +729,25 @@ async def cancel( """ Cancel a message that is currently in the process of being delivered. A well-formatted API call to the cancel message API will return either `200` status code for a successful cancellation or `409` status code for an unsuccessful cancellation. Both cases will include the actual message record in the response body (see details below). - Parameters: - - message_id: str. A unique identifier representing the message ID + Parameters + ---------- + message_id : str + A unique identifier representing the message ID + + idempotency_key : typing.Optional[str] + + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + MessageDetails - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -644,8 +758,8 @@ async def cancel( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}/cancel" ), params=jsonable_encoder( @@ -688,13 +802,23 @@ async def get_history( """ Fetch the array of events of a message you've previously sent. - Parameters: - - message_id: str. A unique identifier representing the message ID + Parameters + ---------- + message_id : str + A unique identifier representing the message ID - - type: typing.Optional[str]. A supported Message History type that will filter the events returned. + type : typing.Optional[str] + A supported Message History type that will filter the events returned. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + MessageHistoryResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -706,8 +830,8 @@ async def get_history( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}/history" ), params=jsonable_encoder( @@ -752,11 +876,20 @@ async def get_content( self, message_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> RenderOutputResponse: """ - Parameters: - - message_id: str. A unique identifier associated with the message you wish to retrieve (results from a send). + Parameters + ---------- + message_id : str + A unique identifier associated with the message you wish to retrieve (results from a send). + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + RenderOutputResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -767,8 +900,8 @@ async def get_content( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"messages/{jsonable_encoder(message_id)}/output" ), params=jsonable_encoder( @@ -802,11 +935,20 @@ async def get_content( async def archive(self, request_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - Parameters: - - request_id: str. A unique identifier representing the request ID + Parameters + ---------- + request_id : str + A unique identifier representing the request ID + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -817,8 +959,8 @@ async def archive(self, request_id: str, *, request_options: typing.Optional[Req ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"requests/{jsonable_encoder(request_id)}/archive" ), params=jsonable_encoder( diff --git a/src/courier/notifications/client.py b/src/courier/notifications/client.py index 68f4552..fc1c675 100644 --- a/src/courier/notifications/client.py +++ b/src/courier/notifications/client.py @@ -30,11 +30,19 @@ def list( self, *, cursor: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None ) -> NotificationListResponse: """ - Parameters: - - cursor: typing.Optional[str]. + Parameters + ---------- + cursor : typing.Optional[str] - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NotificationListResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -45,8 +53,8 @@ def list( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "notifications"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "notifications"), params=jsonable_encoder( remove_none_from_dict( { @@ -85,11 +93,19 @@ def get_content( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> NotificationGetContentResponse: """ - Parameters: - - id: str. + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NotificationGetContentResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -100,8 +116,8 @@ def get_content( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/content" ), params=jsonable_encoder( @@ -133,11 +149,19 @@ def get_draft_content( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> NotificationGetContentResponse: """ - Parameters: - - id: str. + Parameters + ---------- + id : str - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NotificationGetContentResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -148,8 +172,8 @@ def get_draft_content( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/draft/content" ), params=jsonable_encoder( @@ -186,15 +210,23 @@ def update_variations( request_options: typing.Optional[RequestOptions] = None, ) -> None: """ - Parameters: - - id: str. + Parameters + ---------- + id : str + + blocks : typing.Optional[typing.Sequence[NotificationBlock]] + + channels : typing.Optional[typing.Sequence[NotificationChannel]] - - blocks: typing.Optional[typing.Sequence[NotificationBlock]]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - channels: typing.Optional[typing.Sequence[NotificationChannel]]. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( NotificationBlock, NotificationChannel, @@ -235,8 +267,8 @@ def update_variations( if channels is not OMIT: _request["channels"] = channels _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/variations" ), params=jsonable_encoder( @@ -279,15 +311,23 @@ def update_draft_variations( request_options: typing.Optional[RequestOptions] = None, ) -> None: """ - Parameters: - - id: str. + Parameters + ---------- + id : str - - blocks: typing.Optional[typing.Sequence[NotificationBlock]]. + blocks : typing.Optional[typing.Sequence[NotificationBlock]] - - channels: typing.Optional[typing.Sequence[NotificationChannel]]. + channels : typing.Optional[typing.Sequence[NotificationChannel]] - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- from courier import ( NotificationBlock, NotificationChannel, @@ -328,8 +368,8 @@ def update_draft_variations( if channels is not OMIT: _request["channels"] = channels _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/draft/variations" ), params=jsonable_encoder( @@ -367,13 +407,21 @@ def get_submission_checks( self, id: str, submission_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SubmissionChecksGetResponse: """ - Parameters: - - id: str. + Parameters + ---------- + id : str + + submission_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - submission_id: str. + Returns + ------- + SubmissionChecksGetResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -385,8 +433,8 @@ def get_submission_checks( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/{jsonable_encoder(submission_id)}/checks", ), @@ -424,15 +472,23 @@ def replace_submission_checks( request_options: typing.Optional[RequestOptions] = None, ) -> SubmissionChecksReplaceResponse: """ - Parameters: - - id: str. + Parameters + ---------- + id : str - - submission_id: str. + submission_id : str - - checks: typing.Sequence[BaseCheck]. + checks : typing.Sequence[BaseCheck] - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubmissionChecksReplaceResponse + + Examples + -------- from courier import BaseCheck from courier.client import Courier @@ -452,8 +508,8 @@ def replace_submission_checks( ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/{jsonable_encoder(submission_id)}/checks", ), @@ -492,13 +548,21 @@ def cancel_submission( self, id: str, submission_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> None: """ - Parameters: - - id: str. + Parameters + ---------- + id : str + + submission_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - submission_id: str. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -510,8 +574,8 @@ def cancel_submission( ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/{jsonable_encoder(submission_id)}/checks", ), @@ -549,11 +613,19 @@ async def list( self, *, cursor: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None ) -> NotificationListResponse: """ - Parameters: - - cursor: typing.Optional[str]. + Parameters + ---------- + cursor : typing.Optional[str] - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NotificationListResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -564,8 +636,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "notifications"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "notifications"), params=jsonable_encoder( remove_none_from_dict( { @@ -604,11 +676,19 @@ async def get_content( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> NotificationGetContentResponse: """ - Parameters: - - id: str. + Parameters + ---------- + id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NotificationGetContentResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -619,8 +699,8 @@ async def get_content( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/content" ), params=jsonable_encoder( @@ -652,11 +732,19 @@ async def get_draft_content( self, id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> NotificationGetContentResponse: """ - Parameters: - - id: str. + Parameters + ---------- + id : str - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + NotificationGetContentResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -667,8 +755,8 @@ async def get_draft_content( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/draft/content" ), params=jsonable_encoder( @@ -705,15 +793,23 @@ async def update_variations( request_options: typing.Optional[RequestOptions] = None, ) -> None: """ - Parameters: - - id: str. + Parameters + ---------- + id : str + + blocks : typing.Optional[typing.Sequence[NotificationBlock]] + + channels : typing.Optional[typing.Sequence[NotificationChannel]] - - blocks: typing.Optional[typing.Sequence[NotificationBlock]]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - channels: typing.Optional[typing.Sequence[NotificationChannel]]. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier import ( NotificationBlock, NotificationChannel, @@ -754,8 +850,8 @@ async def update_variations( if channels is not OMIT: _request["channels"] = channels _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/variations" ), params=jsonable_encoder( @@ -798,15 +894,23 @@ async def update_draft_variations( request_options: typing.Optional[RequestOptions] = None, ) -> None: """ - Parameters: - - id: str. + Parameters + ---------- + id : str - - blocks: typing.Optional[typing.Sequence[NotificationBlock]]. + blocks : typing.Optional[typing.Sequence[NotificationBlock]] - - channels: typing.Optional[typing.Sequence[NotificationChannel]]. + channels : typing.Optional[typing.Sequence[NotificationChannel]] - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- from courier import ( NotificationBlock, NotificationChannel, @@ -847,8 +951,8 @@ async def update_draft_variations( if channels is not OMIT: _request["channels"] = channels _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/draft/variations" ), params=jsonable_encoder( @@ -886,13 +990,21 @@ async def get_submission_checks( self, id: str, submission_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> SubmissionChecksGetResponse: """ - Parameters: - - id: str. + Parameters + ---------- + id : str + + submission_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - submission_id: str. + Returns + ------- + SubmissionChecksGetResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -904,8 +1016,8 @@ async def get_submission_checks( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/{jsonable_encoder(submission_id)}/checks", ), @@ -943,15 +1055,23 @@ async def replace_submission_checks( request_options: typing.Optional[RequestOptions] = None, ) -> SubmissionChecksReplaceResponse: """ - Parameters: - - id: str. + Parameters + ---------- + id : str - - submission_id: str. + submission_id : str - - checks: typing.Sequence[BaseCheck]. + checks : typing.Sequence[BaseCheck] - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubmissionChecksReplaceResponse + + Examples + -------- from courier import BaseCheck from courier.client import AsyncCourier @@ -971,8 +1091,8 @@ async def replace_submission_checks( ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/{jsonable_encoder(submission_id)}/checks", ), @@ -1011,13 +1131,21 @@ async def cancel_submission( self, id: str, submission_id: str, *, request_options: typing.Optional[RequestOptions] = None ) -> None: """ - Parameters: - - id: str. + Parameters + ---------- + id : str + + submission_id : str + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - submission_id: str. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -1029,8 +1157,8 @@ async def cancel_submission( ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"notifications/{jsonable_encoder(id)}/{jsonable_encoder(submission_id)}/checks", ), diff --git a/src/courier/profiles/client.py b/src/courier/profiles/client.py index 0e6ffad..d371461 100644 --- a/src/courier/profiles/client.py +++ b/src/courier/profiles/client.py @@ -32,11 +32,20 @@ def get(self, user_id: str, *, request_options: typing.Optional[RequestOptions] """ Returns the specified user profile. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProfileGetResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -47,8 +56,10 @@ def get(self, user_id: str, *, request_options: typing.Optional[RequestOptions] ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}"), + method="GET", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -88,17 +99,27 @@ def create( """ Merge the supplied values with an existing profile or create a new profile if one doesn't already exist. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. + + profile : typing.Dict[str, typing.Any] + + idempotency_key : typing.Optional[str] - - profile: typing.Dict[str, typing.Any]. + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + MergeProfileResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -110,8 +131,10 @@ def create( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}"), + method="POST", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -160,13 +183,22 @@ def replace( removed from the profile. Remember, a `PUT` update is a full replacement of the data. For partial updates, use the [Patch](https://www.courier.com/docs/reference/profiles/patch/) request. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. + + profile : typing.Dict[str, typing.Any] - - profile: typing.Dict[str, typing.Any]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + ReplaceProfileResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -178,8 +210,10 @@ def replace( ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}"), + method="PUT", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -217,11 +251,20 @@ def delete(self, user_id: str, *, request_options: typing.Optional[RequestOption """ Deletes the specified user profile. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- from courier.client import Courier client = Courier( @@ -232,8 +275,10 @@ def delete(self, user_id: str, *, request_options: typing.Optional[RequestOption ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}"), + method="DELETE", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -271,13 +316,23 @@ def get_list_subscriptions( """ Returns the subscribed lists for a specified user. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. + + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of message statuses. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of message statuses. + Returns + ------- + GetListSubscriptionsResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -289,8 +344,8 @@ def get_list_subscriptions( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}/lists" ), params=jsonable_encoder( @@ -341,17 +396,27 @@ def subscribe_to_lists( """ Subscribes the given user to one or more lists. If the list does not exist, it will be created. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. - - request: SubscribeToListsRequest. + request : SubscribeToListsRequest - - idempotency_key: typing.Optional[str]. + idempotency_key : typing.Optional[str] - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscribeToListsResponse + + Examples + -------- from courier import SubscribeToListsRequest, SubscribeToListsRequestListObject from courier.client import Courier @@ -366,8 +431,8 @@ def subscribe_to_lists( ) """ _response = self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}/lists" ), params=jsonable_encoder( @@ -411,11 +476,20 @@ def delete_list_subscription( """ Removes all list subscriptions for given user. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteListSubscriptionResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -426,8 +500,8 @@ def delete_list_subscription( ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}/lists" ), params=jsonable_encoder( @@ -466,11 +540,20 @@ async def get(self, user_id: str, *, request_options: typing.Optional[RequestOpt """ Returns the specified user profile. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ProfileGetResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -481,8 +564,10 @@ async def get(self, user_id: str, *, request_options: typing.Optional[RequestOpt ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}"), + method="GET", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -522,17 +607,27 @@ async def create( """ Merge the supplied values with an existing profile or create a new profile if one doesn't already exist. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. + + profile : typing.Dict[str, typing.Any] + + idempotency_key : typing.Optional[str] - - profile: typing.Dict[str, typing.Any]. + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - idempotency_key: typing.Optional[str]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + Returns + ------- + MergeProfileResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -544,8 +639,10 @@ async def create( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}"), + method="POST", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -594,13 +691,22 @@ async def replace( removed from the profile. Remember, a `PUT` update is a full replacement of the data. For partial updates, use the [Patch](https://www.courier.com/docs/reference/profiles/patch/) request. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. + + profile : typing.Dict[str, typing.Any] - - profile: typing.Dict[str, typing.Any]. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + ReplaceProfileResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -612,8 +718,10 @@ async def replace( ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}"), + method="PUT", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -651,11 +759,20 @@ async def delete(self, user_id: str, *, request_options: typing.Optional[Request """ Deletes the specified user profile. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -666,8 +783,10 @@ async def delete(self, user_id: str, *, request_options: typing.Optional[Request ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}"), + method="DELETE", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -705,13 +824,23 @@ async def get_list_subscriptions( """ Returns the subscribed lists for a specified user. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. + + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of message statuses. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of message statuses. + Returns + ------- + GetListSubscriptionsResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -723,8 +852,8 @@ async def get_list_subscriptions( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}/lists" ), params=jsonable_encoder( @@ -775,17 +904,27 @@ async def subscribe_to_lists( """ Subscribes the given user to one or more lists. If the list does not exist, it will be created. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. - - request: SubscribeToListsRequest. + request : SubscribeToListsRequest - - idempotency_key: typing.Optional[str]. + idempotency_key : typing.Optional[str] - - idempotency_expiry: typing.Optional[str]. The expiry can either be an ISO8601 datetime or a duration like "1 Day". + idempotency_expiry : typing.Optional[str] + The expiry can either be an ISO8601 datetime or a duration like "1 Day". - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + SubscribeToListsResponse + + Examples + -------- from courier import SubscribeToListsRequest, SubscribeToListsRequestListObject from courier.client import AsyncCourier @@ -800,8 +939,8 @@ async def subscribe_to_lists( ) """ _response = await self._client_wrapper.httpx_client.request( - "POST", - urllib.parse.urljoin( + method="POST", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}/lists" ), params=jsonable_encoder( @@ -845,11 +984,20 @@ async def delete_list_subscription( """ Removes all list subscriptions for given user. - Parameters: - - user_id: str. A unique identifier representing the user associated with the requested profile. + Parameters + ---------- + user_id : str + A unique identifier representing the user associated with the requested profile. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + DeleteListSubscriptionResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -860,8 +1008,8 @@ async def delete_list_subscription( ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"profiles/{jsonable_encoder(user_id)}/lists" ), params=jsonable_encoder( diff --git a/src/courier/templates/client.py b/src/courier/templates/client.py index 1ee51b9..cb451e3 100644 --- a/src/courier/templates/client.py +++ b/src/courier/templates/client.py @@ -23,11 +23,20 @@ def list( """ Returns a list of notification templates - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of templates + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of templates - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListTemplatesResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -38,8 +47,8 @@ def list( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "notifications"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "notifications"), params=jsonable_encoder( remove_none_from_dict( { @@ -85,11 +94,20 @@ async def list( """ Returns a list of notification templates - Parameters: - - cursor: typing.Optional[str]. A unique identifier that allows for fetching the next set of templates + Parameters + ---------- + cursor : typing.Optional[str] + A unique identifier that allows for fetching the next set of templates + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + ListTemplatesResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -100,8 +118,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "notifications"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "notifications"), params=jsonable_encoder( remove_none_from_dict( { diff --git a/src/courier/tenants/client.py b/src/courier/tenants/client.py index a4970e2..49013cf 100644 --- a/src/courier/tenants/client.py +++ b/src/courier/tenants/client.py @@ -39,23 +39,38 @@ def create_or_replace( request_options: typing.Optional[RequestOptions] = None, ) -> Tenant: """ - Parameters: - - tenant_id: str. A unique identifier representing the tenant to be returned. + Parameters + ---------- + tenant_id : str + A unique identifier representing the tenant to be returned. - - name: str. Name of the tenant. + name : str + Name of the tenant. - - parent_tenant_id: typing.Optional[str]. Tenant's parent id (if any). + parent_tenant_id : typing.Optional[str] + Tenant's parent id (if any). - - default_preferences: typing.Optional[DefaultPreferences]. Defines the preferences used for the tenant when the user hasn't specified their own. + default_preferences : typing.Optional[DefaultPreferences] + Defines the preferences used for the tenant when the user hasn't specified their own. - - properties: typing.Optional[typing.Sequence[TemplateProperty]]. Arbitrary properties accessible to a template. + properties : typing.Optional[typing.Sequence[TemplateProperty]] + Arbitrary properties accessible to a template. - - user_profile: typing.Optional[typing.Dict[str, typing.Any]]. A user profile object merged with user profile on send. + user_profile : typing.Optional[typing.Dict[str, typing.Any]] + A user profile object merged with user profile on send. - - brand_id: typing.Optional[str]. Brand to be used for the account when one is not specified by the send call. + brand_id : typing.Optional[str] + Brand to be used for the account when one is not specified by the send call. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tenant + + Examples + -------- from courier import DefaultPreferences, SubscriptionTopic from courier.client import Courier @@ -86,8 +101,10 @@ def create_or_replace( if brand_id is not OMIT: _request["brand_id"] = brand_id _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}"), + method="PUT", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -123,11 +140,20 @@ def create_or_replace( def get(self, tenant_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Tenant: """ - Parameters: - - tenant_id: str. A unique identifier representing the tenant to be returned. + Parameters + ---------- + tenant_id : str + A unique identifier representing the tenant to be returned. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + Tenant + + Examples + -------- from courier.client import Courier client = Courier( @@ -138,8 +164,10 @@ def get(self, tenant_id: str, *, request_options: typing.Optional[RequestOptions ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}"), + method="GET", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -175,13 +203,24 @@ def list( request_options: typing.Optional[RequestOptions] = None, ) -> TenantListResponse: """ - Parameters: - - limit: typing.Optional[int]. The number of accousnts to return - (defaults to 20, maximum value of 100) - - cursor: typing.Optional[str]. Continue the pagination with the next cursor + Parameters + ---------- + limit : typing.Optional[int] + The number of accousnts to return + (defaults to 20, maximum value of 100) + + cursor : typing.Optional[str] + Continue the pagination with the next cursor + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + TenantListResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -193,8 +232,8 @@ def list( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "tenants"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "tenants"), params=jsonable_encoder( remove_none_from_dict( { @@ -232,11 +271,20 @@ def list( def delete(self, tenant_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - Parameters: - - tenant_id: str. Id of the tenant to be deleted. + Parameters + ---------- + tenant_id : str + Id of the tenant to be deleted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import Courier client = Courier( @@ -247,8 +295,10 @@ def delete(self, tenant_id: str, *, request_options: typing.Optional[RequestOpti ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}"), + method="DELETE", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -283,15 +333,27 @@ def get_users_by_tenant( request_options: typing.Optional[RequestOptions] = None, ) -> ListUsersForTenantResponse: """ - Parameters: - - tenant_id: str. Id of the tenant for user membership. + Parameters + ---------- + tenant_id : str + Id of the tenant for user membership. + + limit : typing.Optional[int] + The number of accounts to return + (defaults to 20, maximum value of 100) + + cursor : typing.Optional[str] + Continue the pagination with the next cursor + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - limit: typing.Optional[int]. The number of accounts to return - (defaults to 20, maximum value of 100) - - cursor: typing.Optional[str]. Continue the pagination with the next cursor + Returns + ------- + ListUsersForTenantResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -304,8 +366,8 @@ def get_users_by_tenant( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}/users" ), params=jsonable_encoder( @@ -363,23 +425,38 @@ async def create_or_replace( request_options: typing.Optional[RequestOptions] = None, ) -> Tenant: """ - Parameters: - - tenant_id: str. A unique identifier representing the tenant to be returned. + Parameters + ---------- + tenant_id : str + A unique identifier representing the tenant to be returned. - - name: str. Name of the tenant. + name : str + Name of the tenant. - - parent_tenant_id: typing.Optional[str]. Tenant's parent id (if any). + parent_tenant_id : typing.Optional[str] + Tenant's parent id (if any). - - default_preferences: typing.Optional[DefaultPreferences]. Defines the preferences used for the tenant when the user hasn't specified their own. + default_preferences : typing.Optional[DefaultPreferences] + Defines the preferences used for the tenant when the user hasn't specified their own. - - properties: typing.Optional[typing.Sequence[TemplateProperty]]. Arbitrary properties accessible to a template. + properties : typing.Optional[typing.Sequence[TemplateProperty]] + Arbitrary properties accessible to a template. - - user_profile: typing.Optional[typing.Dict[str, typing.Any]]. A user profile object merged with user profile on send. + user_profile : typing.Optional[typing.Dict[str, typing.Any]] + A user profile object merged with user profile on send. - - brand_id: typing.Optional[str]. Brand to be used for the account when one is not specified by the send call. + brand_id : typing.Optional[str] + Brand to be used for the account when one is not specified by the send call. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + Tenant + + Examples + -------- from courier import DefaultPreferences, SubscriptionTopic from courier.client import AsyncCourier @@ -410,8 +487,10 @@ async def create_or_replace( if brand_id is not OMIT: _request["brand_id"] = brand_id _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}"), + method="PUT", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -447,11 +526,20 @@ async def create_or_replace( async def get(self, tenant_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Tenant: """ - Parameters: - - tenant_id: str. A unique identifier representing the tenant to be returned. + Parameters + ---------- + tenant_id : str + A unique identifier representing the tenant to be returned. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + Tenant + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -462,8 +550,10 @@ async def get(self, tenant_id: str, *, request_options: typing.Optional[RequestO ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}"), + method="GET", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -499,13 +589,24 @@ async def list( request_options: typing.Optional[RequestOptions] = None, ) -> TenantListResponse: """ - Parameters: - - limit: typing.Optional[int]. The number of accousnts to return - (defaults to 20, maximum value of 100) - - cursor: typing.Optional[str]. Continue the pagination with the next cursor + Parameters + ---------- + limit : typing.Optional[int] + The number of accousnts to return + (defaults to 20, maximum value of 100) + + cursor : typing.Optional[str] + Continue the pagination with the next cursor + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + TenantListResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -517,8 +618,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "tenants"), + method="GET", + url=urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "tenants"), params=jsonable_encoder( remove_none_from_dict( { @@ -556,11 +657,20 @@ async def list( async def delete(self, tenant_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None: """ - Parameters: - - tenant_id: str. Id of the tenant to be deleted. + Parameters + ---------- + tenant_id : str + Id of the tenant to be deleted. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -571,8 +681,10 @@ async def delete(self, tenant_id: str, *, request_options: typing.Optional[Reque ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}"), + method="DELETE", + url=urllib.parse.urljoin( + f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}" + ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), @@ -607,15 +719,27 @@ async def get_users_by_tenant( request_options: typing.Optional[RequestOptions] = None, ) -> ListUsersForTenantResponse: """ - Parameters: - - tenant_id: str. Id of the tenant for user membership. + Parameters + ---------- + tenant_id : str + Id of the tenant for user membership. + + limit : typing.Optional[int] + The number of accounts to return + (defaults to 20, maximum value of 100) + + cursor : typing.Optional[str] + Continue the pagination with the next cursor + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - limit: typing.Optional[int]. The number of accounts to return - (defaults to 20, maximum value of 100) - - cursor: typing.Optional[str]. Continue the pagination with the next cursor + Returns + ------- + ListUsersForTenantResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -628,8 +752,8 @@ async def get_users_by_tenant( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"tenants/{jsonable_encoder(tenant_id)}/users" ), params=jsonable_encoder( diff --git a/src/courier/tenants/types/default_preferences.py b/src/courier/tenants/types/default_preferences.py index 9cdd8f0..b851a4b 100644 --- a/src/courier/tenants/types/default_preferences.py +++ b/src/courier/tenants/types/default_preferences.py @@ -9,7 +9,7 @@ class DefaultPreferences(pydantic_v1.BaseModel): - items: typing.List[SubscriptionTopic] + items: typing.Optional[typing.List[SubscriptionTopic]] = None def json(self, **kwargs: typing.Any) -> str: kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs} diff --git a/src/courier/translations/client.py b/src/courier/translations/client.py index 926f479..f799bc1 100644 --- a/src/courier/translations/client.py +++ b/src/courier/translations/client.py @@ -25,13 +25,24 @@ def get(self, domain: str, locale: str, *, request_options: typing.Optional[Requ """ Get translations by locale - Parameters: - - domain: str. The domain you want to retrieve translations for. Only `default` is supported at the moment + Parameters + ---------- + domain : str + The domain you want to retrieve translations for. Only `default` is supported at the moment - - locale: str. The locale you want to retrieve the translations for + locale : str + The locale you want to retrieve the translations for - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + .po file translation content + + Examples + -------- from courier.client import Courier client = Courier( @@ -43,8 +54,8 @@ def get(self, domain: str, locale: str, *, request_options: typing.Optional[Requ ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"translations/{jsonable_encoder(domain)}/{jsonable_encoder(locale)}", ), @@ -81,15 +92,25 @@ def update( """ Update a translation - Parameters: - - domain: str. The domain you want to retrieve translations for. Only `default` is supported at the moment + Parameters + ---------- + domain : str + The domain you want to retrieve translations for. Only `default` is supported at the moment + + locale : str + The locale you want to retrieve the translations for + + request : str - - locale: str. The locale you want to retrieve the translations for + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request: str. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -102,8 +123,8 @@ def update( ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"translations/{jsonable_encoder(domain)}/{jsonable_encoder(locale)}", ), @@ -144,13 +165,24 @@ async def get(self, domain: str, locale: str, *, request_options: typing.Optiona """ Get translations by locale - Parameters: - - domain: str. The domain you want to retrieve translations for. Only `default` is supported at the moment + Parameters + ---------- + domain : str + The domain you want to retrieve translations for. Only `default` is supported at the moment - - locale: str. The locale you want to retrieve the translations for + locale : str + The locale you want to retrieve the translations for - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + str + .po file translation content + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -162,8 +194,8 @@ async def get(self, domain: str, locale: str, *, request_options: typing.Optiona ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"translations/{jsonable_encoder(domain)}/{jsonable_encoder(locale)}", ), @@ -200,15 +232,25 @@ async def update( """ Update a translation - Parameters: - - domain: str. The domain you want to retrieve translations for. Only `default` is supported at the moment + Parameters + ---------- + domain : str + The domain you want to retrieve translations for. Only `default` is supported at the moment + + locale : str + The locale you want to retrieve the translations for + + request : str - - locale: str. The locale you want to retrieve the translations for + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request: str. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -221,8 +263,8 @@ async def update( ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"translations/{jsonable_encoder(domain)}/{jsonable_encoder(locale)}", ), diff --git a/src/courier/users/preferences/client.py b/src/courier/users/preferences/client.py index fdc8f07..4f9d1fb 100644 --- a/src/courier/users/preferences/client.py +++ b/src/courier/users/preferences/client.py @@ -33,11 +33,20 @@ def list( """ Fetch all user preferences. - Parameters: - - user_id: str. A unique identifier associated with the user whose preferences you wish to retrieve. + Parameters + ---------- + user_id : str + A unique identifier associated with the user whose preferences you wish to retrieve. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserPreferencesListResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -48,8 +57,8 @@ def list( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/preferences" ), params=jsonable_encoder( @@ -85,13 +94,23 @@ def get( """ Fetch user preferences for a specific subscription topic. - Parameters: - - user_id: str. A unique identifier associated with the user whose preferences you wish to retrieve. + Parameters + ---------- + user_id : str + A unique identifier associated with the user whose preferences you wish to retrieve. + + topic_id : str + A unique identifier associated with a subscription topic. - - topic_id: str. A unique identifier associated with a subscription topic. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + UserPreferencesGetResponse + + Examples + -------- from courier.client import Courier client = Courier( @@ -103,8 +122,8 @@ def get( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/preferences/{jsonable_encoder(topic_id)}", ), @@ -146,15 +165,25 @@ def update( """ Update or Create user preferences for a specific subscription topic. - Parameters: - - user_id: str. A unique identifier associated with the user whose preferences you wish to retrieve. + Parameters + ---------- + user_id : str + A unique identifier associated with the user whose preferences you wish to retrieve. + + topic_id : str + A unique identifier associated with a subscription topic. + + topic : TopicPreferenceUpdate - - topic_id: str. A unique identifier associated with a subscription topic. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - topic: TopicPreferenceUpdate. + Returns + ------- + UserPreferencesUpdateResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier from courier.users import TopicPreferenceUpdate @@ -172,8 +201,8 @@ def update( ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/preferences/{jsonable_encoder(topic_id)}", ), @@ -221,11 +250,20 @@ async def list( """ Fetch all user preferences. - Parameters: - - user_id: str. A unique identifier associated with the user whose preferences you wish to retrieve. + Parameters + ---------- + user_id : str + A unique identifier associated with the user whose preferences you wish to retrieve. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + UserPreferencesListResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -236,8 +274,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/preferences" ), params=jsonable_encoder( @@ -273,13 +311,23 @@ async def get( """ Fetch user preferences for a specific subscription topic. - Parameters: - - user_id: str. A unique identifier associated with the user whose preferences you wish to retrieve. + Parameters + ---------- + user_id : str + A unique identifier associated with the user whose preferences you wish to retrieve. + + topic_id : str + A unique identifier associated with a subscription topic. - - topic_id: str. A unique identifier associated with a subscription topic. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + UserPreferencesGetResponse + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -291,8 +339,8 @@ async def get( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/preferences/{jsonable_encoder(topic_id)}", ), @@ -334,15 +382,25 @@ async def update( """ Update or Create user preferences for a specific subscription topic. - Parameters: - - user_id: str. A unique identifier associated with the user whose preferences you wish to retrieve. + Parameters + ---------- + user_id : str + A unique identifier associated with the user whose preferences you wish to retrieve. + + topic_id : str + A unique identifier associated with a subscription topic. + + topic : TopicPreferenceUpdate - - topic_id: str. A unique identifier associated with a subscription topic. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - topic: TopicPreferenceUpdate. + Returns + ------- + UserPreferencesUpdateResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier from courier.users import TopicPreferenceUpdate @@ -360,8 +418,8 @@ async def update( ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/preferences/{jsonable_encoder(topic_id)}", ), diff --git a/src/courier/users/tenants/client.py b/src/courier/users/tenants/client.py index 8a4e370..996a485 100644 --- a/src/courier/users/tenants/client.py +++ b/src/courier/users/tenants/client.py @@ -11,7 +11,6 @@ from ...core.pydantic_utilities import pydantic_v1 from ...core.remove_none_from_dict import remove_none_from_dict from ...core.request_options import RequestOptions -from .types.add_user_to_single_tenants_params_profile import AddUserToSingleTenantsParamsProfile from .types.list_tenants_for_user_response import ListTenantsForUserResponse # this is used as the default value for optional parameters @@ -36,13 +35,22 @@ def add_multple( This profile will be merged with the user's main profile when sending to the user with that tenant. - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. - - tenants: typing.Sequence[UserTenantAssociation]. + tenants : typing.Sequence[UserTenantAssociation] - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- from courier import UserTenantAssociation from courier.client import Courier @@ -62,8 +70,8 @@ def add_multple( ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants" ), params=jsonable_encoder( @@ -102,7 +110,7 @@ def add( user_id: str, tenant_id: str, *, - profile: AddUserToSingleTenantsParamsProfile, + profile: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> None: """ @@ -112,17 +120,26 @@ def add( This profile will be merged with the user's main profile when sending to the user with that tenant. - Parameters: - - user_id: str. Id of the user to be added to the supplied tenant. + Parameters + ---------- + user_id : str + Id of the user to be added to the supplied tenant. + + tenant_id : str + Id of the tenant the user should be added to. - - tenant_id: str. Id of the tenant the user should be added to. + profile : typing.Optional[typing.Dict[str, typing.Any]] - - profile: AddUserToSingleTenantsParamsProfile. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import Courier - from courier.users import AddUserToSingleTenantsParamsProfile client = Courier( authorization_token="YOUR_AUTHORIZATION_TOKEN", @@ -130,28 +147,25 @@ def add( client.users.tenants.add( user_id="string", tenant_id="string", - profile=AddUserToSingleTenantsParamsProfile( - title="string", - email="string", - phone_number="string", - locale="string", - additional_fields={"string": {"key": "value"}}, - ), + profile={"string": {"key": "value"}}, ) """ + _request: typing.Dict[str, typing.Any] = {} + if profile is not OMIT: + _request["profile"] = profile _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants/{jsonable_encoder(tenant_id)}", ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), - json=jsonable_encoder({"profile": profile}) + json=jsonable_encoder(_request) if request_options is None or request_options.get("additional_body_parameters") is None else { - **jsonable_encoder({"profile": profile}), + **jsonable_encoder(_request), **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), }, headers=jsonable_encoder( @@ -180,11 +194,20 @@ def remove_all(self, user_id: str, *, request_options: typing.Optional[RequestOp """ Removes a user from any tenants they may have been associated with. - Parameters: - - user_id: str. Id of the user to be removed from the supplied tenant. + Parameters + ---------- + user_id : str + Id of the user to be removed from the supplied tenant. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import Courier client = Courier( @@ -195,8 +218,8 @@ def remove_all(self, user_id: str, *, request_options: typing.Optional[RequestOp ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants" ), params=jsonable_encoder( @@ -228,13 +251,23 @@ def remove(self, user_id: str, tenant_id: str, *, request_options: typing.Option """ Removes a user from the supplied tenant. - Parameters: - - user_id: str. Id of the user to be removed from the supplied tenant. + Parameters + ---------- + user_id : str + Id of the user to be removed from the supplied tenant. + + tenant_id : str + Id of the tenant the user should be removed from. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - tenant_id: str. Id of the tenant the user should be removed from. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -246,8 +279,8 @@ def remove(self, user_id: str, tenant_id: str, *, request_options: typing.Option ) """ _response = self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants/{jsonable_encoder(tenant_id)}", ), @@ -287,15 +320,27 @@ def list( """ Returns a paginated list of user tenant associations. - Parameters: - - user_id: str. Id of the user to retrieve all associated tenants for. + Parameters + ---------- + user_id : str + Id of the user to retrieve all associated tenants for. + + limit : typing.Optional[int] + The number of accounts to return + (defaults to 20, maximum value of 100) + + cursor : typing.Optional[str] + Continue the pagination with the next cursor + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - limit: typing.Optional[int]. The number of accounts to return - (defaults to 20, maximum value of 100) - - cursor: typing.Optional[str]. Continue the pagination with the next cursor + Returns + ------- + ListTenantsForUserResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -308,8 +353,8 @@ def list( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants" ), params=jsonable_encoder( @@ -366,13 +411,22 @@ async def add_multple( This profile will be merged with the user's main profile when sending to the user with that tenant. - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. - - tenants: typing.Sequence[UserTenantAssociation]. + tenants : typing.Sequence[UserTenantAssociation] - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- from courier import UserTenantAssociation from courier.client import AsyncCourier @@ -392,8 +446,8 @@ async def add_multple( ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants" ), params=jsonable_encoder( @@ -432,7 +486,7 @@ async def add( user_id: str, tenant_id: str, *, - profile: AddUserToSingleTenantsParamsProfile, + profile: typing.Optional[typing.Dict[str, typing.Any]] = OMIT, request_options: typing.Optional[RequestOptions] = None, ) -> None: """ @@ -442,17 +496,26 @@ async def add( This profile will be merged with the user's main profile when sending to the user with that tenant. - Parameters: - - user_id: str. Id of the user to be added to the supplied tenant. + Parameters + ---------- + user_id : str + Id of the user to be added to the supplied tenant. + + tenant_id : str + Id of the tenant the user should be added to. - - tenant_id: str. Id of the tenant the user should be added to. + profile : typing.Optional[typing.Dict[str, typing.Any]] - - profile: AddUserToSingleTenantsParamsProfile. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import AsyncCourier - from courier.users import AddUserToSingleTenantsParamsProfile client = AsyncCourier( authorization_token="YOUR_AUTHORIZATION_TOKEN", @@ -460,28 +523,25 @@ async def add( await client.users.tenants.add( user_id="string", tenant_id="string", - profile=AddUserToSingleTenantsParamsProfile( - title="string", - email="string", - phone_number="string", - locale="string", - additional_fields={"string": {"key": "value"}}, - ), + profile={"string": {"key": "value"}}, ) """ + _request: typing.Dict[str, typing.Any] = {} + if profile is not OMIT: + _request["profile"] = profile _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants/{jsonable_encoder(tenant_id)}", ), params=jsonable_encoder( request_options.get("additional_query_parameters") if request_options is not None else None ), - json=jsonable_encoder({"profile": profile}) + json=jsonable_encoder(_request) if request_options is None or request_options.get("additional_body_parameters") is None else { - **jsonable_encoder({"profile": profile}), + **jsonable_encoder(_request), **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))), }, headers=jsonable_encoder( @@ -510,11 +570,20 @@ async def remove_all(self, user_id: str, *, request_options: typing.Optional[Req """ Removes a user from any tenants they may have been associated with. - Parameters: - - user_id: str. Id of the user to be removed from the supplied tenant. + Parameters + ---------- + user_id : str + Id of the user to be removed from the supplied tenant. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -525,8 +594,8 @@ async def remove_all(self, user_id: str, *, request_options: typing.Optional[Req ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants" ), params=jsonable_encoder( @@ -560,13 +629,23 @@ async def remove( """ Removes a user from the supplied tenant. - Parameters: - - user_id: str. Id of the user to be removed from the supplied tenant. + Parameters + ---------- + user_id : str + Id of the user to be removed from the supplied tenant. + + tenant_id : str + Id of the tenant the user should be removed from. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - tenant_id: str. Id of the tenant the user should be removed from. + Returns + ------- + None - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -578,8 +657,8 @@ async def remove( ) """ _response = await self._client_wrapper.httpx_client.request( - "DELETE", - urllib.parse.urljoin( + method="DELETE", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants/{jsonable_encoder(tenant_id)}", ), @@ -619,15 +698,27 @@ async def list( """ Returns a paginated list of user tenant associations. - Parameters: - - user_id: str. Id of the user to retrieve all associated tenants for. + Parameters + ---------- + user_id : str + Id of the user to retrieve all associated tenants for. + + limit : typing.Optional[int] + The number of accounts to return + (defaults to 20, maximum value of 100) + + cursor : typing.Optional[str] + Continue the pagination with the next cursor + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - limit: typing.Optional[int]. The number of accounts to return - (defaults to 20, maximum value of 100) - - cursor: typing.Optional[str]. Continue the pagination with the next cursor + Returns + ------- + ListTenantsForUserResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -640,8 +731,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tenants" ), params=jsonable_encoder( diff --git a/src/courier/users/tenants/types/add_user_to_single_tenants_params_profile.py b/src/courier/users/tenants/types/add_user_to_single_tenants_params_profile.py index edbc8da..d1458f4 100644 --- a/src/courier/users/tenants/types/add_user_to_single_tenants_params_profile.py +++ b/src/courier/users/tenants/types/add_user_to_single_tenants_params_profile.py @@ -8,6 +8,10 @@ class AddUserToSingleTenantsParamsProfile(pydantic_v1.BaseModel): + """ + AddUserToSingleTenantsParamsProfile is no longer used for Add a User to a Single Tenant + """ + title: str email: str = pydantic_v1.Field() """ diff --git a/src/courier/users/tokens/client.py b/src/courier/users/tokens/client.py index 5198df9..97230a6 100644 --- a/src/courier/users/tokens/client.py +++ b/src/courier/users/tokens/client.py @@ -29,11 +29,20 @@ def add_multiple(self, user_id: str, *, request_options: typing.Optional[Request """ Adds multiple tokens to a user and overwrites matching existing tokens. - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- from courier.client import Courier client = Courier( @@ -44,8 +53,8 @@ def add_multiple(self, user_id: str, *, request_options: typing.Optional[Request ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens" ), params=jsonable_encoder( @@ -84,15 +93,25 @@ def add( """ Adds a single token to a user and overwrites a matching existing token. - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. + + token : str + The full token string. - - token: str. The full token string. + request : UserToken - - request: UserToken. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import Courier from courier.users import Device, Tracking, UserToken @@ -125,8 +144,8 @@ def add( ) """ _response = self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens/{jsonable_encoder(token)}", ), @@ -174,15 +193,25 @@ def update( """ Apply a JSON Patch (RFC 6902) to the specified token. - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. + + token : str + The full token string. - - token: str. The full token string. + request : PatchUserTokenOpts - - request: PatchUserTokenOpts. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import Courier from courier.users import PatchOperation, PatchUserTokenOpts @@ -198,8 +227,8 @@ def update( ) """ _response = self._client_wrapper.httpx_client.request( - "PATCH", - urllib.parse.urljoin( + method="PATCH", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens/{jsonable_encoder(token)}", ), @@ -242,13 +271,23 @@ def get( """ Get single token available for a `:token` - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. + + token : str + The full token string. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - token: str. The full token string. + Returns + ------- + GetUserTokenResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -260,8 +299,8 @@ def get( ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens/{jsonable_encoder(token)}", ), @@ -296,11 +335,20 @@ def list(self, user_id: str, *, request_options: typing.Optional[RequestOptions] """ Gets all tokens available for a :user_id - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAllTokensResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import Courier client = Courier( @@ -311,8 +359,8 @@ def list(self, user_id: str, *, request_options: typing.Optional[RequestOptions] ) """ _response = self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens" ), params=jsonable_encoder( @@ -351,11 +399,20 @@ async def add_multiple(self, user_id: str, *, request_options: typing.Optional[R """ Adds multiple tokens to a user and overwrites matching existing tokens. - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + None + + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -366,8 +423,8 @@ async def add_multiple(self, user_id: str, *, request_options: typing.Optional[R ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens" ), params=jsonable_encoder( @@ -406,15 +463,25 @@ async def add( """ Adds a single token to a user and overwrites a matching existing token. - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. + + token : str + The full token string. - - token: str. The full token string. + request : UserToken - - request: UserToken. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import AsyncCourier from courier.users import Device, Tracking, UserToken @@ -447,8 +514,8 @@ async def add( ) """ _response = await self._client_wrapper.httpx_client.request( - "PUT", - urllib.parse.urljoin( + method="PUT", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens/{jsonable_encoder(token)}", ), @@ -496,15 +563,25 @@ async def update( """ Apply a JSON Patch (RFC 6902) to the specified token. - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. + + token : str + The full token string. - - token: str. The full token string. + request : PatchUserTokenOpts - - request: PatchUserTokenOpts. + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Returns + ------- + None + + Examples + -------- from courier.client import AsyncCourier from courier.users import PatchOperation, PatchUserTokenOpts @@ -520,8 +597,8 @@ async def update( ) """ _response = await self._client_wrapper.httpx_client.request( - "PATCH", - urllib.parse.urljoin( + method="PATCH", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens/{jsonable_encoder(token)}", ), @@ -564,13 +641,23 @@ async def get( """ Get single token available for a `:token` - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. + + token : str + The full token string. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. - - token: str. The full token string. + Returns + ------- + GetUserTokenResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -582,8 +669,8 @@ async def get( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens/{jsonable_encoder(token)}", ), @@ -620,11 +707,20 @@ async def list( """ Gets all tokens available for a :user_id - Parameters: - - user_id: str. The user's ID. This can be any uniquely identifiable string. + Parameters + ---------- + user_id : str + The user's ID. This can be any uniquely identifiable string. + + request_options : typing.Optional[RequestOptions] + Request-specific configuration. + + Returns + ------- + GetAllTokensResponse - - request_options: typing.Optional[RequestOptions]. Request-specific configuration. - --- + Examples + -------- from courier.client import AsyncCourier client = AsyncCourier( @@ -635,8 +731,8 @@ async def list( ) """ _response = await self._client_wrapper.httpx_client.request( - "GET", - urllib.parse.urljoin( + method="GET", + url=urllib.parse.urljoin( f"{self._client_wrapper.get_base_url()}/", f"users/{jsonable_encoder(user_id)}/tokens" ), params=jsonable_encoder(