diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index ac9a2e75218..55d20255c90 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -6,4 +6,4 @@ USER vscode RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash ENV PATH=/home/vscode/.rye/shims:$PATH -RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc +RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bbeb30b148c..c17fdc169fc 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,6 +24,9 @@ } } } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": {} } // Features to add to the dev container. More info: https://containers.dev/features. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8463e3a020..835c7af1ead 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,6 +35,7 @@ jobs: - name: Run lints run: ./scripts/lint + test: name: test runs-on: ubuntu-latest @@ -56,6 +57,7 @@ jobs: - name: Run tests run: ./scripts/test + examples: name: examples runs-on: ubuntu-latest diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 127ac87b532..8e76abb5c08 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.0.0" + ".": "5.0.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 0858e86c2f0..95503a16083 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1493 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3d78f855257b55bbb80884f99c3802cae877968d140eed3557fcb2cdd5f937b3.yml +configured_endpoints: 1570 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9058a9acdb217b68158480c5535c441446cb75f9dc5c5ade62297645df626656.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 6de0b896cdb..7942a1b7e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,113 @@ # Changelog +## 5.0.0 (2025-02-28) + +Full Changelog: [v4.0.0...v5.0.0](https://github.com/cloudflare/cloudflare-python/compare/v4.0.0...v5.0.0) + +### ⚠ BREAKING CHANGES + +* **tunnels:** move all cloudflared resources into dedicated namespace ([#2453](https://github.com/cloudflare/cloudflare-python/issues/2453)) + +### Features + +* **access:** make `access_requests` singular for model ([#2439](https://github.com/cloudflare/cloudflare-python/issues/2439)) ([493bb1f](https://github.com/cloudflare/cloudflare-python/commit/493bb1fa9c6efac7f594dc400e157c98a6f1117c)) +* **access:** move policy rules into policy namespace ([#2409](https://github.com/cloudflare/cloudflare-python/issues/2409)) ([85d7eb5](https://github.com/cloudflare/cloudflare-python/commit/85d7eb542d11177c190f84e52ddf37c0cf582708)) +* **account_roles:** explicitly configure `page_pagination` for listing ([#2420](https://github.com/cloudflare/cloudflare-python/issues/2420)) ([8e961e7](https://github.com/cloudflare/cloudflare-python/commit/8e961e7d7b30598991f91f202357e43988156d27)) +* **api_token_permission_groups:** define `get` operation for datasources ([#2431](https://github.com/cloudflare/cloudflare-python/issues/2431)) ([246265a](https://github.com/cloudflare/cloudflare-python/commit/246265af453b2d7c9245c1d0c43547e88ee66b3b)) +* **api:** add endpoint mappings ([#2408](https://github.com/cloudflare/cloudflare-python/issues/2408)) ([f7bdce1](https://github.com/cloudflare/cloudflare-python/commit/f7bdce1b005a0a8852135609925655b5fed55dfe)) +* **api:** api update ([#2414](https://github.com/cloudflare/cloudflare-python/issues/2414)) ([1a67458](https://github.com/cloudflare/cloudflare-python/commit/1a674582f44dce9601ad01179004f33cdc5867c2)) +* **api:** api update ([#2419](https://github.com/cloudflare/cloudflare-python/issues/2419)) ([3afdb43](https://github.com/cloudflare/cloudflare-python/commit/3afdb434d79d14fe790f7cb384d4665105b32717)) +* **api:** api update ([#2423](https://github.com/cloudflare/cloudflare-python/issues/2423)) ([7cfc2cd](https://github.com/cloudflare/cloudflare-python/commit/7cfc2cdb78de79a4228985a5ab67d5f8a68d257e)) +* **api:** api update ([#2424](https://github.com/cloudflare/cloudflare-python/issues/2424)) ([a10f15f](https://github.com/cloudflare/cloudflare-python/commit/a10f15f4628b0bed2a06d95571ecf83ed66ab4cc)) +* **api:** api update ([#2426](https://github.com/cloudflare/cloudflare-python/issues/2426)) ([d3f7ffb](https://github.com/cloudflare/cloudflare-python/commit/d3f7ffb9de811101e2a43ea2377e9d8a924c85bc)) +* **api:** api update ([#2429](https://github.com/cloudflare/cloudflare-python/issues/2429)) ([8e3c4b8](https://github.com/cloudflare/cloudflare-python/commit/8e3c4b853a76ea15c4a2da0dd36e85f71e6a9eb2)) +* **api:** api update ([#2430](https://github.com/cloudflare/cloudflare-python/issues/2430)) ([414a9d6](https://github.com/cloudflare/cloudflare-python/commit/414a9d6bf33c0d2b886984742d0b8efbae58ebaa)) +* **api:** api update ([#2433](https://github.com/cloudflare/cloudflare-python/issues/2433)) ([bf55994](https://github.com/cloudflare/cloudflare-python/commit/bf559949de9365e33ad06a4b1721b12979a956fb)) +* **api:** api update ([#2437](https://github.com/cloudflare/cloudflare-python/issues/2437)) ([67f7a8a](https://github.com/cloudflare/cloudflare-python/commit/67f7a8a932995240d3b5b678fbf96e33de345511)) +* **api:** api update ([#2442](https://github.com/cloudflare/cloudflare-python/issues/2442)) ([0378708](https://github.com/cloudflare/cloudflare-python/commit/0378708a90684fe96801bc7ff4bf9f5c0437aeb1)) +* **api:** api update ([#2444](https://github.com/cloudflare/cloudflare-python/issues/2444)) ([898893c](https://github.com/cloudflare/cloudflare-python/commit/898893c52d8a25ea9952e968aa60a1de63d85ea2)) +* **api:** api update ([#2446](https://github.com/cloudflare/cloudflare-python/issues/2446)) ([2a0324d](https://github.com/cloudflare/cloudflare-python/commit/2a0324dd595ebd51ff884829b6a9de9aca54cfbf)) +* **api:** api update ([#2447](https://github.com/cloudflare/cloudflare-python/issues/2447)) ([2516853](https://github.com/cloudflare/cloudflare-python/commit/25168533bf4a9c79b30e3f0e218c663d1a69d31f)) +* **api:** api update ([#2451](https://github.com/cloudflare/cloudflare-python/issues/2451)) ([4af9551](https://github.com/cloudflare/cloudflare-python/commit/4af95514405795d8e6fa108c82619d92db6309f2)) +* **api:** api update ([#2452](https://github.com/cloudflare/cloudflare-python/issues/2452)) ([b35a36d](https://github.com/cloudflare/cloudflare-python/commit/b35a36df6180e6f84c22feff7c2155d57f182e29)) +* **api:** api update ([#2456](https://github.com/cloudflare/cloudflare-python/issues/2456)) ([02c1e4e](https://github.com/cloudflare/cloudflare-python/commit/02c1e4e5d7ba1ee26941188e7d78609db1aeca4e)) +* **api:** api update ([#2458](https://github.com/cloudflare/cloudflare-python/issues/2458)) ([25d39d1](https://github.com/cloudflare/cloudflare-python/commit/25d39d166c1b53443cc678065bf64c2e87816c8c)) +* **api:** api update ([#2459](https://github.com/cloudflare/cloudflare-python/issues/2459)) ([b181496](https://github.com/cloudflare/cloudflare-python/commit/b181496b8bafca60cf86bfb77f33eaa3f4c513cf)) +* **api:** api update ([#2463](https://github.com/cloudflare/cloudflare-python/issues/2463)) ([eae9e64](https://github.com/cloudflare/cloudflare-python/commit/eae9e64f2b06e3d8c83566ae0a2e6c5bb71c882c)) +* **api:** api update ([#2465](https://github.com/cloudflare/cloudflare-python/issues/2465)) ([6996e20](https://github.com/cloudflare/cloudflare-python/commit/6996e2031388497e03b18d5030cf35ef3c179622)) +* **api:** api update ([#2467](https://github.com/cloudflare/cloudflare-python/issues/2467)) ([dfd04b2](https://github.com/cloudflare/cloudflare-python/commit/dfd04b221e66ce4bf146105ea825cb961226bb30)) +* **api:** api update ([#2469](https://github.com/cloudflare/cloudflare-python/issues/2469)) ([f3ea490](https://github.com/cloudflare/cloudflare-python/commit/f3ea490397e12346a0cbdd05f3e4f38f2f986f78)) +* **api:** api update ([#2471](https://github.com/cloudflare/cloudflare-python/issues/2471)) ([cc270fe](https://github.com/cloudflare/cloudflare-python/commit/cc270fe1af958d22adaac6dc223b9abd8cfed508)) +* **api:** api update ([#2472](https://github.com/cloudflare/cloudflare-python/issues/2472)) ([6b81c50](https://github.com/cloudflare/cloudflare-python/commit/6b81c502a95ebe8973614434039e87fbf7c59bcb)) +* **api:** api update ([#2473](https://github.com/cloudflare/cloudflare-python/issues/2473)) ([eb8ac49](https://github.com/cloudflare/cloudflare-python/commit/eb8ac49d7eed6aa5c5a6ff45aaa8b582013976ea)) +* **api:** api update ([#2474](https://github.com/cloudflare/cloudflare-python/issues/2474)) ([f7a03e2](https://github.com/cloudflare/cloudflare-python/commit/f7a03e224765a2162b5f74ab8ea36eef76fa7237)) +* **api:** api update ([#2476](https://github.com/cloudflare/cloudflare-python/issues/2476)) ([48bdd22](https://github.com/cloudflare/cloudflare-python/commit/48bdd220c6b7ab8ea54853cf6ef7862de9e89e56)) +* **api:** api update ([#2477](https://github.com/cloudflare/cloudflare-python/issues/2477)) ([da2ce0d](https://github.com/cloudflare/cloudflare-python/commit/da2ce0dcaf3806da245f6a9b040d8b5d17d992d3)) +* **api:** api update ([#2478](https://github.com/cloudflare/cloudflare-python/issues/2478)) ([94e997a](https://github.com/cloudflare/cloudflare-python/commit/94e997ac4f6ccf4eeb97726f67139790b6477a95)) +* **api:** api update ([#2479](https://github.com/cloudflare/cloudflare-python/issues/2479)) ([b49f05d](https://github.com/cloudflare/cloudflare-python/commit/b49f05d2186c4166171570236b639f7e77aabd2e)) +* **api:** api update ([#2480](https://github.com/cloudflare/cloudflare-python/issues/2480)) ([b27f1bb](https://github.com/cloudflare/cloudflare-python/commit/b27f1bbc27264c0fe8ee683052e0b698deb91a58)) +* **api:** api update ([#2489](https://github.com/cloudflare/cloudflare-python/issues/2489)) ([7f6d335](https://github.com/cloudflare/cloudflare-python/commit/7f6d33530f1cec482662ad53611ef62d63bcad25)) +* **api:** automatic updates ([#2432](https://github.com/cloudflare/cloudflare-python/issues/2432)) ([63e2a26](https://github.com/cloudflare/cloudflare-python/commit/63e2a26275569dbbc89a4d3c10af0dfad91bed69)) +* **api:** enable zero_trust_tunnel_cloudflared_token ([#2449](https://github.com/cloudflare/cloudflare-python/issues/2449)) ([24d88fa](https://github.com/cloudflare/cloudflare-python/commit/24d88fa2564ee9e23c7b8ecd45f5aafae3979077)) +* **api:** manual updates ([#2422](https://github.com/cloudflare/cloudflare-python/issues/2422)) ([daceb2a](https://github.com/cloudflare/cloudflare-python/commit/daceb2abcd78f64aa279d587d71645378907e5fc)) +* **api:** rename browsing_rendering to browser_rendering ([#2488](https://github.com/cloudflare/cloudflare-python/issues/2488)) ([6b3425f](https://github.com/cloudflare/cloudflare-python/commit/6b3425fe978466d1536f77212c4ac36c93aa6105)) +* **api:** update internal path ([#2440](https://github.com/cloudflare/cloudflare-python/issues/2440)) ([0b114b7](https://github.com/cloudflare/cloudflare-python/commit/0b114b79654c03dc0aa430721da83daccd0ada95)) +* **browsing_rendering:** add support for subresources ([#2484](https://github.com/cloudflare/cloudflare-python/issues/2484)) ([6739a41](https://github.com/cloudflare/cloudflare-python/commit/6739a4123bcf82fe58143ac51e69f590be8c1822)) +* **client:** allow passing `NotGiven` for body ([#2468](https://github.com/cloudflare/cloudflare-python/issues/2468)) ([2f6ae57](https://github.com/cloudflare/cloudflare-python/commit/2f6ae57ad759e7aeaf2014cf32b4a09359bec62e)) +* **client:** send `X-Stainless-Read-Timeout` header ([#2428](https://github.com/cloudflare/cloudflare-python/issues/2428)) ([0eb2862](https://github.com/cloudflare/cloudflare-python/commit/0eb2862805155f388df50a96eb2620e279a9dd9a)) +* **connectors:** `telemetry` => `events` ([#2464](https://github.com/cloudflare/cloudflare-python/issues/2464)) ([69b8193](https://github.com/cloudflare/cloudflare-python/commit/69b819359d33b15a8c6cd23c4e58e08d2e2090a0)) +* **connectors:** add `telemetry` and `snapshots` ([#2461](https://github.com/cloudflare/cloudflare-python/issues/2461)) ([83dc1e3](https://github.com/cloudflare/cloudflare-python/commit/83dc1e35373b371458f47e79db768b1d9c092af8)) +* **firewall_rules:** remove duplicated `id` query parameter ([#2462](https://github.com/cloudflare/cloudflare-python/issues/2462)) ([bd30260](https://github.com/cloudflare/cloudflare-python/commit/bd30260cd96b03995766f99bd95a384c72d62cfb)) +* **r2_bucket_event_notification:** add resource and flatten method hierarchy ([#2438](https://github.com/cloudflare/cloudflare-python/issues/2438)) ([62bceb0](https://github.com/cloudflare/cloudflare-python/commit/62bceb0628a4c903d7fd44927a22b7eefcb72b0d)) +* **radar:** add DNS endpoint ([#2487](https://github.com/cloudflare/cloudflare-python/issues/2487)) ([a5d4c51](https://github.com/cloudflare/cloudflare-python/commit/a5d4c51312ec12691f9fa4aa1e5ff3721d927d0a)) +* **roles:** enable correct pagination parameters ([#2441](https://github.com/cloudflare/cloudflare-python/issues/2441)) ([5c34539](https://github.com/cloudflare/cloudflare-python/commit/5c345391421f38d3a1ef6d1c1d6432b07acdc8e7)) +* **subscription:** apply enums for rate_plan.id ([#2421](https://github.com/cloudflare/cloudflare-python/issues/2421)) ([58592dc](https://github.com/cloudflare/cloudflare-python/commit/58592dc11c2927130cf2e637d832fe30ac0f5737)) +* **terraform:** add datasource for `zero_trust_tunnel_cloudflared_token` ([#2427](https://github.com/cloudflare/cloudflare-python/issues/2427)) ([5ee78ee](https://github.com/cloudflare/cloudflare-python/commit/5ee78eec670351783034e8a44cff67787943f715)) +* **tunnels:** move all cloudflared resources into dedicated namespace ([#2453](https://github.com/cloudflare/cloudflare-python/issues/2453)) ([819be80](https://github.com/cloudflare/cloudflare-python/commit/819be808da8e502380bfa110410a08d3458abb82)) +* **vpc_flows:** add token support ([#2485](https://github.com/cloudflare/cloudflare-python/issues/2485)) ([904614f](https://github.com/cloudflare/cloudflare-python/commit/904614f85526fa63f3eee05532f6285c2c5d0cdd)) +* **zaraz:** re-enable resources ([#2460](https://github.com/cloudflare/cloudflare-python/issues/2460)) ([3614d2e](https://github.com/cloudflare/cloudflare-python/commit/3614d2e808b9dbba6910e5c1f5d5a6f31653df9d)) +* **zero_trust:** add subnets ([#2454](https://github.com/cloudflare/cloudflare-python/issues/2454)) ([260750c](https://github.com/cloudflare/cloudflare-python/commit/260750c1c31c6e690638034df62b5aa49e60199c)) + + +### Bug Fixes + +* asyncify on non-asyncio runtimes ([#2450](https://github.com/cloudflare/cloudflare-python/issues/2450)) ([f6a1477](https://github.com/cloudflare/cloudflare-python/commit/f6a1477b8eed665cbcdc1dc08e321908fda787b5)) +* **client:** mark some request bodies as optional ([2f6ae57](https://github.com/cloudflare/cloudflare-python/commit/2f6ae57ad759e7aeaf2014cf32b4a09359bec62e)) +* improve names for conflicting params ([#2425](https://github.com/cloudflare/cloudflare-python/issues/2425)) ([198c3b1](https://github.com/cloudflare/cloudflare-python/commit/198c3b1774e74b5b12469f56c19e3557e9708511)) + + +### Chores + +* change api.md to use accounts_or_zones ([#2455](https://github.com/cloudflare/cloudflare-python/issues/2455)) ([d9a5eb2](https://github.com/cloudflare/cloudflare-python/commit/d9a5eb24b8254343a999d8ba014535b8c7bc235c)) +* **docs:** update client docstring ([#2483](https://github.com/cloudflare/cloudflare-python/issues/2483)) ([e98bd28](https://github.com/cloudflare/cloudflare-python/commit/e98bd2880f1f33083e0ce1e585bcaa635eda4176)) +* fix async helper leaving dangling threads under certain cases ([52fdd79](https://github.com/cloudflare/cloudflare-python/commit/52fdd79beaab4253da16b1345bf96670507558f3)) +* **internal:** add back missing test imports ([35bcfd4](https://github.com/cloudflare/cloudflare-python/commit/35bcfd42354e46fce288b50eb62c684f796743da)) +* **internal:** add missing test dependency ([79bf7c1](https://github.com/cloudflare/cloudflare-python/commit/79bf7c11be2372317931facf2b53d8aadd84d6a3)) +* **internal:** bummp ruff dependency ([#2416](https://github.com/cloudflare/cloudflare-python/issues/2416)) ([99fa876](https://github.com/cloudflare/cloudflare-python/commit/99fa876848bee710678a3759d37a7876f40ea870)) +* **internal:** change default timeout to an int ([#2415](https://github.com/cloudflare/cloudflare-python/issues/2415)) ([312a895](https://github.com/cloudflare/cloudflare-python/commit/312a8959daa72bdf06eae3dc4829760518d8391b)) +* **internal:** codegen related update ([#2413](https://github.com/cloudflare/cloudflare-python/issues/2413)) ([d5baa16](https://github.com/cloudflare/cloudflare-python/commit/d5baa16e614ecf100f10699ce85a53456bcc139c)) +* **internal:** codegen related update ([#2443](https://github.com/cloudflare/cloudflare-python/issues/2443)) ([81783bb](https://github.com/cloudflare/cloudflare-python/commit/81783bbbe83e721ab2a8adf8a730ccc8d53dae4a)) +* **internal:** codegen related update ([#2448](https://github.com/cloudflare/cloudflare-python/issues/2448)) ([2a844c6](https://github.com/cloudflare/cloudflare-python/commit/2a844c61654672122a65a8999262aedb635c37ac)) +* **internal:** codegen related update ([#2457](https://github.com/cloudflare/cloudflare-python/issues/2457)) ([89e9d32](https://github.com/cloudflare/cloudflare-python/commit/89e9d32cbe5e7fb992d367906592b69a2bd696de)) +* **internal:** codegen related update ([#2475](https://github.com/cloudflare/cloudflare-python/issues/2475)) ([329c314](https://github.com/cloudflare/cloudflare-python/commit/329c314d1756618ef5434817f1077173041a0ebc)) +* **internal:** fix devcontainers setup ([#2470](https://github.com/cloudflare/cloudflare-python/issues/2470)) ([0b5ad5f](https://github.com/cloudflare/cloudflare-python/commit/0b5ad5fffc079e14e07c170229c03384f50ac8e8)) +* **internal:** fix path params tests ([#2411](https://github.com/cloudflare/cloudflare-python/issues/2411)) ([be6603f](https://github.com/cloudflare/cloudflare-python/commit/be6603f8021b6d5777cf8365874bb967152abea4)) +* **internal:** fix type traversing dictionary params ([#2434](https://github.com/cloudflare/cloudflare-python/issues/2434)) ([e71215d](https://github.com/cloudflare/cloudflare-python/commit/e71215df8267baee95173c17567919988b3de209)) +* **internal:** mark VPC and PDF as initialisms ([#2486](https://github.com/cloudflare/cloudflare-python/issues/2486)) ([f0b00be](https://github.com/cloudflare/cloudflare-python/commit/f0b00beeebe149cc989e6c398b5f9ccfd2dce33b)) +* **internal:** minor type handling changes ([#2435](https://github.com/cloudflare/cloudflare-python/issues/2435)) ([06e91c3](https://github.com/cloudflare/cloudflare-python/commit/06e91c303666493ccf1134cc64e40db06e064964)) +* **internal:** update client tests ([#2445](https://github.com/cloudflare/cloudflare-python/issues/2445)) ([cb0dfdb](https://github.com/cloudflare/cloudflare-python/commit/cb0dfdba9b05bba9f65758c05721c11b7cef1783)) +* **internal:** use TypeAliasType for type aliases ([#2417](https://github.com/cloudflare/cloudflare-python/issues/2417)) ([48e461a](https://github.com/cloudflare/cloudflare-python/commit/48e461a739ca8ca1c4d3d9ea6e3506a6975e52ed)) +* minor change to tests ([#2436](https://github.com/cloudflare/cloudflare-python/issues/2436)) ([949ab06](https://github.com/cloudflare/cloudflare-python/commit/949ab067065bc75ab9e782f54fd8bed9410634ac)) +* revert request tracers change ([58ced28](https://github.com/cloudflare/cloudflare-python/commit/58ced28ba034cd0a62b730ac8d5c0dacb2f62ea2)) +* **tests:** fix mising password param ([b9ea5e3](https://github.com/cloudflare/cloudflare-python/commit/b9ea5e3c095ac23f00158c364a327f9a2d1d1739)) +* **tests:** fix path params tests ([#2412](https://github.com/cloudflare/cloudflare-python/issues/2412)) ([de03087](https://github.com/cloudflare/cloudflare-python/commit/de030875ea811e7372f31c602bea8d7191f3728d)) +* **types:** fix ApplicationPolicy imports ([1767baf](https://github.com/cloudflare/cloudflare-python/commit/1767baf17fe0f4e11c24f039de9c9044fcb3c894)) + + +### Documentation + +* update URLs from stainlessapi.com to stainless.com ([#2481](https://github.com/cloudflare/cloudflare-python/issues/2481)) ([fe98b1d](https://github.com/cloudflare/cloudflare-python/commit/fe98b1da5bed21d62ff14cb1c84f8f89da4a03ac)) + ## 4.0.0 (2025-01-13) Full Changelog: [v3.1.1...v4.0.0](https://github.com/cloudflare/cloudflare-python/compare/v3.1.1...v4.0.0) diff --git a/README.md b/README.md index ca473229f1c..3f6263c150d 100644 --- a/README.md +++ b/README.md @@ -142,6 +142,25 @@ for account in first_page.result: # Remove `await` for non-async usage. ``` +## File uploads + +Request parameters that correspond to file uploads can be passed as `bytes`, a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. + +```python +from pathlib import Path +from cloudflare import Cloudflare + +client = Cloudflare() + +client.api_gateway.user_schemas.create( + zone_id="023e105f4ecef8ad9ca31a8372d0c353", + file=Path("/path/to/file"), + kind="openapi_v3", +) +``` + +The async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically. + ## Handling errors When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `cloudflare.APIConnectionError` is raised. diff --git a/SECURITY.md b/SECURITY.md index f04da23d126..0735c892994 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,3 +1,3 @@ # Reporting Security Vulnerabilities -Please see [this page](https://www.cloudflare.com/.well-known/security.txt) for information on how to report a vulnerability to Cloudflare. Thanks! \ No newline at end of file +Please see [this page](https://www.cloudflare.com/.well-known/security.txt) for information on how to report a vulnerability to Cloudflare. Thanks! diff --git a/api.md b/api.md index 05082cde748..df93e4c39e6 100644 --- a/api.md +++ b/api.md @@ -65,7 +65,7 @@ Methods: Methods: -- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[Role] +- client.accounts.roles.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Role] - client.accounts.roles.get(role_id, \*, account_id) -> Optional[Role] ## Subscriptions @@ -77,7 +77,6 @@ from cloudflare.types.accounts import ( SubscriptionCreateResponse, SubscriptionUpdateResponse, SubscriptionDeleteResponse, - SubscriptionGetResponse, ) ``` @@ -86,7 +85,7 @@ Methods: - client.accounts.subscriptions.create(\*, account_id, \*\*params) -> SubscriptionCreateResponse - client.accounts.subscriptions.update(subscription_identifier, \*, account_id, \*\*params) -> SubscriptionUpdateResponse - client.accounts.subscriptions.delete(subscription_identifier, \*, account_id) -> SubscriptionDeleteResponse -- client.accounts.subscriptions.get(\*, account_id) -> Optional[SubscriptionGetResponse] +- client.accounts.subscriptions.get(\*, account_id) -> SyncSinglePage[Subscription] ## Tokens @@ -110,12 +109,13 @@ Methods: Types: ```python -from cloudflare.types.accounts.tokens import PermissionGroupListResponse +from cloudflare.types.accounts.tokens import PermissionGroupListResponse, PermissionGroupGetResponse ``` Methods: -- client.accounts.tokens.permission_groups.list(\*, account_id) -> SyncSinglePage[object] +- client.accounts.tokens.permission_groups.list(\*, account_id) -> SyncSinglePage[PermissionGroupListResponse] +- client.accounts.tokens.permission_groups.get(\*, account_id) -> SyncSinglePage[PermissionGroupGetResponse] ### Value @@ -265,18 +265,14 @@ Methods: Types: ```python -from cloudflare.types.user import ( - SubscriptionUpdateResponse, - SubscriptionDeleteResponse, - SubscriptionGetResponse, -) +from cloudflare.types.user import SubscriptionUpdateResponse, SubscriptionDeleteResponse ``` Methods: - client.user.subscriptions.update(identifier, \*\*params) -> SubscriptionUpdateResponse - client.user.subscriptions.delete(identifier) -> SubscriptionDeleteResponse -- client.user.subscriptions.get() -> Optional[SubscriptionGetResponse] +- client.user.subscriptions.get() -> SyncSinglePage[Subscription] ## Tokens @@ -305,7 +301,7 @@ from cloudflare.types.user.tokens import PermissionGroupListResponse Methods: -- client.user.tokens.permission_groups.list() -> SyncSinglePage[object] +- client.user.tokens.permission_groups.list() -> SyncSinglePage[PermissionGroupListResponse] ### Value @@ -417,7 +413,7 @@ from cloudflare.types.zones import CustomNameserverUpdateResponse, CustomNameser Methods: -- client.zones.custom_nameservers.update(\*, zone_id, \*\*params) -> Optional[CustomNameserverUpdateResponse] +- client.zones.custom_nameservers.update(\*, zone_id, \*\*params) -> SyncSinglePage[CustomNameserverUpdateResponse] - client.zones.custom_nameservers.get(\*, zone_id) -> CustomNameserverGetResponse ## Holds @@ -476,7 +472,7 @@ from cloudflare.types.zones import RatePlanGetResponse Methods: -- client.zones.rate_plans.get(\*, zone_id) -> Optional[RatePlanGetResponse] +- client.zones.rate_plans.get(\*, zone_id) -> SyncSinglePage[RatePlanGetResponse] # LoadBalancers @@ -553,14 +549,14 @@ from cloudflare.types.load_balancers.monitors import ReferenceGetResponse Methods: -- client.load_balancers.monitors.references.get(monitor_id, \*, account_id) -> ReferenceGetResponse +- client.load_balancers.monitors.references.get(monitor_id, \*, account_id) -> SyncSinglePage[ReferenceGetResponse] ## Pools Types: ```python -from cloudflare.types.load_balancers import Pool, PoolDeleteResponse, PoolBulkEditResponse +from cloudflare.types.load_balancers import Pool, PoolDeleteResponse ``` Methods: @@ -569,7 +565,7 @@ Methods: - client.load_balancers.pools.update(pool_id, \*, account_id, \*\*params) -> Pool - client.load_balancers.pools.list(\*, account_id, \*\*params) -> SyncSinglePage[Pool] - client.load_balancers.pools.delete(pool_id, \*, account_id) -> PoolDeleteResponse -- client.load_balancers.pools.bulk_edit(\*, account_id, \*\*params) -> PoolBulkEditResponse +- client.load_balancers.pools.bulk_edit(\*, account_id, \*\*params) -> SyncSinglePage[Pool] - client.load_balancers.pools.edit(pool_id, \*, account_id, \*\*params) -> Pool - client.load_balancers.pools.get(pool_id, \*, account_id) -> Pool @@ -596,7 +592,7 @@ from cloudflare.types.load_balancers.pools import ReferenceGetResponse Methods: -- client.load_balancers.pools.references.get(pool_id, \*, account_id) -> ReferenceGetResponse +- client.load_balancers.pools.references.get(pool_id, \*, account_id) -> SyncSinglePage[ReferenceGetResponse] ## Previews @@ -628,12 +624,12 @@ Methods: Types: ```python -from cloudflare.types.load_balancers import SearchGetResponse +from cloudflare.types.load_balancers import SearchListResponse ``` Methods: -- client.load_balancers.searches.get(\*, account_id, \*\*params) -> SearchGetResponse +- client.load_balancers.searches.list(\*, account_id, \*\*params) -> SyncV4PagePagination[SearchListResponse] # Cache @@ -786,7 +782,7 @@ from cloudflare.types.ssl import RecommendationGetResponse Methods: -- client.ssl.recommendations.get(zone_identifier) -> Optional[RecommendationGetResponse] +- client.ssl.recommendations.get(\*, zone_id) -> Optional[RecommendationGetResponse] ## Universal @@ -918,15 +914,9 @@ Methods: ## Prioritize -Types: - -```python -from cloudflare.types.custom_certificates import PrioritizeUpdateResponse -``` - Methods: -- client.custom_certificates.prioritize.update(\*, zone_id, \*\*params) -> Optional[PrioritizeUpdateResponse] +- client.custom_certificates.prioritize.update(\*, zone_id, \*\*params) -> SyncSinglePage[CustomCertificate] # CustomHostnames @@ -972,6 +962,24 @@ Methods: - client.custom_hostnames.fallback_origin.delete(\*, zone_id) -> Optional[FallbackOriginDeleteResponse] - client.custom_hostnames.fallback_origin.get(\*, zone_id) -> Optional[FallbackOriginGetResponse] +## CertificatePack + +### Certificates + +Types: + +```python +from cloudflare.types.custom_hostnames.certificate_pack import ( + CertificateUpdateResponse, + CertificateDeleteResponse, +) +``` + +Methods: + +- client.custom_hostnames.certificate_pack.certificates.update(certificate_id, \*, zone_id, custom_hostname_id, certificate_pack_id, \*\*params) -> Optional[CertificateUpdateResponse] +- client.custom_hostnames.certificate_pack.certificates.delete(certificate_id, \*, zone_id, custom_hostname_id, certificate_pack_id) -> CertificateDeleteResponse + # CustomNameservers Types: @@ -981,16 +989,15 @@ from cloudflare.types.custom_nameservers import ( CustomNameserver, CustomNameserverDeleteResponse, CustomNameserverAvailabiltyResponse, - CustomNameserverGetResponse, ) ``` Methods: - client.custom_nameservers.create(\*, account_id, \*\*params) -> Optional[CustomNameserver] -- client.custom_nameservers.delete(custom_ns_id, \*, account_id) -> Optional[CustomNameserverDeleteResponse] -- client.custom_nameservers.availabilty(\*, account_id) -> Optional[CustomNameserverAvailabiltyResponse] -- client.custom_nameservers.get(\*, account_id) -> Optional[CustomNameserverGetResponse] +- client.custom_nameservers.delete(custom_ns_id, \*, account_id) -> SyncSinglePage[CustomNameserverDeleteResponse] +- client.custom_nameservers.availabilty(\*, account_id) -> SyncSinglePage[CustomNameserverAvailabiltyResponse] +- client.custom_nameservers.get(\*, account_id) -> SyncSinglePage[CustomNameserver] # DNSFirewall @@ -1129,8 +1136,8 @@ from cloudflare.types.dns import DNSSetting, SettingEditResponse, SettingGetResp Methods: -- client.dns.settings.edit(\*, account_id, zone_id, \*\*params) -> Optional[SettingEditResponse] -- client.dns.settings.get(\*, account_id, zone_id) -> Optional[SettingGetResponse] +- client.dns.settings.edit(\*, account_id, zone_id, \*\*params) -> Optional[SettingEditResponse] +- client.dns.settings.get(\*, account_id, zone_id) -> Optional[SettingGetResponse] ### Views @@ -1371,8 +1378,8 @@ from cloudflare.types.email_security.investigate import MoveCreateResponse, Move Methods: -- client.email_security.investigate.move.create(postfix_id, \*, account_id, \*\*params) -> MoveCreateResponse -- client.email_security.investigate.move.bulk(\*, account_id, \*\*params) -> MoveBulkResponse +- client.email_security.investigate.move.create(postfix_id, \*, account_id, \*\*params) -> SyncSinglePage[MoveCreateResponse] +- client.email_security.investigate.move.bulk(\*, account_id, \*\*params) -> SyncSinglePage[MoveBulkResponse] ### Reclassify @@ -1396,7 +1403,7 @@ from cloudflare.types.email_security.investigate import ReleaseBulkResponse Methods: -- client.email_security.investigate.release.bulk(\*, account_id, \*\*params) -> ReleaseBulkResponse +- client.email_security.investigate.release.bulk(\*, account_id, \*\*params) -> SyncSinglePage[ReleaseBulkResponse] ## Settings @@ -1462,7 +1469,7 @@ Methods: - client.email_security.settings.domains.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DomainListResponse] - client.email_security.settings.domains.delete(domain_id, \*, account_id) -> DomainDeleteResponse -- client.email_security.settings.domains.bulk_delete(\*, account_id) -> DomainBulkDeleteResponse +- client.email_security.settings.domains.bulk_delete(\*, account_id) -> SyncSinglePage[DomainBulkDeleteResponse] - client.email_security.settings.domains.edit(domain_id, \*, account_id, \*\*params) -> DomainEditResponse - client.email_security.settings.domains.get(domain_id, \*, account_id) -> DomainGetResponse @@ -1541,13 +1548,13 @@ Methods: Types: ```python -from cloudflare.types.email_routing import DNSRecord, DNSDeleteResponse, DNSGetResponse +from cloudflare.types.email_routing import DNSRecord, DNSGetResponse ``` Methods: - client.email_routing.dns.create(\*, zone_id, \*\*params) -> Optional[Settings] -- client.email_routing.dns.delete(\*, zone_id) -> DNSDeleteResponse +- client.email_routing.dns.delete(\*, zone_id) -> SyncSinglePage[DNSRecord] - client.email_routing.dns.edit(\*, zone_id, \*\*params) -> Optional[Settings] - client.email_routing.dns.get(\*, zone_id, \*\*params) -> DNSGetResponse @@ -1605,22 +1612,17 @@ Methods: Types: ```python -from cloudflare.types.filters import ( - FirewallFilter, - FilterCreateResponse, - FilterBulkDeleteResponse, - FilterBulkUpdateResponse, -) +from cloudflare.types.filters import FirewallFilter ``` Methods: -- client.filters.create(\*, zone_id, \*\*params) -> Optional[FilterCreateResponse] +- client.filters.create(\*, zone_id, \*\*params) -> SyncSinglePage[FirewallFilter] - client.filters.update(filter_id, \*, zone_id, \*\*params) -> FirewallFilter - client.filters.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[FirewallFilter] - client.filters.delete(filter_id, \*, zone_id) -> FirewallFilter -- client.filters.bulk_delete(\*, zone_id) -> Optional[FilterBulkDeleteResponse] -- client.filters.bulk_update(\*, zone_id) -> Optional[FilterBulkUpdateResponse] +- client.filters.bulk_delete(\*, zone_id) -> SyncSinglePage[FirewallFilter] +- client.filters.bulk_update(\*, zone_id) -> SyncSinglePage[FirewallFilter] - client.filters.get(filter_id, \*, zone_id) -> FirewallFilter # Firewall @@ -1653,29 +1655,20 @@ Methods: Types: ```python -from cloudflare.types.firewall import ( - DeletedFilter, - FirewallRule, - Product, - RuleCreateResponse, - RuleBulkDeleteResponse, - RuleBulkEditResponse, - RuleBulkUpdateResponse, - RuleEditResponse, -) +from cloudflare.types.firewall import DeletedFilter, FirewallRule, Product ``` Methods: -- client.firewall.rules.create(\*, zone_id, \*\*params) -> Optional[RuleCreateResponse] +- client.firewall.rules.create(\*, zone_id, \*\*params) -> SyncSinglePage[FirewallRule] - client.firewall.rules.update(rule_id, \*, zone_id, \*\*params) -> FirewallRule - client.firewall.rules.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[FirewallRule] - client.firewall.rules.delete(rule_id, \*, zone_id) -> FirewallRule -- client.firewall.rules.bulk_delete(\*, zone_id) -> Optional[RuleBulkDeleteResponse] -- client.firewall.rules.bulk_edit(\*, zone_id, \*\*params) -> Optional[RuleBulkEditResponse] -- client.firewall.rules.bulk_update(\*, zone_id, \*\*params) -> Optional[RuleBulkUpdateResponse] -- client.firewall.rules.edit(rule_id, \*, zone_id) -> Optional[RuleEditResponse] -- client.firewall.rules.get(rule_id, \*, zone_id, \*\*params) -> FirewallRule +- client.firewall.rules.bulk_delete(\*, zone_id) -> SyncSinglePage[FirewallRule] +- client.firewall.rules.bulk_edit(\*, zone_id, \*\*params) -> SyncSinglePage[FirewallRule] +- client.firewall.rules.bulk_update(\*, zone_id, \*\*params) -> SyncSinglePage[FirewallRule] +- client.firewall.rules.edit(rule_id, \*, zone_id) -> SyncSinglePage[FirewallRule] +- client.firewall.rules.get(rule_id, \*, zone_id) -> FirewallRule ## AccessRules @@ -1698,11 +1691,11 @@ from cloudflare.types.firewall import ( Methods: -- client.firewall.access_rules.create(\*, account_id, zone_id, \*\*params) -> AccessRuleCreateResponse -- client.firewall.access_rules.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[AccessRuleListResponse] -- client.firewall.access_rules.delete(rule_id, \*, account_id, zone_id) -> Optional[AccessRuleDeleteResponse] -- client.firewall.access_rules.edit(rule_id, \*, account_id, zone_id, \*\*params) -> AccessRuleEditResponse -- client.firewall.access_rules.get(rule_id, \*, account_id, zone_id) -> AccessRuleGetResponse +- client.firewall.access_rules.create(\*, account_id, zone_id, \*\*params) -> AccessRuleCreateResponse +- client.firewall.access_rules.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[AccessRuleListResponse] +- client.firewall.access_rules.delete(rule_id, \*, account_id, zone_id) -> Optional[AccessRuleDeleteResponse] +- client.firewall.access_rules.edit(rule_id, \*, account_id, zone_id, \*\*params) -> AccessRuleEditResponse +- client.firewall.access_rules.get(rule_id, \*, account_id, zone_id) -> AccessRuleGetResponse ## UARules @@ -1869,32 +1862,26 @@ from cloudflare.types.logpush.datasets import FieldGetResponse Methods: -- client.logpush.datasets.fields.get(dataset_id, \*, account_id, zone_id) -> object +- client.logpush.datasets.fields.get(dataset_id, \*, account_id, zone_id) -> object ### Jobs -Types: - -```python -from cloudflare.types.logpush.datasets import JobGetResponse -``` - Methods: -- client.logpush.datasets.jobs.get(dataset_id, \*, account_id, zone_id) -> Optional[JobGetResponse] +- client.logpush.datasets.jobs.get(dataset_id, \*, account_id, zone_id) -> SyncSinglePage[Optional[LogpushJob]] ## Edge Types: ```python -from cloudflare.types.logpush import InstantLogpushJob, EdgeGetResponse +from cloudflare.types.logpush import InstantLogpushJob ``` Methods: - client.logpush.edge.create(\*, zone_id, \*\*params) -> Optional[InstantLogpushJob] -- client.logpush.edge.get(\*, zone_id) -> Optional[EdgeGetResponse] +- client.logpush.edge.get(\*, zone_id) -> SyncSinglePage[Optional[InstantLogpushJob]] ## Jobs @@ -1906,11 +1893,11 @@ from cloudflare.types.logpush import LogpushJob, OutputOptions, JobDeleteRespons Methods: -- client.logpush.jobs.create(\*, account_id, zone_id, \*\*params) -> Optional[LogpushJob] -- client.logpush.jobs.update(job_id, \*, account_id, zone_id, \*\*params) -> Optional[LogpushJob] -- client.logpush.jobs.list(\*, account_id, zone_id) -> SyncSinglePage[Optional[LogpushJob]] -- client.logpush.jobs.delete(job_id, \*, account_id, zone_id) -> Optional[JobDeleteResponse] -- client.logpush.jobs.get(job_id, \*, account_id, zone_id) -> Optional[LogpushJob] +- client.logpush.jobs.create(\*, account_id, zone_id, \*\*params) -> Optional[LogpushJob] +- client.logpush.jobs.update(job_id, \*, account_id, zone_id, \*\*params) -> Optional[LogpushJob] +- client.logpush.jobs.list(\*, account_id, zone_id) -> SyncSinglePage[Optional[LogpushJob]] +- client.logpush.jobs.delete(job_id, \*, account_id, zone_id) -> Optional[JobDeleteResponse] +- client.logpush.jobs.get(job_id, \*, account_id, zone_id) -> Optional[LogpushJob] ## Ownership @@ -1922,21 +1909,26 @@ from cloudflare.types.logpush import OwnershipValidation, OwnershipCreateRespons Methods: -- client.logpush.ownership.create(\*, account_id, zone_id, \*\*params) -> Optional[OwnershipCreateResponse] -- client.logpush.ownership.validate(\*, account_id, zone_id, \*\*params) -> Optional[OwnershipValidation] +- client.logpush.ownership.create(\*, account_id, zone_id, \*\*params) -> Optional[OwnershipCreateResponse] +- client.logpush.ownership.validate(\*, account_id, zone_id, \*\*params) -> Optional[OwnershipValidation] ## Validate Types: ```python -from cloudflare.types.logpush import ValidateDestinationResponse, ValidateOriginResponse +from cloudflare.types.logpush import ( + ValidateDestinationResponse, + ValidateDestinationExistsResponse, + ValidateOriginResponse, +) ``` Methods: -- client.logpush.validate.destination(\*, account_id, zone_id, \*\*params) -> Optional[ValidateDestinationResponse] -- client.logpush.validate.origin(\*, account_id, zone_id, \*\*params) -> Optional[ValidateOriginResponse] +- client.logpush.validate.destination(\*, account_id, zone_id, \*\*params) -> Optional[ValidateDestinationResponse] +- client.logpush.validate.destination_exists(\*, account_id, zone_id, \*\*params) -> Optional[ValidateDestinationExistsResponse] +- client.logpush.validate.origin(\*, account_id, zone_id, \*\*params) -> Optional[ValidateOriginResponse] # Logs @@ -2038,7 +2030,7 @@ from cloudflare.types.origin_tls_client_auth import AuthenticatedOriginPull, Hos Methods: -- client.origin_tls_client_auth.hostnames.update(\*, zone_id, \*\*params) -> Optional[HostnameUpdateResponse] +- client.origin_tls_client_auth.hostnames.update(\*, zone_id, \*\*params) -> SyncSinglePage[HostnameUpdateResponse] - client.origin_tls_client_auth.hostnames.get(hostname, \*, zone_id) -> Optional[AuthenticatedOriginPull] ### Certificates @@ -2182,23 +2174,16 @@ Methods: Types: ```python -from cloudflare.types.waiting_rooms import ( - WaitingRoomRule, - RuleCreateResponse, - RuleUpdateResponse, - RuleDeleteResponse, - RuleEditResponse, - RuleGetResponse, -) +from cloudflare.types.waiting_rooms import WaitingRoomRule ``` Methods: -- client.waiting_rooms.rules.create(waiting_room_id, \*, zone_id, \*\*params) -> Optional[RuleCreateResponse] -- client.waiting_rooms.rules.update(waiting_room_id, \*, zone_id, \*\*params) -> Optional[RuleUpdateResponse] -- client.waiting_rooms.rules.delete(rule_id, \*, zone_id, waiting_room_id) -> Optional[RuleDeleteResponse] -- client.waiting_rooms.rules.edit(rule_id, \*, zone_id, waiting_room_id, \*\*params) -> Optional[RuleEditResponse] -- client.waiting_rooms.rules.get(waiting_room_id, \*, zone_id) -> Optional[RuleGetResponse] +- client.waiting_rooms.rules.create(waiting_room_id, \*, zone_id, \*\*params) -> SyncSinglePage[WaitingRoomRule] +- client.waiting_rooms.rules.update(waiting_room_id, \*, zone_id, \*\*params) -> SyncSinglePage[WaitingRoomRule] +- client.waiting_rooms.rules.delete(rule_id, \*, zone_id, waiting_room_id) -> SyncSinglePage[WaitingRoomRule] +- client.waiting_rooms.rules.edit(rule_id, \*, zone_id, waiting_room_id, \*\*params) -> SyncSinglePage[WaitingRoomRule] +- client.waiting_rooms.rules.get(waiting_room_id, \*, zone_id) -> SyncSinglePage[WaitingRoomRule] ## Statuses @@ -2618,7 +2603,7 @@ Methods: Types: ```python -from cloudflare.types.queues import Consumer, ConsumerDeleteResponse, ConsumerGetResponse +from cloudflare.types.queues import Consumer, ConsumerDeleteResponse ``` Methods: @@ -2626,7 +2611,7 @@ Methods: - client.queues.consumers.create(queue_id, \*, account_id, \*\*params) -> Optional[Consumer] - client.queues.consumers.update(consumer_id, \*, account_id, queue_id, \*\*params) -> Optional[Consumer] - client.queues.consumers.delete(consumer_id, \*, account_id, queue_id) -> ConsumerDeleteResponse -- client.queues.consumers.get(queue_id, \*, account_id) -> Optional[ConsumerGetResponse] +- client.queues.consumers.get(queue_id, \*, account_id) -> SyncSinglePage[Consumer] ## Messages @@ -2639,7 +2624,7 @@ from cloudflare.types.queues import MessageAckResponse, MessagePullResponse Methods: - client.queues.messages.ack(queue_id, \*, account_id, \*\*params) -> Optional[MessageAckResponse] -- client.queues.messages.pull(queue_id, \*, account_id, \*\*params) -> Optional[MessagePullResponse] +- client.queues.messages.pull(queue_id, \*, account_id, \*\*params) -> SyncSinglePage[MessagePullResponse] # APIGateway @@ -2703,7 +2688,7 @@ Methods: - client.api_gateway.operations.create(\*, zone_id, \*\*params) -> OperationCreateResponse - client.api_gateway.operations.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[OperationListResponse] - client.api_gateway.operations.delete(operation_id, \*, zone_id) -> OperationDeleteResponse -- client.api_gateway.operations.bulk_create(\*, zone_id, \*\*params) -> OperationBulkCreateResponse +- client.api_gateway.operations.bulk_create(\*, zone_id, \*\*params) -> SyncSinglePage[OperationBulkCreateResponse] - client.api_gateway.operations.bulk_delete(\*, zone_id) -> OperationBulkDeleteResponse - client.api_gateway.operations.get(operation_id, \*, zone_id, \*\*params) -> OperationGetResponse @@ -2921,11 +2906,11 @@ from cloudflare.types.rulesets import ( Methods: -- client.rulesets.create(\*, account_id, zone_id, \*\*params) -> RulesetCreateResponse -- client.rulesets.update(ruleset_id, \*, account_id, zone_id, \*\*params) -> RulesetUpdateResponse -- client.rulesets.list(\*, account_id, zone_id) -> SyncSinglePage[RulesetListResponse] -- client.rulesets.delete(ruleset_id, \*, account_id, zone_id) -> None -- client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> RulesetGetResponse +- client.rulesets.create(\*, account_id, zone_id, \*\*params) -> RulesetCreateResponse +- client.rulesets.update(ruleset_id, \*, account_id, zone_id, \*\*params) -> RulesetUpdateResponse +- client.rulesets.list(\*, account_id, zone_id, \*\*params) -> SyncCursorPagination[RulesetListResponse] +- client.rulesets.delete(ruleset_id, \*, account_id, zone_id) -> None +- client.rulesets.get(ruleset_id, \*, account_id, zone_id) -> RulesetGetResponse ## Phases @@ -2937,8 +2922,8 @@ from cloudflare.types.rulesets import PhaseUpdateResponse, PhaseGetResponse Methods: -- client.rulesets.phases.update(ruleset_phase, \*, account_id, zone_id, \*\*params) -> PhaseUpdateResponse -- client.rulesets.phases.get(ruleset_phase, \*, account_id, zone_id) -> PhaseGetResponse +- client.rulesets.phases.update(ruleset_phase, \*, account_id, zone_id, \*\*params) -> PhaseUpdateResponse +- client.rulesets.phases.get(ruleset_phase, \*, account_id, zone_id) -> PhaseGetResponse ### Versions @@ -2950,8 +2935,8 @@ from cloudflare.types.rulesets.phases import VersionListResponse, VersionGetResp Methods: -- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] -- client.rulesets.phases.versions.get(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> VersionGetResponse +- client.rulesets.phases.versions.list(ruleset_phase, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] +- client.rulesets.phases.versions.get(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> VersionGetResponse ## Rules @@ -2986,9 +2971,9 @@ from cloudflare.types.rulesets import ( Methods: -- client.rulesets.rules.create(ruleset_id, \*, account_id, zone_id, \*\*params) -> RuleCreateResponse -- client.rulesets.rules.delete(rule_id, \*, ruleset_id, account_id, zone_id) -> RuleDeleteResponse -- client.rulesets.rules.edit(rule_id, \*, ruleset_id, account_id, zone_id, \*\*params) -> RuleEditResponse +- client.rulesets.rules.create(ruleset_id, \*, account_id, zone_id, \*\*params) -> RuleCreateResponse +- client.rulesets.rules.delete(rule_id, \*, ruleset_id, account_id, zone_id) -> RuleDeleteResponse +- client.rulesets.rules.edit(rule_id, \*, ruleset_id, account_id, zone_id, \*\*params) -> RuleEditResponse ## Versions @@ -3000,9 +2985,9 @@ from cloudflare.types.rulesets import VersionListResponse, VersionGetResponse Methods: -- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] -- client.rulesets.versions.delete(ruleset_version, \*, ruleset_id, account_id, zone_id) -> None -- client.rulesets.versions.get(ruleset_version, \*, ruleset_id, account_id, zone_id) -> VersionGetResponse +- client.rulesets.versions.list(ruleset_id, \*, account_id, zone_id) -> SyncSinglePage[VersionListResponse] +- client.rulesets.versions.delete(ruleset_version, \*, ruleset_id, account_id, zone_id) -> None +- client.rulesets.versions.get(ruleset_version, \*, ruleset_id, account_id, zone_id) -> VersionGetResponse # URLNormalization @@ -3343,12 +3328,12 @@ Methods: Types: ```python -from cloudflare.types.diagnostics import Traceroute, TracerouteCreateResponse +from cloudflare.types.diagnostics import Traceroute ``` Methods: -- client.diagnostics.traceroutes.create(\*, account_id, \*\*params) -> Optional[TracerouteCreateResponse] +- client.diagnostics.traceroutes.create(\*, account_id, \*\*params) -> SyncSinglePage[Traceroute] # Images @@ -3531,12 +3516,12 @@ Methods: Types: ```python -from cloudflare.types.intel import IPList, IPListGetResponse +from cloudflare.types.intel import IPList ``` Methods: -- client.intel.ip_lists.get(\*, account_id) -> Optional[IPListGetResponse] +- client.intel.ip_lists.get(\*, account_id) -> SyncSinglePage[IPList] ## Miscategorizations @@ -3650,7 +3635,7 @@ from cloudflare.types.intel.attack_surface_report import IssueTypeGetResponse Methods: -- client.intel.attack_surface_report.issue_types.get(\*, account_id) -> Optional[IssueTypeGetResponse] +- client.intel.attack_surface_report.issue_types.get(\*, account_id) -> SyncSinglePage[IssueTypeGetResponse] ### Issues @@ -3848,13 +3833,12 @@ from cloudflare.types.magic_transit.sites import ( LANStaticAddressing, Nat, RoutedSubnet, - LANCreateResponse, ) ``` Methods: -- client.magic_transit.sites.lans.create(site_id, \*, account_id, \*\*params) -> LANCreateResponse +- client.magic_transit.sites.lans.create(site_id, \*, account_id, \*\*params) -> SyncSinglePage[LAN] - client.magic_transit.sites.lans.update(lan_id, \*, account_id, site_id, \*\*params) -> LAN - client.magic_transit.sites.lans.list(site_id, \*, account_id) -> SyncSinglePage[LAN] - client.magic_transit.sites.lans.delete(lan_id, \*, account_id, site_id) -> LAN @@ -3866,12 +3850,12 @@ Methods: Types: ```python -from cloudflare.types.magic_transit.sites import WAN, WANStaticAddressing, WANCreateResponse +from cloudflare.types.magic_transit.sites import WAN, WANStaticAddressing ``` Methods: -- client.magic_transit.sites.wans.create(site_id, \*, account_id, \*\*params) -> WANCreateResponse +- client.magic_transit.sites.wans.create(site_id, \*, account_id, \*\*params) -> SyncSinglePage[WAN] - client.magic_transit.sites.wans.update(wan_id, \*, account_id, site_id, \*\*params) -> WAN - client.magic_transit.sites.wans.list(site_id, \*, account_id) -> SyncSinglePage[WAN] - client.magic_transit.sites.wans.delete(wan_id, \*, account_id, site_id) -> WAN @@ -3893,10 +3877,36 @@ from cloudflare.types.magic_transit import ( Methods: -- client.magic_transit.connectors.update(connector_id, \*, account_id, \*\*params) -> ConnectorUpdateResponse -- client.magic_transit.connectors.list(\*, account_id) -> SyncSinglePage[ConnectorListResponse] -- client.magic_transit.connectors.edit(connector_id, \*, account_id, \*\*params) -> ConnectorEditResponse -- client.magic_transit.connectors.get(connector_id, \*, account_id) -> ConnectorGetResponse +- client.magic_transit.connectors.update(connector_id, \*, account_id, \*\*params) -> ConnectorUpdateResponse +- client.magic_transit.connectors.list(\*, account_id) -> SyncSinglePage[ConnectorListResponse] +- client.magic_transit.connectors.edit(connector_id, \*, account_id, \*\*params) -> ConnectorEditResponse +- client.magic_transit.connectors.get(connector_id, \*, account_id) -> ConnectorGetResponse + +### Events + +Types: + +```python +from cloudflare.types.magic_transit.connectors import EventListResponse, EventGetResponse +``` + +Methods: + +- client.magic_transit.connectors.events.list(connector_id, \*, account_id, \*\*params) -> EventListResponse +- client.magic_transit.connectors.events.get(event_n, \*, account_id, connector_id, event_t) -> EventGetResponse + +### Snapshots + +Types: + +```python +from cloudflare.types.magic_transit.connectors import SnapshotListResponse, SnapshotGetResponse +``` + +Methods: + +- client.magic_transit.connectors.snapshots.list(connector_id, \*, account_id, \*\*params) -> SnapshotListResponse +- client.magic_transit.connectors.snapshots.get(snapshot_t, \*, account_id, connector_id) -> SnapshotGetResponse ## PCAPs @@ -3923,14 +3933,14 @@ Methods: Types: ```python -from cloudflare.types.magic_transit.pcaps import Ownership, OwnershipGetResponse +from cloudflare.types.magic_transit.pcaps import Ownership ``` Methods: - client.magic_transit.pcaps.ownership.create(\*, account_id, \*\*params) -> Ownership - client.magic_transit.pcaps.ownership.delete(ownership_id, \*, account_id) -> None -- client.magic_transit.pcaps.ownership.get(\*, account_id) -> Optional[OwnershipGetResponse] +- client.magic_transit.pcaps.ownership.get(\*, account_id) -> SyncSinglePage[Ownership] - client.magic_transit.pcaps.ownership.validate(\*, account_id, \*\*params) -> Ownership ### Download @@ -3941,6 +3951,20 @@ Methods: # MagicNetworkMonitoring +## VPCFlows + +### Tokens + +Types: + +```python +from cloudflare.types.magic_network_monitoring.vpc_flows import TokenCreateResponse +``` + +Methods: + +- client.magic_network_monitoring.vpc_flows.tokens.create(\*, account_id) -> str + ## Configs Types: @@ -3992,6 +4016,77 @@ Methods: - client.magic_network_monitoring.rules.advertisements.edit(rule_id, \*, account_id, \*\*params) -> Optional[Advertisement] +# NetworkInterconnects + +## CNIs + +Types: + +```python +from cloudflare.types.network_interconnects import ( + CNICreateResponse, + CNIUpdateResponse, + CNIListResponse, + CNIGetResponse, +) +``` + +Methods: + +- client.network_interconnects.cnis.create(\*, account_id, \*\*params) -> CNICreateResponse +- client.network_interconnects.cnis.update(cni, \*, account_id, \*\*params) -> CNIUpdateResponse +- client.network_interconnects.cnis.list(\*, account_id, \*\*params) -> CNIListResponse +- client.network_interconnects.cnis.delete(cni, \*, account_id) -> None +- client.network_interconnects.cnis.get(cni, \*, account_id) -> CNIGetResponse + +## Interconnects + +Types: + +```python +from cloudflare.types.network_interconnects import ( + InterconnectCreateResponse, + InterconnectListResponse, + InterconnectGetResponse, + InterconnectStatusResponse, +) +``` + +Methods: + +- client.network_interconnects.interconnects.create(\*, account_id, \*\*params) -> InterconnectCreateResponse +- client.network_interconnects.interconnects.list(\*, account_id, \*\*params) -> InterconnectListResponse +- client.network_interconnects.interconnects.delete(icon, \*, account_id) -> None +- client.network_interconnects.interconnects.get(icon, \*, account_id) -> InterconnectGetResponse +- client.network_interconnects.interconnects.loa(icon, \*, account_id) -> None +- client.network_interconnects.interconnects.status(icon, \*, account_id) -> InterconnectStatusResponse + +## Settings + +Types: + +```python +from cloudflare.types.network_interconnects import SettingUpdateResponse, SettingGetResponse +``` + +Methods: + +- client.network_interconnects.settings.update(\*, account_id, \*\*params) -> SettingUpdateResponse +- client.network_interconnects.settings.get(\*, account_id) -> SettingGetResponse + +## Slots + +Types: + +```python +from cloudflare.types.network_interconnects import SlotListResponse, SlotGetResponse +``` + +Methods: + +- client.network_interconnects.slots.list(\*, account_id, \*\*params) -> SlotListResponse +- client.network_interconnects.slots.get(slot, \*, account_id) -> SlotGetResponse + # MTLSCertificates Types: @@ -4012,12 +4107,12 @@ Methods: Types: ```python -from cloudflare.types.mtls_certificates import CertificateAsssociation, AssociationGetResponse +from cloudflare.types.mtls_certificates import CertificateAsssociation ``` Methods: -- client.mtls_certificates.associations.get(mtls_certificate_id, \*, account_id) -> Optional[AssociationGetResponse] +- client.mtls_certificates.associations.get(mtls_certificate_id, \*, account_id) -> SyncSinglePage[CertificateAsssociation] # Pages @@ -4202,7 +4297,7 @@ Methods: Types: ```python -from cloudflare.types.stream import Audio, AudioTrackDeleteResponse, AudioTrackGetResponse +from cloudflare.types.stream import Audio, AudioTrackDeleteResponse ``` Methods: @@ -4210,7 +4305,7 @@ Methods: - client.stream.audio_tracks.delete(audio_identifier, \*, account_id, identifier) -> str - client.stream.audio_tracks.copy(identifier, \*, account_id, \*\*params) -> Optional[Audio] - client.stream.audio_tracks.edit(audio_identifier, \*, account_id, identifier, \*\*params) -> Optional[Audio] -- client.stream.audio_tracks.get(identifier, \*, account_id) -> Optional[AudioTrackGetResponse] +- client.stream.audio_tracks.get(identifier, \*, account_id) -> SyncSinglePage[Audio] ## Videos @@ -4266,7 +4361,7 @@ Methods: - client.stream.keys.create(\*, account_id, \*\*params) -> Optional[Keys] - client.stream.keys.delete(identifier, \*, account_id) -> str -- client.stream.keys.get(\*, account_id) -> Optional[KeyGetResponse] +- client.stream.keys.get(\*, account_id) -> SyncSinglePage[KeyGetResponse] ## LiveInputs @@ -4333,12 +4428,12 @@ Methods: Types: ```python -from cloudflare.types.stream import Caption, CaptionGetResponse +from cloudflare.types.stream import Caption ``` Methods: -- client.stream.captions.get(identifier, \*, account_id) -> Optional[CaptionGetResponse] +- client.stream.captions.get(identifier, \*, account_id) -> SyncSinglePage[Caption] ### Language @@ -4446,7 +4541,6 @@ from cloudflare.types.alerting.destinations import ( Pagerduty, PagerdutyCreateResponse, PagerdutyDeleteResponse, - PagerdutyGetResponse, PagerdutyLinkResponse, ) ``` @@ -4455,7 +4549,7 @@ Methods: - client.alerting.destinations.pagerduty.create(\*, account_id) -> Optional[PagerdutyCreateResponse] - client.alerting.destinations.pagerduty.delete(\*, account_id) -> PagerdutyDeleteResponse -- client.alerting.destinations.pagerduty.get(\*, account_id) -> Optional[PagerdutyGetResponse] +- client.alerting.destinations.pagerduty.get(\*, account_id) -> SyncSinglePage[Pagerduty] - client.alerting.destinations.pagerduty.link(token_id, \*, account_id) -> Optional[PagerdutyLinkResponse] ### Webhooks @@ -4533,7 +4627,6 @@ from cloudflare.types.d1 import ( DatabaseDeleteResponse, DatabaseExportResponse, DatabaseImportResponse, - DatabaseQueryResponse, DatabaseRawResponse, ) ``` @@ -4546,8 +4639,8 @@ Methods: - client.d1.database.export(database_id, \*, account_id, \*\*params) -> DatabaseExportResponse - client.d1.database.get(database_id, \*, account_id) -> D1 - client.d1.database.import\_(database_id, \*, account_id, \*\*params) -> DatabaseImportResponse -- client.d1.database.query(database_id, \*, account_id, \*\*params) -> DatabaseQueryResponse -- client.d1.database.raw(database_id, \*, account_id, \*\*params) -> DatabaseRawResponse +- client.d1.database.query(database_id, \*, account_id, \*\*params) -> SyncSinglePage[QueryResult] +- client.d1.database.raw(database_id, \*, account_id, \*\*params) -> SyncSinglePage[DatabaseRawResponse] # R2 @@ -4632,33 +4725,46 @@ Methods: ### EventNotifications -#### Configuration +Types: + +```python +from cloudflare.types.r2.buckets import ( + EventNotificationUpdateResponse, + EventNotificationDeleteResponse, + EventNotificationGetResponse, +) +``` + +Methods: + +- client.r2.buckets.event_notifications.update(queue_id, \*, account_id, bucket_name, \*\*params) -> object +- client.r2.buckets.event_notifications.delete(queue_id, \*, account_id, bucket_name) -> object +- client.r2.buckets.event_notifications.get(bucket_name, \*, account_id) -> EventNotificationGetResponse + +### Locks Types: ```python -from cloudflare.types.r2.buckets.event_notifications import ConfigurationGetResponse +from cloudflare.types.r2.buckets import LockUpdateResponse, LockGetResponse ``` Methods: -- client.r2.buckets.event_notifications.configuration.get(bucket_name, \*, account_id) -> ConfigurationGetResponse +- client.r2.buckets.locks.update(bucket_name, \*, account_id, \*\*params) -> object +- client.r2.buckets.locks.get(bucket_name, \*, account_id) -> LockGetResponse -##### Queues +### Metrics Types: ```python -from cloudflare.types.r2.buckets.event_notifications.configuration import ( - QueueUpdateResponse, - QueueDeleteResponse, -) +from cloudflare.types.r2.buckets import MetricListResponse ``` Methods: -- client.r2.buckets.event_notifications.configuration.queues.update(queue_id, \*, account_id, bucket_name, \*\*params) -> object -- client.r2.buckets.event_notifications.configuration.queues.delete(queue_id, \*, account_id, bucket_name) -> object +- client.r2.buckets.metrics.list(\*, account_id) -> MetricListResponse ### Sippy @@ -4771,7 +4877,7 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import B Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> Optional[BindingGetResponse] +- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[BindingGetResponse] ##### Secrets @@ -4806,7 +4912,7 @@ from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import ( Methods: -- client.workers_for_platforms.dispatch.namespaces.scripts.tags.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional[TagUpdateResponse] +- client.workers_for_platforms.dispatch.namespaces.scripts.tags.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SyncSinglePage[TagUpdateResponse] - client.workers_for_platforms.dispatch.namespaces.scripts.tags.list(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[TagListResponse] - client.workers_for_platforms.dispatch.namespaces.scripts.tags.delete(tag, \*, account_id, dispatch_namespace, script_name) -> object @@ -4851,7 +4957,7 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.devices import DeviceNetwork, NetworkDeleteResponse +from cloudflare.types.zero_trust.devices import DeviceNetwork ``` Methods: @@ -4859,7 +4965,7 @@ Methods: - client.zero_trust.devices.networks.create(\*, account_id, \*\*params) -> Optional[DeviceNetwork] - client.zero_trust.devices.networks.update(network_id, \*, account_id, \*\*params) -> Optional[DeviceNetwork] - client.zero_trust.devices.networks.list(\*, account_id) -> SyncSinglePage[DeviceNetwork] -- client.zero_trust.devices.networks.delete(network_id, \*, account_id) -> Optional[NetworkDeleteResponse] +- client.zero_trust.devices.networks.delete(network_id, \*, account_id) -> SyncSinglePage[DeviceNetwork] - client.zero_trust.devices.networks.get(network_id, \*, account_id) -> Optional[DeviceNetwork] ### FleetStatus @@ -4904,51 +5010,24 @@ Methods: ##### Excludes -Types: - -```python -from cloudflare.types.zero_trust.devices.policies.default import ( - ExcludeUpdateResponse, - ExcludeGetResponse, -) -``` - Methods: -- client.zero_trust.devices.policies.default.excludes.update(\*, account_id, \*\*params) -> Optional[ExcludeUpdateResponse] -- client.zero_trust.devices.policies.default.excludes.get(\*, account_id) -> Optional[ExcludeGetResponse] +- client.zero_trust.devices.policies.default.excludes.update(\*, account_id, \*\*params) -> SyncSinglePage[SplitTunnelExclude] +- client.zero_trust.devices.policies.default.excludes.get(\*, account_id) -> SyncSinglePage[SplitTunnelExclude] ##### Includes -Types: - -```python -from cloudflare.types.zero_trust.devices.policies.default import ( - IncludeUpdateResponse, - IncludeGetResponse, -) -``` - Methods: -- client.zero_trust.devices.policies.default.includes.update(\*, account_id, \*\*params) -> Optional[IncludeUpdateResponse] -- client.zero_trust.devices.policies.default.includes.get(\*, account_id) -> Optional[IncludeGetResponse] +- client.zero_trust.devices.policies.default.includes.update(\*, account_id, \*\*params) -> SyncSinglePage[SplitTunnelInclude] +- client.zero_trust.devices.policies.default.includes.get(\*, account_id) -> SyncSinglePage[SplitTunnelInclude] ##### FallbackDomains -Types: - -```python -from cloudflare.types.zero_trust.devices.policies.default import ( - FallbackDomainUpdateResponse, - FallbackDomainGetResponse, -) -``` - Methods: -- client.zero_trust.devices.policies.default.fallback_domains.update(\*, account_id, \*\*params) -> Optional[FallbackDomainUpdateResponse] -- client.zero_trust.devices.policies.default.fallback_domains.get(\*, account_id) -> Optional[FallbackDomainGetResponse] +- client.zero_trust.devices.policies.default.fallback_domains.update(\*, account_id, \*\*params) -> SyncSinglePage[FallbackDomain] +- client.zero_trust.devices.policies.default.fallback_domains.get(\*, account_id) -> SyncSinglePage[FallbackDomain] ##### Certificates @@ -4968,67 +5047,34 @@ Methods: #### Custom -Types: - -```python -from cloudflare.types.zero_trust.devices.policies import CustomDeleteResponse -``` - Methods: - client.zero_trust.devices.policies.custom.create(\*, account_id, \*\*params) -> Optional[SettingsPolicy] - client.zero_trust.devices.policies.custom.list(\*, account_id) -> SyncSinglePage[SettingsPolicy] -- client.zero_trust.devices.policies.custom.delete(policy_id, \*, account_id) -> Optional[CustomDeleteResponse] +- client.zero_trust.devices.policies.custom.delete(policy_id, \*, account_id) -> SyncSinglePage[SettingsPolicy] - client.zero_trust.devices.policies.custom.edit(policy_id, \*, account_id, \*\*params) -> Optional[SettingsPolicy] - client.zero_trust.devices.policies.custom.get(policy_id, \*, account_id) -> Optional[SettingsPolicy] ##### Excludes -Types: - -```python -from cloudflare.types.zero_trust.devices.policies.custom import ( - ExcludeUpdateResponse, - ExcludeGetResponse, -) -``` - Methods: -- client.zero_trust.devices.policies.custom.excludes.update(policy_id, \*, account_id, \*\*params) -> Optional[ExcludeUpdateResponse] -- client.zero_trust.devices.policies.custom.excludes.get(policy_id, \*, account_id) -> Optional[ExcludeGetResponse] +- client.zero_trust.devices.policies.custom.excludes.update(policy_id, \*, account_id, \*\*params) -> SyncSinglePage[SplitTunnelExclude] +- client.zero_trust.devices.policies.custom.excludes.get(policy_id, \*, account_id) -> SyncSinglePage[SplitTunnelExclude] ##### Includes -Types: - -```python -from cloudflare.types.zero_trust.devices.policies.custom import ( - IncludeUpdateResponse, - IncludeGetResponse, -) -``` - Methods: -- client.zero_trust.devices.policies.custom.includes.update(policy_id, \*, account_id, \*\*params) -> Optional[IncludeUpdateResponse] -- client.zero_trust.devices.policies.custom.includes.get(policy_id, \*, account_id) -> Optional[IncludeGetResponse] +- client.zero_trust.devices.policies.custom.includes.update(policy_id, \*, account_id, \*\*params) -> SyncSinglePage[SplitTunnelInclude] +- client.zero_trust.devices.policies.custom.includes.get(policy_id, \*, account_id) -> SyncSinglePage[SplitTunnelInclude] ##### FallbackDomains -Types: - -```python -from cloudflare.types.zero_trust.devices.policies.custom import ( - FallbackDomainUpdateResponse, - FallbackDomainGetResponse, -) -``` - Methods: -- client.zero_trust.devices.policies.custom.fallback_domains.update(policy_id, \*, account_id, \*\*params) -> Optional[FallbackDomainUpdateResponse] -- client.zero_trust.devices.policies.custom.fallback_domains.get(policy_id, \*, account_id) -> Optional[FallbackDomainGetResponse] +- client.zero_trust.devices.policies.custom.fallback_domains.update(policy_id, \*, account_id, \*\*params) -> SyncSinglePage[FallbackDomain] +- client.zero_trust.devices.policies.custom.fallback_domains.get(policy_id, \*, account_id) -> SyncSinglePage[FallbackDomain] ### Posture @@ -5150,11 +5196,25 @@ from cloudflare.types.zero_trust import ( Methods: -- client.zero_trust.identity_providers.create(\*, account_id, zone_id, \*\*params) -> Optional[IdentityProvider] -- client.zero_trust.identity_providers.update(identity_provider_id, \*, account_id, zone_id, \*\*params) -> Optional[IdentityProvider] -- client.zero_trust.identity_providers.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[IdentityProviderListResponse] -- client.zero_trust.identity_providers.delete(identity_provider_id, \*, account_id, zone_id) -> Optional[IdentityProviderDeleteResponse] -- client.zero_trust.identity_providers.get(identity_provider_id, \*, account_id, zone_id) -> Optional[IdentityProvider] +- client.zero_trust.identity_providers.create(\*, account_id, zone_id, \*\*params) -> Optional[IdentityProvider] +- client.zero_trust.identity_providers.update(identity_provider_id, \*, account_id, zone_id, \*\*params) -> Optional[IdentityProvider] +- client.zero_trust.identity_providers.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[IdentityProviderListResponse] +- client.zero_trust.identity_providers.delete(identity_provider_id, \*, account_id, zone_id) -> Optional[IdentityProviderDeleteResponse] +- client.zero_trust.identity_providers.get(identity_provider_id, \*, account_id, zone_id) -> Optional[IdentityProvider] + +### SCIM + +#### Groups + +Methods: + +- client.zero_trust.identity_providers.scim.groups.list(identity_provider_id, \*, account_id, \*\*params) -> SyncSinglePage[ZeroTrustGroup] + +#### Users + +Methods: + +- client.zero_trust.identity_providers.scim.users.list(identity_provider_id, \*, account_id, \*\*params) -> SyncSinglePage[AccessUser] ## Organizations @@ -5166,10 +5226,10 @@ from cloudflare.types.zero_trust import LoginDesign, Organization, OrganizationR Methods: -- client.zero_trust.organizations.create(\*, account_id, zone_id, \*\*params) -> Optional[Organization] -- client.zero_trust.organizations.update(\*, account_id, zone_id, \*\*params) -> Optional[Organization] -- client.zero_trust.organizations.list(\*, account_id, zone_id) -> Optional[Organization] -- client.zero_trust.organizations.revoke_users(\*, account_id, zone_id, \*\*params) -> Optional[OrganizationRevokeUsersResponse] +- client.zero_trust.organizations.create(\*, account_id, zone_id, \*\*params) -> Optional[Organization] +- client.zero_trust.organizations.update(\*, account_id, zone_id, \*\*params) -> Optional[Organization] +- client.zero_trust.organizations.list(\*, account_id, zone_id) -> Optional[Organization] +- client.zero_trust.organizations.revoke_users(\*, account_id, zone_id, \*\*params) -> Optional[OrganizationRevokeUsersResponse] ### DOH @@ -5189,42 +5249,15 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import Seat, SeatEditResponse +from cloudflare.types.zero_trust import Seat ``` Methods: -- client.zero_trust.seats.edit(\*, account_id, \*\*params) -> Optional[SeatEditResponse] +- client.zero_trust.seats.edit(\*, account_id, \*\*params) -> SyncSinglePage[Seat] ## Access -Types: - -```python -from cloudflare.types.zero_trust import ( - AccessDevicePostureRule, - AccessRule, - AnyValidServiceTokenRule, - AuthenticationMethodRule, - AzureGroupRule, - CertificateRule, - CountryRule, - DomainRule, - EmailListRule, - EmailRule, - EveryoneRule, - ExternalEvaluationRule, - GitHubOrganizationRule, - GroupRule, - GSuiteGroupRule, - IPListRule, - IPRule, - OktaGroupRule, - SAMLGroupRule, - ServiceTokenRule, -) -``` - ### GatewayCA Types: @@ -5305,12 +5338,12 @@ from cloudflare.types.zero_trust.access import ( Methods: -- client.zero_trust.access.applications.create(\*, account_id, zone_id, \*\*params) -> Optional[ApplicationCreateResponse] -- client.zero_trust.access.applications.update(app_id, \*, account_id, zone_id, \*\*params) -> Optional[ApplicationUpdateResponse] -- client.zero_trust.access.applications.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[ApplicationListResponse] -- client.zero_trust.access.applications.delete(app_id, \*, account_id, zone_id) -> Optional[ApplicationDeleteResponse] -- client.zero_trust.access.applications.get(app_id, \*, account_id, zone_id) -> Optional[ApplicationGetResponse] -- client.zero_trust.access.applications.revoke_tokens(app_id, \*, account_id, zone_id) -> object +- client.zero_trust.access.applications.create(\*, account_id, zone_id, \*\*params) -> Optional[ApplicationCreateResponse] +- client.zero_trust.access.applications.update(app_id, \*, account_id, zone_id, \*\*params) -> Optional[ApplicationUpdateResponse] +- client.zero_trust.access.applications.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[ApplicationListResponse] +- client.zero_trust.access.applications.delete(app_id, \*, account_id, zone_id) -> Optional[ApplicationDeleteResponse] +- client.zero_trust.access.applications.get(app_id, \*, account_id, zone_id) -> Optional[ApplicationGetResponse] +- client.zero_trust.access.applications.revoke_tokens(app_id, \*, account_id, zone_id) -> object #### CAs @@ -5322,10 +5355,10 @@ from cloudflare.types.zero_trust.access.applications import CA, CADeleteResponse Methods: -- client.zero_trust.access.applications.cas.create(app_id, \*, account_id, zone_id) -> Optional[CA] -- client.zero_trust.access.applications.cas.list(\*, account_id, zone_id) -> SyncSinglePage[CA] -- client.zero_trust.access.applications.cas.delete(app_id, \*, account_id, zone_id) -> Optional[CADeleteResponse] -- client.zero_trust.access.applications.cas.get(app_id, \*, account_id, zone_id) -> Optional[CA] +- client.zero_trust.access.applications.cas.create(app_id, \*, account_id, zone_id) -> Optional[CA] +- client.zero_trust.access.applications.cas.list(\*, account_id, zone_id) -> SyncSinglePage[CA] +- client.zero_trust.access.applications.cas.delete(app_id, \*, account_id, zone_id) -> Optional[CADeleteResponse] +- client.zero_trust.access.applications.cas.get(app_id, \*, account_id, zone_id) -> Optional[CA] #### UserPolicyChecks @@ -5340,7 +5373,7 @@ from cloudflare.types.zero_trust.access.applications import ( Methods: -- client.zero_trust.access.applications.user_policy_checks.list(app_id, \*, account_id, zone_id) -> Optional[UserPolicyCheckListResponse] +- client.zero_trust.access.applications.user_policy_checks.list(app_id, \*, account_id, zone_id) -> Optional[UserPolicyCheckListResponse] #### Policies @@ -5348,6 +5381,26 @@ Types: ```python from cloudflare.types.zero_trust.access.applications import ( + AccessDevicePostureRule, + AccessRule, + AnyValidServiceTokenRule, + AuthenticationMethodRule, + AzureGroupRule, + CertificateRule, + CountryRule, + DomainRule, + EmailListRule, + EmailRule, + EveryoneRule, + ExternalEvaluationRule, + GitHubOrganizationRule, + GroupRule, + GSuiteGroupRule, + IPListRule, + IPRule, + OktaGroupRule, + SAMLGroupRule, + ServiceTokenRule, PolicyCreateResponse, PolicyUpdateResponse, PolicyListResponse, @@ -5358,11 +5411,11 @@ from cloudflare.types.zero_trust.access.applications import ( Methods: -- client.zero_trust.access.applications.policies.create(app_id, \*, account_id, zone_id, \*\*params) -> Optional[PolicyCreateResponse] -- client.zero_trust.access.applications.policies.update(policy_id, \*, app_id, account_id, zone_id, \*\*params) -> Optional[PolicyUpdateResponse] -- client.zero_trust.access.applications.policies.list(app_id, \*, account_id, zone_id) -> SyncSinglePage[PolicyListResponse] -- client.zero_trust.access.applications.policies.delete(policy_id, \*, app_id, account_id, zone_id) -> Optional[PolicyDeleteResponse] -- client.zero_trust.access.applications.policies.get(policy_id, \*, app_id, account_id, zone_id) -> Optional[PolicyGetResponse] +- client.zero_trust.access.applications.policies.create(app_id, \*, account_id, zone_id, \*\*params) -> Optional[PolicyCreateResponse] +- client.zero_trust.access.applications.policies.update(policy_id, \*, app_id, account_id, zone_id, \*\*params) -> Optional[PolicyUpdateResponse] +- client.zero_trust.access.applications.policies.list(app_id, \*, account_id, zone_id) -> SyncSinglePage[PolicyListResponse] +- client.zero_trust.access.applications.policies.delete(policy_id, \*, app_id, account_id, zone_id) -> Optional[PolicyDeleteResponse] +- client.zero_trust.access.applications.policies.get(policy_id, \*, app_id, account_id, zone_id) -> Optional[PolicyGetResponse] #### PolicyTests @@ -5377,8 +5430,8 @@ from cloudflare.types.zero_trust.access.applications import ( Methods: -- client.zero_trust.access.applications.policy_tests.create(\*, account_id, \*\*params) -> PolicyTestCreateResponse -- client.zero_trust.access.applications.policy_tests.get(policy_test_id, \*, account_id) -> PolicyTestGetResponse +- client.zero_trust.access.applications.policy_tests.create(\*, account_id, \*\*params) -> Optional[PolicyTestCreateResponse] +- client.zero_trust.access.applications.policy_tests.get(policy_test_id, \*, account_id, \*\*params) -> Optional[PolicyTestGetResponse] ##### Users @@ -5390,7 +5443,7 @@ from cloudflare.types.zero_trust.access.applications.policy_tests import UserLis Methods: -- client.zero_trust.access.applications.policy_tests.users.list(policy_test_id, \*, account_id) -> UserListResponse +- client.zero_trust.access.applications.policy_tests.users.list(policy_test_id, \*, account_id, \*\*params) -> SyncSinglePage[UserListResponse] ### Certificates @@ -5406,44 +5459,47 @@ from cloudflare.types.zero_trust.access import ( Methods: -- client.zero_trust.access.certificates.create(\*, account_id, zone_id, \*\*params) -> Optional[Certificate] -- client.zero_trust.access.certificates.update(certificate_id, \*, account_id, zone_id, \*\*params) -> Optional[Certificate] -- client.zero_trust.access.certificates.list(\*, account_id, zone_id) -> SyncSinglePage[Certificate] -- client.zero_trust.access.certificates.delete(certificate_id, \*, account_id, zone_id) -> Optional[CertificateDeleteResponse] -- client.zero_trust.access.certificates.get(certificate_id, \*, account_id, zone_id) -> Optional[Certificate] +- client.zero_trust.access.certificates.create(\*, account_id, zone_id, \*\*params) -> Optional[Certificate] +- client.zero_trust.access.certificates.update(certificate_id, \*, account_id, zone_id, \*\*params) -> Optional[Certificate] +- client.zero_trust.access.certificates.list(\*, account_id, zone_id) -> SyncSinglePage[Certificate] +- client.zero_trust.access.certificates.delete(certificate_id, \*, account_id, zone_id) -> Optional[CertificateDeleteResponse] +- client.zero_trust.access.certificates.get(certificate_id, \*, account_id, zone_id) -> Optional[Certificate] #### Settings Types: ```python -from cloudflare.types.zero_trust.access.certificates import ( - CertificateSettings, - SettingUpdateResponse, - SettingGetResponse, -) +from cloudflare.types.zero_trust.access.certificates import CertificateSettings ``` Methods: -- client.zero_trust.access.certificates.settings.update(\*, account_id, zone_id, \*\*params) -> Optional[SettingUpdateResponse] -- client.zero_trust.access.certificates.settings.get(\*, account_id, zone_id) -> Optional[SettingGetResponse] +- client.zero_trust.access.certificates.settings.update(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[CertificateSettings] +- client.zero_trust.access.certificates.settings.get(\*, account_id, zone_id) -> SyncSinglePage[CertificateSettings] ### Groups Types: ```python -from cloudflare.types.zero_trust.access import ZeroTrustGroup, GroupDeleteResponse +from cloudflare.types.zero_trust.access import ( + ZeroTrustGroup, + GroupCreateResponse, + GroupUpdateResponse, + GroupListResponse, + GroupDeleteResponse, + GroupGetResponse, +) ``` Methods: -- client.zero_trust.access.groups.create(\*, account_id, zone_id, \*\*params) -> Optional[ZeroTrustGroup] -- client.zero_trust.access.groups.update(group_id, \*, account_id, zone_id, \*\*params) -> Optional[ZeroTrustGroup] -- client.zero_trust.access.groups.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[ZeroTrustGroup] -- client.zero_trust.access.groups.delete(group_id, \*, account_id, zone_id) -> Optional[GroupDeleteResponse] -- client.zero_trust.access.groups.get(group_id, \*, account_id, zone_id) -> Optional[ZeroTrustGroup] +- client.zero_trust.access.groups.create(\*, account_id, zone_id, \*\*params) -> Optional[GroupCreateResponse] +- client.zero_trust.access.groups.update(group_id, \*, account_id, zone_id, \*\*params) -> Optional[GroupUpdateResponse] +- client.zero_trust.access.groups.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[GroupListResponse] +- client.zero_trust.access.groups.delete(group_id, \*, account_id, zone_id) -> Optional[GroupDeleteResponse] +- client.zero_trust.access.groups.get(group_id, \*, account_id, zone_id) -> Optional[GroupGetResponse] ### ServiceTokens @@ -5459,11 +5515,11 @@ from cloudflare.types.zero_trust.access import ( Methods: -- client.zero_trust.access.service_tokens.create(\*, account_id, zone_id, \*\*params) -> Optional[ServiceTokenCreateResponse] -- client.zero_trust.access.service_tokens.update(service_token_id, \*, account_id, zone_id, \*\*params) -> Optional[ServiceToken] -- client.zero_trust.access.service_tokens.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[ServiceToken] -- client.zero_trust.access.service_tokens.delete(service_token_id, \*, account_id, zone_id) -> Optional[ServiceToken] -- client.zero_trust.access.service_tokens.get(service_token_id, \*, account_id, zone_id) -> Optional[ServiceToken] +- client.zero_trust.access.service_tokens.create(\*, account_id, zone_id, \*\*params) -> Optional[ServiceTokenCreateResponse] +- client.zero_trust.access.service_tokens.update(service_token_id, \*, account_id, zone_id, \*\*params) -> Optional[ServiceToken] +- client.zero_trust.access.service_tokens.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[ServiceToken] +- client.zero_trust.access.service_tokens.delete(service_token_id, \*, account_id, zone_id) -> Optional[ServiceToken] +- client.zero_trust.access.service_tokens.get(service_token_id, \*, account_id, zone_id) -> Optional[ServiceToken] - client.zero_trust.access.service_tokens.refresh(service_token_id, \*, account_id) -> Optional[ServiceToken] - client.zero_trust.access.service_tokens.rotate(service_token_id, \*, account_id) -> Optional[ServiceTokenRotateResponse] @@ -5504,24 +5560,44 @@ Methods: Types: ```python -from cloudflare.types.zero_trust.access.logs import AccessRequests, AccessRequestListResponse +from cloudflare.types.zero_trust.access.logs import AccessRequestListResponse ``` Methods: - client.zero_trust.access.logs.access_requests.list(\*, account_id, \*\*params) -> Optional[AccessRequestListResponse] +#### SCIM + +Types: + +```python +from cloudflare.types.zero_trust.access.logs import AccessRequest +``` + +##### Updates + +Types: + +```python +from cloudflare.types.zero_trust.access.logs.scim import UpdateListResponse +``` + +Methods: + +- client.zero_trust.access.logs.scim.updates.list(\*, account_id, \*\*params) -> SyncSinglePage[UpdateListResponse] + ### Users Types: ```python -from cloudflare.types.zero_trust.access import AccessUser +from cloudflare.types.zero_trust.access import AccessUser, UserListResponse ``` Methods: -- client.zero_trust.access.users.list(\*, account_id, \*\*params) -> SyncSinglePage[AccessUser] +- client.zero_trust.access.users.list(\*, account_id, \*\*params) -> SyncSinglePage[UserListResponse] #### ActiveSessions @@ -5649,18 +5725,6 @@ Methods: - client.zero_trust.dex.commands.create(\*, account_id, \*\*params) -> Optional[CommandCreateResponse] - client.zero_trust.dex.commands.list(\*, account_id, \*\*params) -> SyncV4PagePagination[Optional[CommandListResponse]] -#### Users - -Types: - -```python -from cloudflare.types.zero_trust.dex.commands import UserListResponse -``` - -Methods: - -- client.zero_trust.dex.commands.users.list(\*, account_id, \*\*params) -> Optional[UserListResponse] - #### Devices Types: @@ -5809,54 +5873,41 @@ Methods: Types: ```python -from cloudflare.types.zero_trust import ( - Connection, - TunnelCreateResponse, - TunnelListResponse, - TunnelDeleteResponse, - TunnelEditResponse, - TunnelGetResponse, -) +from cloudflare.types.zero_trust import Connection, TunnelListResponse ``` Methods: -- client.zero_trust.tunnels.create(\*, account_id, \*\*params) -> TunnelCreateResponse -- client.zero_trust.tunnels.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[TunnelListResponse] -- client.zero_trust.tunnels.delete(tunnel_id, \*, account_id) -> TunnelDeleteResponse -- client.zero_trust.tunnels.edit(tunnel_id, \*, account_id, \*\*params) -> TunnelEditResponse -- client.zero_trust.tunnels.get(tunnel_id, \*, account_id) -> TunnelGetResponse +- client.zero_trust.tunnels.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[TunnelListResponse] -### WARPConnector +### Cloudflared Types: ```python from cloudflare.types.zero_trust.tunnels import ( - WARPConnectorCreateResponse, - WARPConnectorListResponse, - WARPConnectorDeleteResponse, - WARPConnectorEditResponse, - WARPConnectorGetResponse, - WARPConnectorTokenResponse, + CloudflaredCreateResponse, + CloudflaredListResponse, + CloudflaredDeleteResponse, + CloudflaredEditResponse, + CloudflaredGetResponse, ) ``` Methods: -- client.zero_trust.tunnels.warp_connector.create(\*, account_id, \*\*params) -> WARPConnectorCreateResponse -- client.zero_trust.tunnels.warp_connector.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WARPConnectorListResponse] -- client.zero_trust.tunnels.warp_connector.delete(tunnel_id, \*, account_id) -> WARPConnectorDeleteResponse -- client.zero_trust.tunnels.warp_connector.edit(tunnel_id, \*, account_id, \*\*params) -> WARPConnectorEditResponse -- client.zero_trust.tunnels.warp_connector.get(tunnel_id, \*, account_id) -> WARPConnectorGetResponse -- client.zero_trust.tunnels.warp_connector.token(tunnel_id, \*, account_id) -> str +- client.zero_trust.tunnels.cloudflared.create(\*, account_id, \*\*params) -> CloudflaredCreateResponse +- client.zero_trust.tunnels.cloudflared.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[CloudflaredListResponse] +- client.zero_trust.tunnels.cloudflared.delete(tunnel_id, \*, account_id) -> CloudflaredDeleteResponse +- client.zero_trust.tunnels.cloudflared.edit(tunnel_id, \*, account_id, \*\*params) -> CloudflaredEditResponse +- client.zero_trust.tunnels.cloudflared.get(tunnel_id, \*, account_id) -> CloudflaredGetResponse -### Configurations +#### Configurations Types: ```python -from cloudflare.types.zero_trust.tunnels import ( +from cloudflare.types.zero_trust.tunnels.cloudflared import ( ConfigurationUpdateResponse, ConfigurationGetResponse, ) @@ -5864,55 +5915,85 @@ from cloudflare.types.zero_trust.tunnels import ( Methods: -- client.zero_trust.tunnels.configurations.update(tunnel_id, \*, account_id, \*\*params) -> Optional[ConfigurationUpdateResponse] -- client.zero_trust.tunnels.configurations.get(tunnel_id, \*, account_id) -> Optional[ConfigurationGetResponse] +- client.zero_trust.tunnels.cloudflared.configurations.update(tunnel_id, \*, account_id, \*\*params) -> Optional[ConfigurationUpdateResponse] +- client.zero_trust.tunnels.cloudflared.configurations.get(tunnel_id, \*, account_id) -> Optional[ConfigurationGetResponse] -### Connections +#### Connections Types: ```python -from cloudflare.types.zero_trust.tunnels import ( - Client, - ConnectionDeleteResponse, - ConnectionGetResponse, -) +from cloudflare.types.zero_trust.tunnels.cloudflared import Client, ConnectionDeleteResponse ``` Methods: -- client.zero_trust.tunnels.connections.delete(tunnel_id, \*, account_id, \*\*params) -> object -- client.zero_trust.tunnels.connections.get(tunnel_id, \*, account_id) -> Optional[ConnectionGetResponse] +- client.zero_trust.tunnels.cloudflared.connections.delete(tunnel_id, \*, account_id, \*\*params) -> object +- client.zero_trust.tunnels.cloudflared.connections.get(tunnel_id, \*, account_id) -> SyncSinglePage[Client] -### Token +#### Token Types: ```python -from cloudflare.types.zero_trust.tunnels import TokenGetResponse +from cloudflare.types.zero_trust.tunnels.cloudflared import TokenGetResponse ``` Methods: -- client.zero_trust.tunnels.token.get(tunnel_id, \*, account_id) -> str +- client.zero_trust.tunnels.cloudflared.token.get(tunnel_id, \*, account_id) -> str -### Connectors +#### Connectors Methods: -- client.zero_trust.tunnels.connectors.get(connector_id, \*, account_id, tunnel_id) -> Client +- client.zero_trust.tunnels.cloudflared.connectors.get(connector_id, \*, account_id, tunnel_id) -> Client -### Management +#### Management Types: ```python -from cloudflare.types.zero_trust.tunnels import ManagementCreateResponse +from cloudflare.types.zero_trust.tunnels.cloudflared import ManagementCreateResponse ``` Methods: -- client.zero_trust.tunnels.management.create(tunnel_id, \*, account_id, \*\*params) -> str +- client.zero_trust.tunnels.cloudflared.management.create(tunnel_id, \*, account_id, \*\*params) -> str + +### WARPConnector + +Types: + +```python +from cloudflare.types.zero_trust.tunnels import ( + WARPConnectorCreateResponse, + WARPConnectorListResponse, + WARPConnectorDeleteResponse, + WARPConnectorEditResponse, + WARPConnectorGetResponse, +) +``` + +Methods: + +- client.zero_trust.tunnels.warp_connector.create(\*, account_id, \*\*params) -> WARPConnectorCreateResponse +- client.zero_trust.tunnels.warp_connector.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[WARPConnectorListResponse] +- client.zero_trust.tunnels.warp_connector.delete(tunnel_id, \*, account_id) -> WARPConnectorDeleteResponse +- client.zero_trust.tunnels.warp_connector.edit(tunnel_id, \*, account_id, \*\*params) -> WARPConnectorEditResponse +- client.zero_trust.tunnels.warp_connector.get(tunnel_id, \*, account_id) -> WARPConnectorGetResponse + +#### Token + +Types: + +```python +from cloudflare.types.zero_trust.tunnels.warp_connector import TokenGetResponse +``` + +Methods: + +- client.zero_trust.tunnels.warp_connector.token.get(tunnel_id, \*, account_id) -> str ## ConnectivitySettings @@ -5971,7 +6052,7 @@ from cloudflare.types.zero_trust.dlp.datasets import VersionCreateResponse Methods: -- client.zero_trust.dlp.datasets.versions.create(version, \*, account_id, dataset_id, \*\*params) -> Optional[VersionCreateResponse] +- client.zero_trust.dlp.datasets.versions.create(version, \*, account_id, dataset_id, \*\*params) -> SyncSinglePage[VersionCreateResponse] ##### Entries @@ -6301,7 +6382,6 @@ from cloudflare.types.zero_trust.gateway import ( GatewayIPs, ProxyEndpoint, ProxyEndpointDeleteResponse, - ProxyEndpointGetResponse, ) ``` @@ -6311,7 +6391,7 @@ Methods: - client.zero_trust.gateway.proxy_endpoints.list(\*, account_id) -> Optional[ProxyEndpoint] - client.zero_trust.gateway.proxy_endpoints.delete(proxy_endpoint_id, \*, account_id) -> object - client.zero_trust.gateway.proxy_endpoints.edit(proxy_endpoint_id, \*, account_id, \*\*params) -> Optional[ProxyEndpoint] -- client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> Optional[ProxyEndpointGetResponse] +- client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> SyncSinglePage[ProxyEndpoint] ### Rules @@ -6410,6 +6490,30 @@ Methods: - client.zero_trust.networks.virtual_networks.edit(virtual_network_id, \*, account_id, \*\*params) -> VirtualNetwork - client.zero_trust.networks.virtual_networks.get(virtual_network_id, \*, account_id) -> VirtualNetwork +### Subnets + +Types: + +```python +from cloudflare.types.zero_trust.networks import SubnetListResponse +``` + +Methods: + +- client.zero_trust.networks.subnets.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[SubnetListResponse] + +#### CloudflareSource + +Types: + +```python +from cloudflare.types.zero_trust.networks.subnets import CloudflareSourceUpdateResponse +``` + +Methods: + +- client.zero_trust.networks.subnets.cloudflare_source.update(address_family, \*, account_id, \*\*params) -> CloudflareSourceUpdateResponse + ## RiskScoring Types: @@ -6669,6 +6773,39 @@ Methods: ## AI +### Inference + +#### Summary + +Types: + +```python +from cloudflare.types.radar.ai.inference import SummaryModelResponse, SummaryTaskResponse +``` + +Methods: + +- client.radar.ai.inference.summary.model(\*\*params) -> SummaryModelResponse +- client.radar.ai.inference.summary.task(\*\*params) -> SummaryTaskResponse + +#### TimeseriesGroups + +##### Summary + +Types: + +```python +from cloudflare.types.radar.ai.inference.timeseries_groups import ( + SummaryModelResponse, + SummaryTaskResponse, +) +``` + +Methods: + +- client.radar.ai.inference.timeseries_groups.summary.model(\*\*params) -> SummaryModelResponse +- client.radar.ai.inference.timeseries_groups.summary.task(\*\*params) -> SummaryTaskResponse + ### Bots #### Summary @@ -6833,6 +6970,16 @@ Methods: ## DNS +Types: + +```python +from cloudflare.types.radar import DNSTimeseriesResponse +``` + +Methods: + +- client.radar.dns.timeseries(\*\*params) -> DNSTimeseriesResponse + ### Top Types: @@ -6846,6 +6993,70 @@ Methods: - client.radar.dns.top.ases(\*\*params) -> TopAsesResponse - client.radar.dns.top.locations(\*\*params) -> TopLocationsResponse +### Summary + +Types: + +```python +from cloudflare.types.radar.dns import ( + SummaryCacheHitResponse, + SummaryDNSSECResponse, + SummaryDNSSECAwareResponse, + SummaryDNSSECE2EResponse, + SummaryIPVersionResponse, + SummaryMatchingAnswerResponse, + SummaryProtocolResponse, + SummaryQueryTypeResponse, + SummaryResponseCodeResponse, + SummaryResponseTTLResponse, +) +``` + +Methods: + +- client.radar.dns.summary.cache_hit(\*\*params) -> SummaryCacheHitResponse +- client.radar.dns.summary.dnssec(\*\*params) -> SummaryDNSSECResponse +- client.radar.dns.summary.dnssec_aware(\*\*params) -> SummaryDNSSECAwareResponse +- client.radar.dns.summary.dnssec_e2e(\*\*params) -> SummaryDNSSECE2EResponse +- client.radar.dns.summary.ip_version(\*\*params) -> SummaryIPVersionResponse +- client.radar.dns.summary.matching_answer(\*\*params) -> SummaryMatchingAnswerResponse +- client.radar.dns.summary.protocol(\*\*params) -> SummaryProtocolResponse +- client.radar.dns.summary.query_type(\*\*params) -> SummaryQueryTypeResponse +- client.radar.dns.summary.response_code(\*\*params) -> SummaryResponseCodeResponse +- client.radar.dns.summary.response_ttl(\*\*params) -> SummaryResponseTTLResponse + +### TimeseriesGroups + +Types: + +```python +from cloudflare.types.radar.dns import ( + TimeseriesGroupCacheHitResponse, + TimeseriesGroupDNSSECResponse, + TimeseriesGroupDNSSECAwareResponse, + TimeseriesGroupDNSSECE2EResponse, + TimeseriesGroupIPVersionResponse, + TimeseriesGroupMatchingAnswerResponse, + TimeseriesGroupProtocolResponse, + TimeseriesGroupQueryTypeResponse, + TimeseriesGroupResponseCodeResponse, + TimeseriesGroupResponseTTLResponse, +) +``` + +Methods: + +- client.radar.dns.timeseries_groups.cache_hit(\*\*params) -> TimeseriesGroupCacheHitResponse +- client.radar.dns.timeseries_groups.dnssec(\*\*params) -> TimeseriesGroupDNSSECResponse +- client.radar.dns.timeseries_groups.dnssec_aware(\*\*params) -> TimeseriesGroupDNSSECAwareResponse +- client.radar.dns.timeseries_groups.dnssec_e2e(\*\*params) -> TimeseriesGroupDNSSECE2EResponse +- client.radar.dns.timeseries_groups.ip_version(\*\*params) -> TimeseriesGroupIPVersionResponse +- client.radar.dns.timeseries_groups.matching_answer(\*\*params) -> TimeseriesGroupMatchingAnswerResponse +- client.radar.dns.timeseries_groups.protocol(\*\*params) -> TimeseriesGroupProtocolResponse +- client.radar.dns.timeseries_groups.query_type(\*\*params) -> TimeseriesGroupQueryTypeResponse +- client.radar.dns.timeseries_groups.response_code(\*\*params) -> TimeseriesGroupResponseCodeResponse +- client.radar.dns.timeseries_groups.response_ttl(\*\*params) -> TimeseriesGroupResponseTTLResponse + ## Netflows Types: @@ -7171,7 +7382,6 @@ Types: from cloudflare.types.radar.attacks.layer3 import ( SummaryBitrateResponse, SummaryDurationResponse, - SummaryGetResponse, SummaryIPVersionResponse, SummaryProtocolResponse, SummaryVectorResponse, @@ -7182,7 +7392,6 @@ Methods: - client.radar.attacks.layer3.summary.bitrate(\*\*params) -> SummaryBitrateResponse - client.radar.attacks.layer3.summary.duration(\*\*params) -> SummaryDurationResponse -- client.radar.attacks.layer3.summary.get(\*\*params) -> SummaryGetResponse - client.radar.attacks.layer3.summary.ip_version(\*\*params) -> SummaryIPVersionResponse - client.radar.attacks.layer3.summary.protocol(\*\*params) -> SummaryProtocolResponse - client.radar.attacks.layer3.summary.vector(\*\*params) -> SummaryVectorResponse @@ -7195,7 +7404,6 @@ Types: from cloudflare.types.radar.attacks.layer3 import ( TimeseriesGroupBitrateResponse, TimeseriesGroupDurationResponse, - TimeseriesGroupGetResponse, TimeseriesGroupIndustryResponse, TimeseriesGroupIPVersionResponse, TimeseriesGroupProtocolResponse, @@ -7208,7 +7416,6 @@ Methods: - client.radar.attacks.layer3.timeseries_groups.bitrate(\*\*params) -> TimeseriesGroupBitrateResponse - client.radar.attacks.layer3.timeseries_groups.duration(\*\*params) -> TimeseriesGroupDurationResponse -- client.radar.attacks.layer3.timeseries_groups.get(\*\*params) -> TimeseriesGroupGetResponse - client.radar.attacks.layer3.timeseries_groups.industry(\*\*params) -> TimeseriesGroupIndustryResponse - client.radar.attacks.layer3.timeseries_groups.ip_version(\*\*params) -> TimeseriesGroupIPVersionResponse - client.radar.attacks.layer3.timeseries_groups.protocol(\*\*params) -> TimeseriesGroupProtocolResponse @@ -7264,7 +7471,6 @@ Types: ```python from cloudflare.types.radar.attacks.layer7 import ( - SummaryGetResponse, SummaryHTTPMethodResponse, SummaryHTTPVersionResponse, SummaryIPVersionResponse, @@ -7275,7 +7481,6 @@ from cloudflare.types.radar.attacks.layer7 import ( Methods: -- client.radar.attacks.layer7.summary.get(\*\*params) -> SummaryGetResponse - client.radar.attacks.layer7.summary.http_method(\*\*params) -> SummaryHTTPMethodResponse - client.radar.attacks.layer7.summary.http_version(\*\*params) -> SummaryHTTPVersionResponse - client.radar.attacks.layer7.summary.ip_version(\*\*params) -> SummaryIPVersionResponse @@ -7288,7 +7493,6 @@ Types: ```python from cloudflare.types.radar.attacks.layer7 import ( - TimeseriesGroupGetResponse, TimeseriesGroupHTTPMethodResponse, TimeseriesGroupHTTPVersionResponse, TimeseriesGroupIndustryResponse, @@ -7301,7 +7505,6 @@ from cloudflare.types.radar.attacks.layer7 import ( Methods: -- client.radar.attacks.layer7.timeseries_groups.get(\*\*params) -> TimeseriesGroupGetResponse - client.radar.attacks.layer7.timeseries_groups.http_method(\*\*params) -> TimeseriesGroupHTTPMethodResponse - client.radar.attacks.layer7.timeseries_groups.http_version(\*\*params) -> TimeseriesGroupHTTPVersionResponse - client.radar.attacks.layer7.timeseries_groups.industry(\*\*params) -> TimeseriesGroupIndustryResponse @@ -7765,6 +7968,24 @@ Methods: - client.radar.ranking.domain.get(domain, \*\*params) -> DomainGetResponse +### InternetServices + +Types: + +```python +from cloudflare.types.radar.ranking import ( + InternetServiceCategoriesResponse, + InternetServiceTimeseriesGroupsResponse, + InternetServiceTopResponse, +) +``` + +Methods: + +- client.radar.ranking.internet_services.categories(\*\*params) -> InternetServiceCategoriesResponse +- client.radar.ranking.internet_services.timeseries_groups(\*\*params) -> InternetServiceTimeseriesGroupsResponse +- client.radar.ranking.internet_services.top(\*\*params) -> InternetServiceTopResponse + ## TrafficAnomalies Types: @@ -7805,6 +8026,32 @@ Methods: - client.radar.tcp_resets_timeouts.summary(\*\*params) -> TCPResetsTimeoutSummaryResponse - client.radar.tcp_resets_timeouts.timeseries_groups(\*\*params) -> TCPResetsTimeoutTimeseriesGroupsResponse +## RobotsTXT + +### Top + +Types: + +```python +from cloudflare.types.radar.robots_txt import TopDomainCategoriesResponse +``` + +Methods: + +- client.radar.robots_txt.top.domain_categories(\*\*params) -> TopDomainCategoriesResponse + +#### UserAgents + +Types: + +```python +from cloudflare.types.radar.robots_txt.top import UserAgentDirectiveResponse +``` + +Methods: + +- client.radar.robots_txt.top.user_agents.directive(\*\*params) -> UserAgentDirectiveResponse + # BotManagement Types: @@ -7841,6 +8088,92 @@ Methods: - client.origin_post_quantum_encryption.update(\*, zone_id, \*\*params) -> Optional[OriginPostQuantumEncryptionUpdateResponse] - client.origin_post_quantum_encryption.get(\*, zone_id) -> Optional[OriginPostQuantumEncryptionGetResponse] +# Zaraz + +Types: + +```python +from cloudflare.types.zaraz import ButtonTextTranslation, NeoEvent +``` + +Methods: + +- client.zaraz.update(\*, zone_id, \*\*params) -> Workflow + +## Config + +Types: + +```python +from cloudflare.types.zaraz import Configuration +``` + +Methods: + +- client.zaraz.config.update(\*, zone_id, \*\*params) -> Configuration +- client.zaraz.config.get(\*, zone_id) -> Configuration + +## Default + +Methods: + +- client.zaraz.default.get(\*, zone_id) -> Configuration + +## Export + +Methods: + +- client.zaraz.export.get(\*, zone_id) -> Configuration + +## History + +Types: + +```python +from cloudflare.types.zaraz import HistoryListResponse +``` + +Methods: + +- client.zaraz.history.update(\*, zone_id, \*\*params) -> Configuration +- client.zaraz.history.list(\*, zone_id, \*\*params) -> SyncSinglePage[HistoryListResponse] + +### Configs + +Types: + +```python +from cloudflare.types.zaraz.history import ConfigGetResponse +``` + +Methods: + +- client.zaraz.history.configs.get(\*, zone_id, \*\*params) -> ConfigGetResponse + +## Publish + +Types: + +```python +from cloudflare.types.zaraz import PublishCreateResponse +``` + +Methods: + +- client.zaraz.publish.create(\*, zone_id, \*\*params) -> str + +## Workflow + +Types: + +```python +from cloudflare.types.zaraz import Workflow +``` + +Methods: + +- client.zaraz.workflow.get(\*, zone_id) -> Workflow + # Speed Types: @@ -7936,7 +8269,7 @@ Methods: - client.hostnames.settings.tls.update(hostname, \*, zone_id, setting_id, \*\*params) -> Optional[Setting] - client.hostnames.settings.tls.delete(hostname, \*, zone_id, setting_id) -> Optional[TLSDeleteResponse] -- client.hostnames.settings.tls.get(setting_id, \*, zone_id) -> Optional[TLSGetResponse] +- client.hostnames.settings.tls.get(setting_id, \*, zone_id) -> SyncSinglePage[TLSGetResponse] # Snippets @@ -7969,7 +8302,7 @@ from cloudflare.types.snippets import RuleUpdateResponse, RuleListResponse, Rule Methods: -- client.snippets.rules.update(\*, zone_id, \*\*params) -> Optional[RuleUpdateResponse] +- client.snippets.rules.update(\*, zone_id, \*\*params) -> SyncSinglePage[RuleUpdateResponse] - client.snippets.rules.list(\*, zone_id) -> SyncSinglePage[RuleListResponse] - client.snippets.rules.delete(\*, zone_id) -> RuleDeleteResponse @@ -8033,6 +8366,7 @@ from cloudflare.types.cloudforce_one import ( RequestConstants, RequestTypes, RequestDeleteResponse, + RequestTypesResponse, ) ``` @@ -8040,23 +8374,19 @@ Methods: - client.cloudforce_one.requests.create(account_identifier, \*\*params) -> Optional[Item] - client.cloudforce_one.requests.update(request_identifier, \*, account_identifier, \*\*params) -> Optional[Item] -- client.cloudforce_one.requests.list(account_identifier, \*\*params) -> SyncV4PagePaginationArray[ListItem] +- client.cloudforce_one.requests.list(account_identifier, \*\*params) -> SyncSinglePage[ListItem] - client.cloudforce_one.requests.delete(request_identifier, \*, account_identifier) -> RequestDeleteResponse - client.cloudforce_one.requests.constants(account_identifier) -> Optional[RequestConstants] - client.cloudforce_one.requests.get(request_identifier, \*, account_identifier) -> Optional[Item] - client.cloudforce_one.requests.quota(account_identifier) -> Optional[Quota] -- client.cloudforce_one.requests.types(account_identifier) -> Optional[RequestTypes] +- client.cloudforce_one.requests.types(account_identifier) -> SyncSinglePage[RequestTypesResponse] ### Message Types: ```python -from cloudflare.types.cloudforce_one.requests import ( - Message, - MessageDeleteResponse, - MessageGetResponse, -) +from cloudflare.types.cloudforce_one.requests import Message, MessageDeleteResponse ``` Methods: @@ -8064,7 +8394,7 @@ Methods: - client.cloudforce_one.requests.message.create(request_identifier, \*, account_identifier, \*\*params) -> Optional[Message] - client.cloudforce_one.requests.message.update(message_identifer, \*, account_identifier, request_identifier, \*\*params) -> Optional[Message] - client.cloudforce_one.requests.message.delete(message_identifer, \*, account_identifier, request_identifier) -> MessageDeleteResponse -- client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> Optional[MessageGetResponse] +- client.cloudforce_one.requests.message.get(request_identifier, \*, account_identifier, \*\*params) -> SyncSinglePage[Message] ### Priority @@ -8102,10 +8432,10 @@ from cloudflare.types.cloudforce_one.requests import ( Methods: -- client.cloudforce_one.requests.assets.create(request_identifier, \*, account_identifier, \*\*params) -> Optional[AssetCreateResponse] +- client.cloudforce_one.requests.assets.create(request_identifier, \*, account_identifier, \*\*params) -> SyncSinglePage[AssetCreateResponse] - client.cloudforce_one.requests.assets.update(asset_identifer, \*, account_identifier, request_identifier, \*\*params) -> Optional[AssetUpdateResponse] - client.cloudforce_one.requests.assets.delete(asset_identifer, \*, account_identifier, request_identifier) -> AssetDeleteResponse -- client.cloudforce_one.requests.assets.get(asset_identifer, \*, account_identifier, request_identifier) -> Optional[AssetGetResponse] +- client.cloudforce_one.requests.assets.get(asset_identifer, \*, account_identifier, request_identifier) -> SyncSinglePage[AssetGetResponse] # AIGateway @@ -8134,12 +8464,12 @@ Methods: Types: ```python -from cloudflare.types.ai_gateway import EvaluationTypeGetResponse +from cloudflare.types.ai_gateway import EvaluationTypeListResponse ``` Methods: -- client.ai_gateway.evaluation_types.get(\*, account_id, \*\*params) -> EvaluationTypeGetResponse +- client.ai_gateway.evaluation_types.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[EvaluationTypeListResponse] ## Logs @@ -8219,7 +8549,7 @@ from cloudflare.types.iam import PermissionGroupListResponse, PermissionGroupGet Methods: -- client.iam.permission_groups.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[object] +- client.iam.permission_groups.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[PermissionGroupListResponse] - client.iam.permission_groups.get(permission_group_id, \*, account_id) -> PermissionGroupGetResponse ## ResourceGroups @@ -8240,7 +8570,7 @@ Methods: - client.iam.resource_groups.create(\*, account_id, \*\*params) -> ResourceGroupCreateResponse - client.iam.resource_groups.update(resource_group_id, \*, account_id, \*\*params) -> ResourceGroupUpdateResponse -- client.iam.resource_groups.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[object] +- client.iam.resource_groups.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[ResourceGroupListResponse] - client.iam.resource_groups.delete(resource_group_id, \*, account_id) -> Optional[ResourceGroupDeleteResponse] - client.iam.resource_groups.get(resource_group_id, \*, account_id) -> ResourceGroupGetResponse @@ -8256,7 +8586,7 @@ from cloudflare.types.cloud_connector import RuleUpdateResponse, RuleListRespons Methods: -- client.cloud_connector.rules.update(\*, zone_id, \*\*params) -> Optional[RuleUpdateResponse] +- client.cloud_connector.rules.update(\*, zone_id, \*\*params) -> SyncSinglePage[RuleUpdateResponse] - client.cloud_connector.rules.list(\*, zone_id) -> SyncSinglePage[RuleListResponse] # BotnetFeed @@ -8498,9 +8828,9 @@ from cloudflare.types.content_scanning import ( Methods: -- client.content_scanning.payloads.create(\*, zone_id, \*\*params) -> Optional[PayloadCreateResponse] +- client.content_scanning.payloads.create(\*, zone_id, \*\*params) -> SyncSinglePage[PayloadCreateResponse] - client.content_scanning.payloads.list(\*, zone_id) -> SyncSinglePage[PayloadListResponse] -- client.content_scanning.payloads.delete(expression_id, \*, zone_id) -> Optional[PayloadDeleteResponse] +- client.content_scanning.payloads.delete(expression_id, \*, zone_id) -> SyncSinglePage[PayloadDeleteResponse] ## Settings @@ -8622,3 +8952,110 @@ from cloudflare.types.ai.models import SchemaGetResponse Methods: - client.ai.models.schema.get(\*, account_id, \*\*params) -> object + +# SecurityCenter + +## Insights + +Types: + +```python +from cloudflare.types.security_center import InsightListResponse, InsightDismissResponse +``` + +Methods: + +- client.security_center.insights.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePagination[Optional[InsightListResponse]] +- client.security_center.insights.dismiss(issue_id, \*, account_id, zone_id, \*\*params) -> InsightDismissResponse + +### Class + +Types: + +```python +from cloudflare.types.security_center.insights import ClassGetResponse +``` + +Methods: + +- client.security*center.insights.class*.get(\*, account_id, zone_id, \*\*params) -> Optional[ClassGetResponse] + +### Severity + +Types: + +```python +from cloudflare.types.security_center.insights import SeverityGetResponse +``` + +Methods: + +- client.security_center.insights.severity.get(\*, account_id, zone_id, \*\*params) -> Optional[SeverityGetResponse] + +### Type + +Types: + +```python +from cloudflare.types.security_center.insights import TypeGetResponse +``` + +Methods: + +- client.security_center.insights.type.get(\*, account_id, zone_id, \*\*params) -> Optional[TypeGetResponse] + +# BrowserRendering + +## Content + +Types: + +```python +from cloudflare.types.browser_rendering import ContentCreateResponse +``` + +Methods: + +- client.browser_rendering.content.create(account_id, \*\*params) -> str + +## PDF + +Methods: + +- client.browser_rendering.pdf.create(account_id, \*\*params) -> BinaryAPIResponse + +## Scrape + +Types: + +```python +from cloudflare.types.browser_rendering import ScrapeCreateResponse +``` + +Methods: + +- client.browser_rendering.scrape.create(account_id, \*\*params) -> ScrapeCreateResponse + +## Screenshot + +Types: + +```python +from cloudflare.types.browser_rendering import ScreenshotCreateResponse +``` + +Methods: + +- client.browser_rendering.screenshot.create(account_id, \*\*params) -> ScreenshotCreateResponse + +## Snapshot + +Types: + +```python +from cloudflare.types.browser_rendering import SnapshotCreateResponse +``` + +Methods: + +- client.browser_rendering.snapshot.create(account_id, \*\*params) -> Optional[SnapshotCreateResponse] diff --git a/mypy.ini b/mypy.ini index 4511df962f0..e929ff8caa2 100644 --- a/mypy.ini +++ b/mypy.ini @@ -41,7 +41,7 @@ cache_fine_grained = True # ``` # Changing this codegen to make mypy happy would increase complexity # and would not be worth it. -disable_error_code = func-returns-value +disable_error_code = func-returns-value,overload-cannot-match # https://github.com/python/mypy/issues/12162 [mypy.overrides] diff --git a/pyproject.toml b/pyproject.toml index 2dcb85b55ab..5b3867d29a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "cloudflare" -version = "4.0.0" +version = "5.0.0" description = "The official Python library for the cloudflare API" dynamic = ["readme"] license = "Apache-2.0" @@ -54,6 +54,7 @@ dev-dependencies = [ "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", "rich>=13.7.1", + "nest_asyncio==1.6.0", ] [tool.rye.scripts] @@ -128,6 +129,7 @@ testpaths = ["tests"] addopts = "--tb=short" xfail_strict = true asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "session" filterwarnings = [ "error" ] @@ -176,7 +178,7 @@ select = [ "T201", "T203", # misuse of typing.TYPE_CHECKING - "TCH004", + "TC004", # import rules "TID251", ] diff --git a/requirements-dev.lock b/requirements-dev.lock index 83265a0ae6f..904432cb213 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -48,9 +48,10 @@ markdown-it-py==3.0.0 # via rich mdurl==0.1.2 # via markdown-it-py -mypy==1.13.0 +mypy==1.14.1 mypy-extensions==1.0.0 # via mypy +nest-asyncio==1.6.0 nodeenv==1.8.0 # via pyright nox==2023.4.22 @@ -67,7 +68,7 @@ pydantic-core==2.27.1 # via pydantic pygments==2.18.0 # via rich -pyright==1.1.390 +pyright==1.1.392.post0 pytest==8.3.3 # via pytest-asyncio pytest-asyncio==0.24.0 @@ -77,7 +78,7 @@ pytz==2023.3.post1 # via dirty-equals respx==0.22.0 rich==13.7.1 -ruff==0.6.9 +ruff==0.9.4 setuptools==68.2.2 # via nodeenv six==1.16.0 diff --git a/scripts/bootstrap b/scripts/bootstrap index 8c5c60eba34..e84fe62c380 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then brew bundle check >/dev/null 2>&1 || { echo "==> Installing Homebrew dependencies…" brew bundle diff --git a/scripts/lint b/scripts/lint index aa39f69ffbd..9ad76783d44 100755 --- a/scripts/lint +++ b/scripts/lint @@ -9,4 +9,3 @@ rye run lint echo "==> Making sure it imports" rye run python -c 'import cloudflare' - diff --git a/scripts/utils/ruffen-docs.py b/scripts/utils/ruffen-docs.py index 37b3d94f0f8..0cf2bd2fd9d 100644 --- a/scripts/utils/ruffen-docs.py +++ b/scripts/utils/ruffen-docs.py @@ -47,7 +47,7 @@ def _md_match(match: Match[str]) -> str: with _collect_error(match): code = format_code_block(code) code = textwrap.indent(code, match["indent"]) - return f'{match["before"]}{code}{match["after"]}' + return f"{match['before']}{code}{match['after']}" def _pycon_match(match: Match[str]) -> str: code = "" @@ -97,7 +97,7 @@ def finish_fragment() -> None: def _md_pycon_match(match: Match[str]) -> str: code = _pycon_match(match) code = textwrap.indent(code, match["indent"]) - return f'{match["before"]}{code}{match["after"]}' + return f"{match['before']}{code}{match['after']}" src = MD_RE.sub(_md_match, src) src = MD_PYCON_RE.sub(_md_pycon_match, src) diff --git a/src/cloudflare/_base_client.py b/src/cloudflare/_base_client.py index c8867a59b53..2cf50416beb 100644 --- a/src/cloudflare/_base_client.py +++ b/src/cloudflare/_base_client.py @@ -63,7 +63,7 @@ ModelBuilderProtocol, ) from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping -from ._compat import model_copy, model_dump +from ._compat import PYDANTIC_V2, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, @@ -207,6 +207,9 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options @@ -292,6 +295,9 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: + if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options @@ -418,10 +424,17 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0 if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: headers[idempotency_header] = options.idempotency_key or self._idempotency_key() - # Don't set the retry count header if it was already set or removed by the caller. We check + # Don't set these headers if they were already set or removed by the caller. We check # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. - if "x-stainless-retry-count" not in (header.lower() for header in custom_headers): + lower_custom_headers = [header.lower() for header in custom_headers] + if "x-stainless-retry-count" not in lower_custom_headers: headers["x-stainless-retry-count"] = str(retries_taken) + if "x-stainless-read-timeout" not in lower_custom_headers: + timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout + if isinstance(timeout, Timeout): + timeout = timeout.read + if timeout is not None: + headers["x-stainless-read-timeout"] = str(timeout) return headers @@ -511,7 +524,7 @@ def _build_request( # so that passing a `TypedDict` doesn't cause an error. # https://github.com/microsoft/pyright/issues/3526#event-6715453066 params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, - json=json_data, + json=json_data if is_given(json_data) else None, files=files, **kwargs, ) diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py index f48b5ae2359..23e31591b77 100644 --- a/src/cloudflare/_client.py +++ b/src/cloudflare/_client.py @@ -57,6 +57,7 @@ radar, rules, speed, + zaraz, zones, images, queues, @@ -104,10 +105,12 @@ cloud_connector, durable_objects, request_tracers, + security_center, brand_protection, content_scanning, custom_hostnames, resource_sharing, + browser_rendering, mtls_certificates, url_normalization, custom_nameservers, @@ -115,6 +118,7 @@ client_certificates, custom_certificates, keyless_certificates, + network_interconnects, workers_for_platforms, origin_ca_certificates, origin_tls_client_auth, @@ -149,6 +153,7 @@ from .resources.rate_limits import RateLimitsResource, AsyncRateLimitsResource from .resources.rules.rules import RulesResource, AsyncRulesResource from .resources.speed.speed import SpeedResource, AsyncSpeedResource + from .resources.zaraz.zaraz import ZarazResource, AsyncZarazResource from .resources.zones.zones import ZonesResource, AsyncZonesResource from .resources.security_txt import SecurityTXTResource, AsyncSecurityTXTResource from .resources.abuse_reports import AbuseReportsResource, AsyncAbuseReportsResource @@ -202,14 +207,20 @@ from .resources.cloud_connector.cloud_connector import CloudConnectorResource, AsyncCloudConnectorResource from .resources.durable_objects.durable_objects import DurableObjectsResource, AsyncDurableObjectsResource from .resources.request_tracers.request_tracers import RequestTracersResource, AsyncRequestTracersResource + from .resources.security_center.security_center import SecurityCenterResource, AsyncSecurityCenterResource from .resources.content_scanning.content_scanning import ContentScanningResource, AsyncContentScanningResource from .resources.custom_hostnames.custom_hostnames import CustomHostnamesResource, AsyncCustomHostnamesResource from .resources.resource_sharing.resource_sharing import ResourceSharingResource, AsyncResourceSharingResource + from .resources.browser_rendering.browser_rendering import BrowserRenderingResource, AsyncBrowserRenderingResource from .resources.mtls_certificates.mtls_certificates import MTLSCertificatesResource, AsyncMTLSCertificatesResource from .resources.custom_certificates.custom_certificates import ( CustomCertificatesResource, AsyncCustomCertificatesResource, ) + from .resources.network_interconnects.network_interconnects import ( + NetworkInterconnectsResource, + AsyncNetworkInterconnectsResource, + ) from .resources.workers_for_platforms.workers_for_platforms import ( WorkersForPlatformsResource, AsyncWorkersForPlatformsResource, @@ -276,7 +287,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new synchronous cloudflare client instance. + """Construct a new synchronous Cloudflare client instance. This automatically infers the following arguments from their corresponding environment variables if they are not provided: - `api_token` from `CLOUDFLARE_API_TOKEN` @@ -616,6 +627,12 @@ def magic_network_monitoring(self) -> MagicNetworkMonitoringResource: return MagicNetworkMonitoringResource(self) + @cached_property + def network_interconnects(self) -> NetworkInterconnectsResource: + from .resources.network_interconnects import NetworkInterconnectsResource + + return NetworkInterconnectsResource(self) + @cached_property def mtls_certificates(self) -> MTLSCertificatesResource: from .resources.mtls_certificates import MTLSCertificatesResource @@ -730,6 +747,12 @@ def origin_post_quantum_encryption(self) -> OriginPostQuantumEncryptionResource: return OriginPostQuantumEncryptionResource(self) + @cached_property + def zaraz(self) -> ZarazResource: + from .resources.zaraz import ZarazResource + + return ZarazResource(self) + @cached_property def speed(self) -> SpeedResource: from .resources.speed import SpeedResource @@ -832,6 +855,18 @@ def ai(self) -> AIResource: return AIResource(self) + @cached_property + def security_center(self) -> SecurityCenterResource: + from .resources.security_center import SecurityCenterResource + + return SecurityCenterResource(self) + + @cached_property + def browser_rendering(self) -> BrowserRenderingResource: + from .resources.browser_rendering import BrowserRenderingResource + + return BrowserRenderingResource(self) + @cached_property def with_raw_response(self) -> CloudflareWithRawResponse: return CloudflareWithRawResponse(self) @@ -1047,7 +1082,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new async cloudflare client instance. + """Construct a new async AsyncCloudflare client instance. This automatically infers the following arguments from their corresponding environment variables if they are not provided: - `api_token` from `CLOUDFLARE_API_TOKEN` @@ -1387,6 +1422,12 @@ def magic_network_monitoring(self) -> AsyncMagicNetworkMonitoringResource: return AsyncMagicNetworkMonitoringResource(self) + @cached_property + def network_interconnects(self) -> AsyncNetworkInterconnectsResource: + from .resources.network_interconnects import AsyncNetworkInterconnectsResource + + return AsyncNetworkInterconnectsResource(self) + @cached_property def mtls_certificates(self) -> AsyncMTLSCertificatesResource: from .resources.mtls_certificates import AsyncMTLSCertificatesResource @@ -1501,6 +1542,12 @@ def origin_post_quantum_encryption(self) -> AsyncOriginPostQuantumEncryptionReso return AsyncOriginPostQuantumEncryptionResource(self) + @cached_property + def zaraz(self) -> AsyncZarazResource: + from .resources.zaraz import AsyncZarazResource + + return AsyncZarazResource(self) + @cached_property def speed(self) -> AsyncSpeedResource: from .resources.speed import AsyncSpeedResource @@ -1603,6 +1650,18 @@ def ai(self) -> AsyncAIResource: return AsyncAIResource(self) + @cached_property + def security_center(self) -> AsyncSecurityCenterResource: + from .resources.security_center import AsyncSecurityCenterResource + + return AsyncSecurityCenterResource(self) + + @cached_property + def browser_rendering(self) -> AsyncBrowserRenderingResource: + from .resources.browser_rendering import AsyncBrowserRenderingResource + + return AsyncBrowserRenderingResource(self) + @cached_property def with_raw_response(self) -> AsyncCloudflareWithRawResponse: return AsyncCloudflareWithRawResponse(self) @@ -2091,6 +2150,12 @@ def magic_network_monitoring(self) -> magic_network_monitoring.MagicNetworkMonit return MagicNetworkMonitoringResourceWithRawResponse(self._client.magic_network_monitoring) + @cached_property + def network_interconnects(self) -> network_interconnects.NetworkInterconnectsResourceWithRawResponse: + from .resources.network_interconnects import NetworkInterconnectsResourceWithRawResponse + + return NetworkInterconnectsResourceWithRawResponse(self._client.network_interconnects) + @cached_property def mtls_certificates(self) -> mtls_certificates.MTLSCertificatesResourceWithRawResponse: from .resources.mtls_certificates import MTLSCertificatesResourceWithRawResponse @@ -2207,6 +2272,12 @@ def origin_post_quantum_encryption( return OriginPostQuantumEncryptionResourceWithRawResponse(self._client.origin_post_quantum_encryption) + @cached_property + def zaraz(self) -> zaraz.ZarazResourceWithRawResponse: + from .resources.zaraz import ZarazResourceWithRawResponse + + return ZarazResourceWithRawResponse(self._client.zaraz) + @cached_property def speed(self) -> speed.SpeedResourceWithRawResponse: from .resources.speed import SpeedResourceWithRawResponse @@ -2309,6 +2380,18 @@ def ai(self) -> ai.AIResourceWithRawResponse: return AIResourceWithRawResponse(self._client.ai) + @cached_property + def security_center(self) -> security_center.SecurityCenterResourceWithRawResponse: + from .resources.security_center import SecurityCenterResourceWithRawResponse + + return SecurityCenterResourceWithRawResponse(self._client.security_center) + + @cached_property + def browser_rendering(self) -> browser_rendering.BrowserRenderingResourceWithRawResponse: + from .resources.browser_rendering import BrowserRenderingResourceWithRawResponse + + return BrowserRenderingResourceWithRawResponse(self._client.browser_rendering) + class AsyncCloudflareWithRawResponse: _client: AsyncCloudflare @@ -2616,6 +2699,12 @@ def magic_network_monitoring(self) -> magic_network_monitoring.AsyncMagicNetwork return AsyncMagicNetworkMonitoringResourceWithRawResponse(self._client.magic_network_monitoring) + @cached_property + def network_interconnects(self) -> network_interconnects.AsyncNetworkInterconnectsResourceWithRawResponse: + from .resources.network_interconnects import AsyncNetworkInterconnectsResourceWithRawResponse + + return AsyncNetworkInterconnectsResourceWithRawResponse(self._client.network_interconnects) + @cached_property def mtls_certificates(self) -> mtls_certificates.AsyncMTLSCertificatesResourceWithRawResponse: from .resources.mtls_certificates import AsyncMTLSCertificatesResourceWithRawResponse @@ -2732,6 +2821,12 @@ def origin_post_quantum_encryption( return AsyncOriginPostQuantumEncryptionResourceWithRawResponse(self._client.origin_post_quantum_encryption) + @cached_property + def zaraz(self) -> zaraz.AsyncZarazResourceWithRawResponse: + from .resources.zaraz import AsyncZarazResourceWithRawResponse + + return AsyncZarazResourceWithRawResponse(self._client.zaraz) + @cached_property def speed(self) -> speed.AsyncSpeedResourceWithRawResponse: from .resources.speed import AsyncSpeedResourceWithRawResponse @@ -2834,6 +2929,18 @@ def ai(self) -> ai.AsyncAIResourceWithRawResponse: return AsyncAIResourceWithRawResponse(self._client.ai) + @cached_property + def security_center(self) -> security_center.AsyncSecurityCenterResourceWithRawResponse: + from .resources.security_center import AsyncSecurityCenterResourceWithRawResponse + + return AsyncSecurityCenterResourceWithRawResponse(self._client.security_center) + + @cached_property + def browser_rendering(self) -> browser_rendering.AsyncBrowserRenderingResourceWithRawResponse: + from .resources.browser_rendering import AsyncBrowserRenderingResourceWithRawResponse + + return AsyncBrowserRenderingResourceWithRawResponse(self._client.browser_rendering) + class CloudflareWithStreamedResponse: _client: Cloudflare @@ -3141,6 +3248,12 @@ def magic_network_monitoring(self) -> magic_network_monitoring.MagicNetworkMonit return MagicNetworkMonitoringResourceWithStreamingResponse(self._client.magic_network_monitoring) + @cached_property + def network_interconnects(self) -> network_interconnects.NetworkInterconnectsResourceWithStreamingResponse: + from .resources.network_interconnects import NetworkInterconnectsResourceWithStreamingResponse + + return NetworkInterconnectsResourceWithStreamingResponse(self._client.network_interconnects) + @cached_property def mtls_certificates(self) -> mtls_certificates.MTLSCertificatesResourceWithStreamingResponse: from .resources.mtls_certificates import MTLSCertificatesResourceWithStreamingResponse @@ -3257,6 +3370,12 @@ def origin_post_quantum_encryption( return OriginPostQuantumEncryptionResourceWithStreamingResponse(self._client.origin_post_quantum_encryption) + @cached_property + def zaraz(self) -> zaraz.ZarazResourceWithStreamingResponse: + from .resources.zaraz import ZarazResourceWithStreamingResponse + + return ZarazResourceWithStreamingResponse(self._client.zaraz) + @cached_property def speed(self) -> speed.SpeedResourceWithStreamingResponse: from .resources.speed import SpeedResourceWithStreamingResponse @@ -3359,6 +3478,18 @@ def ai(self) -> ai.AIResourceWithStreamingResponse: return AIResourceWithStreamingResponse(self._client.ai) + @cached_property + def security_center(self) -> security_center.SecurityCenterResourceWithStreamingResponse: + from .resources.security_center import SecurityCenterResourceWithStreamingResponse + + return SecurityCenterResourceWithStreamingResponse(self._client.security_center) + + @cached_property + def browser_rendering(self) -> browser_rendering.BrowserRenderingResourceWithStreamingResponse: + from .resources.browser_rendering import BrowserRenderingResourceWithStreamingResponse + + return BrowserRenderingResourceWithStreamingResponse(self._client.browser_rendering) + class AsyncCloudflareWithStreamedResponse: _client: AsyncCloudflare @@ -3670,6 +3801,12 @@ def magic_network_monitoring( return AsyncMagicNetworkMonitoringResourceWithStreamingResponse(self._client.magic_network_monitoring) + @cached_property + def network_interconnects(self) -> network_interconnects.AsyncNetworkInterconnectsResourceWithStreamingResponse: + from .resources.network_interconnects import AsyncNetworkInterconnectsResourceWithStreamingResponse + + return AsyncNetworkInterconnectsResourceWithStreamingResponse(self._client.network_interconnects) + @cached_property def mtls_certificates(self) -> mtls_certificates.AsyncMTLSCertificatesResourceWithStreamingResponse: from .resources.mtls_certificates import AsyncMTLSCertificatesResourceWithStreamingResponse @@ -3790,6 +3927,12 @@ def origin_post_quantum_encryption( self._client.origin_post_quantum_encryption ) + @cached_property + def zaraz(self) -> zaraz.AsyncZarazResourceWithStreamingResponse: + from .resources.zaraz import AsyncZarazResourceWithStreamingResponse + + return AsyncZarazResourceWithStreamingResponse(self._client.zaraz) + @cached_property def speed(self) -> speed.AsyncSpeedResourceWithStreamingResponse: from .resources.speed import AsyncSpeedResourceWithStreamingResponse @@ -3894,6 +4037,18 @@ def ai(self) -> ai.AsyncAIResourceWithStreamingResponse: return AsyncAIResourceWithStreamingResponse(self._client.ai) + @cached_property + def security_center(self) -> security_center.AsyncSecurityCenterResourceWithStreamingResponse: + from .resources.security_center import AsyncSecurityCenterResourceWithStreamingResponse + + return AsyncSecurityCenterResourceWithStreamingResponse(self._client.security_center) + + @cached_property + def browser_rendering(self) -> browser_rendering.AsyncBrowserRenderingResourceWithStreamingResponse: + from .resources.browser_rendering import AsyncBrowserRenderingResourceWithStreamingResponse + + return AsyncBrowserRenderingResourceWithStreamingResponse(self._client.browser_rendering) + Client = Cloudflare diff --git a/src/cloudflare/_constants.py b/src/cloudflare/_constants.py index a2ac3b6f327..6ddf2c7170b 100644 --- a/src/cloudflare/_constants.py +++ b/src/cloudflare/_constants.py @@ -6,7 +6,7 @@ OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" # default timeout is 1 minute -DEFAULT_TIMEOUT = httpx.Timeout(timeout=60.0, connect=5.0) +DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0) DEFAULT_MAX_RETRIES = 2 DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) diff --git a/src/cloudflare/_files.py b/src/cloudflare/_files.py index 715cc2078d1..8c03622633a 100644 --- a/src/cloudflare/_files.py +++ b/src/cloudflare/_files.py @@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: if not is_file_content(obj): prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`" raise RuntimeError( - f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead." + f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/cloudflare/cloudflare-python/tree/main#file-uploads" ) from None diff --git a/src/cloudflare/_models.py b/src/cloudflare/_models.py index 9a918aabf37..c4401ff868e 100644 --- a/src/cloudflare/_models.py +++ b/src/cloudflare/_models.py @@ -172,7 +172,7 @@ def to_json( @override def __str__(self) -> str: # mypy complains about an invalid self arg - return f'{self.__repr_name__()}({self.__repr_str__(", ")})' # type: ignore[misc] + return f"{self.__repr_name__()}({self.__repr_str__(', ')})" # type: ignore[misc] # Override the 'construct' method in a way that supports recursive parsing without validation. # Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836. @@ -426,10 +426,16 @@ def construct_type(*, value: object, type_: object) -> object: If the given value does not match the expected type then it is returned as-is. """ + + # store a reference to the original type we were given before we extract any inner + # types so that we can properly resolve forward references in `TypeAliasType` annotations + original_type = None + # we allow `object` as the input type because otherwise, passing things like # `Literal['value']` will be reported as a type error by type checkers type_ = cast("type[object]", type_) if is_type_alias_type(type_): + original_type = type_ # type: ignore[unreachable] type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` @@ -446,7 +452,7 @@ def construct_type(*, value: object, type_: object) -> object: if is_union(origin): try: - return validate_type(type_=cast("type[object]", type_), value=value) + return validate_type(type_=cast("type[object]", original_type or type_), value=value) except Exception: pass diff --git a/src/cloudflare/_response.py b/src/cloudflare/_response.py index c0db87171ff..f20e4379a89 100644 --- a/src/cloudflare/_response.py +++ b/src/cloudflare/_response.py @@ -136,6 +136,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to and is_annotated_type(cast_to): cast_to = extract_type_arg(cast_to, 0) + origin = get_origin(cast_to) or cast_to + if self._is_sse_stream: if to: if not is_stream_class_type(to): @@ -195,8 +197,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") - origin = get_origin(cast_to) or cast_to - if origin == APIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") @@ -210,7 +210,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`") return cast(R, response) - if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel): + if ( + inspect.isclass( + origin # pyright: ignore[reportUnknownArgumentType] + ) + and not issubclass(origin, BaseModel) + and issubclass(origin, pydantic.BaseModel) + ): raise TypeError( "Pydantic models must subclass our base model type, e.g. `from cloudflare import BaseModel`" ) diff --git a/src/cloudflare/_utils/_sync.py b/src/cloudflare/_utils/_sync.py index d0d810337ec..ad7ec71b76b 100644 --- a/src/cloudflare/_utils/_sync.py +++ b/src/cloudflare/_utils/_sync.py @@ -1,56 +1,77 @@ from __future__ import annotations +import sys +import asyncio import functools -from typing import TypeVar, Callable, Awaitable +import contextvars +from typing import Any, TypeVar, Callable, Awaitable from typing_extensions import ParamSpec import anyio +import sniffio import anyio.to_thread -from ._reflection import function_has_argument - T_Retval = TypeVar("T_Retval") T_ParamSpec = ParamSpec("T_ParamSpec") -# copied from `asyncer`, https://github.com/tiangolo/asyncer -def asyncify( - function: Callable[T_ParamSpec, T_Retval], - *, - cancellable: bool = False, - limiter: anyio.CapacityLimiter | None = None, -) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: +if sys.version_info >= (3, 9): + _asyncio_to_thread = asyncio.to_thread +else: + # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread + # for Python 3.8 support + async def _asyncio_to_thread( + func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs + ) -> Any: + """Asynchronously run function *func* in a separate thread. + + Any *args and **kwargs supplied for this function are directly passed + to *func*. Also, the current :class:`contextvars.Context` is propagated, + allowing context variables from the main thread to be accessed in the + separate thread. + + Returns a coroutine that can be awaited to get the eventual result of *func*. + """ + loop = asyncio.events.get_running_loop() + ctx = contextvars.copy_context() + func_call = functools.partial(ctx.run, func, *args, **kwargs) + return await loop.run_in_executor(None, func_call) + + +async def to_thread( + func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs +) -> T_Retval: + if sniffio.current_async_library() == "asyncio": + return await _asyncio_to_thread(func, *args, **kwargs) + + return await anyio.to_thread.run_sync( + functools.partial(func, *args, **kwargs), + ) + + +# inspired by `asyncer`, https://github.com/tiangolo/asyncer +def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: """ Take a blocking function and create an async one that receives the same - positional and keyword arguments, and that when called, calls the original function - in a worker thread using `anyio.to_thread.run_sync()`. Internally, - `asyncer.asyncify()` uses the same `anyio.to_thread.run_sync()`, but it supports - keyword arguments additional to positional arguments and it adds better support for - autocompletion and inline errors for the arguments of the function called and the - return value. - - If the `cancellable` option is enabled and the task waiting for its completion is - cancelled, the thread will still run its course but its return value (or any raised - exception) will be ignored. + positional and keyword arguments. For python version 3.9 and above, it uses + asyncio.to_thread to run the function in a separate thread. For python version + 3.8, it uses locally defined copy of the asyncio.to_thread function which was + introduced in python 3.9. - Use it like this: + Usage: - ```Python - def do_work(arg1, arg2, kwarg1="", kwarg2="") -> str: - # Do work - return "Some result" + ```python + def blocking_func(arg1, arg2, kwarg1=None): + # blocking code + return result - result = await to_thread.asyncify(do_work)("spam", "ham", kwarg1="a", kwarg2="b") - print(result) + result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1) ``` ## Arguments `function`: a blocking regular callable (e.g. a function) - `cancellable`: `True` to allow cancellation of the operation - `limiter`: capacity limiter to use to limit the total amount of threads running - (if omitted, the default limiter is used) ## Return @@ -60,22 +81,6 @@ def do_work(arg1, arg2, kwarg1="", kwarg2="") -> str: """ async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval: - partial_f = functools.partial(function, *args, **kwargs) - - # In `v4.1.0` anyio added the `abandon_on_cancel` argument and deprecated the old - # `cancellable` argument, so we need to use the new `abandon_on_cancel` to avoid - # surfacing deprecation warnings. - if function_has_argument(anyio.to_thread.run_sync, "abandon_on_cancel"): - return await anyio.to_thread.run_sync( - partial_f, - abandon_on_cancel=cancellable, - limiter=limiter, - ) - - return await anyio.to_thread.run_sync( - partial_f, - cancellable=cancellable, - limiter=limiter, - ) + return await to_thread(function, *args, **kwargs) return wrapper diff --git a/src/cloudflare/_utils/_transform.py b/src/cloudflare/_utils/_transform.py index a6b62cad0cb..18afd9d8bd5 100644 --- a/src/cloudflare/_utils/_transform.py +++ b/src/cloudflare/_utils/_transform.py @@ -25,7 +25,7 @@ is_annotated_type, strip_annotated_type, ) -from .._compat import model_dump, is_typeddict +from .._compat import get_origin, model_dump, is_typeddict _T = TypeVar("_T") @@ -164,9 +164,14 @@ def _transform_recursive( inner_type = annotation stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type if is_typeddict(stripped_type) and is_mapping(data): return _transform_typeddict(data, stripped_type) + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + if ( # List[T] (is_list_type(stripped_type) and is_list(data)) @@ -307,9 +312,14 @@ async def _async_transform_recursive( inner_type = annotation stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type if is_typeddict(stripped_type) and is_mapping(data): return await _async_transform_typeddict(data, stripped_type) + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + if ( # List[T] (is_list_type(stripped_type) and is_list(data)) diff --git a/src/cloudflare/_version.py b/src/cloudflare/_version.py index 0ed86798ee1..ffdaa193fd4 100644 --- a/src/cloudflare/_version.py +++ b/src/cloudflare/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "cloudflare" -__version__ = "4.0.0" # x-release-please-version +__version__ = "5.0.0" # x-release-please-version diff --git a/src/cloudflare/resources/abuse_reports.py b/src/cloudflare/resources/abuse_reports.py index a81ce3c43a6..a90898c5109 100644 --- a/src/cloudflare/resources/abuse_reports.py +++ b/src/cloudflare/resources/abuse_reports.py @@ -32,7 +32,7 @@ class AbuseReportsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AbuseReportsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -72,6 +72,7 @@ def create( "abuse_registrar_whois", "abuse_ncsei", ], + agree: Literal[0, 1], email: str, email2: str, host_notification: Literal["send", "send-anon", "none"], @@ -80,7 +81,6 @@ def create( urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, - agree: Literal[0, 1] | NotGiven = NOT_GIVEN, city: str | NotGiven = NOT_GIVEN, comments: str | NotGiven = NOT_GIVEN, company: str | NotGiven = NOT_GIVEN, @@ -114,7 +114,10 @@ def create( act: The abuse report type - email: A valid email of the abuse reporter + agree: Can be `0` for false or `1` for true + + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). email2: Should match the value provided in `email` @@ -129,21 +132,26 @@ def create( urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique - - address1: Text not exceeding 100 characters + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). - agent_name: The name of the copyright holder. Text not exceeding 60 characters. + address1: Text not exceeding 100 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - agree: Can be 0 or 1 + agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field + may be released by Cloudflare to third parties such as the Lumen Database + (https://lumendatabase.org/). - city: Text not exceeding 255 characters + city: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). comments: Any additional comments about the infringement not exceeding 2000 characters - company: Text not exceeding 100 characters + company: Text not exceeding 100 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - country: Text not exceeding 255 characters + country: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of destination IPs should not exceed 30 IP addresses. Each one of the IP addresses @@ -153,11 +161,13 @@ def create( details and the exact steps needed to view the content, not exceeding 5000 characters - name: Text not exceeding 255 characters + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report - original_work: Text not exceeding 255 characters + original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual @@ -172,9 +182,11 @@ def create( IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - state: Text not exceeding 255 characters + state: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - tele: Text not exceeding 20 characters + tele: Text not exceeding 20 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). title: Text not exceeding 255 characters @@ -201,6 +213,7 @@ def create( body=maybe_transform( { "act": act, + "agree": agree, "email": email, "email2": email2, "host_notification": host_notification, @@ -209,7 +222,6 @@ def create( "urls": urls, "address1": address1, "agent_name": agent_name, - "agree": agree, "city": city, "comments": comments, "company": company, @@ -246,7 +258,7 @@ class AsyncAbuseReportsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAbuseReportsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -286,6 +298,7 @@ async def create( "abuse_registrar_whois", "abuse_ncsei", ], + agree: Literal[0, 1], email: str, email2: str, host_notification: Literal["send", "send-anon", "none"], @@ -294,7 +307,6 @@ async def create( urls: str, address1: str | NotGiven = NOT_GIVEN, agent_name: str | NotGiven = NOT_GIVEN, - agree: Literal[0, 1] | NotGiven = NOT_GIVEN, city: str | NotGiven = NOT_GIVEN, comments: str | NotGiven = NOT_GIVEN, company: str | NotGiven = NOT_GIVEN, @@ -328,7 +340,10 @@ async def create( act: The abuse report type - email: A valid email of the abuse reporter + agree: Can be `0` for false or `1` for true + + email: A valid email of the abuse reporter. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). email2: Should match the value provided in `email` @@ -343,21 +358,26 @@ async def create( urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs should not exceed 250 URLs. All URLs should have the same hostname. Each URL - should be unique - - address1: Text not exceeding 100 characters + should be unique. This field may be released by Cloudflare to third parties such + as the Lumen Database (https://lumendatabase.org/). - agent_name: The name of the copyright holder. Text not exceeding 60 characters. + address1: Text not exceeding 100 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - agree: Can be 0 or 1 + agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field + may be released by Cloudflare to third parties such as the Lumen Database + (https://lumendatabase.org/). - city: Text not exceeding 255 characters + city: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). comments: Any additional comments about the infringement not exceeding 2000 characters - company: Text not exceeding 100 characters + company: Text not exceeding 100 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - country: Text not exceeding 255 characters + country: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of destination IPs should not exceed 30 IP addresses. Each one of the IP addresses @@ -367,11 +387,13 @@ async def create( details and the exact steps needed to view the content, not exceeding 5000 characters - name: Text not exceeding 255 characters + name: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report - original_work: Text not exceeding 255 characters + original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total size of the field should not exceed 2000 characters. Each individual @@ -386,9 +408,11 @@ async def create( IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be unique - state: Text not exceeding 255 characters + state: Text not exceeding 255 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). - tele: Text not exceeding 20 characters + tele: Text not exceeding 20 characters. This field may be released by Cloudflare to + third parties such as the Lumen Database (https://lumendatabase.org/). title: Text not exceeding 255 characters @@ -415,6 +439,7 @@ async def create( body=await async_maybe_transform( { "act": act, + "agree": agree, "email": email, "email2": email2, "host_notification": host_notification, @@ -423,7 +448,6 @@ async def create( "urls": urls, "address1": address1, "agent_name": agent_name, - "agree": agree, "city": city, "comments": comments, "company": company, diff --git a/src/cloudflare/resources/accounts/accounts.py b/src/cloudflare/resources/accounts/accounts.py index eba792cbcc5..d59d809d688 100644 --- a/src/cloudflare/resources/accounts/accounts.py +++ b/src/cloudflare/resources/accounts/accounts.py @@ -94,7 +94,7 @@ def logs(self) -> LogsResource: @cached_property def with_raw_response(self) -> AccountsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -377,7 +377,7 @@ def logs(self) -> AsyncLogsResource: @cached_property def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/accounts/logs/audit.py b/src/cloudflare/resources/accounts/logs/audit.py index 7375f4199ec..d5ea8076548 100644 --- a/src/cloudflare/resources/accounts/logs/audit.py +++ b/src/cloudflare/resources/accounts/logs/audit.py @@ -30,7 +30,7 @@ class AuditResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AuditResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -212,7 +212,7 @@ class AsyncAuditResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAuditResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/accounts/logs/logs.py b/src/cloudflare/resources/accounts/logs/logs.py index 475921543aa..69595caf7a3 100644 --- a/src/cloudflare/resources/accounts/logs/logs.py +++ b/src/cloudflare/resources/accounts/logs/logs.py @@ -24,7 +24,7 @@ def audit(self) -> AuditResource: @cached_property def with_raw_response(self) -> LogsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -49,7 +49,7 @@ def audit(self) -> AsyncAuditResource: @cached_property def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py index ed54745beb2..1565d83d173 100644 --- a/src/cloudflare/resources/accounts/members.py +++ b/src/cloudflare/resources/accounts/members.py @@ -36,7 +36,7 @@ class MembersResource(SyncAPIResource): @cached_property def with_raw_response(self) -> MembersResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -424,7 +424,7 @@ class AsyncMembersResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncMembersResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/accounts/roles.py b/src/cloudflare/resources/accounts/roles.py index 1fcaa9c487c..8c49fb115a9 100644 --- a/src/cloudflare/resources/accounts/roles.py +++ b/src/cloudflare/resources/accounts/roles.py @@ -7,6 +7,7 @@ import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -16,8 +17,9 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ...pagination import SyncSinglePage, AsyncSinglePage +from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ..._base_client import AsyncPaginator, make_request_options +from ...types.accounts import role_list_params from ...types.shared.role import Role __all__ = ["RolesResource", "AsyncRolesResource"] @@ -27,7 +29,7 @@ class RolesResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RolesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -47,19 +49,25 @@ def list( self, *, account_id: str, + page: float | NotGiven = NOT_GIVEN, + per_page: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[Role]: + ) -> SyncV4PagePaginationArray[Role]: """ Get all available roles for an account. Args: account_id: Account identifier tag. + page: Page number of paginated results. + + per_page: Number of roles per page. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -72,9 +80,19 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/roles", - page=SyncSinglePage[Role], + page=SyncV4PagePaginationArray[Role], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + role_list_params.RoleListParams, + ), ), model=Role, ) @@ -128,7 +146,7 @@ class AsyncRolesResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRolesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -148,19 +166,25 @@ def list( self, *, account_id: str, + page: float | NotGiven = NOT_GIVEN, + per_page: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Role, AsyncSinglePage[Role]]: + ) -> AsyncPaginator[Role, AsyncV4PagePaginationArray[Role]]: """ Get all available roles for an account. Args: account_id: Account identifier tag. + page: Page number of paginated results. + + per_page: Number of roles per page. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -173,9 +197,19 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/roles", - page=AsyncSinglePage[Role], + page=AsyncV4PagePaginationArray[Role], options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "page": page, + "per_page": per_page, + }, + role_list_params.RoleListParams, + ), ), model=Role, ) diff --git a/src/cloudflare/resources/accounts/subscriptions.py b/src/cloudflare/resources/accounts/subscriptions.py index 1bf69681bd2..542727c8900 100644 --- a/src/cloudflare/resources/accounts/subscriptions.py +++ b/src/cloudflare/resources/accounts/subscriptions.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, Type, Optional, cast +from typing import Any, Type, cast from typing_extensions import Literal import httpx @@ -21,10 +21,11 @@ async_to_streamed_response_wrapper, ) from ..._wrappers import ResultWrapper -from ..._base_client import make_request_options +from ...pagination import SyncSinglePage, AsyncSinglePage +from ..._base_client import AsyncPaginator, make_request_options from ...types.accounts import subscription_create_params, subscription_update_params +from ...types.shared.subscription import Subscription from ...types.shared_params.rate_plan import RatePlan -from ...types.accounts.subscription_get_response import SubscriptionGetResponse from ...types.accounts.subscription_create_response import SubscriptionCreateResponse from ...types.accounts.subscription_delete_response import SubscriptionDeleteResponse from ...types.accounts.subscription_update_response import SubscriptionUpdateResponse @@ -36,7 +37,7 @@ class SubscriptionsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SubscriptionsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -229,7 +230,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SubscriptionGetResponse]: + ) -> SyncSinglePage[Subscription]: """ Lists all of an account's subscriptions. @@ -246,16 +247,13 @@ def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/subscriptions", + page=SyncSinglePage[Subscription], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SubscriptionGetResponse]]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[SubscriptionGetResponse]], ResultWrapper[SubscriptionGetResponse]), + model=Subscription, ) @@ -263,7 +261,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSubscriptionsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -446,7 +444,7 @@ async def delete( cast_to=cast(Type[SubscriptionDeleteResponse], ResultWrapper[SubscriptionDeleteResponse]), ) - async def get( + def get( self, *, account_id: str, @@ -456,7 +454,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[SubscriptionGetResponse]: + ) -> AsyncPaginator[Subscription, AsyncSinglePage[Subscription]]: """ Lists all of an account's subscriptions. @@ -473,16 +471,13 @@ async def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/subscriptions", + page=AsyncSinglePage[Subscription], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[SubscriptionGetResponse]]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[SubscriptionGetResponse]], ResultWrapper[SubscriptionGetResponse]), + model=Subscription, ) diff --git a/src/cloudflare/resources/accounts/tokens/permission_groups.py b/src/cloudflare/resources/accounts/tokens/permission_groups.py index 591870ebe7f..d98d5235ce0 100644 --- a/src/cloudflare/resources/accounts/tokens/permission_groups.py +++ b/src/cloudflare/resources/accounts/tokens/permission_groups.py @@ -15,6 +15,8 @@ ) from ....pagination import SyncSinglePage, AsyncSinglePage from ...._base_client import AsyncPaginator, make_request_options +from ....types.accounts.tokens.permission_group_get_response import PermissionGroupGetResponse +from ....types.accounts.tokens.permission_group_list_response import PermissionGroupListResponse __all__ = ["PermissionGroupsResource", "AsyncPermissionGroupsResource"] @@ -23,7 +25,7 @@ class PermissionGroupsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> PermissionGroupsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -49,7 +51,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncSinglePage[object]: + ) -> SyncSinglePage[PermissionGroupListResponse]: """ Find all available permission groups for Account Owned API Tokens @@ -68,11 +70,47 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/tokens/permission_groups", - page=SyncSinglePage[object], + page=SyncSinglePage[PermissionGroupListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=object, + model=PermissionGroupListResponse, + ) + + def get( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> SyncSinglePage[PermissionGroupGetResponse]: + """ + Find all available permission groups for Account Owned API Tokens + + Args: + account_id: Account identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/tokens/permission_groups", + page=SyncSinglePage[PermissionGroupGetResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=PermissionGroupGetResponse, ) @@ -80,7 +118,7 @@ class AsyncPermissionGroupsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncPermissionGroupsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -106,7 +144,43 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[object, AsyncSinglePage[object]]: + ) -> AsyncPaginator[PermissionGroupListResponse, AsyncSinglePage[PermissionGroupListResponse]]: + """ + Find all available permission groups for Account Owned API Tokens + + Args: + account_id: Account identifier tag. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not account_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get_api_list( + f"/accounts/{account_id}/tokens/permission_groups", + page=AsyncSinglePage[PermissionGroupListResponse], + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + model=PermissionGroupListResponse, + ) + + def get( + self, + *, + account_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> AsyncPaginator[PermissionGroupGetResponse, AsyncSinglePage[PermissionGroupGetResponse]]: """ Find all available permission groups for Account Owned API Tokens @@ -125,11 +199,11 @@ def list( raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get_api_list( f"/accounts/{account_id}/tokens/permission_groups", - page=AsyncSinglePage[object], + page=AsyncSinglePage[PermissionGroupGetResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - model=object, + model=PermissionGroupGetResponse, ) @@ -140,6 +214,9 @@ def __init__(self, permission_groups: PermissionGroupsResource) -> None: self.list = to_raw_response_wrapper( permission_groups.list, ) + self.get = to_raw_response_wrapper( + permission_groups.get, + ) class AsyncPermissionGroupsResourceWithRawResponse: @@ -149,6 +226,9 @@ def __init__(self, permission_groups: AsyncPermissionGroupsResource) -> None: self.list = async_to_raw_response_wrapper( permission_groups.list, ) + self.get = async_to_raw_response_wrapper( + permission_groups.get, + ) class PermissionGroupsResourceWithStreamingResponse: @@ -158,6 +238,9 @@ def __init__(self, permission_groups: PermissionGroupsResource) -> None: self.list = to_streamed_response_wrapper( permission_groups.list, ) + self.get = to_streamed_response_wrapper( + permission_groups.get, + ) class AsyncPermissionGroupsResourceWithStreamingResponse: @@ -167,3 +250,6 @@ def __init__(self, permission_groups: AsyncPermissionGroupsResource) -> None: self.list = async_to_streamed_response_wrapper( permission_groups.list, ) + self.get = async_to_streamed_response_wrapper( + permission_groups.get, + ) diff --git a/src/cloudflare/resources/accounts/tokens/tokens.py b/src/cloudflare/resources/accounts/tokens/tokens.py index b5eb2fbd996..5af8755d84e 100644 --- a/src/cloudflare/resources/accounts/tokens/tokens.py +++ b/src/cloudflare/resources/accounts/tokens/tokens.py @@ -62,7 +62,7 @@ def value(self) -> ValueResource: @cached_property def with_raw_response(self) -> TokensResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -409,7 +409,7 @@ def value(self) -> AsyncValueResource: @cached_property def with_raw_response(self) -> AsyncTokensResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/accounts/tokens/value.py b/src/cloudflare/resources/accounts/tokens/value.py index 59dac86db7c..94034ab2a7d 100644 --- a/src/cloudflare/resources/accounts/tokens/value.py +++ b/src/cloudflare/resources/accounts/tokens/value.py @@ -31,7 +31,7 @@ class ValueResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ValueResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -98,7 +98,7 @@ class AsyncValueResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncValueResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/acm/acm.py b/src/cloudflare/resources/acm/acm.py index 97cc4b05fa2..4d576c8fa13 100644 --- a/src/cloudflare/resources/acm/acm.py +++ b/src/cloudflare/resources/acm/acm.py @@ -24,7 +24,7 @@ def total_tls(self) -> TotalTLSResource: @cached_property def with_raw_response(self) -> ACMResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -49,7 +49,7 @@ def total_tls(self) -> AsyncTotalTLSResource: @cached_property def with_raw_response(self) -> AsyncACMResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/acm/total_tls.py b/src/cloudflare/resources/acm/total_tls.py index 1eded706d28..2d0e550ccf5 100644 --- a/src/cloudflare/resources/acm/total_tls.py +++ b/src/cloudflare/resources/acm/total_tls.py @@ -33,7 +33,7 @@ class TotalTLSResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TotalTLSResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -146,7 +146,7 @@ class AsyncTotalTLSResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTotalTLSResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/address_maps/accounts.py b/src/cloudflare/resources/addressing/address_maps/accounts.py index a5279ff240c..d30e053c698 100644 --- a/src/cloudflare/resources/addressing/address_maps/accounts.py +++ b/src/cloudflare/resources/addressing/address_maps/accounts.py @@ -29,7 +29,7 @@ class AccountsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AccountsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -132,7 +132,7 @@ class AsyncAccountsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/address_maps/address_maps.py b/src/cloudflare/resources/addressing/address_maps/address_maps.py index b3a6fda77c9..e2dd8d9111d 100644 --- a/src/cloudflare/resources/addressing/address_maps/address_maps.py +++ b/src/cloudflare/resources/addressing/address_maps/address_maps.py @@ -71,7 +71,7 @@ def zones(self) -> ZonesResource: @cached_property def with_raw_response(self) -> AddressMapsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -354,7 +354,7 @@ def zones(self) -> AsyncZonesResource: @cached_property def with_raw_response(self) -> AsyncAddressMapsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/address_maps/ips.py b/src/cloudflare/resources/addressing/address_maps/ips.py index 15c999ab654..c17ae0f81bc 100644 --- a/src/cloudflare/resources/addressing/address_maps/ips.py +++ b/src/cloudflare/resources/addressing/address_maps/ips.py @@ -29,7 +29,7 @@ class IPsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> IPsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -142,7 +142,7 @@ class AsyncIPsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncIPsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/address_maps/zones.py b/src/cloudflare/resources/addressing/address_maps/zones.py index d7f859f2617..b0813f207c3 100644 --- a/src/cloudflare/resources/addressing/address_maps/zones.py +++ b/src/cloudflare/resources/addressing/address_maps/zones.py @@ -29,7 +29,7 @@ class ZonesResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ZonesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -142,7 +142,7 @@ class AsyncZonesResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncZonesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/addressing.py b/src/cloudflare/resources/addressing/addressing.py index 65ac3b59c70..2ddc2d78362 100644 --- a/src/cloudflare/resources/addressing/addressing.py +++ b/src/cloudflare/resources/addressing/addressing.py @@ -72,7 +72,7 @@ def prefixes(self) -> PrefixesResource: @cached_property def with_raw_response(self) -> AddressingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -113,7 +113,7 @@ def prefixes(self) -> AsyncPrefixesResource: @cached_property def with_raw_response(self) -> AsyncAddressingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/loa_documents.py b/src/cloudflare/resources/addressing/loa_documents.py index c4db454b8c2..47abb0af10f 100644 --- a/src/cloudflare/resources/addressing/loa_documents.py +++ b/src/cloudflare/resources/addressing/loa_documents.py @@ -39,7 +39,7 @@ class LOADocumentsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> LOADocumentsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -148,7 +148,7 @@ class AsyncLOADocumentsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncLOADocumentsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/prefixes/advertisement_status.py b/src/cloudflare/resources/addressing/prefixes/advertisement_status.py index 4ca0b677f15..c8ce2f9fb6b 100644 --- a/src/cloudflare/resources/addressing/prefixes/advertisement_status.py +++ b/src/cloudflare/resources/addressing/prefixes/advertisement_status.py @@ -32,7 +32,7 @@ class AdvertisementStatusResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AdvertisementStatusResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -156,7 +156,7 @@ class AsyncAdvertisementStatusResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAdvertisementStatusResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py b/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py index 3f65acd83ad..f933e12539e 100644 --- a/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py @@ -32,7 +32,7 @@ class BGPPrefixesResource(SyncAPIResource): @cached_property def with_raw_response(self) -> BGPPrefixesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -249,7 +249,7 @@ class AsyncBGPPrefixesResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBGPPrefixesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/prefixes/delegations.py b/src/cloudflare/resources/addressing/prefixes/delegations.py index 93870db9319..6c1e409eef1 100644 --- a/src/cloudflare/resources/addressing/prefixes/delegations.py +++ b/src/cloudflare/resources/addressing/prefixes/delegations.py @@ -33,7 +33,7 @@ class DelegationsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> DelegationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -201,7 +201,7 @@ class AsyncDelegationsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncDelegationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/prefixes/prefixes.py b/src/cloudflare/resources/addressing/prefixes/prefixes.py index b9620460953..6c9f5435bec 100644 --- a/src/cloudflare/resources/addressing/prefixes/prefixes.py +++ b/src/cloudflare/resources/addressing/prefixes/prefixes.py @@ -81,7 +81,7 @@ def delegations(self) -> DelegationsResource: @cached_property def with_raw_response(self) -> PrefixesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -342,7 +342,7 @@ def delegations(self) -> AsyncDelegationsResource: @cached_property def with_raw_response(self) -> AsyncPrefixesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/prefixes/service_bindings.py b/src/cloudflare/resources/addressing/prefixes/service_bindings.py index c5be5b730ca..053cdd351c4 100644 --- a/src/cloudflare/resources/addressing/prefixes/service_bindings.py +++ b/src/cloudflare/resources/addressing/prefixes/service_bindings.py @@ -33,7 +33,7 @@ class ServiceBindingsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ServiceBindingsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -256,7 +256,7 @@ class AsyncServiceBindingsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncServiceBindingsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py b/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py index 6df921030ff..ed9b3b46be5 100644 --- a/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py +++ b/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py @@ -48,7 +48,7 @@ def regions(self) -> RegionsResource: @cached_property def with_raw_response(self) -> RegionalHostnamesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -303,7 +303,7 @@ def regions(self) -> AsyncRegionsResource: @cached_property def with_raw_response(self) -> AsyncRegionalHostnamesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/regional_hostnames/regions.py b/src/cloudflare/resources/addressing/regional_hostnames/regions.py index 16d9deac419..f0c69f1b81f 100644 --- a/src/cloudflare/resources/addressing/regional_hostnames/regions.py +++ b/src/cloudflare/resources/addressing/regional_hostnames/regions.py @@ -24,7 +24,7 @@ class RegionsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> RegionsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -81,7 +81,7 @@ class AsyncRegionsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncRegionsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/addressing/services.py b/src/cloudflare/resources/addressing/services.py index e73f0c62298..799ce7f0980 100644 --- a/src/cloudflare/resources/addressing/services.py +++ b/src/cloudflare/resources/addressing/services.py @@ -24,7 +24,7 @@ class ServicesResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ServicesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -84,7 +84,7 @@ class AsyncServicesResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncServicesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai/ai.py b/src/cloudflare/resources/ai/ai.py index 396a1360fe9..bbc218bb3ab 100644 --- a/src/cloudflare/resources/ai/ai.py +++ b/src/cloudflare/resources/ai/ai.py @@ -81,7 +81,7 @@ def models(self) -> ModelsResource: @cached_property def with_raw_response(self) -> AIResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -424,6 +424,7 @@ def run( presence_penalty: float | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN, + response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN, seed: int | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN, @@ -501,6 +502,7 @@ def run( max_tokens: int | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN, + response_format: ai_run_params.MessagesResponseFormat | NotGiven = NOT_GIVEN, seed: int | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN, @@ -656,10 +658,16 @@ def run( *, account_id: str, image: Iterable[float], + frequency_penalty: float | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, + presence_penalty: float | NotGiven = NOT_GIVEN, prompt: str | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, + repetition_penalty: float | NotGiven = NOT_GIVEN, + seed: float | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN, + top_k: float | NotGiven = NOT_GIVEN, + top_p: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -682,16 +690,32 @@ def run( image: An array of integers that represent the image data constrained to 8-bit unsigned integer values + frequency_penalty: Decreases the likelihood of the model repeating the same lines verbatim. + max_tokens: The maximum number of tokens to generate in the response. + presence_penalty: Increases the likelihood of the model introducing new topics. + prompt: The input text prompt for the model to generate a response. raw: If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + repetition_penalty: Penalty for repeated tokens; higher values discourage repetition. + + seed: Random seed for reproducibility of the generation. + temperature: Controls the randomness of the output; higher values produce more random results. + top_k: Limits the AI to choose from the top 'k' most probable words. Lower values make + responses more focused; higher values introduce more variety and potential + surprises. + + top_p: Controls the creativity of the AI's responses by adjusting how many possible + words it considers. Lower values make outputs more predictable; higher values + allow for more varied and creative responses. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -726,7 +750,7 @@ def run( mask: Iterable[float] | NotGiven = NOT_GIVEN, negative_prompt: str | NotGiven = NOT_GIVEN, num_steps: int | NotGiven = NOT_GIVEN, - seed: int | NotGiven = NOT_GIVEN, + seed: int | float | NotGiven = NOT_GIVEN, strength: float | NotGiven = NOT_GIVEN, width: int | NotGiven = NOT_GIVEN, lang: str | NotGiven = NOT_GIVEN, @@ -739,9 +763,10 @@ def run( presence_penalty: float | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN, + response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN, - top_k: int | NotGiven = NOT_GIVEN, + top_k: int | float | NotGiven = NOT_GIVEN, top_p: float | NotGiven = NOT_GIVEN, messages: Iterable[ai_run_params.MessagesMessage] | NotGiven = NOT_GIVEN, functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN, @@ -787,6 +812,7 @@ def run( "presence_penalty": presence_penalty, "raw": raw, "repetition_penalty": repetition_penalty, + "response_format": response_format, "stream": stream, "temperature": temperature, "top_k": top_k, @@ -833,7 +859,7 @@ def models(self) -> AsyncModelsResource: @cached_property def with_raw_response(self) -> AsyncAIResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -1176,6 +1202,7 @@ async def run( presence_penalty: float | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN, + response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN, seed: int | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN, @@ -1253,6 +1280,7 @@ async def run( max_tokens: int | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN, + response_format: ai_run_params.MessagesResponseFormat | NotGiven = NOT_GIVEN, seed: int | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN, @@ -1408,10 +1436,16 @@ async def run( *, account_id: str, image: Iterable[float], + frequency_penalty: float | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN, + presence_penalty: float | NotGiven = NOT_GIVEN, prompt: str | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, + repetition_penalty: float | NotGiven = NOT_GIVEN, + seed: float | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN, + top_k: float | NotGiven = NOT_GIVEN, + top_p: float | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1434,16 +1468,32 @@ async def run( image: An array of integers that represent the image data constrained to 8-bit unsigned integer values + frequency_penalty: Decreases the likelihood of the model repeating the same lines verbatim. + max_tokens: The maximum number of tokens to generate in the response. + presence_penalty: Increases the likelihood of the model introducing new topics. + prompt: The input text prompt for the model to generate a response. raw: If true, a chat template is not applied and you must adhere to the specific model's expected formatting. + repetition_penalty: Penalty for repeated tokens; higher values discourage repetition. + + seed: Random seed for reproducibility of the generation. + temperature: Controls the randomness of the output; higher values produce more random results. + top_k: Limits the AI to choose from the top 'k' most probable words. Lower values make + responses more focused; higher values introduce more variety and potential + surprises. + + top_p: Controls the creativity of the AI's responses by adjusting how many possible + words it considers. Lower values make outputs more predictable; higher values + allow for more varied and creative responses. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1478,7 +1528,7 @@ async def run( mask: Iterable[float] | NotGiven = NOT_GIVEN, negative_prompt: str | NotGiven = NOT_GIVEN, num_steps: int | NotGiven = NOT_GIVEN, - seed: int | NotGiven = NOT_GIVEN, + seed: int | float | NotGiven = NOT_GIVEN, strength: float | NotGiven = NOT_GIVEN, width: int | NotGiven = NOT_GIVEN, lang: str | NotGiven = NOT_GIVEN, @@ -1491,9 +1541,10 @@ async def run( presence_penalty: float | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN, + response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN, - top_k: int | NotGiven = NOT_GIVEN, + top_k: int | float | NotGiven = NOT_GIVEN, top_p: float | NotGiven = NOT_GIVEN, messages: Iterable[ai_run_params.MessagesMessage] | NotGiven = NOT_GIVEN, functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN, @@ -1539,6 +1590,7 @@ async def run( "presence_penalty": presence_penalty, "raw": raw, "repetition_penalty": repetition_penalty, + "response_format": response_format, "stream": stream, "temperature": temperature, "top_k": top_k, diff --git a/src/cloudflare/resources/ai/authors.py b/src/cloudflare/resources/ai/authors.py index ecf213ff048..f5c5ce9877d 100644 --- a/src/cloudflare/resources/ai/authors.py +++ b/src/cloudflare/resources/ai/authors.py @@ -23,7 +23,7 @@ class AuthorsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AuthorsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -78,7 +78,7 @@ class AsyncAuthorsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAuthorsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai/finetunes/assets.py b/src/cloudflare/resources/ai/finetunes/assets.py index dfeb072ae01..7df434bb081 100644 --- a/src/cloudflare/resources/ai/finetunes/assets.py +++ b/src/cloudflare/resources/ai/finetunes/assets.py @@ -33,7 +33,7 @@ class AssetsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AssetsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -109,7 +109,7 @@ class AsyncAssetsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAssetsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai/finetunes/finetunes.py b/src/cloudflare/resources/ai/finetunes/finetunes.py index 1cdef4efc51..51bac25f1b5 100644 --- a/src/cloudflare/resources/ai/finetunes/finetunes.py +++ b/src/cloudflare/resources/ai/finetunes/finetunes.py @@ -56,7 +56,7 @@ def public(self) -> PublicResource: @cached_property def with_raw_response(self) -> FinetunesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -172,7 +172,7 @@ def public(self) -> AsyncPublicResource: @cached_property def with_raw_response(self) -> AsyncFinetunesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai/finetunes/public.py b/src/cloudflare/resources/ai/finetunes/public.py index 74c49e747fa..c8d542c985e 100644 --- a/src/cloudflare/resources/ai/finetunes/public.py +++ b/src/cloudflare/resources/ai/finetunes/public.py @@ -26,7 +26,7 @@ class PublicResource(SyncAPIResource): @cached_property def with_raw_response(self) -> PublicResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -101,7 +101,7 @@ class AsyncPublicResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncPublicResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai/models/models.py b/src/cloudflare/resources/ai/models/models.py index 66a2394f641..74f1ac1ad34 100644 --- a/src/cloudflare/resources/ai/models/models.py +++ b/src/cloudflare/resources/ai/models/models.py @@ -37,7 +37,7 @@ def schema(self) -> SchemaResource: @cached_property def with_raw_response(self) -> ModelsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -128,7 +128,7 @@ def schema(self) -> AsyncSchemaResource: @cached_property def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai/models/schema.py b/src/cloudflare/resources/ai/models/schema.py index be4afa7007f..9b62769bf19 100644 --- a/src/cloudflare/resources/ai/models/schema.py +++ b/src/cloudflare/resources/ai/models/schema.py @@ -30,7 +30,7 @@ class SchemaResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SchemaResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -92,7 +92,7 @@ class AsyncSchemaResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSchemaResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai/tasks.py b/src/cloudflare/resources/ai/tasks.py index c2b6cae396a..16b130e6805 100644 --- a/src/cloudflare/resources/ai/tasks.py +++ b/src/cloudflare/resources/ai/tasks.py @@ -23,7 +23,7 @@ class TasksResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TasksResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -78,7 +78,7 @@ class AsyncTasksResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai_gateway/ai_gateway.py b/src/cloudflare/resources/ai_gateway/ai_gateway.py index ebbaa17ba8b..feb9806e49e 100644 --- a/src/cloudflare/resources/ai_gateway/ai_gateway.py +++ b/src/cloudflare/resources/ai_gateway/ai_gateway.py @@ -85,7 +85,7 @@ def evaluations(self) -> EvaluationsResource: @cached_property def with_raw_response(self) -> AIGatewayResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -112,6 +112,9 @@ def create( rate_limiting_interval: Optional[int], rate_limiting_limit: Optional[int], rate_limiting_technique: Literal["fixed", "sliding"], + authentication: bool | NotGiven = NOT_GIVEN, + log_management: Optional[int] | NotGiven = NOT_GIVEN, + log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | NotGiven = NOT_GIVEN, logpush: bool | NotGiven = NOT_GIVEN, logpush_public_key: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -148,6 +151,9 @@ def create( "rate_limiting_interval": rate_limiting_interval, "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, + "authentication": authentication, + "log_management": log_management, + "log_management_strategy": log_management_strategy, "logpush": logpush, "logpush_public_key": logpush_public_key, }, @@ -174,6 +180,9 @@ def update( rate_limiting_interval: Optional[int], rate_limiting_limit: Optional[int], rate_limiting_technique: Literal["fixed", "sliding"], + authentication: bool | NotGiven = NOT_GIVEN, + log_management: Optional[int] | NotGiven = NOT_GIVEN, + log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | NotGiven = NOT_GIVEN, logpush: bool | NotGiven = NOT_GIVEN, logpush_public_key: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -211,6 +220,9 @@ def update( "rate_limiting_interval": rate_limiting_interval, "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, + "authentication": authentication, + "log_management": log_management, + "log_management_strategy": log_management_strategy, "logpush": logpush, "logpush_public_key": logpush_public_key, }, @@ -381,7 +393,7 @@ def evaluations(self) -> AsyncEvaluationsResource: @cached_property def with_raw_response(self) -> AsyncAIGatewayResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -408,6 +420,9 @@ async def create( rate_limiting_interval: Optional[int], rate_limiting_limit: Optional[int], rate_limiting_technique: Literal["fixed", "sliding"], + authentication: bool | NotGiven = NOT_GIVEN, + log_management: Optional[int] | NotGiven = NOT_GIVEN, + log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | NotGiven = NOT_GIVEN, logpush: bool | NotGiven = NOT_GIVEN, logpush_public_key: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -444,6 +459,9 @@ async def create( "rate_limiting_interval": rate_limiting_interval, "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, + "authentication": authentication, + "log_management": log_management, + "log_management_strategy": log_management_strategy, "logpush": logpush, "logpush_public_key": logpush_public_key, }, @@ -470,6 +488,9 @@ async def update( rate_limiting_interval: Optional[int], rate_limiting_limit: Optional[int], rate_limiting_technique: Literal["fixed", "sliding"], + authentication: bool | NotGiven = NOT_GIVEN, + log_management: Optional[int] | NotGiven = NOT_GIVEN, + log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | NotGiven = NOT_GIVEN, logpush: bool | NotGiven = NOT_GIVEN, logpush_public_key: Optional[str] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -507,6 +528,9 @@ async def update( "rate_limiting_interval": rate_limiting_interval, "rate_limiting_limit": rate_limiting_limit, "rate_limiting_technique": rate_limiting_technique, + "authentication": authentication, + "log_management": log_management, + "log_management_strategy": log_management_strategy, "logpush": logpush, "logpush_public_key": logpush_public_key, }, diff --git a/src/cloudflare/resources/ai_gateway/datasets.py b/src/cloudflare/resources/ai_gateway/datasets.py index 3d58ec297b4..afed3ec86ef 100644 --- a/src/cloudflare/resources/ai_gateway/datasets.py +++ b/src/cloudflare/resources/ai_gateway/datasets.py @@ -36,7 +36,7 @@ class DatasetsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> DatasetsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -315,7 +315,7 @@ class AsyncDatasetsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncDatasetsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai_gateway/evaluation_types.py b/src/cloudflare/resources/ai_gateway/evaluation_types.py index 94d76d33826..047c5936dec 100644 --- a/src/cloudflare/resources/ai_gateway/evaluation_types.py +++ b/src/cloudflare/resources/ai_gateway/evaluation_types.py @@ -2,16 +2,12 @@ from __future__ import annotations -from typing import Type, cast from typing_extensions import Literal import httpx from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._utils import maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -20,10 +16,10 @@ async_to_raw_response_wrapper, async_to_streamed_response_wrapper, ) -from ..._wrappers import ResultWrapper -from ..._base_client import make_request_options -from ...types.ai_gateway import evaluation_type_get_params -from ...types.ai_gateway.evaluation_type_get_response import EvaluationTypeGetResponse +from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from ..._base_client import AsyncPaginator, make_request_options +from ...types.ai_gateway import evaluation_type_list_params +from ...types.ai_gateway.evaluation_type_list_response import EvaluationTypeListResponse __all__ = ["EvaluationTypesResource", "AsyncEvaluationTypesResource"] @@ -32,7 +28,7 @@ class EvaluationTypesResource(SyncAPIResource): @cached_property def with_raw_response(self) -> EvaluationTypesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -48,7 +44,7 @@ def with_streaming_response(self) -> EvaluationTypesResourceWithStreamingRespons """ return EvaluationTypesResourceWithStreamingResponse(self) - def get( + def list( self, *, account_id: str, @@ -62,7 +58,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EvaluationTypeGetResponse: + ) -> SyncV4PagePaginationArray[EvaluationTypeListResponse]: """ List Evaluators @@ -77,8 +73,9 @@ def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/ai-gateway/evaluation-types", + page=SyncV4PagePaginationArray[EvaluationTypeListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -91,11 +88,10 @@ def get( "page": page, "per_page": per_page, }, - evaluation_type_get_params.EvaluationTypeGetParams, + evaluation_type_list_params.EvaluationTypeListParams, ), - post_parser=ResultWrapper[EvaluationTypeGetResponse]._unwrapper, ), - cast_to=cast(Type[EvaluationTypeGetResponse], ResultWrapper[EvaluationTypeGetResponse]), + model=EvaluationTypeListResponse, ) @@ -103,7 +99,7 @@ class AsyncEvaluationTypesResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncEvaluationTypesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -119,7 +115,7 @@ def with_streaming_response(self) -> AsyncEvaluationTypesResourceWithStreamingRe """ return AsyncEvaluationTypesResourceWithStreamingResponse(self) - async def get( + def list( self, *, account_id: str, @@ -133,7 +129,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EvaluationTypeGetResponse: + ) -> AsyncPaginator[EvaluationTypeListResponse, AsyncV4PagePaginationArray[EvaluationTypeListResponse]]: """ List Evaluators @@ -148,25 +144,25 @@ async def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/ai-gateway/evaluation-types", + page=AsyncV4PagePaginationArray[EvaluationTypeListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - query=await async_maybe_transform( + query=maybe_transform( { "order_by": order_by, "order_by_direction": order_by_direction, "page": page, "per_page": per_page, }, - evaluation_type_get_params.EvaluationTypeGetParams, + evaluation_type_list_params.EvaluationTypeListParams, ), - post_parser=ResultWrapper[EvaluationTypeGetResponse]._unwrapper, ), - cast_to=cast(Type[EvaluationTypeGetResponse], ResultWrapper[EvaluationTypeGetResponse]), + model=EvaluationTypeListResponse, ) @@ -174,8 +170,8 @@ class EvaluationTypesResourceWithRawResponse: def __init__(self, evaluation_types: EvaluationTypesResource) -> None: self._evaluation_types = evaluation_types - self.get = to_raw_response_wrapper( - evaluation_types.get, + self.list = to_raw_response_wrapper( + evaluation_types.list, ) @@ -183,8 +179,8 @@ class AsyncEvaluationTypesResourceWithRawResponse: def __init__(self, evaluation_types: AsyncEvaluationTypesResource) -> None: self._evaluation_types = evaluation_types - self.get = async_to_raw_response_wrapper( - evaluation_types.get, + self.list = async_to_raw_response_wrapper( + evaluation_types.list, ) @@ -192,8 +188,8 @@ class EvaluationTypesResourceWithStreamingResponse: def __init__(self, evaluation_types: EvaluationTypesResource) -> None: self._evaluation_types = evaluation_types - self.get = to_streamed_response_wrapper( - evaluation_types.get, + self.list = to_streamed_response_wrapper( + evaluation_types.list, ) @@ -201,6 +197,6 @@ class AsyncEvaluationTypesResourceWithStreamingResponse: def __init__(self, evaluation_types: AsyncEvaluationTypesResource) -> None: self._evaluation_types = evaluation_types - self.get = async_to_streamed_response_wrapper( - evaluation_types.get, + self.list = async_to_streamed_response_wrapper( + evaluation_types.list, ) diff --git a/src/cloudflare/resources/ai_gateway/evaluations.py b/src/cloudflare/resources/ai_gateway/evaluations.py index 5dbccd8f358..9fadf2aa944 100644 --- a/src/cloudflare/resources/ai_gateway/evaluations.py +++ b/src/cloudflare/resources/ai_gateway/evaluations.py @@ -35,7 +35,7 @@ class EvaluationsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> EvaluationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -258,7 +258,7 @@ class AsyncEvaluationsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncEvaluationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/ai_gateway/logs.py b/src/cloudflare/resources/ai_gateway/logs.py index 65ac6d95b48..0daa36fc2c6 100644 --- a/src/cloudflare/resources/ai_gateway/logs.py +++ b/src/cloudflare/resources/ai_gateway/logs.py @@ -36,7 +36,7 @@ class LogsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> LogsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -410,7 +410,7 @@ class AsyncLogsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/alerting/alerting.py b/src/cloudflare/resources/alerting/alerting.py index 26acc6c7b63..faa242b37cb 100644 --- a/src/cloudflare/resources/alerting/alerting.py +++ b/src/cloudflare/resources/alerting/alerting.py @@ -60,7 +60,7 @@ def policies(self) -> PoliciesResource: @cached_property def with_raw_response(self) -> AlertingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -97,7 +97,7 @@ def policies(self) -> AsyncPoliciesResource: @cached_property def with_raw_response(self) -> AsyncAlertingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/alerting/available_alerts.py b/src/cloudflare/resources/alerting/available_alerts.py index 0ef63c9f03f..713f9e8db34 100644 --- a/src/cloudflare/resources/alerting/available_alerts.py +++ b/src/cloudflare/resources/alerting/available_alerts.py @@ -26,7 +26,7 @@ class AvailableAlertsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AvailableAlertsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -86,7 +86,7 @@ class AsyncAvailableAlertsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAvailableAlertsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/alerting/destinations/destinations.py b/src/cloudflare/resources/alerting/destinations/destinations.py index d15420aed0f..8e074ffa262 100644 --- a/src/cloudflare/resources/alerting/destinations/destinations.py +++ b/src/cloudflare/resources/alerting/destinations/destinations.py @@ -48,7 +48,7 @@ def webhooks(self) -> WebhooksResource: @cached_property def with_raw_response(self) -> DestinationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -81,7 +81,7 @@ def webhooks(self) -> AsyncWebhooksResource: @cached_property def with_raw_response(self) -> AsyncDestinationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/alerting/destinations/eligible.py b/src/cloudflare/resources/alerting/destinations/eligible.py index 4f73d80b393..b93d17a6409 100644 --- a/src/cloudflare/resources/alerting/destinations/eligible.py +++ b/src/cloudflare/resources/alerting/destinations/eligible.py @@ -26,7 +26,7 @@ class EligibleResource(SyncAPIResource): @cached_property def with_raw_response(self) -> EligibleResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -86,7 +86,7 @@ class AsyncEligibleResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncEligibleResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/alerting/destinations/pagerduty.py b/src/cloudflare/resources/alerting/destinations/pagerduty.py index e59cf6537ad..035b26f0af8 100644 --- a/src/cloudflare/resources/alerting/destinations/pagerduty.py +++ b/src/cloudflare/resources/alerting/destinations/pagerduty.py @@ -16,8 +16,9 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ...._base_client import make_request_options -from ....types.alerting.destinations.pagerduty_get_response import PagerdutyGetResponse +from ....pagination import SyncSinglePage, AsyncSinglePage +from ...._base_client import AsyncPaginator, make_request_options +from ....types.alerting.destinations.pagerduty import Pagerduty from ....types.alerting.destinations.pagerduty_link_response import PagerdutyLinkResponse from ....types.alerting.destinations.pagerduty_create_response import PagerdutyCreateResponse from ....types.alerting.destinations.pagerduty_delete_response import PagerdutyDeleteResponse @@ -29,7 +30,7 @@ class PagerdutyResource(SyncAPIResource): @cached_property def with_raw_response(self) -> PagerdutyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -129,7 +130,7 @@ def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PagerdutyGetResponse]: + ) -> SyncSinglePage[Pagerduty]: """ Get a list of all configured PagerDuty services. @@ -146,16 +147,13 @@ def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( + return self._get_api_list( f"/accounts/{account_id}/alerting/v3/destinations/pagerduty", + page=SyncSinglePage[Pagerduty], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PagerdutyGetResponse]]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PagerdutyGetResponse]], ResultWrapper[PagerdutyGetResponse]), + model=Pagerduty, ) def link( @@ -207,7 +205,7 @@ class AsyncPagerdutyResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncPagerdutyResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -297,7 +295,7 @@ async def delete( cast_to=PagerdutyDeleteResponse, ) - async def get( + def get( self, *, account_id: str, @@ -307,7 +305,7 @@ async def get( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Optional[PagerdutyGetResponse]: + ) -> AsyncPaginator[Pagerduty, AsyncSinglePage[Pagerduty]]: """ Get a list of all configured PagerDuty services. @@ -324,16 +322,13 @@ async def get( """ if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( + return self._get_api_list( f"/accounts/{account_id}/alerting/v3/destinations/pagerduty", + page=AsyncSinglePage[Pagerduty], options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[Optional[PagerdutyGetResponse]]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[Optional[PagerdutyGetResponse]], ResultWrapper[PagerdutyGetResponse]), + model=Pagerduty, ) async def link( diff --git a/src/cloudflare/resources/alerting/destinations/webhooks.py b/src/cloudflare/resources/alerting/destinations/webhooks.py index 5189a7b807d..e5d7f0d1b9c 100644 --- a/src/cloudflare/resources/alerting/destinations/webhooks.py +++ b/src/cloudflare/resources/alerting/destinations/webhooks.py @@ -35,7 +35,7 @@ class WebhooksResource(SyncAPIResource): @cached_property def with_raw_response(self) -> WebhooksResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -299,7 +299,7 @@ class AsyncWebhooksResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncWebhooksResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/alerting/history.py b/src/cloudflare/resources/alerting/history.py index 29a1fe0f31d..23733d5fa65 100644 --- a/src/cloudflare/resources/alerting/history.py +++ b/src/cloudflare/resources/alerting/history.py @@ -29,7 +29,7 @@ class HistoryResource(SyncAPIResource): @cached_property def with_raw_response(self) -> HistoryResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -115,7 +115,7 @@ class AsyncHistoryResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncHistoryResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/alerting/policies.py b/src/cloudflare/resources/alerting/policies.py index c3f6b52c997..650d09f1800 100644 --- a/src/cloudflare/resources/alerting/policies.py +++ b/src/cloudflare/resources/alerting/policies.py @@ -38,7 +38,7 @@ class PoliciesResource(SyncAPIResource): @cached_property def with_raw_response(self) -> PoliciesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -88,9 +88,9 @@ def create( "hostname_aop_custom_certificate_expiration_type", "http_alert_edge_error", "http_alert_origin_error", - "incident_alert", "image_notification", "image_resizing_notification", + "incident_alert", "load_balancing_health_alert", "load_balancing_pool_enablement_alert", "logo_match_alert", @@ -113,6 +113,7 @@ def create( "secondary_dns_warning", "secondary_dns_zone_successfully_updated", "secondary_dns_zone_validation_warning", + "security_insights_alert", "sentinel_alert", "stream_live_notifications", "synthetic_test_latency_alert", @@ -233,9 +234,9 @@ def update( "hostname_aop_custom_certificate_expiration_type", "http_alert_edge_error", "http_alert_origin_error", - "incident_alert", "image_notification", "image_resizing_notification", + "incident_alert", "load_balancing_health_alert", "load_balancing_pool_enablement_alert", "logo_match_alert", @@ -258,6 +259,7 @@ def update( "secondary_dns_warning", "secondary_dns_zone_successfully_updated", "secondary_dns_zone_validation_warning", + "security_insights_alert", "sentinel_alert", "stream_live_notifications", "synthetic_test_latency_alert", @@ -471,7 +473,7 @@ class AsyncPoliciesResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -521,9 +523,9 @@ async def create( "hostname_aop_custom_certificate_expiration_type", "http_alert_edge_error", "http_alert_origin_error", - "incident_alert", "image_notification", "image_resizing_notification", + "incident_alert", "load_balancing_health_alert", "load_balancing_pool_enablement_alert", "logo_match_alert", @@ -546,6 +548,7 @@ async def create( "secondary_dns_warning", "secondary_dns_zone_successfully_updated", "secondary_dns_zone_validation_warning", + "security_insights_alert", "sentinel_alert", "stream_live_notifications", "synthetic_test_latency_alert", @@ -666,9 +669,9 @@ async def update( "hostname_aop_custom_certificate_expiration_type", "http_alert_edge_error", "http_alert_origin_error", - "incident_alert", "image_notification", "image_resizing_notification", + "incident_alert", "load_balancing_health_alert", "load_balancing_pool_enablement_alert", "logo_match_alert", @@ -691,6 +694,7 @@ async def update( "secondary_dns_warning", "secondary_dns_zone_successfully_updated", "secondary_dns_zone_validation_warning", + "security_insights_alert", "sentinel_alert", "stream_live_notifications", "synthetic_test_latency_alert", diff --git a/src/cloudflare/resources/api_gateway/api_gateway.py b/src/cloudflare/resources/api_gateway/api_gateway.py index 780055b0239..70917610f7d 100644 --- a/src/cloudflare/resources/api_gateway/api_gateway.py +++ b/src/cloudflare/resources/api_gateway/api_gateway.py @@ -96,7 +96,7 @@ def expression_template(self) -> ExpressionTemplateResource: @cached_property def with_raw_response(self) -> APIGatewayResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -145,7 +145,7 @@ def expression_template(self) -> AsyncExpressionTemplateResource: @cached_property def with_raw_response(self) -> AsyncAPIGatewayResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/configurations.py b/src/cloudflare/resources/api_gateway/configurations.py index dafedfedd47..450f5205f0d 100644 --- a/src/cloudflare/resources/api_gateway/configurations.py +++ b/src/cloudflare/resources/api_gateway/configurations.py @@ -33,7 +33,7 @@ class ConfigurationsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ConfigurationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -137,7 +137,7 @@ class AsyncConfigurationsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncConfigurationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/discovery/discovery.py b/src/cloudflare/resources/api_gateway/discovery/discovery.py index 340447b9e82..9c3152dd49b 100644 --- a/src/cloudflare/resources/api_gateway/discovery/discovery.py +++ b/src/cloudflare/resources/api_gateway/discovery/discovery.py @@ -38,7 +38,7 @@ def operations(self) -> OperationsResource: @cached_property def with_raw_response(self) -> DiscoveryResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -103,7 +103,7 @@ def operations(self) -> AsyncOperationsResource: @cached_property def with_raw_response(self) -> AsyncDiscoveryResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/discovery/operations.py b/src/cloudflare/resources/api_gateway/discovery/operations.py index 1994f365d02..f7a8556479a 100644 --- a/src/cloudflare/resources/api_gateway/discovery/operations.py +++ b/src/cloudflare/resources/api_gateway/discovery/operations.py @@ -35,7 +35,7 @@ class OperationsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> OperationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -246,7 +246,7 @@ class AsyncOperationsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncOperationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/expression_template/expression_template.py b/src/cloudflare/resources/api_gateway/expression_template/expression_template.py index 870b06fcc0f..e5173f78539 100644 --- a/src/cloudflare/resources/api_gateway/expression_template/expression_template.py +++ b/src/cloudflare/resources/api_gateway/expression_template/expression_template.py @@ -24,7 +24,7 @@ def fallthrough(self) -> FallthroughResource: @cached_property def with_raw_response(self) -> ExpressionTemplateResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -49,7 +49,7 @@ def fallthrough(self) -> AsyncFallthroughResource: @cached_property def with_raw_response(self) -> AsyncExpressionTemplateResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py b/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py index e518de7be3b..1cb60fb64c1 100644 --- a/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py +++ b/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py @@ -31,7 +31,7 @@ class FallthroughResource(SyncAPIResource): @cached_property def with_raw_response(self) -> FallthroughResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -95,7 +95,7 @@ class AsyncFallthroughResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncFallthroughResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/operations/operations.py b/src/cloudflare/resources/api_gateway/operations/operations.py index 2681b95f944..eae381497ff 100644 --- a/src/cloudflare/resources/api_gateway/operations/operations.py +++ b/src/cloudflare/resources/api_gateway/operations/operations.py @@ -21,7 +21,7 @@ async_to_streamed_response_wrapper, ) from ...._wrappers import ResultWrapper -from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray +from ....pagination import SyncSinglePage, AsyncSinglePage, SyncV4PagePaginationArray, AsyncV4PagePaginationArray from ...._base_client import AsyncPaginator, make_request_options from .schema_validation import ( SchemaValidationResource, @@ -55,7 +55,7 @@ def schema_validation(self) -> SchemaValidationResource: @cached_property def with_raw_response(self) -> OperationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -265,7 +265,7 @@ def bulk_create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OperationBulkCreateResponse: + ) -> SyncSinglePage[OperationBulkCreateResponse]: """Add one or more operations to a zone. Endpoints can contain path variables. @@ -287,17 +287,15 @@ def bulk_create( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return self._post( + return self._get_api_list( f"/zones/{zone_id}/api_gateway/operations", + page=SyncSinglePage[OperationBulkCreateResponse], body=maybe_transform(body, Iterable[operation_bulk_create_params.Body]), options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OperationBulkCreateResponse]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[OperationBulkCreateResponse], ResultWrapper[OperationBulkCreateResponse]), + model=OperationBulkCreateResponse, + method="post", ) def bulk_delete( @@ -394,7 +392,7 @@ def schema_validation(self) -> AsyncSchemaValidationResource: @cached_property def with_raw_response(self) -> AsyncOperationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -593,7 +591,7 @@ async def delete( cast_to=OperationDeleteResponse, ) - async def bulk_create( + def bulk_create( self, *, zone_id: str, @@ -604,7 +602,7 @@ async def bulk_create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> OperationBulkCreateResponse: + ) -> AsyncPaginator[OperationBulkCreateResponse, AsyncSinglePage[OperationBulkCreateResponse]]: """Add one or more operations to a zone. Endpoints can contain path variables. @@ -626,17 +624,15 @@ async def bulk_create( """ if not zone_id: raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") - return await self._post( + return self._get_api_list( f"/zones/{zone_id}/api_gateway/operations", - body=await async_maybe_transform(body, Iterable[operation_bulk_create_params.Body]), + page=AsyncSinglePage[OperationBulkCreateResponse], + body=maybe_transform(body, Iterable[operation_bulk_create_params.Body]), options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - post_parser=ResultWrapper[OperationBulkCreateResponse]._unwrapper, + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=cast(Type[OperationBulkCreateResponse], ResultWrapper[OperationBulkCreateResponse]), + model=OperationBulkCreateResponse, + method="post", ) async def bulk_delete( diff --git a/src/cloudflare/resources/api_gateway/operations/schema_validation.py b/src/cloudflare/resources/api_gateway/operations/schema_validation.py index 1aec1379e0e..d08ebba4175 100644 --- a/src/cloudflare/resources/api_gateway/operations/schema_validation.py +++ b/src/cloudflare/resources/api_gateway/operations/schema_validation.py @@ -39,7 +39,7 @@ class SchemaValidationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SchemaValidationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -194,7 +194,7 @@ class AsyncSchemaValidationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSchemaValidationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/schemas.py b/src/cloudflare/resources/api_gateway/schemas.py index 7b7eb1ef11c..79611e37e5d 100644 --- a/src/cloudflare/resources/api_gateway/schemas.py +++ b/src/cloudflare/resources/api_gateway/schemas.py @@ -32,7 +32,7 @@ class SchemasResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SchemasResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -107,7 +107,7 @@ class AsyncSchemasResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSchemasResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/settings/schema_validation.py b/src/cloudflare/resources/api_gateway/settings/schema_validation.py index 6a984a33529..ccb54128e03 100644 --- a/src/cloudflare/resources/api_gateway/settings/schema_validation.py +++ b/src/cloudflare/resources/api_gateway/settings/schema_validation.py @@ -31,7 +31,7 @@ class SchemaValidationResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SchemaValidationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -212,7 +212,7 @@ class AsyncSchemaValidationResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSchemaValidationResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/settings/settings.py b/src/cloudflare/resources/api_gateway/settings/settings.py index 8a7e918de87..543c2a869d1 100644 --- a/src/cloudflare/resources/api_gateway/settings/settings.py +++ b/src/cloudflare/resources/api_gateway/settings/settings.py @@ -24,7 +24,7 @@ def schema_validation(self) -> SchemaValidationResource: @cached_property def with_raw_response(self) -> SettingsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -49,7 +49,7 @@ def schema_validation(self) -> AsyncSchemaValidationResource: @cached_property def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/user_schemas/hosts.py b/src/cloudflare/resources/api_gateway/user_schemas/hosts.py index 1bd4a3f8520..aa9fcadb55f 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/hosts.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/hosts.py @@ -26,7 +26,7 @@ class HostsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> HostsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -99,7 +99,7 @@ class AsyncHostsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncHostsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/user_schemas/operations.py b/src/cloudflare/resources/api_gateway/user_schemas/operations.py index a2f9a67fd3e..5a9c28fa03d 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/operations.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/operations.py @@ -29,7 +29,7 @@ class OperationsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> OperationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -132,7 +132,7 @@ class AsyncOperationsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncOperationsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py index 983cdf40118..35c37f69fb6 100644 --- a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py +++ b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py @@ -66,7 +66,7 @@ def hosts(self) -> HostsResource: @cached_property def with_raw_response(self) -> UserSchemasResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -353,7 +353,7 @@ def hosts(self) -> AsyncHostsResource: @cached_property def with_raw_response(self) -> AsyncUserSchemasResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/argo/argo.py b/src/cloudflare/resources/argo/argo.py index 3aa821072b3..eb94300db7a 100644 --- a/src/cloudflare/resources/argo/argo.py +++ b/src/cloudflare/resources/argo/argo.py @@ -36,7 +36,7 @@ def tiered_caching(self) -> TieredCachingResource: @cached_property def with_raw_response(self) -> ArgoResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -65,7 +65,7 @@ def tiered_caching(self) -> AsyncTieredCachingResource: @cached_property def with_raw_response(self) -> AsyncArgoResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/argo/smart_routing.py b/src/cloudflare/resources/argo/smart_routing.py index f45d5a4b043..66ae9a42e3a 100644 --- a/src/cloudflare/resources/argo/smart_routing.py +++ b/src/cloudflare/resources/argo/smart_routing.py @@ -33,7 +33,7 @@ class SmartRoutingResource(SyncAPIResource): @cached_property def with_raw_response(self) -> SmartRoutingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -146,7 +146,7 @@ class AsyncSmartRoutingResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncSmartRoutingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/argo/tiered_caching.py b/src/cloudflare/resources/argo/tiered_caching.py index 066b5a75b53..a598a0d4f6a 100644 --- a/src/cloudflare/resources/argo/tiered_caching.py +++ b/src/cloudflare/resources/argo/tiered_caching.py @@ -33,7 +33,7 @@ class TieredCachingResource(SyncAPIResource): @cached_property def with_raw_response(self) -> TieredCachingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -156,7 +156,7 @@ class AsyncTieredCachingResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncTieredCachingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/audit_logs.py b/src/cloudflare/resources/audit_logs.py index 8e3020f4b33..bcb31f75e13 100644 --- a/src/cloudflare/resources/audit_logs.py +++ b/src/cloudflare/resources/audit_logs.py @@ -30,7 +30,7 @@ class AuditLogsResource(SyncAPIResource): @cached_property def with_raw_response(self) -> AuditLogsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -137,7 +137,7 @@ class AsyncAuditLogsResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncAuditLogsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/billing/billing.py b/src/cloudflare/resources/billing/billing.py index 5146ee841dd..d57c019144e 100644 --- a/src/cloudflare/resources/billing/billing.py +++ b/src/cloudflare/resources/billing/billing.py @@ -24,7 +24,7 @@ def profiles(self) -> ProfilesResource: @cached_property def with_raw_response(self) -> BillingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -49,7 +49,7 @@ def profiles(self) -> AsyncProfilesResource: @cached_property def with_raw_response(self) -> AsyncBillingResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/billing/profiles.py b/src/cloudflare/resources/billing/profiles.py index c025bcb6617..6d97c84a04c 100644 --- a/src/cloudflare/resources/billing/profiles.py +++ b/src/cloudflare/resources/billing/profiles.py @@ -26,7 +26,7 @@ class ProfilesResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ProfilesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -86,7 +86,7 @@ class AsyncProfilesResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncProfilesResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/bot_management.py b/src/cloudflare/resources/bot_management.py index eefa78d028b..f9875019fe6 100644 --- a/src/cloudflare/resources/bot_management.py +++ b/src/cloudflare/resources/bot_management.py @@ -34,7 +34,7 @@ class BotManagementResource(SyncAPIResource): @cached_property def with_raw_response(self) -> BotManagementResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -578,7 +578,7 @@ class AsyncBotManagementResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBotManagementResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/botnet_feed/asn.py b/src/cloudflare/resources/botnet_feed/asn.py index 88932ab9b7d..15e06d69a8c 100755 --- a/src/cloudflare/resources/botnet_feed/asn.py +++ b/src/cloudflare/resources/botnet_feed/asn.py @@ -33,7 +33,7 @@ class ASNResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ASNResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -139,7 +139,7 @@ class AsyncASNResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncASNResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/botnet_feed/botnet_feed.py b/src/cloudflare/resources/botnet_feed/botnet_feed.py index b61dfc867fc..5f71396a78d 100755 --- a/src/cloudflare/resources/botnet_feed/botnet_feed.py +++ b/src/cloudflare/resources/botnet_feed/botnet_feed.py @@ -36,7 +36,7 @@ def configs(self) -> ConfigsResource: @cached_property def with_raw_response(self) -> BotnetFeedResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -65,7 +65,7 @@ def configs(self) -> AsyncConfigsResource: @cached_property def with_raw_response(self) -> AsyncBotnetFeedResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/botnet_feed/configs/asn.py b/src/cloudflare/resources/botnet_feed/configs/asn.py index 0d948a96a6f..e2f27d024b6 100755 --- a/src/cloudflare/resources/botnet_feed/configs/asn.py +++ b/src/cloudflare/resources/botnet_feed/configs/asn.py @@ -27,7 +27,7 @@ class ASNResource(SyncAPIResource): @cached_property def with_raw_response(self) -> ASNResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -127,7 +127,7 @@ class AsyncASNResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncASNResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/botnet_feed/configs/configs.py b/src/cloudflare/resources/botnet_feed/configs/configs.py index 90d32679557..6fe692cec0c 100755 --- a/src/cloudflare/resources/botnet_feed/configs/configs.py +++ b/src/cloudflare/resources/botnet_feed/configs/configs.py @@ -24,7 +24,7 @@ def asn(self) -> ASNResource: @cached_property def with_raw_response(self) -> ConfigsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -49,7 +49,7 @@ def asn(self) -> AsyncASNResource: @cached_property def with_raw_response(self) -> AsyncConfigsResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/brand_protection.py b/src/cloudflare/resources/brand_protection.py index 1727851d6e2..a23a6034443 100644 --- a/src/cloudflare/resources/brand_protection.py +++ b/src/cloudflare/resources/brand_protection.py @@ -32,7 +32,7 @@ class BrandProtectionResource(SyncAPIResource): @cached_property def with_raw_response(self) -> BrandProtectionResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers @@ -148,7 +148,7 @@ class AsyncBrandProtectionResource(AsyncAPIResource): @cached_property def with_raw_response(self) -> AsyncBrandProtectionResourceWithRawResponse: """ - This property can be used as a prefix for any HTTP method call to return the + This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content. For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers diff --git a/src/cloudflare/resources/browser_rendering/__init__.py b/src/cloudflare/resources/browser_rendering/__init__.py new file mode 100644 index 00000000000..d42a51797d4 --- /dev/null +++ b/src/cloudflare/resources/browser_rendering/__init__.py @@ -0,0 +1,89 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from .pdf import ( + PDFResource, + AsyncPDFResource, + PDFResourceWithRawResponse, + AsyncPDFResourceWithRawResponse, + PDFResourceWithStreamingResponse, + AsyncPDFResourceWithStreamingResponse, +) +from .scrape import ( + ScrapeResource, + AsyncScrapeResource, + ScrapeResourceWithRawResponse, + AsyncScrapeResourceWithRawResponse, + ScrapeResourceWithStreamingResponse, + AsyncScrapeResourceWithStreamingResponse, +) +from .content import ( + ContentResource, + AsyncContentResource, + ContentResourceWithRawResponse, + AsyncContentResourceWithRawResponse, + ContentResourceWithStreamingResponse, + AsyncContentResourceWithStreamingResponse, +) +from .snapshot import ( + SnapshotResource, + AsyncSnapshotResource, + SnapshotResourceWithRawResponse, + AsyncSnapshotResourceWithRawResponse, + SnapshotResourceWithStreamingResponse, + AsyncSnapshotResourceWithStreamingResponse, +) +from .screenshot import ( + ScreenshotResource, + AsyncScreenshotResource, + ScreenshotResourceWithRawResponse, + AsyncScreenshotResourceWithRawResponse, + ScreenshotResourceWithStreamingResponse, + AsyncScreenshotResourceWithStreamingResponse, +) +from .browser_rendering import ( + BrowserRenderingResource, + AsyncBrowserRenderingResource, + BrowserRenderingResourceWithRawResponse, + AsyncBrowserRenderingResourceWithRawResponse, + BrowserRenderingResourceWithStreamingResponse, + AsyncBrowserRenderingResourceWithStreamingResponse, +) + +__all__ = [ + "ContentResource", + "AsyncContentResource", + "ContentResourceWithRawResponse", + "AsyncContentResourceWithRawResponse", + "ContentResourceWithStreamingResponse", + "AsyncContentResourceWithStreamingResponse", + "PDFResource", + "AsyncPDFResource", + "PDFResourceWithRawResponse", + "AsyncPDFResourceWithRawResponse", + "PDFResourceWithStreamingResponse", + "AsyncPDFResourceWithStreamingResponse", + "ScrapeResource", + "AsyncScrapeResource", + "ScrapeResourceWithRawResponse", + "AsyncScrapeResourceWithRawResponse", + "ScrapeResourceWithStreamingResponse", + "AsyncScrapeResourceWithStreamingResponse", + "ScreenshotResource", + "AsyncScreenshotResource", + "ScreenshotResourceWithRawResponse", + "AsyncScreenshotResourceWithRawResponse", + "ScreenshotResourceWithStreamingResponse", + "AsyncScreenshotResourceWithStreamingResponse", + "SnapshotResource", + "AsyncSnapshotResource", + "SnapshotResourceWithRawResponse", + "AsyncSnapshotResourceWithRawResponse", + "SnapshotResourceWithStreamingResponse", + "AsyncSnapshotResourceWithStreamingResponse", + "BrowserRenderingResource", + "AsyncBrowserRenderingResource", + "BrowserRenderingResourceWithRawResponse", + "AsyncBrowserRenderingResourceWithRawResponse", + "BrowserRenderingResourceWithStreamingResponse", + "AsyncBrowserRenderingResourceWithStreamingResponse", +] diff --git a/src/cloudflare/resources/browser_rendering/browser_rendering.py b/src/cloudflare/resources/browser_rendering/browser_rendering.py new file mode 100644 index 00000000000..b597be3813f --- /dev/null +++ b/src/cloudflare/resources/browser_rendering/browser_rendering.py @@ -0,0 +1,230 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from .pdf import ( + PDFResource, + AsyncPDFResource, + PDFResourceWithRawResponse, + AsyncPDFResourceWithRawResponse, + PDFResourceWithStreamingResponse, + AsyncPDFResourceWithStreamingResponse, +) +from .scrape import ( + ScrapeResource, + AsyncScrapeResource, + ScrapeResourceWithRawResponse, + AsyncScrapeResourceWithRawResponse, + ScrapeResourceWithStreamingResponse, + AsyncScrapeResourceWithStreamingResponse, +) +from .content import ( + ContentResource, + AsyncContentResource, + ContentResourceWithRawResponse, + AsyncContentResourceWithRawResponse, + ContentResourceWithStreamingResponse, + AsyncContentResourceWithStreamingResponse, +) +from .snapshot import ( + SnapshotResource, + AsyncSnapshotResource, + SnapshotResourceWithRawResponse, + AsyncSnapshotResourceWithRawResponse, + SnapshotResourceWithStreamingResponse, + AsyncSnapshotResourceWithStreamingResponse, +) +from ..._compat import cached_property +from .screenshot import ( + ScreenshotResource, + AsyncScreenshotResource, + ScreenshotResourceWithRawResponse, + AsyncScreenshotResourceWithRawResponse, + ScreenshotResourceWithStreamingResponse, + AsyncScreenshotResourceWithStreamingResponse, +) +from ..._resource import SyncAPIResource, AsyncAPIResource + +__all__ = ["BrowserRenderingResource", "AsyncBrowserRenderingResource"] + + +class BrowserRenderingResource(SyncAPIResource): + @cached_property + def content(self) -> ContentResource: + return ContentResource(self._client) + + @cached_property + def pdf(self) -> PDFResource: + return PDFResource(self._client) + + @cached_property + def scrape(self) -> ScrapeResource: + return ScrapeResource(self._client) + + @cached_property + def screenshot(self) -> ScreenshotResource: + return ScreenshotResource(self._client) + + @cached_property + def snapshot(self) -> SnapshotResource: + return SnapshotResource(self._client) + + @cached_property + def with_raw_response(self) -> BrowserRenderingResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return BrowserRenderingResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BrowserRenderingResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return BrowserRenderingResourceWithStreamingResponse(self) + + +class AsyncBrowserRenderingResource(AsyncAPIResource): + @cached_property + def content(self) -> AsyncContentResource: + return AsyncContentResource(self._client) + + @cached_property + def pdf(self) -> AsyncPDFResource: + return AsyncPDFResource(self._client) + + @cached_property + def scrape(self) -> AsyncScrapeResource: + return AsyncScrapeResource(self._client) + + @cached_property + def screenshot(self) -> AsyncScreenshotResource: + return AsyncScreenshotResource(self._client) + + @cached_property + def snapshot(self) -> AsyncSnapshotResource: + return AsyncSnapshotResource(self._client) + + @cached_property + def with_raw_response(self) -> AsyncBrowserRenderingResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return AsyncBrowserRenderingResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBrowserRenderingResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return AsyncBrowserRenderingResourceWithStreamingResponse(self) + + +class BrowserRenderingResourceWithRawResponse: + def __init__(self, browser_rendering: BrowserRenderingResource) -> None: + self._browser_rendering = browser_rendering + + @cached_property + def content(self) -> ContentResourceWithRawResponse: + return ContentResourceWithRawResponse(self._browser_rendering.content) + + @cached_property + def pdf(self) -> PDFResourceWithRawResponse: + return PDFResourceWithRawResponse(self._browser_rendering.pdf) + + @cached_property + def scrape(self) -> ScrapeResourceWithRawResponse: + return ScrapeResourceWithRawResponse(self._browser_rendering.scrape) + + @cached_property + def screenshot(self) -> ScreenshotResourceWithRawResponse: + return ScreenshotResourceWithRawResponse(self._browser_rendering.screenshot) + + @cached_property + def snapshot(self) -> SnapshotResourceWithRawResponse: + return SnapshotResourceWithRawResponse(self._browser_rendering.snapshot) + + +class AsyncBrowserRenderingResourceWithRawResponse: + def __init__(self, browser_rendering: AsyncBrowserRenderingResource) -> None: + self._browser_rendering = browser_rendering + + @cached_property + def content(self) -> AsyncContentResourceWithRawResponse: + return AsyncContentResourceWithRawResponse(self._browser_rendering.content) + + @cached_property + def pdf(self) -> AsyncPDFResourceWithRawResponse: + return AsyncPDFResourceWithRawResponse(self._browser_rendering.pdf) + + @cached_property + def scrape(self) -> AsyncScrapeResourceWithRawResponse: + return AsyncScrapeResourceWithRawResponse(self._browser_rendering.scrape) + + @cached_property + def screenshot(self) -> AsyncScreenshotResourceWithRawResponse: + return AsyncScreenshotResourceWithRawResponse(self._browser_rendering.screenshot) + + @cached_property + def snapshot(self) -> AsyncSnapshotResourceWithRawResponse: + return AsyncSnapshotResourceWithRawResponse(self._browser_rendering.snapshot) + + +class BrowserRenderingResourceWithStreamingResponse: + def __init__(self, browser_rendering: BrowserRenderingResource) -> None: + self._browser_rendering = browser_rendering + + @cached_property + def content(self) -> ContentResourceWithStreamingResponse: + return ContentResourceWithStreamingResponse(self._browser_rendering.content) + + @cached_property + def pdf(self) -> PDFResourceWithStreamingResponse: + return PDFResourceWithStreamingResponse(self._browser_rendering.pdf) + + @cached_property + def scrape(self) -> ScrapeResourceWithStreamingResponse: + return ScrapeResourceWithStreamingResponse(self._browser_rendering.scrape) + + @cached_property + def screenshot(self) -> ScreenshotResourceWithStreamingResponse: + return ScreenshotResourceWithStreamingResponse(self._browser_rendering.screenshot) + + @cached_property + def snapshot(self) -> SnapshotResourceWithStreamingResponse: + return SnapshotResourceWithStreamingResponse(self._browser_rendering.snapshot) + + +class AsyncBrowserRenderingResourceWithStreamingResponse: + def __init__(self, browser_rendering: AsyncBrowserRenderingResource) -> None: + self._browser_rendering = browser_rendering + + @cached_property + def content(self) -> AsyncContentResourceWithStreamingResponse: + return AsyncContentResourceWithStreamingResponse(self._browser_rendering.content) + + @cached_property + def pdf(self) -> AsyncPDFResourceWithStreamingResponse: + return AsyncPDFResourceWithStreamingResponse(self._browser_rendering.pdf) + + @cached_property + def scrape(self) -> AsyncScrapeResourceWithStreamingResponse: + return AsyncScrapeResourceWithStreamingResponse(self._browser_rendering.scrape) + + @cached_property + def screenshot(self) -> AsyncScreenshotResourceWithStreamingResponse: + return AsyncScreenshotResourceWithStreamingResponse(self._browser_rendering.screenshot) + + @cached_property + def snapshot(self) -> AsyncSnapshotResourceWithStreamingResponse: + return AsyncSnapshotResourceWithStreamingResponse(self._browser_rendering.snapshot) diff --git a/src/cloudflare/resources/browser_rendering/content.py b/src/cloudflare/resources/browser_rendering/content.py new file mode 100644 index 00000000000..9ab1d829960 --- /dev/null +++ b/src/cloudflare/resources/browser_rendering/content.py @@ -0,0 +1,442 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Type, Iterable, Optional, cast +from typing_extensions import Literal + +import httpx + +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._utils import ( + maybe_transform, + async_maybe_transform, +) +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._wrappers import ResultWrapper +from ..._base_client import make_request_options +from ...types.browser_rendering import content_create_params +from ...types.browser_rendering.content_create_response import ContentCreateResponse + +__all__ = ["ContentResource", "AsyncContentResource"] + + +class ContentResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ContentResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers + """ + return ContentResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ContentResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/cloudflare/cloudflare-python#with_streaming_response + """ + return ContentResourceWithStreamingResponse(self) + + def create( + self, + account_id: str, + *, + cache_ttl: float | NotGiven = NOT_GIVEN, + add_script_tag: Iterable[content_create_params.AddScriptTag] | NotGiven = NOT_GIVEN, + add_style_tag: Iterable[content_create_params.AddStyleTag] | NotGiven = NOT_GIVEN, + allow_request_pattern: List[str] | NotGiven = NOT_GIVEN, + allow_resource_types: List[ + Literal[ + "document", + "stylesheet", + "image", + "media", + "font", + "script", + "texttrack", + "xhr", + "fetch", + "prefetch", + "eventsource", + "websocket", + "manifest", + "signedexchange", + "ping", + "cspviolationreport", + "preflight", + "other", + ] + ] + | NotGiven = NOT_GIVEN, + authenticate: content_create_params.Authenticate | NotGiven = NOT_GIVEN, + best_attempt: bool | NotGiven = NOT_GIVEN, + cookies: Iterable[content_create_params.Cookie] | NotGiven = NOT_GIVEN, + emulate_media_type: str | NotGiven = NOT_GIVEN, + goto_options: content_create_params.GotoOptions | NotGiven = NOT_GIVEN, + html: str | NotGiven = NOT_GIVEN, + reject_request_pattern: List[str] | NotGiven = NOT_GIVEN, + reject_resource_types: List[ + Literal[ + "document", + "stylesheet", + "image", + "media", + "font", + "script", + "texttrack", + "xhr", + "fetch", + "prefetch", + "eventsource", + "websocket", + "manifest", + "signedexchange", + "ping", + "cspviolationreport", + "preflight", + "other", + ] + ] + | NotGiven = NOT_GIVEN, + set_extra_http_headers: Dict[str, str] | NotGiven = NOT_GIVEN, + set_java_script_enabled: bool | NotGiven = NOT_GIVEN, + url: str | NotGiven = NOT_GIVEN, + user_agent: str | NotGiven = NOT_GIVEN, + viewport: content_create_params.Viewport | NotGiven = NOT_GIVEN, + wait_for_selector: content_create_params.WaitForSelector | NotGiven = NOT_GIVEN, + wait_for_timeout: float | NotGiven = NOT_GIVEN, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + ) -> str: + """Fetches rendered HTML content from provided URL or HTML. + + Check available options + like `goToOptions` and `waitFor*` to control page load behaviour. + + Args: + account_id: Account ID. + + cache_ttl: Cache TTL default is 5s. Set to 0 to disable. + + add_script_tag: Adds a `