release: 4.1.0 (#2359)

This commit is contained in:
stainless-app[bot] 2025-03-18 15:42:23 +11:00 committed by GitHub
parent 8dacecc0d6
commit fc6ca90779
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
1930 changed files with 126730 additions and 23072 deletions

View file

@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
USER vscode USER vscode
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash
ENV PATH=/home/vscode/.rye/shims:$PATH 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

View file

@ -24,6 +24,9 @@
} }
} }
} }
},
"features": {
"ghcr.io/devcontainers/features/node:1": {}
} }
// Features to add to the dev container. More info: https://containers.dev/features. // Features to add to the dev container. More info: https://containers.dev/features.

View file

@ -27,7 +27,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH echo "$HOME/.rye/shims" >> $GITHUB_PATH
env: env:
RYE_VERSION: '0.35.0' RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes' RYE_INSTALL_OPTION: '--yes'
- name: Install dependencies - name: Install dependencies
@ -35,6 +35,7 @@ jobs:
- name: Run lints - name: Run lints
run: ./scripts/lint run: ./scripts/lint
test: test:
name: test name: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -48,7 +49,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH echo "$HOME/.rye/shims" >> $GITHUB_PATH
env: env:
RYE_VERSION: '0.35.0' RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes' RYE_INSTALL_OPTION: '--yes'
- name: Bootstrap - name: Bootstrap
@ -56,6 +57,7 @@ jobs:
- name: Run tests - name: Run tests
run: ./scripts/test run: ./scripts/test
examples: examples:
name: examples name: examples
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -69,7 +71,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH echo "$HOME/.rye/shims" >> $GITHUB_PATH
env: env:
RYE_VERSION: '0.35.0' RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes' RYE_INSTALL_OPTION: '--yes'
- name: Install dependencies - name: Install dependencies
run: | run: |

View file

@ -21,7 +21,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH echo "$HOME/.rye/shims" >> $GITHUB_PATH
env: env:
RYE_VERSION: '0.35.0' RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes' RYE_INSTALL_OPTION: '--yes'
- name: Publish to PyPI - name: Publish to PyPI

View file

@ -1,3 +1,3 @@
{ {
".": "4.0.0" ".": "4.1.0"
} }

View file

@ -1,2 +1,2 @@
configured_endpoints: 1493 configured_endpoints: 1655
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3d78f855257b55bbb80884f99c3802cae877968d140eed3557fcb2cdd5f937b3.yml openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0ed9f898b31619623e50d660d04beca50e44987bfd3eb3a6ff98d3bca2a9c569.yml

View file

@ -1,5 +1,95 @@
# Changelog # Changelog
## 4.1.0 (2025-03-18)
Full Changelog: [v4.0.0...v4.1.0](https://github.com/cloudflare/cloudflare-python/compare/v4.0.0...v4.1.0)
### Features
* **ai_gateway:** add urls support ([#2539](https://github.com/cloudflare/cloudflare-python/issues/2539)) ([650366e](https://github.com/cloudflare/cloudflare-python/commit/650366eb7f562d7ff3f9cdcdc713a0dac4eef742))
* **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:** api update ([#2492](https://github.com/cloudflare/cloudflare-python/issues/2492)) ([12d3ff5](https://github.com/cloudflare/cloudflare-python/commit/12d3ff52795e5da6c30f90ce659f8d4d0bacab18))
* **api:** api update ([#2493](https://github.com/cloudflare/cloudflare-python/issues/2493)) ([9061b65](https://github.com/cloudflare/cloudflare-python/commit/9061b659bcae3340e18e75eb8178e654a39361a0))
* **api:** api update ([#2495](https://github.com/cloudflare/cloudflare-python/issues/2495)) ([28d11c6](https://github.com/cloudflare/cloudflare-python/commit/28d11c6027d2ff4546b4f48f929a1140da015740))
* **api:** api update ([#2496](https://github.com/cloudflare/cloudflare-python/issues/2496)) ([538f71d](https://github.com/cloudflare/cloudflare-python/commit/538f71df81d2181e7724a73b86c181ce3f9b479d))
* **api:** api update ([#2497](https://github.com/cloudflare/cloudflare-python/issues/2497)) ([e826a02](https://github.com/cloudflare/cloudflare-python/commit/e826a024ab9bad3105cde190ab1e8717ebda80bb))
* **api:** api update ([#2500](https://github.com/cloudflare/cloudflare-python/issues/2500)) ([b8f02a0](https://github.com/cloudflare/cloudflare-python/commit/b8f02a087be93011eb24532eea5a4c5c0c61dbd1))
* **api:** api update ([#2501](https://github.com/cloudflare/cloudflare-python/issues/2501)) ([b8b3891](https://github.com/cloudflare/cloudflare-python/commit/b8b3891a42db6f5a1631ceddf5ab581d224e0b40))
* **api:** api update ([#2502](https://github.com/cloudflare/cloudflare-python/issues/2502)) ([345ac45](https://github.com/cloudflare/cloudflare-python/commit/345ac45b5700bc3d80005c61d716792e39fa4c99))
* **api:** api update ([#2503](https://github.com/cloudflare/cloudflare-python/issues/2503)) ([80fdb8f](https://github.com/cloudflare/cloudflare-python/commit/80fdb8f78726e093afbfb6e966df4a5b74ded3c9))
* **api:** api update ([#2516](https://github.com/cloudflare/cloudflare-python/issues/2516)) ([b6adc14](https://github.com/cloudflare/cloudflare-python/commit/b6adc142da1c6f6693c6c41ff3fde485aedd588d))
* **api:** api update ([#2517](https://github.com/cloudflare/cloudflare-python/issues/2517)) ([401b717](https://github.com/cloudflare/cloudflare-python/commit/401b717505df1746f6ffbbf7f111e7c93e6fae4a))
* **api:** api update ([#2518](https://github.com/cloudflare/cloudflare-python/issues/2518)) ([e1a2474](https://github.com/cloudflare/cloudflare-python/commit/e1a2474555a21af53b67e13be76d4c99dfbe4814))
* **api:** api update ([#2520](https://github.com/cloudflare/cloudflare-python/issues/2520)) ([151a44a](https://github.com/cloudflare/cloudflare-python/commit/151a44a584d21d4acbf2459513c585ef937eb984))
* **api:** api update ([#2522](https://github.com/cloudflare/cloudflare-python/issues/2522)) ([fc6d9d6](https://github.com/cloudflare/cloudflare-python/commit/fc6d9d6359390476e531499034ab114baeb1bcfe))
* **api:** api update ([#2523](https://github.com/cloudflare/cloudflare-python/issues/2523)) ([43ebeee](https://github.com/cloudflare/cloudflare-python/commit/43ebeee56dea63a55d23665e70ae2a0391d9e66b))
* **api:** api update ([#2528](https://github.com/cloudflare/cloudflare-python/issues/2528)) ([cc14467](https://github.com/cloudflare/cloudflare-python/commit/cc14467fce380ffe7d1baddb678415b319d48e22))
* **api:** api update ([#2530](https://github.com/cloudflare/cloudflare-python/issues/2530)) ([4def3c7](https://github.com/cloudflare/cloudflare-python/commit/4def3c7bb1f0fa1189fb0d0e644f54e6453f27ad))
* **api:** api update ([#2531](https://github.com/cloudflare/cloudflare-python/issues/2531)) ([4aef71e](https://github.com/cloudflare/cloudflare-python/commit/4aef71e490884d29a3e3d8f5cdd97101a464bc3b))
* **api:** api update ([#2533](https://github.com/cloudflare/cloudflare-python/issues/2533)) ([d231762](https://github.com/cloudflare/cloudflare-python/commit/d23176293003e4788c907ff0417f5470aaa4a31b))
* **api:** api update ([#2534](https://github.com/cloudflare/cloudflare-python/issues/2534)) ([6bae2c2](https://github.com/cloudflare/cloudflare-python/commit/6bae2c2223a2047270110c8d1cd934e69ef306a9))
* **api:** api update ([#2535](https://github.com/cloudflare/cloudflare-python/issues/2535)) ([d3821d2](https://github.com/cloudflare/cloudflare-python/commit/d3821d225922bf8bae3484c498e440d4e90dc194))
* **api:** api update ([#2537](https://github.com/cloudflare/cloudflare-python/issues/2537)) ([7cace87](https://github.com/cloudflare/cloudflare-python/commit/7cace874090689ada3ea6b099e7f304e6b7da6a1))
* **api:** api update ([#2544](https://github.com/cloudflare/cloudflare-python/issues/2544)) ([7ea429d](https://github.com/cloudflare/cloudflare-python/commit/7ea429d47d7741d1062eded3374c25f6f5965868))
* **api:** api update ([#2547](https://github.com/cloudflare/cloudflare-python/issues/2547)) ([7b0ce60](https://github.com/cloudflare/cloudflare-python/commit/7b0ce60f9a2ea2b7b7560cbc7da733247f31d63b))
* **api:** api update ([#2549](https://github.com/cloudflare/cloudflare-python/issues/2549)) ([aca2b76](https://github.com/cloudflare/cloudflare-python/commit/aca2b76e0daa7bef7936aee794b9cbf173ac4e4d))
* **api:** manual updates ([#2491](https://github.com/cloudflare/cloudflare-python/issues/2491)) ([e93ce12](https://github.com/cloudflare/cloudflare-python/commit/e93ce12a62dc48376a2fafba968a2eeff7f83345))
* **api:** manual updates ([#2513](https://github.com/cloudflare/cloudflare-python/issues/2513)) ([71e522b](https://github.com/cloudflare/cloudflare-python/commit/71e522b756012338f5909c2644b18c62b430cc0f))
* **api:** manual updates ([#2526](https://github.com/cloudflare/cloudflare-python/issues/2526)) ([f0b7af9](https://github.com/cloudflare/cloudflare-python/commit/f0b7af9d7cbad933520d3e50657d4762c2ca156d))
* **api:** manual updates ([#2527](https://github.com/cloudflare/cloudflare-python/issues/2527)) ([aa892cc](https://github.com/cloudflare/cloudflare-python/commit/aa892cc55f7fb177521c2b2010bf760a9975c7cd))
* **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))
* **browser_rendering:** move methods to top level ([#2490](https://github.com/cloudflare/cloudflare-python/issues/2490)) ([19e4cb0](https://github.com/cloudflare/cloudflare-python/commit/19e4cb01cff0811129fbac3e0f474f04532be483))
* **browsing_rendering:** add support for subresources ([#2484](https://github.com/cloudflare/cloudflare-python/issues/2484)) ([6739a41](https://github.com/cloudflare/cloudflare-python/commit/6739a4123bcf82fe58143ac51e69f590be8c1822))
* **cloudforce_one:** fix scans model ([#2504](https://github.com/cloudflare/cloudflare-python/issues/2504)) ([23e94c9](https://github.com/cloudflare/cloudflare-python/commit/23e94c9ee7ae82bc2931d077874a9a17dd8bfec3))
* **dns_settings:** fix hierarchy ([#2514](https://github.com/cloudflare/cloudflare-python/issues/2514)) ([a95d254](https://github.com/cloudflare/cloudflare-python/commit/a95d254cf22932f9f22e3e27171ae7efe35e6abd))
* **dns:** split account and zone DNS settings ([#2507](https://github.com/cloudflare/cloudflare-python/issues/2507)) ([6a80948](https://github.com/cloudflare/cloudflare-python/commit/6a809488ff2fd32ef13ad1dc37c1d9a052b79b98))
* **internal:** group browser rendering ([#2508](https://github.com/cloudflare/cloudflare-python/issues/2508)) ([349e280](https://github.com/cloudflare/cloudflare-python/commit/349e280cd359544242e6c78cacce97f437cf9125))
* **magic_cloud_networking:** add endpoint mappings ([#2550](https://github.com/cloudflare/cloudflare-python/issues/2550)) ([f0a6a21](https://github.com/cloudflare/cloudflare-python/commit/f0a6a21ceb592b32ea1079abfd42278f1da3d392))
* **radar:** add compromised credential endpoints ([#2552](https://github.com/cloudflare/cloudflare-python/issues/2552)) ([99c9845](https://github.com/cloudflare/cloudflare-python/commit/99c9845e2548528a5ea0fc1099d3b5c39a165dae))
* **radar:** add DNS endpoint ([#2487](https://github.com/cloudflare/cloudflare-python/issues/2487)) ([a5d4c51](https://github.com/cloudflare/cloudflare-python/commit/a5d4c51312ec12691f9fa4aa1e5ff3721d927d0a))
* **threat_events:** fix create endpoint ([#2532](https://github.com/cloudflare/cloudflare-python/issues/2532)) ([0a45fe8](https://github.com/cloudflare/cloudflare-python/commit/0a45fe8002fa64e2dda4fb7e91badb43e0436bcc))
* **threat_events:** shuffle endpoints from POST => PATCH ([#2525](https://github.com/cloudflare/cloudflare-python/issues/2525)) ([dc037a9](https://github.com/cloudflare/cloudflare-python/commit/dc037a9b9385fc979e11f64e5b576bef3d2a2d0a))
* **vpc_flows:** add token support ([#2485](https://github.com/cloudflare/cloudflare-python/issues/2485)) ([904614f](https://github.com/cloudflare/cloudflare-python/commit/904614f85526fa63f3eee05532f6285c2c5d0cdd))
* **waiting_rooms:** add account level list API ([#2524](https://github.com/cloudflare/cloudflare-python/issues/2524)) ([d10fb45](https://github.com/cloudflare/cloudflare-python/commit/d10fb45195b6b6d4b689bc5629877a7dee91a74b))
* **workers:** add in secrets endpoints ([#2540](https://github.com/cloudflare/cloudflare-python/issues/2540)) ([0f3127d](https://github.com/cloudflare/cloudflare-python/commit/0f3127d57e8675a30f10caf8ba052651e5f75954))
* **workflows:** add `bulk` support ([#2551](https://github.com/cloudflare/cloudflare-python/issues/2551)) ([45d91e2](https://github.com/cloudflare/cloudflare-python/commit/45d91e2a032aac5b4d1471027dbcd50e873dd0c8))
### Bug Fixes
* **api:** missing union discriminator naming ([#2548](https://github.com/cloudflare/cloudflare-python/issues/2548)) ([8c842a3](https://github.com/cloudflare/cloudflare-python/commit/8c842a3fc5e1fb641bb1cb279f5b143ed980bbed))
* **ci:** ensure pip is always available ([#2543](https://github.com/cloudflare/cloudflare-python/issues/2543)) ([5ab256e](https://github.com/cloudflare/cloudflare-python/commit/5ab256eb4d93222012a808fde8a119a60a4a8bc3))
* **ci:** remove publishing patch ([#2546](https://github.com/cloudflare/cloudflare-python/issues/2546)) ([2316376](https://github.com/cloudflare/cloudflare-python/commit/2316376a75b6a6ff41e1d1d7510206aa050ece09))
* **internal:** remove port scans pending path fixes ([#2498](https://github.com/cloudflare/cloudflare-python/issues/2498)) ([f3c8131](https://github.com/cloudflare/cloudflare-python/commit/f3c81313a8878f84abdfcd6b6f9af48126ece4c5))
* **r2_custom_domain:** update path placeholders to de-duplicate internal values ([#2506](https://github.com/cloudflare/cloudflare-python/issues/2506)) ([1288828](https://github.com/cloudflare/cloudflare-python/commit/1288828790c8cb3ddc38e81fb4e870406a0caab9))
* **workers_for_platforms:** remove cyclic import due to model ([#2542](https://github.com/cloudflare/cloudflare-python/issues/2542)) ([7d9d338](https://github.com/cloudflare/cloudflare-python/commit/7d9d3381eacc52694d477b388165a26f77bde9b5))
### Chores
* **docs:** update client docstring ([#2483](https://github.com/cloudflare/cloudflare-python/issues/2483)) ([e98bd28](https://github.com/cloudflare/cloudflare-python/commit/e98bd2880f1f33083e0ce1e585bcaa635eda4176))
* **internal:** bump rye to 0.44.0 ([#2536](https://github.com/cloudflare/cloudflare-python/issues/2536)) ([b1a4155](https://github.com/cloudflare/cloudflare-python/commit/b1a4155e83b067684f202159ad4b6f2b1d3c5283))
* **internal:** codegen related update ([#2475](https://github.com/cloudflare/cloudflare-python/issues/2475)) ([329c314](https://github.com/cloudflare/cloudflare-python/commit/329c314d1756618ef5434817f1077173041a0ebc))
* **internal:** codegen related update ([#2505](https://github.com/cloudflare/cloudflare-python/issues/2505)) ([ea4d061](https://github.com/cloudflare/cloudflare-python/commit/ea4d06178fa05d7907edd1d2869d566c80a1a567))
* **internal:** codegen related update ([#2511](https://github.com/cloudflare/cloudflare-python/issues/2511)) ([d8e67ed](https://github.com/cloudflare/cloudflare-python/commit/d8e67ede7ad1363353b09e93d29951df62b87ed5))
* **internal:** codegen related update ([#2512](https://github.com/cloudflare/cloudflare-python/issues/2512)) ([ee0fa76](https://github.com/cloudflare/cloudflare-python/commit/ee0fa7627138689a4115a9a54e3c504d9ef2d7a9))
* **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:** remove extra empty newlines ([#2529](https://github.com/cloudflare/cloudflare-python/issues/2529)) ([b1cabe6](https://github.com/cloudflare/cloudflare-python/commit/b1cabe63a9238d0e00cbde50b1a8d1843e26b03b))
* **internal:** remove unused http client options forwarding ([#2494](https://github.com/cloudflare/cloudflare-python/issues/2494)) ([db37526](https://github.com/cloudflare/cloudflare-python/commit/db375269cd6e68fc5b184384d15f5290e6b63cb7))
### 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) ## 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) Full Changelog: [v3.1.1...v4.0.0](https://github.com/cloudflare/cloudflare-python/compare/v3.1.1...v4.0.0)

View file

@ -142,6 +142,42 @@ for account in first_page.result:
# Remove `await` for non-async usage. # Remove `await` for non-async usage.
``` ```
## Nested params
Nested parameters are dictionaries, typed using `TypedDict`, for example:
```python
from cloudflare import Cloudflare
client = Cloudflare()
account = client.accounts.create(
name="name",
type="standard",
unit={"id": "f267e341f3dd4697bd3b9f71dd96247f"},
)
print(account.unit)
```
## 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 ## 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. 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.

View file

@ -1,3 +1,3 @@
# Reporting Security Vulnerabilities # 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! Please see [this page](https://www.cloudflare.com/.well-known/security.txt) for information on how to report a vulnerability to Cloudflare. Thanks!

1835
api.md

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,4 @@
set -eux set -eux
mkdir -p dist mkdir -p dist
rye build --clean rye build --clean
# Patching importlib-metadata version until upstream library version is updated
# https://github.com/pypa/twine/issues/977#issuecomment-2189800841
"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
rye publish --yes --token=$PYPI_TOKEN rye publish --yes --token=$PYPI_TOKEN

View file

@ -41,7 +41,7 @@ cache_fine_grained = True
# ``` # ```
# Changing this codegen to make mypy happy would increase complexity # Changing this codegen to make mypy happy would increase complexity
# and would not be worth it. # 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 # https://github.com/python/mypy/issues/12162
[mypy.overrides] [mypy.overrides]

View file

@ -1,6 +1,6 @@
[project] [project]
name = "cloudflare" name = "cloudflare"
version = "4.0.0" version = "4.1.0"
description = "The official Python library for the cloudflare API" description = "The official Python library for the cloudflare API"
dynamic = ["readme"] dynamic = ["readme"]
license = "Apache-2.0" license = "Apache-2.0"
@ -38,7 +38,6 @@ Homepage = "https://github.com/cloudflare/cloudflare-python"
Repository = "https://github.com/cloudflare/cloudflare-python" Repository = "https://github.com/cloudflare/cloudflare-python"
[tool.rye] [tool.rye]
managed = true managed = true
# version pins are in requirements-dev.lock # version pins are in requirements-dev.lock
@ -54,6 +53,7 @@ dev-dependencies = [
"dirty-equals>=0.6.0", "dirty-equals>=0.6.0",
"importlib-metadata>=6.7.0", "importlib-metadata>=6.7.0",
"rich>=13.7.1", "rich>=13.7.1",
"nest_asyncio==1.6.0",
] ]
[tool.rye.scripts] [tool.rye.scripts]
@ -86,7 +86,7 @@ typecheck = { chain = [
"typecheck:mypy" = "mypy ." "typecheck:mypy" = "mypy ."
[build-system] [build-system]
requires = ["hatchling", "hatch-fancy-pypi-readme"] requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build" build-backend = "hatchling.build"
[tool.hatch.build] [tool.hatch.build]
@ -128,6 +128,7 @@ testpaths = ["tests"]
addopts = "--tb=short" addopts = "--tb=short"
xfail_strict = true xfail_strict = true
asyncio_mode = "auto" asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
filterwarnings = [ filterwarnings = [
"error" "error"
] ]
@ -176,7 +177,7 @@ select = [
"T201", "T201",
"T203", "T203",
# misuse of typing.TYPE_CHECKING # misuse of typing.TYPE_CHECKING
"TCH004", "TC004",
# import rules # import rules
"TID251", "TID251",
] ]

View file

@ -7,6 +7,7 @@
# all-features: true # all-features: true
# with-sources: false # with-sources: false
# generate-hashes: false # generate-hashes: false
# universal: false
-e file:. -e file:.
annotated-types==0.6.0 annotated-types==0.6.0
@ -48,9 +49,10 @@ markdown-it-py==3.0.0
# via rich # via rich
mdurl==0.1.2 mdurl==0.1.2
# via markdown-it-py # via markdown-it-py
mypy==1.13.0 mypy==1.14.1
mypy-extensions==1.0.0 mypy-extensions==1.0.0
# via mypy # via mypy
nest-asyncio==1.6.0
nodeenv==1.8.0 nodeenv==1.8.0
# via pyright # via pyright
nox==2023.4.22 nox==2023.4.22
@ -67,7 +69,7 @@ pydantic-core==2.27.1
# via pydantic # via pydantic
pygments==2.18.0 pygments==2.18.0
# via rich # via rich
pyright==1.1.390 pyright==1.1.392.post0
pytest==8.3.3 pytest==8.3.3
# via pytest-asyncio # via pytest-asyncio
pytest-asyncio==0.24.0 pytest-asyncio==0.24.0
@ -77,7 +79,7 @@ pytz==2023.3.post1
# via dirty-equals # via dirty-equals
respx==0.22.0 respx==0.22.0
rich==13.7.1 rich==13.7.1
ruff==0.6.9 ruff==0.9.4
setuptools==68.2.2 setuptools==68.2.2
# via nodeenv # via nodeenv
six==1.16.0 six==1.16.0

View file

@ -7,6 +7,7 @@
# all-features: true # all-features: true
# with-sources: false # with-sources: false
# generate-hashes: false # generate-hashes: false
# universal: false
-e file:. -e file:.
annotated-types==0.6.0 annotated-types==0.6.0

View file

@ -4,7 +4,7 @@ set -e
cd "$(dirname "$0")/.." 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 || { brew bundle check >/dev/null 2>&1 || {
echo "==> Installing Homebrew dependencies…" echo "==> Installing Homebrew dependencies…"
brew bundle brew bundle

View file

@ -9,4 +9,3 @@ rye run lint
echo "==> Making sure it imports" echo "==> Making sure it imports"
rye run python -c 'import cloudflare' rye run python -c 'import cloudflare'

View file

@ -52,6 +52,8 @@ else
echo echo
fi fi
export DEFER_PYDANTIC_BUILD=false
echo "==> Running tests" echo "==> Running tests"
rye run pytest "$@" rye run pytest "$@"

View file

@ -47,7 +47,7 @@ def format_str(
with _collect_error(match): with _collect_error(match):
code = format_code_block(code) code = format_code_block(code)
code = textwrap.indent(code, match["indent"]) 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: def _pycon_match(match: Match[str]) -> str:
code = "" code = ""
@ -97,7 +97,7 @@ def format_str(
def _md_pycon_match(match: Match[str]) -> str: def _md_pycon_match(match: Match[str]) -> str:
code = _pycon_match(match) code = _pycon_match(match)
code = textwrap.indent(code, match["indent"]) 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_RE.sub(_md_match, src)
src = MD_PYCON_RE.sub(_md_pycon_match, src) src = MD_PYCON_RE.sub(_md_pycon_match, src)

View file

@ -9,7 +9,6 @@ import asyncio
import inspect import inspect
import logging import logging
import platform import platform
import warnings
import email.utils import email.utils
from types import TracebackType from types import TracebackType
from random import random from random import random
@ -36,7 +35,7 @@ import anyio
import httpx import httpx
import distro import distro
import pydantic import pydantic
from httpx import URL, Limits from httpx import URL
from pydantic import PrivateAttr from pydantic import PrivateAttr
from . import _exceptions from . import _exceptions
@ -51,19 +50,16 @@ from ._types import (
Timeout, Timeout,
NotGiven, NotGiven,
ResponseT, ResponseT,
Transport,
AnyMapping, AnyMapping,
PostParser, PostParser,
ProxiesTypes,
RequestFiles, RequestFiles,
HttpxSendArgs, HttpxSendArgs,
AsyncTransport,
RequestOptions, RequestOptions,
HttpxRequestFiles, HttpxRequestFiles,
ModelBuilderProtocol, ModelBuilderProtocol,
) )
from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping 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 ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
from ._response import ( from ._response import (
APIResponse, APIResponse,
@ -207,6 +203,9 @@ class BaseSyncPage(BasePage[_T], Generic[_T]):
model: Type[_T], model: Type[_T],
options: FinalRequestOptions, options: FinalRequestOptions,
) -> None: ) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}
self._model = model self._model = model
self._client = client self._client = client
self._options = options self._options = options
@ -292,6 +291,9 @@ class BaseAsyncPage(BasePage[_T], Generic[_T]):
client: AsyncAPIClient, client: AsyncAPIClient,
options: FinalRequestOptions, options: FinalRequestOptions,
) -> None: ) -> None:
if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}
self._model = model self._model = model
self._client = client self._client = client
self._options = options self._options = options
@ -331,9 +333,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
_base_url: URL _base_url: URL
max_retries: int max_retries: int
timeout: Union[float, Timeout, None] timeout: Union[float, Timeout, None]
_limits: httpx.Limits
_proxies: ProxiesTypes | None
_transport: Transport | AsyncTransport | None
_strict_response_validation: bool _strict_response_validation: bool
_idempotency_header: str | None _idempotency_header: str | None
_default_stream_cls: type[_DefaultStreamT] | None = None _default_stream_cls: type[_DefaultStreamT] | None = None
@ -346,9 +345,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
_strict_response_validation: bool, _strict_response_validation: bool,
max_retries: int = DEFAULT_MAX_RETRIES, max_retries: int = DEFAULT_MAX_RETRIES,
timeout: float | Timeout | None = DEFAULT_TIMEOUT, timeout: float | Timeout | None = DEFAULT_TIMEOUT,
limits: httpx.Limits,
transport: Transport | AsyncTransport | None,
proxies: ProxiesTypes | None,
custom_headers: Mapping[str, str] | None = None, custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None, custom_query: Mapping[str, object] | None = None,
) -> None: ) -> None:
@ -356,9 +352,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
self._base_url = self._enforce_trailing_slash(URL(base_url)) self._base_url = self._enforce_trailing_slash(URL(base_url))
self.max_retries = max_retries self.max_retries = max_retries
self.timeout = timeout self.timeout = timeout
self._limits = limits
self._proxies = proxies
self._transport = transport
self._custom_headers = custom_headers or {} self._custom_headers = custom_headers or {}
self._custom_query = custom_query or {} self._custom_query = custom_query or {}
self._strict_response_validation = _strict_response_validation self._strict_response_validation = _strict_response_validation
@ -418,10 +411,17 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
headers[idempotency_header] = options.idempotency_key or self._idempotency_key() 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. # `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) 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 return headers
@ -511,7 +511,7 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
# so that passing a `TypedDict` doesn't cause an error. # so that passing a `TypedDict` doesn't cause an error.
# https://github.com/microsoft/pyright/issues/3526#event-6715453066 # https://github.com/microsoft/pyright/issues/3526#event-6715453066
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, 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, files=files,
**kwargs, **kwargs,
) )
@ -787,46 +787,11 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
base_url: str | URL, base_url: str | URL,
max_retries: int = DEFAULT_MAX_RETRIES, max_retries: int = DEFAULT_MAX_RETRIES,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN, timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
transport: Transport | None = None,
proxies: ProxiesTypes | None = None,
limits: Limits | None = None,
http_client: httpx.Client | None = None, http_client: httpx.Client | None = None,
custom_headers: Mapping[str, str] | None = None, custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None, custom_query: Mapping[str, object] | None = None,
_strict_response_validation: bool, _strict_response_validation: bool,
) -> None: ) -> None:
kwargs: dict[str, Any] = {}
if limits is not None:
warnings.warn(
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
stacklevel=3,
)
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
else:
limits = DEFAULT_CONNECTION_LIMITS
if transport is not None:
kwargs["transport"] = transport
warnings.warn(
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
stacklevel=3,
)
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
if proxies is not None:
kwargs["proxies"] = proxies
warnings.warn(
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
stacklevel=3,
)
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
if not is_given(timeout): if not is_given(timeout):
# if the user passed in a custom http client with a non-default # if the user passed in a custom http client with a non-default
# timeout set then we use that timeout. # timeout set then we use that timeout.
@ -847,12 +812,9 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
super().__init__( super().__init__(
version=version, version=version,
limits=limits,
# cast to a valid type because mypy doesn't understand our type narrowing # cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout), timeout=cast(Timeout, timeout),
proxies=proxies,
base_url=base_url, base_url=base_url,
transport=transport,
max_retries=max_retries, max_retries=max_retries,
custom_query=custom_query, custom_query=custom_query,
custom_headers=custom_headers, custom_headers=custom_headers,
@ -862,9 +824,6 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
base_url=base_url, base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing # cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout), timeout=cast(Timeout, timeout),
limits=limits,
follow_redirects=True,
**kwargs, # type: ignore
) )
def is_closed(self) -> bool: def is_closed(self) -> bool:
@ -1359,45 +1318,10 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
_strict_response_validation: bool, _strict_response_validation: bool,
max_retries: int = DEFAULT_MAX_RETRIES, max_retries: int = DEFAULT_MAX_RETRIES,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN, timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
transport: AsyncTransport | None = None,
proxies: ProxiesTypes | None = None,
limits: Limits | None = None,
http_client: httpx.AsyncClient | None = None, http_client: httpx.AsyncClient | None = None,
custom_headers: Mapping[str, str] | None = None, custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None, custom_query: Mapping[str, object] | None = None,
) -> None: ) -> None:
kwargs: dict[str, Any] = {}
if limits is not None:
warnings.warn(
"The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
stacklevel=3,
)
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`")
else:
limits = DEFAULT_CONNECTION_LIMITS
if transport is not None:
kwargs["transport"] = transport
warnings.warn(
"The `transport` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
stacklevel=3,
)
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `transport`")
if proxies is not None:
kwargs["proxies"] = proxies
warnings.warn(
"The `proxies` argument is deprecated. The `http_client` argument should be passed instead",
category=DeprecationWarning,
stacklevel=3,
)
if http_client is not None:
raise ValueError("The `http_client` argument is mutually exclusive with `proxies`")
if not is_given(timeout): if not is_given(timeout):
# if the user passed in a custom http client with a non-default # if the user passed in a custom http client with a non-default
# timeout set then we use that timeout. # timeout set then we use that timeout.
@ -1419,11 +1343,8 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
super().__init__( super().__init__(
version=version, version=version,
base_url=base_url, base_url=base_url,
limits=limits,
# cast to a valid type because mypy doesn't understand our type narrowing # cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout), timeout=cast(Timeout, timeout),
proxies=proxies,
transport=transport,
max_retries=max_retries, max_retries=max_retries,
custom_query=custom_query, custom_query=custom_query,
custom_headers=custom_headers, custom_headers=custom_headers,
@ -1433,9 +1354,6 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
base_url=base_url, base_url=base_url,
# cast to a valid type because mypy doesn't understand our type narrowing # cast to a valid type because mypy doesn't understand our type narrowing
timeout=cast(Timeout, timeout), timeout=cast(Timeout, timeout),
limits=limits,
follow_redirects=True,
**kwargs, # type: ignore
) )
def is_closed(self) -> bool: def is_closed(self) -> bool:

View file

@ -57,6 +57,7 @@ if TYPE_CHECKING:
radar, radar,
rules, rules,
speed, speed,
zaraz,
zones, zones,
images, images,
queues, queues,
@ -89,6 +90,7 @@ if TYPE_CHECKING:
page_shield, page_shield,
rate_limits, rate_limits,
url_scanner, url_scanner,
custom_pages,
dns_firewall, dns_firewall,
healthchecks, healthchecks,
security_txt, security_txt,
@ -104,10 +106,12 @@ if TYPE_CHECKING:
cloud_connector, cloud_connector,
durable_objects, durable_objects,
request_tracers, request_tracers,
security_center,
brand_protection, brand_protection,
content_scanning, content_scanning,
custom_hostnames, custom_hostnames,
resource_sharing, resource_sharing,
browser_rendering,
mtls_certificates, mtls_certificates,
url_normalization, url_normalization,
custom_nameservers, custom_nameservers,
@ -115,7 +119,9 @@ if TYPE_CHECKING:
client_certificates, client_certificates,
custom_certificates, custom_certificates,
keyless_certificates, keyless_certificates,
network_interconnects,
workers_for_platforms, workers_for_platforms,
magic_cloud_networking,
origin_ca_certificates, origin_ca_certificates,
origin_tls_client_auth, origin_tls_client_auth,
certificate_authorities, certificate_authorities,
@ -149,7 +155,9 @@ if TYPE_CHECKING:
from .resources.rate_limits import RateLimitsResource, AsyncRateLimitsResource from .resources.rate_limits import RateLimitsResource, AsyncRateLimitsResource
from .resources.rules.rules import RulesResource, AsyncRulesResource from .resources.rules.rules import RulesResource, AsyncRulesResource
from .resources.speed.speed import SpeedResource, AsyncSpeedResource from .resources.speed.speed import SpeedResource, AsyncSpeedResource
from .resources.zaraz.zaraz import ZarazResource, AsyncZarazResource
from .resources.zones.zones import ZonesResource, AsyncZonesResource from .resources.zones.zones import ZonesResource, AsyncZonesResource
from .resources.custom_pages import CustomPagesResource, AsyncCustomPagesResource
from .resources.security_txt import SecurityTXTResource, AsyncSecurityTXTResource from .resources.security_txt import SecurityTXTResource, AsyncSecurityTXTResource
from .resources.abuse_reports import AbuseReportsResource, AsyncAbuseReportsResource from .resources.abuse_reports import AbuseReportsResource, AsyncAbuseReportsResource
from .resources.images.images import ImagesResource, AsyncImagesResource from .resources.images.images import ImagesResource, AsyncImagesResource
@ -202,18 +210,28 @@ if TYPE_CHECKING:
from .resources.cloud_connector.cloud_connector import CloudConnectorResource, AsyncCloudConnectorResource from .resources.cloud_connector.cloud_connector import CloudConnectorResource, AsyncCloudConnectorResource
from .resources.durable_objects.durable_objects import DurableObjectsResource, AsyncDurableObjectsResource from .resources.durable_objects.durable_objects import DurableObjectsResource, AsyncDurableObjectsResource
from .resources.request_tracers.request_tracers import RequestTracersResource, AsyncRequestTracersResource 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.content_scanning.content_scanning import ContentScanningResource, AsyncContentScanningResource
from .resources.custom_hostnames.custom_hostnames import CustomHostnamesResource, AsyncCustomHostnamesResource from .resources.custom_hostnames.custom_hostnames import CustomHostnamesResource, AsyncCustomHostnamesResource
from .resources.resource_sharing.resource_sharing import ResourceSharingResource, AsyncResourceSharingResource 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.mtls_certificates.mtls_certificates import MTLSCertificatesResource, AsyncMTLSCertificatesResource
from .resources.custom_certificates.custom_certificates import ( from .resources.custom_certificates.custom_certificates import (
CustomCertificatesResource, CustomCertificatesResource,
AsyncCustomCertificatesResource, AsyncCustomCertificatesResource,
) )
from .resources.network_interconnects.network_interconnects import (
NetworkInterconnectsResource,
AsyncNetworkInterconnectsResource,
)
from .resources.workers_for_platforms.workers_for_platforms import ( from .resources.workers_for_platforms.workers_for_platforms import (
WorkersForPlatformsResource, WorkersForPlatformsResource,
AsyncWorkersForPlatformsResource, AsyncWorkersForPlatformsResource,
) )
from .resources.magic_cloud_networking.magic_cloud_networking import (
MagicCloudNetworkingResource,
AsyncMagicCloudNetworkingResource,
)
from .resources.origin_tls_client_auth.origin_tls_client_auth import ( from .resources.origin_tls_client_auth.origin_tls_client_auth import (
OriginTLSClientAuthResource, OriginTLSClientAuthResource,
AsyncOriginTLSClientAuthResource, AsyncOriginTLSClientAuthResource,
@ -276,7 +294,7 @@ class Cloudflare(SyncAPIClient):
# part of our public interface in the future. # part of our public interface in the future.
_strict_response_validation: bool = False, _strict_response_validation: bool = False,
) -> None: ) -> 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: This automatically infers the following arguments from their corresponding environment variables if they are not provided:
- `api_token` from `CLOUDFLARE_API_TOKEN` - `api_token` from `CLOUDFLARE_API_TOKEN`
@ -616,6 +634,18 @@ class Cloudflare(SyncAPIClient):
return MagicNetworkMonitoringResource(self) return MagicNetworkMonitoringResource(self)
@cached_property
def magic_cloud_networking(self) -> MagicCloudNetworkingResource:
from .resources.magic_cloud_networking import MagicCloudNetworkingResource
return MagicCloudNetworkingResource(self)
@cached_property
def network_interconnects(self) -> NetworkInterconnectsResource:
from .resources.network_interconnects import NetworkInterconnectsResource
return NetworkInterconnectsResource(self)
@cached_property @cached_property
def mtls_certificates(self) -> MTLSCertificatesResource: def mtls_certificates(self) -> MTLSCertificatesResource:
from .resources.mtls_certificates import MTLSCertificatesResource from .resources.mtls_certificates import MTLSCertificatesResource
@ -730,6 +760,12 @@ class Cloudflare(SyncAPIClient):
return OriginPostQuantumEncryptionResource(self) return OriginPostQuantumEncryptionResource(self)
@cached_property
def zaraz(self) -> ZarazResource:
from .resources.zaraz import ZarazResource
return ZarazResource(self)
@cached_property @cached_property
def speed(self) -> SpeedResource: def speed(self) -> SpeedResource:
from .resources.speed import SpeedResource from .resources.speed import SpeedResource
@ -832,6 +868,24 @@ class Cloudflare(SyncAPIClient):
return AIResource(self) 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 custom_pages(self) -> CustomPagesResource:
from .resources.custom_pages import CustomPagesResource
return CustomPagesResource(self)
@cached_property @cached_property
def with_raw_response(self) -> CloudflareWithRawResponse: def with_raw_response(self) -> CloudflareWithRawResponse:
return CloudflareWithRawResponse(self) return CloudflareWithRawResponse(self)
@ -1047,7 +1101,7 @@ class AsyncCloudflare(AsyncAPIClient):
# part of our public interface in the future. # part of our public interface in the future.
_strict_response_validation: bool = False, _strict_response_validation: bool = False,
) -> None: ) -> 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: This automatically infers the following arguments from their corresponding environment variables if they are not provided:
- `api_token` from `CLOUDFLARE_API_TOKEN` - `api_token` from `CLOUDFLARE_API_TOKEN`
@ -1387,6 +1441,18 @@ class AsyncCloudflare(AsyncAPIClient):
return AsyncMagicNetworkMonitoringResource(self) return AsyncMagicNetworkMonitoringResource(self)
@cached_property
def magic_cloud_networking(self) -> AsyncMagicCloudNetworkingResource:
from .resources.magic_cloud_networking import AsyncMagicCloudNetworkingResource
return AsyncMagicCloudNetworkingResource(self)
@cached_property
def network_interconnects(self) -> AsyncNetworkInterconnectsResource:
from .resources.network_interconnects import AsyncNetworkInterconnectsResource
return AsyncNetworkInterconnectsResource(self)
@cached_property @cached_property
def mtls_certificates(self) -> AsyncMTLSCertificatesResource: def mtls_certificates(self) -> AsyncMTLSCertificatesResource:
from .resources.mtls_certificates import AsyncMTLSCertificatesResource from .resources.mtls_certificates import AsyncMTLSCertificatesResource
@ -1501,6 +1567,12 @@ class AsyncCloudflare(AsyncAPIClient):
return AsyncOriginPostQuantumEncryptionResource(self) return AsyncOriginPostQuantumEncryptionResource(self)
@cached_property
def zaraz(self) -> AsyncZarazResource:
from .resources.zaraz import AsyncZarazResource
return AsyncZarazResource(self)
@cached_property @cached_property
def speed(self) -> AsyncSpeedResource: def speed(self) -> AsyncSpeedResource:
from .resources.speed import AsyncSpeedResource from .resources.speed import AsyncSpeedResource
@ -1603,6 +1675,24 @@ class AsyncCloudflare(AsyncAPIClient):
return AsyncAIResource(self) 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 custom_pages(self) -> AsyncCustomPagesResource:
from .resources.custom_pages import AsyncCustomPagesResource
return AsyncCustomPagesResource(self)
@cached_property @cached_property
def with_raw_response(self) -> AsyncCloudflareWithRawResponse: def with_raw_response(self) -> AsyncCloudflareWithRawResponse:
return AsyncCloudflareWithRawResponse(self) return AsyncCloudflareWithRawResponse(self)
@ -2091,6 +2181,18 @@ class CloudflareWithRawResponse:
return MagicNetworkMonitoringResourceWithRawResponse(self._client.magic_network_monitoring) return MagicNetworkMonitoringResourceWithRawResponse(self._client.magic_network_monitoring)
@cached_property
def magic_cloud_networking(self) -> magic_cloud_networking.MagicCloudNetworkingResourceWithRawResponse:
from .resources.magic_cloud_networking import MagicCloudNetworkingResourceWithRawResponse
return MagicCloudNetworkingResourceWithRawResponse(self._client.magic_cloud_networking)
@cached_property
def network_interconnects(self) -> network_interconnects.NetworkInterconnectsResourceWithRawResponse:
from .resources.network_interconnects import NetworkInterconnectsResourceWithRawResponse
return NetworkInterconnectsResourceWithRawResponse(self._client.network_interconnects)
@cached_property @cached_property
def mtls_certificates(self) -> mtls_certificates.MTLSCertificatesResourceWithRawResponse: def mtls_certificates(self) -> mtls_certificates.MTLSCertificatesResourceWithRawResponse:
from .resources.mtls_certificates import MTLSCertificatesResourceWithRawResponse from .resources.mtls_certificates import MTLSCertificatesResourceWithRawResponse
@ -2207,6 +2309,12 @@ class CloudflareWithRawResponse:
return OriginPostQuantumEncryptionResourceWithRawResponse(self._client.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 @cached_property
def speed(self) -> speed.SpeedResourceWithRawResponse: def speed(self) -> speed.SpeedResourceWithRawResponse:
from .resources.speed import SpeedResourceWithRawResponse from .resources.speed import SpeedResourceWithRawResponse
@ -2309,6 +2417,24 @@ class CloudflareWithRawResponse:
return AIResourceWithRawResponse(self._client.ai) 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)
@cached_property
def custom_pages(self) -> custom_pages.CustomPagesResourceWithRawResponse:
from .resources.custom_pages import CustomPagesResourceWithRawResponse
return CustomPagesResourceWithRawResponse(self._client.custom_pages)
class AsyncCloudflareWithRawResponse: class AsyncCloudflareWithRawResponse:
_client: AsyncCloudflare _client: AsyncCloudflare
@ -2616,6 +2742,18 @@ class AsyncCloudflareWithRawResponse:
return AsyncMagicNetworkMonitoringResourceWithRawResponse(self._client.magic_network_monitoring) return AsyncMagicNetworkMonitoringResourceWithRawResponse(self._client.magic_network_monitoring)
@cached_property
def magic_cloud_networking(self) -> magic_cloud_networking.AsyncMagicCloudNetworkingResourceWithRawResponse:
from .resources.magic_cloud_networking import AsyncMagicCloudNetworkingResourceWithRawResponse
return AsyncMagicCloudNetworkingResourceWithRawResponse(self._client.magic_cloud_networking)
@cached_property
def network_interconnects(self) -> network_interconnects.AsyncNetworkInterconnectsResourceWithRawResponse:
from .resources.network_interconnects import AsyncNetworkInterconnectsResourceWithRawResponse
return AsyncNetworkInterconnectsResourceWithRawResponse(self._client.network_interconnects)
@cached_property @cached_property
def mtls_certificates(self) -> mtls_certificates.AsyncMTLSCertificatesResourceWithRawResponse: def mtls_certificates(self) -> mtls_certificates.AsyncMTLSCertificatesResourceWithRawResponse:
from .resources.mtls_certificates import AsyncMTLSCertificatesResourceWithRawResponse from .resources.mtls_certificates import AsyncMTLSCertificatesResourceWithRawResponse
@ -2732,6 +2870,12 @@ class AsyncCloudflareWithRawResponse:
return AsyncOriginPostQuantumEncryptionResourceWithRawResponse(self._client.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 @cached_property
def speed(self) -> speed.AsyncSpeedResourceWithRawResponse: def speed(self) -> speed.AsyncSpeedResourceWithRawResponse:
from .resources.speed import AsyncSpeedResourceWithRawResponse from .resources.speed import AsyncSpeedResourceWithRawResponse
@ -2834,6 +2978,24 @@ class AsyncCloudflareWithRawResponse:
return AsyncAIResourceWithRawResponse(self._client.ai) 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)
@cached_property
def custom_pages(self) -> custom_pages.AsyncCustomPagesResourceWithRawResponse:
from .resources.custom_pages import AsyncCustomPagesResourceWithRawResponse
return AsyncCustomPagesResourceWithRawResponse(self._client.custom_pages)
class CloudflareWithStreamedResponse: class CloudflareWithStreamedResponse:
_client: Cloudflare _client: Cloudflare
@ -3141,6 +3303,18 @@ class CloudflareWithStreamedResponse:
return MagicNetworkMonitoringResourceWithStreamingResponse(self._client.magic_network_monitoring) return MagicNetworkMonitoringResourceWithStreamingResponse(self._client.magic_network_monitoring)
@cached_property
def magic_cloud_networking(self) -> magic_cloud_networking.MagicCloudNetworkingResourceWithStreamingResponse:
from .resources.magic_cloud_networking import MagicCloudNetworkingResourceWithStreamingResponse
return MagicCloudNetworkingResourceWithStreamingResponse(self._client.magic_cloud_networking)
@cached_property
def network_interconnects(self) -> network_interconnects.NetworkInterconnectsResourceWithStreamingResponse:
from .resources.network_interconnects import NetworkInterconnectsResourceWithStreamingResponse
return NetworkInterconnectsResourceWithStreamingResponse(self._client.network_interconnects)
@cached_property @cached_property
def mtls_certificates(self) -> mtls_certificates.MTLSCertificatesResourceWithStreamingResponse: def mtls_certificates(self) -> mtls_certificates.MTLSCertificatesResourceWithStreamingResponse:
from .resources.mtls_certificates import MTLSCertificatesResourceWithStreamingResponse from .resources.mtls_certificates import MTLSCertificatesResourceWithStreamingResponse
@ -3257,6 +3431,12 @@ class CloudflareWithStreamedResponse:
return OriginPostQuantumEncryptionResourceWithStreamingResponse(self._client.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 @cached_property
def speed(self) -> speed.SpeedResourceWithStreamingResponse: def speed(self) -> speed.SpeedResourceWithStreamingResponse:
from .resources.speed import SpeedResourceWithStreamingResponse from .resources.speed import SpeedResourceWithStreamingResponse
@ -3359,6 +3539,24 @@ class CloudflareWithStreamedResponse:
return AIResourceWithStreamingResponse(self._client.ai) 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)
@cached_property
def custom_pages(self) -> custom_pages.CustomPagesResourceWithStreamingResponse:
from .resources.custom_pages import CustomPagesResourceWithStreamingResponse
return CustomPagesResourceWithStreamingResponse(self._client.custom_pages)
class AsyncCloudflareWithStreamedResponse: class AsyncCloudflareWithStreamedResponse:
_client: AsyncCloudflare _client: AsyncCloudflare
@ -3670,6 +3868,18 @@ class AsyncCloudflareWithStreamedResponse:
return AsyncMagicNetworkMonitoringResourceWithStreamingResponse(self._client.magic_network_monitoring) return AsyncMagicNetworkMonitoringResourceWithStreamingResponse(self._client.magic_network_monitoring)
@cached_property
def magic_cloud_networking(self) -> magic_cloud_networking.AsyncMagicCloudNetworkingResourceWithStreamingResponse:
from .resources.magic_cloud_networking import AsyncMagicCloudNetworkingResourceWithStreamingResponse
return AsyncMagicCloudNetworkingResourceWithStreamingResponse(self._client.magic_cloud_networking)
@cached_property
def network_interconnects(self) -> network_interconnects.AsyncNetworkInterconnectsResourceWithStreamingResponse:
from .resources.network_interconnects import AsyncNetworkInterconnectsResourceWithStreamingResponse
return AsyncNetworkInterconnectsResourceWithStreamingResponse(self._client.network_interconnects)
@cached_property @cached_property
def mtls_certificates(self) -> mtls_certificates.AsyncMTLSCertificatesResourceWithStreamingResponse: def mtls_certificates(self) -> mtls_certificates.AsyncMTLSCertificatesResourceWithStreamingResponse:
from .resources.mtls_certificates import AsyncMTLSCertificatesResourceWithStreamingResponse from .resources.mtls_certificates import AsyncMTLSCertificatesResourceWithStreamingResponse
@ -3790,6 +4000,12 @@ class AsyncCloudflareWithStreamedResponse:
self._client.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 @cached_property
def speed(self) -> speed.AsyncSpeedResourceWithStreamingResponse: def speed(self) -> speed.AsyncSpeedResourceWithStreamingResponse:
from .resources.speed import AsyncSpeedResourceWithStreamingResponse from .resources.speed import AsyncSpeedResourceWithStreamingResponse
@ -3894,6 +4110,24 @@ class AsyncCloudflareWithStreamedResponse:
return AsyncAIResourceWithStreamingResponse(self._client.ai) 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)
@cached_property
def custom_pages(self) -> custom_pages.AsyncCustomPagesResourceWithStreamingResponse:
from .resources.custom_pages import AsyncCustomPagesResourceWithStreamingResponse
return AsyncCustomPagesResourceWithStreamingResponse(self._client.custom_pages)
Client = Cloudflare Client = Cloudflare

View file

@ -6,7 +6,7 @@ RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response"
OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"
# default timeout is 1 minute # 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_MAX_RETRIES = 2
DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20)

View file

@ -34,7 +34,7 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None:
if not is_file_content(obj): if not is_file_content(obj):
prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`" prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`"
raise RuntimeError( 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 ) from None

View file

@ -65,7 +65,7 @@ from ._compat import (
from ._constants import RAW_RESPONSE_HEADER from ._constants import RAW_RESPONSE_HEADER
if TYPE_CHECKING: if TYPE_CHECKING:
from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema
__all__ = ["BaseModel", "GenericModel"] __all__ = ["BaseModel", "GenericModel"]
@ -172,7 +172,7 @@ class BaseModel(pydantic.BaseModel):
@override @override
def __str__(self) -> str: def __str__(self) -> str:
# mypy complains about an invalid self arg # 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. # Override the 'construct' method in a way that supports recursive parsing without validation.
# Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836. # 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. 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 # we allow `object` as the input type because otherwise, passing things like
# `Literal['value']` will be reported as a type error by type checkers # `Literal['value']` will be reported as a type error by type checkers
type_ = cast("type[object]", type_) type_ = cast("type[object]", type_)
if is_type_alias_type(type_): if is_type_alias_type(type_):
original_type = type_ # type: ignore[unreachable]
type_ = type_.__value__ # type: ignore[unreachable] type_ = type_.__value__ # type: ignore[unreachable]
# unwrap `Annotated[T, ...]` -> `T` # unwrap `Annotated[T, ...]` -> `T`
@ -446,7 +452,7 @@ def construct_type(*, value: object, type_: object) -> object:
if is_union(origin): if is_union(origin):
try: 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: except Exception:
pass pass
@ -640,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None: def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
schema = model.__pydantic_core_schema__ schema = model.__pydantic_core_schema__
if schema["type"] == "definitions":
schema = schema["schema"]
if schema["type"] != "model": if schema["type"] != "model":
return None return None
schema = cast("ModelSchema", schema)
fields_schema = schema["schema"] fields_schema = schema["schema"]
if fields_schema["type"] != "model-fields": if fields_schema["type"] != "model-fields":
return None return None
fields_schema = cast("ModelFieldsSchema", fields_schema) fields_schema = cast("ModelFieldsSchema", fields_schema)
field = fields_schema["fields"].get(field_name) field = fields_schema["fields"].get(field_name)
if not field: if not field:
return None return None

View file

@ -136,6 +136,8 @@ class BaseAPIResponse(Generic[R]):
if cast_to and is_annotated_type(cast_to): if cast_to and is_annotated_type(cast_to):
cast_to = extract_type_arg(cast_to, 0) cast_to = extract_type_arg(cast_to, 0)
origin = get_origin(cast_to) or cast_to
if self._is_sse_stream: if self._is_sse_stream:
if to: if to:
if not is_stream_class_type(to): if not is_stream_class_type(to):
@ -195,8 +197,6 @@ class BaseAPIResponse(Generic[R]):
if cast_to == bool: if cast_to == bool:
return cast(R, response.text.lower() == "true") return cast(R, response.text.lower() == "true")
origin = get_origin(cast_to) or cast_to
if origin == APIResponse: if origin == APIResponse:
raise RuntimeError("Unexpected state - cast_to is `APIResponse`") raise RuntimeError("Unexpected state - cast_to is `APIResponse`")
@ -210,7 +210,13 @@ class BaseAPIResponse(Generic[R]):
raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`") raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`")
return cast(R, response) 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( raise TypeError(
"Pydantic models must subclass our base model type, e.g. `from cloudflare import BaseModel`" "Pydantic models must subclass our base model type, e.g. `from cloudflare import BaseModel`"
) )

View file

@ -1,56 +1,77 @@
from __future__ import annotations from __future__ import annotations
import sys
import asyncio
import functools import functools
from typing import TypeVar, Callable, Awaitable import contextvars
from typing import Any, TypeVar, Callable, Awaitable
from typing_extensions import ParamSpec from typing_extensions import ParamSpec
import anyio import anyio
import sniffio
import anyio.to_thread import anyio.to_thread
from ._reflection import function_has_argument
T_Retval = TypeVar("T_Retval") T_Retval = TypeVar("T_Retval")
T_ParamSpec = ParamSpec("T_ParamSpec") T_ParamSpec = ParamSpec("T_ParamSpec")
# copied from `asyncer`, https://github.com/tiangolo/asyncer if sys.version_info >= (3, 9):
def asyncify( _asyncio_to_thread = asyncio.to_thread
function: Callable[T_ParamSpec, T_Retval], else:
*, # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
cancellable: bool = False, # for Python 3.8 support
limiter: anyio.CapacityLimiter | None = None, async def _asyncio_to_thread(
) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: 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 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 positional and keyword arguments. For python version 3.9 and above, it uses
in a worker thread using `anyio.to_thread.run_sync()`. Internally, asyncio.to_thread to run the function in a separate thread. For python version
`asyncer.asyncify()` uses the same `anyio.to_thread.run_sync()`, but it supports 3.8, it uses locally defined copy of the asyncio.to_thread function which was
keyword arguments additional to positional arguments and it adds better support for introduced in python 3.9.
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 Usage:
cancelled, the thread will still run its course but its return value (or any raised
exception) will be ignored.
Use it like this: ```python
def blocking_func(arg1, arg2, kwarg1=None):
```Python # blocking code
def do_work(arg1, arg2, kwarg1="", kwarg2="") -> str: return result
# Do work
return "Some result"
result = await to_thread.asyncify(do_work)("spam", "ham", kwarg1="a", kwarg2="b") result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1)
print(result)
``` ```
## Arguments ## Arguments
`function`: a blocking regular callable (e.g. a function) `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 ## Return
@ -60,22 +81,6 @@ def asyncify(
""" """
async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval: async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval:
partial_f = functools.partial(function, *args, **kwargs) return await to_thread(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 wrapper return wrapper

View file

@ -25,7 +25,7 @@ from ._typing import (
is_annotated_type, is_annotated_type,
strip_annotated_type, strip_annotated_type,
) )
from .._compat import model_dump, is_typeddict from .._compat import get_origin, model_dump, is_typeddict
_T = TypeVar("_T") _T = TypeVar("_T")
@ -164,9 +164,14 @@ def _transform_recursive(
inner_type = annotation inner_type = annotation
stripped_type = strip_annotated_type(inner_type) stripped_type = strip_annotated_type(inner_type)
origin = get_origin(stripped_type) or stripped_type
if is_typeddict(stripped_type) and is_mapping(data): if is_typeddict(stripped_type) and is_mapping(data):
return _transform_typeddict(data, stripped_type) 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 ( if (
# List[T] # List[T]
(is_list_type(stripped_type) and is_list(data)) (is_list_type(stripped_type) and is_list(data))
@ -307,9 +312,14 @@ async def _async_transform_recursive(
inner_type = annotation inner_type = annotation
stripped_type = strip_annotated_type(inner_type) stripped_type = strip_annotated_type(inner_type)
origin = get_origin(stripped_type) or stripped_type
if is_typeddict(stripped_type) and is_mapping(data): if is_typeddict(stripped_type) and is_mapping(data):
return await _async_transform_typeddict(data, stripped_type) 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 ( if (
# List[T] # List[T]
(is_list_type(stripped_type) and is_list(data)) (is_list_type(stripped_type) and is_list(data))

View file

@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "cloudflare" __title__ = "cloudflare"
__version__ = "4.0.0" # x-release-please-version __version__ = "4.1.0" # x-release-please-version

File diff suppressed because it is too large Load diff

View file

@ -94,7 +94,7 @@ class AccountsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AccountsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -377,7 +377,7 @@ class AsyncAccountsResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -30,7 +30,7 @@ class AuditResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AuditResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncAuditResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -24,7 +24,7 @@ class LogsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> LogsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -49,7 +49,7 @@ class AsyncLogsResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -36,7 +36,7 @@ class MembersResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> MembersResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncMembersResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -7,6 +7,7 @@ from typing import Type, Optional, cast
import httpx import httpx
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import maybe_transform
from ..._compat import cached_property from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import ( from ..._response import (
@ -16,8 +17,9 @@ from ..._response import (
async_to_streamed_response_wrapper, async_to_streamed_response_wrapper,
) )
from ..._wrappers import ResultWrapper from ..._wrappers import ResultWrapper
from ...pagination import SyncSinglePage, AsyncSinglePage from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from ..._base_client import AsyncPaginator, make_request_options from ..._base_client import AsyncPaginator, make_request_options
from ...types.accounts import role_list_params
from ...types.shared.role import Role from ...types.shared.role import Role
__all__ = ["RolesResource", "AsyncRolesResource"] __all__ = ["RolesResource", "AsyncRolesResource"]
@ -27,7 +29,7 @@ class RolesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> RolesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -47,19 +49,25 @@ class RolesResource(SyncAPIResource):
self, self,
*, *,
account_id: str, 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. # 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. # The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None, extra_headers: Headers | None = None,
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[Role]: ) -> SyncV4PagePaginationArray[Role]:
""" """
Get all available roles for an account. Get all available roles for an account.
Args: Args:
account_id: Account identifier tag. account_id: Account identifier tag.
page: Page number of paginated results.
per_page: Number of roles per page.
extra_headers: Send extra headers extra_headers: Send extra headers
extra_query: Add additional query parameters to the request extra_query: Add additional query parameters to the request
@ -72,9 +80,19 @@ class RolesResource(SyncAPIResource):
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list( return self._get_api_list(
f"/accounts/{account_id}/roles", f"/accounts/{account_id}/roles",
page=SyncSinglePage[Role], page=SyncV4PagePaginationArray[Role],
options=make_request_options( 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, model=Role,
) )
@ -128,7 +146,7 @@ class AsyncRolesResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncRolesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -148,19 +166,25 @@ class AsyncRolesResource(AsyncAPIResource):
self, self,
*, *,
account_id: str, 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. # 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. # The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None, extra_headers: Headers | None = None,
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[Role, AsyncSinglePage[Role]]: ) -> AsyncPaginator[Role, AsyncV4PagePaginationArray[Role]]:
""" """
Get all available roles for an account. Get all available roles for an account.
Args: Args:
account_id: Account identifier tag. account_id: Account identifier tag.
page: Page number of paginated results.
per_page: Number of roles per page.
extra_headers: Send extra headers extra_headers: Send extra headers
extra_query: Add additional query parameters to the request extra_query: Add additional query parameters to the request
@ -173,9 +197,19 @@ class AsyncRolesResource(AsyncAPIResource):
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list( return self._get_api_list(
f"/accounts/{account_id}/roles", f"/accounts/{account_id}/roles",
page=AsyncSinglePage[Role], page=AsyncV4PagePaginationArray[Role],
options=make_request_options( 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, model=Role,
) )

View file

@ -2,7 +2,7 @@
from __future__ import annotations from __future__ import annotations
from typing import Any, Type, Optional, cast from typing import Any, Type, cast
from typing_extensions import Literal from typing_extensions import Literal
import httpx import httpx
@ -21,10 +21,11 @@ from ..._response import (
async_to_streamed_response_wrapper, async_to_streamed_response_wrapper,
) )
from ..._wrappers import ResultWrapper 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.accounts import subscription_create_params, subscription_update_params
from ...types.shared.subscription import Subscription
from ...types.shared_params.rate_plan import RatePlan 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_create_response import SubscriptionCreateResponse
from ...types.accounts.subscription_delete_response import SubscriptionDeleteResponse from ...types.accounts.subscription_delete_response import SubscriptionDeleteResponse
from ...types.accounts.subscription_update_response import SubscriptionUpdateResponse from ...types.accounts.subscription_update_response import SubscriptionUpdateResponse
@ -36,7 +37,7 @@ class SubscriptionsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> SubscriptionsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -229,7 +230,7 @@ class SubscriptionsResource(SyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SubscriptionGetResponse]: ) -> SyncSinglePage[Subscription]:
""" """
Lists all of an account's subscriptions. Lists all of an account's subscriptions.
@ -246,16 +247,13 @@ class SubscriptionsResource(SyncAPIResource):
""" """
if not account_id: if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") 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", f"/accounts/{account_id}/subscriptions",
page=SyncSinglePage[Subscription],
options=make_request_options( options=make_request_options(
extra_headers=extra_headers, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SubscriptionGetResponse]]._unwrapper,
), ),
cast_to=cast(Type[Optional[SubscriptionGetResponse]], ResultWrapper[SubscriptionGetResponse]), model=Subscription,
) )
@ -263,7 +261,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncSubscriptionsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -446,7 +444,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
cast_to=cast(Type[SubscriptionDeleteResponse], ResultWrapper[SubscriptionDeleteResponse]), cast_to=cast(Type[SubscriptionDeleteResponse], ResultWrapper[SubscriptionDeleteResponse]),
) )
async def get( def get(
self, self,
*, *,
account_id: str, account_id: str,
@ -456,7 +454,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[SubscriptionGetResponse]: ) -> AsyncPaginator[Subscription, AsyncSinglePage[Subscription]]:
""" """
Lists all of an account's subscriptions. Lists all of an account's subscriptions.
@ -473,16 +471,13 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
""" """
if not account_id: if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") 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", f"/accounts/{account_id}/subscriptions",
page=AsyncSinglePage[Subscription],
options=make_request_options( options=make_request_options(
extra_headers=extra_headers, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[SubscriptionGetResponse]]._unwrapper,
), ),
cast_to=cast(Type[Optional[SubscriptionGetResponse]], ResultWrapper[SubscriptionGetResponse]), model=Subscription,
) )

View file

@ -15,6 +15,8 @@ from ...._response import (
) )
from ....pagination import SyncSinglePage, AsyncSinglePage from ....pagination import SyncSinglePage, AsyncSinglePage
from ...._base_client import AsyncPaginator, make_request_options 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"] __all__ = ["PermissionGroupsResource", "AsyncPermissionGroupsResource"]
@ -23,7 +25,7 @@ class PermissionGroupsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> PermissionGroupsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -49,7 +51,7 @@ class PermissionGroupsResource(SyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[object]: ) -> SyncSinglePage[PermissionGroupListResponse]:
""" """
Find all available permission groups for Account Owned API Tokens Find all available permission groups for Account Owned API Tokens
@ -68,11 +70,47 @@ class PermissionGroupsResource(SyncAPIResource):
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list( return self._get_api_list(
f"/accounts/{account_id}/tokens/permission_groups", f"/accounts/{account_id}/tokens/permission_groups",
page=SyncSinglePage[object], page=SyncSinglePage[PermissionGroupListResponse],
options=make_request_options( 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
), ),
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 @cached_property
def with_raw_response(self) -> AsyncPermissionGroupsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -106,7 +144,7 @@ class AsyncPermissionGroupsResource(AsyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, 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 Find all available permission groups for Account Owned API Tokens
@ -125,11 +163,47 @@ class AsyncPermissionGroupsResource(AsyncAPIResource):
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list( return self._get_api_list(
f"/accounts/{account_id}/tokens/permission_groups", f"/accounts/{account_id}/tokens/permission_groups",
page=AsyncSinglePage[object], page=AsyncSinglePage[PermissionGroupListResponse],
options=make_request_options( 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
), ),
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,
) -> AsyncPaginator[PermissionGroupGetResponse, AsyncSinglePage[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=AsyncSinglePage[PermissionGroupGetResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=PermissionGroupGetResponse,
) )
@ -140,6 +214,9 @@ class PermissionGroupsResourceWithRawResponse:
self.list = to_raw_response_wrapper( self.list = to_raw_response_wrapper(
permission_groups.list, permission_groups.list,
) )
self.get = to_raw_response_wrapper(
permission_groups.get,
)
class AsyncPermissionGroupsResourceWithRawResponse: class AsyncPermissionGroupsResourceWithRawResponse:
@ -149,6 +226,9 @@ class AsyncPermissionGroupsResourceWithRawResponse:
self.list = async_to_raw_response_wrapper( self.list = async_to_raw_response_wrapper(
permission_groups.list, permission_groups.list,
) )
self.get = async_to_raw_response_wrapper(
permission_groups.get,
)
class PermissionGroupsResourceWithStreamingResponse: class PermissionGroupsResourceWithStreamingResponse:
@ -158,6 +238,9 @@ class PermissionGroupsResourceWithStreamingResponse:
self.list = to_streamed_response_wrapper( self.list = to_streamed_response_wrapper(
permission_groups.list, permission_groups.list,
) )
self.get = to_streamed_response_wrapper(
permission_groups.get,
)
class AsyncPermissionGroupsResourceWithStreamingResponse: class AsyncPermissionGroupsResourceWithStreamingResponse:
@ -167,3 +250,6 @@ class AsyncPermissionGroupsResourceWithStreamingResponse:
self.list = async_to_streamed_response_wrapper( self.list = async_to_streamed_response_wrapper(
permission_groups.list, permission_groups.list,
) )
self.get = async_to_streamed_response_wrapper(
permission_groups.get,
)

View file

@ -62,7 +62,7 @@ class TokensResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> TokensResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -409,7 +409,7 @@ class AsyncTokensResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncTokensResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -31,7 +31,7 @@ class ValueResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ValueResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncValueResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -24,7 +24,7 @@ class ACMResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ACMResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -49,7 +49,7 @@ class AsyncACMResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncACMResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -33,7 +33,7 @@ class TotalTLSResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> TotalTLSResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncTotalTLSResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -29,7 +29,7 @@ class AccountsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AccountsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -71,7 +71,7 @@ class AddressMapsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AddressMapsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -354,7 +354,7 @@ class AsyncAddressMapsResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncAddressMapsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -29,7 +29,7 @@ class IPsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> IPsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncIPsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -29,7 +29,7 @@ class ZonesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ZonesResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncZonesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -72,7 +72,7 @@ class AddressingResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AddressingResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -113,7 +113,7 @@ class AsyncAddressingResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncAddressingResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -39,7 +39,7 @@ class LOADocumentsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> LOADocumentsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncLOADocumentsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -32,7 +32,7 @@ class AdvertisementStatusResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AdvertisementStatusResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncAdvertisementStatusResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -32,7 +32,7 @@ class BGPPrefixesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> BGPPrefixesResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncBGPPrefixesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -33,7 +33,7 @@ class DelegationsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> DelegationsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncDelegationsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -81,7 +81,7 @@ class PrefixesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> PrefixesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -342,7 +342,7 @@ class AsyncPrefixesResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncPrefixesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -33,7 +33,7 @@ class ServiceBindingsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ServiceBindingsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncServiceBindingsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -48,7 +48,7 @@ class RegionalHostnamesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> RegionalHostnamesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -303,7 +303,7 @@ class AsyncRegionalHostnamesResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncRegionalHostnamesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -24,7 +24,7 @@ class RegionsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> RegionsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncRegionsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -24,7 +24,7 @@ class ServicesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ServicesResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncServicesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -81,7 +81,7 @@ class AIResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AIResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -424,6 +424,7 @@ class AIResource(SyncAPIResource):
presence_penalty: float | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN,
raw: bool | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN,
repetition_penalty: float | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN,
response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN,
seed: int | NotGiven = NOT_GIVEN, seed: int | NotGiven = NOT_GIVEN,
stream: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN,
@ -501,6 +502,7 @@ class AIResource(SyncAPIResource):
max_tokens: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN,
presence_penalty: float | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN,
repetition_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, seed: int | NotGiven = NOT_GIVEN,
stream: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN,
@ -656,10 +658,16 @@ class AIResource(SyncAPIResource):
*, *,
account_id: str, account_id: str,
image: Iterable[float], image: Iterable[float],
frequency_penalty: float | NotGiven = NOT_GIVEN,
max_tokens: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN,
presence_penalty: float | NotGiven = NOT_GIVEN,
prompt: str | NotGiven = NOT_GIVEN, prompt: str | NotGiven = NOT_GIVEN,
raw: bool | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN,
repetition_penalty: float | NotGiven = NOT_GIVEN,
seed: float | NotGiven = NOT_GIVEN,
temperature: 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. # 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. # The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None, extra_headers: Headers | None = None,
@ -682,16 +690,32 @@ class AIResource(SyncAPIResource):
image: An array of integers that represent the image data constrained to 8-bit unsigned image: An array of integers that represent the image data constrained to 8-bit unsigned
integer values 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. 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. 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 raw: If true, a chat template is not applied and you must adhere to the specific
model's expected formatting. 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 temperature: Controls the randomness of the output; higher values produce more random
results. 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_headers: Send extra headers
extra_query: Add additional query parameters to the request extra_query: Add additional query parameters to the request
@ -726,7 +750,7 @@ class AIResource(SyncAPIResource):
mask: Iterable[float] | NotGiven = NOT_GIVEN, mask: Iterable[float] | NotGiven = NOT_GIVEN,
negative_prompt: str | NotGiven = NOT_GIVEN, negative_prompt: str | NotGiven = NOT_GIVEN,
num_steps: int | 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, strength: float | NotGiven = NOT_GIVEN,
width: int | NotGiven = NOT_GIVEN, width: int | NotGiven = NOT_GIVEN,
lang: str | NotGiven = NOT_GIVEN, lang: str | NotGiven = NOT_GIVEN,
@ -739,9 +763,10 @@ class AIResource(SyncAPIResource):
presence_penalty: float | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN,
raw: bool | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN,
repetition_penalty: float | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN,
response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN,
stream: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN,
temperature: float | 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, top_p: float | NotGiven = NOT_GIVEN,
messages: Iterable[ai_run_params.MessagesMessage] | NotGiven = NOT_GIVEN, messages: Iterable[ai_run_params.MessagesMessage] | NotGiven = NOT_GIVEN,
functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN, functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN,
@ -787,6 +812,7 @@ class AIResource(SyncAPIResource):
"presence_penalty": presence_penalty, "presence_penalty": presence_penalty,
"raw": raw, "raw": raw,
"repetition_penalty": repetition_penalty, "repetition_penalty": repetition_penalty,
"response_format": response_format,
"stream": stream, "stream": stream,
"temperature": temperature, "temperature": temperature,
"top_k": top_k, "top_k": top_k,
@ -833,7 +859,7 @@ class AsyncAIResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncAIResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -1176,6 +1202,7 @@ class AsyncAIResource(AsyncAPIResource):
presence_penalty: float | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN,
raw: bool | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN,
repetition_penalty: float | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN,
response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN,
seed: int | NotGiven = NOT_GIVEN, seed: int | NotGiven = NOT_GIVEN,
stream: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN,
@ -1253,6 +1280,7 @@ class AsyncAIResource(AsyncAPIResource):
max_tokens: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN,
presence_penalty: float | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN,
repetition_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, seed: int | NotGiven = NOT_GIVEN,
stream: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN,
temperature: float | NotGiven = NOT_GIVEN, temperature: float | NotGiven = NOT_GIVEN,
@ -1408,10 +1436,16 @@ class AsyncAIResource(AsyncAPIResource):
*, *,
account_id: str, account_id: str,
image: Iterable[float], image: Iterable[float],
frequency_penalty: float | NotGiven = NOT_GIVEN,
max_tokens: int | NotGiven = NOT_GIVEN, max_tokens: int | NotGiven = NOT_GIVEN,
presence_penalty: float | NotGiven = NOT_GIVEN,
prompt: str | NotGiven = NOT_GIVEN, prompt: str | NotGiven = NOT_GIVEN,
raw: bool | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN,
repetition_penalty: float | NotGiven = NOT_GIVEN,
seed: float | NotGiven = NOT_GIVEN,
temperature: 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. # 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. # The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None, extra_headers: Headers | None = None,
@ -1434,16 +1468,32 @@ class AsyncAIResource(AsyncAPIResource):
image: An array of integers that represent the image data constrained to 8-bit unsigned image: An array of integers that represent the image data constrained to 8-bit unsigned
integer values 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. 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. 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 raw: If true, a chat template is not applied and you must adhere to the specific
model's expected formatting. 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 temperature: Controls the randomness of the output; higher values produce more random
results. 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_headers: Send extra headers
extra_query: Add additional query parameters to the request extra_query: Add additional query parameters to the request
@ -1478,7 +1528,7 @@ class AsyncAIResource(AsyncAPIResource):
mask: Iterable[float] | NotGiven = NOT_GIVEN, mask: Iterable[float] | NotGiven = NOT_GIVEN,
negative_prompt: str | NotGiven = NOT_GIVEN, negative_prompt: str | NotGiven = NOT_GIVEN,
num_steps: int | 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, strength: float | NotGiven = NOT_GIVEN,
width: int | NotGiven = NOT_GIVEN, width: int | NotGiven = NOT_GIVEN,
lang: str | NotGiven = NOT_GIVEN, lang: str | NotGiven = NOT_GIVEN,
@ -1491,9 +1541,10 @@ class AsyncAIResource(AsyncAPIResource):
presence_penalty: float | NotGiven = NOT_GIVEN, presence_penalty: float | NotGiven = NOT_GIVEN,
raw: bool | NotGiven = NOT_GIVEN, raw: bool | NotGiven = NOT_GIVEN,
repetition_penalty: float | NotGiven = NOT_GIVEN, repetition_penalty: float | NotGiven = NOT_GIVEN,
response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN,
stream: bool | NotGiven = NOT_GIVEN, stream: bool | NotGiven = NOT_GIVEN,
temperature: float | 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, top_p: float | NotGiven = NOT_GIVEN,
messages: Iterable[ai_run_params.MessagesMessage] | NotGiven = NOT_GIVEN, messages: Iterable[ai_run_params.MessagesMessage] | NotGiven = NOT_GIVEN,
functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN, functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN,
@ -1539,6 +1590,7 @@ class AsyncAIResource(AsyncAPIResource):
"presence_penalty": presence_penalty, "presence_penalty": presence_penalty,
"raw": raw, "raw": raw,
"repetition_penalty": repetition_penalty, "repetition_penalty": repetition_penalty,
"response_format": response_format,
"stream": stream, "stream": stream,
"temperature": temperature, "temperature": temperature,
"top_k": top_k, "top_k": top_k,

View file

@ -23,7 +23,7 @@ class AuthorsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AuthorsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncAuthorsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -33,7 +33,7 @@ class AssetsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AssetsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncAssetsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -56,7 +56,7 @@ class FinetunesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> FinetunesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -172,7 +172,7 @@ class AsyncFinetunesResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncFinetunesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -26,7 +26,7 @@ class PublicResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> PublicResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncPublicResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -37,7 +37,7 @@ class ModelsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ModelsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -128,7 +128,7 @@ class AsyncModelsResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncModelsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -30,7 +30,7 @@ class SchemaResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> SchemaResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncSchemaResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -23,7 +23,7 @@ class TasksResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> TasksResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncTasksResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -8,6 +8,14 @@ from .logs import (
LogsResourceWithStreamingResponse, LogsResourceWithStreamingResponse,
AsyncLogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse,
) )
from .urls import (
URLsResource,
AsyncURLsResource,
URLsResourceWithRawResponse,
AsyncURLsResourceWithRawResponse,
URLsResourceWithStreamingResponse,
AsyncURLsResourceWithStreamingResponse,
)
from .datasets import ( from .datasets import (
DatasetsResource, DatasetsResource,
AsyncDatasetsResource, AsyncDatasetsResource,
@ -66,6 +74,12 @@ __all__ = [
"AsyncEvaluationsResourceWithRawResponse", "AsyncEvaluationsResourceWithRawResponse",
"EvaluationsResourceWithStreamingResponse", "EvaluationsResourceWithStreamingResponse",
"AsyncEvaluationsResourceWithStreamingResponse", "AsyncEvaluationsResourceWithStreamingResponse",
"URLsResource",
"AsyncURLsResource",
"URLsResourceWithRawResponse",
"AsyncURLsResourceWithRawResponse",
"URLsResourceWithStreamingResponse",
"AsyncURLsResourceWithStreamingResponse",
"AIGatewayResource", "AIGatewayResource",
"AsyncAIGatewayResource", "AsyncAIGatewayResource",
"AIGatewayResourceWithRawResponse", "AIGatewayResourceWithRawResponse",

View file

@ -15,6 +15,14 @@ from .logs import (
LogsResourceWithStreamingResponse, LogsResourceWithStreamingResponse,
AsyncLogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse,
) )
from .urls import (
URLsResource,
AsyncURLsResource,
URLsResourceWithRawResponse,
AsyncURLsResourceWithRawResponse,
URLsResourceWithStreamingResponse,
AsyncURLsResourceWithStreamingResponse,
)
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import ( from ..._utils import (
maybe_transform, maybe_transform,
@ -82,10 +90,14 @@ class AIGatewayResource(SyncAPIResource):
def evaluations(self) -> EvaluationsResource: def evaluations(self) -> EvaluationsResource:
return EvaluationsResource(self._client) return EvaluationsResource(self._client)
@cached_property
def urls(self) -> URLsResource:
return URLsResource(self._client)
@cached_property @cached_property
def with_raw_response(self) -> AIGatewayResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -112,6 +124,9 @@ class AIGatewayResource(SyncAPIResource):
rate_limiting_interval: Optional[int], rate_limiting_interval: Optional[int],
rate_limiting_limit: Optional[int], rate_limiting_limit: Optional[int],
rate_limiting_technique: Literal["fixed", "sliding"], 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: bool | NotGiven = NOT_GIVEN,
logpush_public_key: Optional[str] | 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. # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@ -148,6 +163,9 @@ class AIGatewayResource(SyncAPIResource):
"rate_limiting_interval": rate_limiting_interval, "rate_limiting_interval": rate_limiting_interval,
"rate_limiting_limit": rate_limiting_limit, "rate_limiting_limit": rate_limiting_limit,
"rate_limiting_technique": rate_limiting_technique, "rate_limiting_technique": rate_limiting_technique,
"authentication": authentication,
"log_management": log_management,
"log_management_strategy": log_management_strategy,
"logpush": logpush, "logpush": logpush,
"logpush_public_key": logpush_public_key, "logpush_public_key": logpush_public_key,
}, },
@ -174,6 +192,9 @@ class AIGatewayResource(SyncAPIResource):
rate_limiting_interval: Optional[int], rate_limiting_interval: Optional[int],
rate_limiting_limit: Optional[int], rate_limiting_limit: Optional[int],
rate_limiting_technique: Literal["fixed", "sliding"], 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: bool | NotGiven = NOT_GIVEN,
logpush_public_key: Optional[str] | 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. # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@ -211,6 +232,9 @@ class AIGatewayResource(SyncAPIResource):
"rate_limiting_interval": rate_limiting_interval, "rate_limiting_interval": rate_limiting_interval,
"rate_limiting_limit": rate_limiting_limit, "rate_limiting_limit": rate_limiting_limit,
"rate_limiting_technique": rate_limiting_technique, "rate_limiting_technique": rate_limiting_technique,
"authentication": authentication,
"log_management": log_management,
"log_management_strategy": log_management_strategy,
"logpush": logpush, "logpush": logpush,
"logpush_public_key": logpush_public_key, "logpush_public_key": logpush_public_key,
}, },
@ -378,10 +402,14 @@ class AsyncAIGatewayResource(AsyncAPIResource):
def evaluations(self) -> AsyncEvaluationsResource: def evaluations(self) -> AsyncEvaluationsResource:
return AsyncEvaluationsResource(self._client) return AsyncEvaluationsResource(self._client)
@cached_property
def urls(self) -> AsyncURLsResource:
return AsyncURLsResource(self._client)
@cached_property @cached_property
def with_raw_response(self) -> AsyncAIGatewayResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -408,6 +436,9 @@ class AsyncAIGatewayResource(AsyncAPIResource):
rate_limiting_interval: Optional[int], rate_limiting_interval: Optional[int],
rate_limiting_limit: Optional[int], rate_limiting_limit: Optional[int],
rate_limiting_technique: Literal["fixed", "sliding"], 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: bool | NotGiven = NOT_GIVEN,
logpush_public_key: Optional[str] | 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. # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@ -444,6 +475,9 @@ class AsyncAIGatewayResource(AsyncAPIResource):
"rate_limiting_interval": rate_limiting_interval, "rate_limiting_interval": rate_limiting_interval,
"rate_limiting_limit": rate_limiting_limit, "rate_limiting_limit": rate_limiting_limit,
"rate_limiting_technique": rate_limiting_technique, "rate_limiting_technique": rate_limiting_technique,
"authentication": authentication,
"log_management": log_management,
"log_management_strategy": log_management_strategy,
"logpush": logpush, "logpush": logpush,
"logpush_public_key": logpush_public_key, "logpush_public_key": logpush_public_key,
}, },
@ -470,6 +504,9 @@ class AsyncAIGatewayResource(AsyncAPIResource):
rate_limiting_interval: Optional[int], rate_limiting_interval: Optional[int],
rate_limiting_limit: Optional[int], rate_limiting_limit: Optional[int],
rate_limiting_technique: Literal["fixed", "sliding"], 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: bool | NotGiven = NOT_GIVEN,
logpush_public_key: Optional[str] | 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. # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@ -507,6 +544,9 @@ class AsyncAIGatewayResource(AsyncAPIResource):
"rate_limiting_interval": rate_limiting_interval, "rate_limiting_interval": rate_limiting_interval,
"rate_limiting_limit": rate_limiting_limit, "rate_limiting_limit": rate_limiting_limit,
"rate_limiting_technique": rate_limiting_technique, "rate_limiting_technique": rate_limiting_technique,
"authentication": authentication,
"log_management": log_management,
"log_management_strategy": log_management_strategy,
"logpush": logpush, "logpush": logpush,
"logpush_public_key": logpush_public_key, "logpush_public_key": logpush_public_key,
}, },
@ -693,6 +733,10 @@ class AIGatewayResourceWithRawResponse:
def evaluations(self) -> EvaluationsResourceWithRawResponse: def evaluations(self) -> EvaluationsResourceWithRawResponse:
return EvaluationsResourceWithRawResponse(self._ai_gateway.evaluations) return EvaluationsResourceWithRawResponse(self._ai_gateway.evaluations)
@cached_property
def urls(self) -> URLsResourceWithRawResponse:
return URLsResourceWithRawResponse(self._ai_gateway.urls)
class AsyncAIGatewayResourceWithRawResponse: class AsyncAIGatewayResourceWithRawResponse:
def __init__(self, ai_gateway: AsyncAIGatewayResource) -> None: def __init__(self, ai_gateway: AsyncAIGatewayResource) -> None:
@ -730,6 +774,10 @@ class AsyncAIGatewayResourceWithRawResponse:
def evaluations(self) -> AsyncEvaluationsResourceWithRawResponse: def evaluations(self) -> AsyncEvaluationsResourceWithRawResponse:
return AsyncEvaluationsResourceWithRawResponse(self._ai_gateway.evaluations) return AsyncEvaluationsResourceWithRawResponse(self._ai_gateway.evaluations)
@cached_property
def urls(self) -> AsyncURLsResourceWithRawResponse:
return AsyncURLsResourceWithRawResponse(self._ai_gateway.urls)
class AIGatewayResourceWithStreamingResponse: class AIGatewayResourceWithStreamingResponse:
def __init__(self, ai_gateway: AIGatewayResource) -> None: def __init__(self, ai_gateway: AIGatewayResource) -> None:
@ -767,6 +815,10 @@ class AIGatewayResourceWithStreamingResponse:
def evaluations(self) -> EvaluationsResourceWithStreamingResponse: def evaluations(self) -> EvaluationsResourceWithStreamingResponse:
return EvaluationsResourceWithStreamingResponse(self._ai_gateway.evaluations) return EvaluationsResourceWithStreamingResponse(self._ai_gateway.evaluations)
@cached_property
def urls(self) -> URLsResourceWithStreamingResponse:
return URLsResourceWithStreamingResponse(self._ai_gateway.urls)
class AsyncAIGatewayResourceWithStreamingResponse: class AsyncAIGatewayResourceWithStreamingResponse:
def __init__(self, ai_gateway: AsyncAIGatewayResource) -> None: def __init__(self, ai_gateway: AsyncAIGatewayResource) -> None:
@ -803,3 +855,7 @@ class AsyncAIGatewayResourceWithStreamingResponse:
@cached_property @cached_property
def evaluations(self) -> AsyncEvaluationsResourceWithStreamingResponse: def evaluations(self) -> AsyncEvaluationsResourceWithStreamingResponse:
return AsyncEvaluationsResourceWithStreamingResponse(self._ai_gateway.evaluations) return AsyncEvaluationsResourceWithStreamingResponse(self._ai_gateway.evaluations)
@cached_property
def urls(self) -> AsyncURLsResourceWithStreamingResponse:
return AsyncURLsResourceWithStreamingResponse(self._ai_gateway.urls)

View file

@ -36,7 +36,7 @@ class DatasetsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> DatasetsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncDatasetsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -2,16 +2,12 @@
from __future__ import annotations from __future__ import annotations
from typing import Type, cast
from typing_extensions import Literal from typing_extensions import Literal
import httpx import httpx
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import ( from ..._utils import maybe_transform
maybe_transform,
async_maybe_transform,
)
from ..._compat import cached_property from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import ( from ..._response import (
@ -20,10 +16,10 @@ from ..._response import (
async_to_raw_response_wrapper, async_to_raw_response_wrapper,
async_to_streamed_response_wrapper, async_to_streamed_response_wrapper,
) )
from ..._wrappers import ResultWrapper from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from ..._base_client import make_request_options from ..._base_client import AsyncPaginator, make_request_options
from ...types.ai_gateway import evaluation_type_get_params from ...types.ai_gateway import evaluation_type_list_params
from ...types.ai_gateway.evaluation_type_get_response import EvaluationTypeGetResponse from ...types.ai_gateway.evaluation_type_list_response import EvaluationTypeListResponse
__all__ = ["EvaluationTypesResource", "AsyncEvaluationTypesResource"] __all__ = ["EvaluationTypesResource", "AsyncEvaluationTypesResource"]
@ -32,7 +28,7 @@ class EvaluationTypesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> EvaluationTypesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -48,7 +44,7 @@ class EvaluationTypesResource(SyncAPIResource):
""" """
return EvaluationTypesResourceWithStreamingResponse(self) return EvaluationTypesResourceWithStreamingResponse(self)
def get( def list(
self, self,
*, *,
account_id: str, account_id: str,
@ -62,7 +58,7 @@ class EvaluationTypesResource(SyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> EvaluationTypeGetResponse: ) -> SyncV4PagePaginationArray[EvaluationTypeListResponse]:
""" """
List Evaluators List Evaluators
@ -77,8 +73,9 @@ class EvaluationTypesResource(SyncAPIResource):
""" """
if not account_id: if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") 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", f"/accounts/{account_id}/ai-gateway/evaluation-types",
page=SyncV4PagePaginationArray[EvaluationTypeListResponse],
options=make_request_options( options=make_request_options(
extra_headers=extra_headers, extra_headers=extra_headers,
extra_query=extra_query, extra_query=extra_query,
@ -91,11 +88,10 @@ class EvaluationTypesResource(SyncAPIResource):
"page": page, "page": page,
"per_page": per_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 @cached_property
def with_raw_response(self) -> AsyncEvaluationTypesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -119,7 +115,7 @@ class AsyncEvaluationTypesResource(AsyncAPIResource):
""" """
return AsyncEvaluationTypesResourceWithStreamingResponse(self) return AsyncEvaluationTypesResourceWithStreamingResponse(self)
async def get( def list(
self, self,
*, *,
account_id: str, account_id: str,
@ -133,7 +129,7 @@ class AsyncEvaluationTypesResource(AsyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> EvaluationTypeGetResponse: ) -> AsyncPaginator[EvaluationTypeListResponse, AsyncV4PagePaginationArray[EvaluationTypeListResponse]]:
""" """
List Evaluators List Evaluators
@ -148,25 +144,25 @@ class AsyncEvaluationTypesResource(AsyncAPIResource):
""" """
if not account_id: if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") 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", f"/accounts/{account_id}/ai-gateway/evaluation-types",
page=AsyncV4PagePaginationArray[EvaluationTypeListResponse],
options=make_request_options( options=make_request_options(
extra_headers=extra_headers, extra_headers=extra_headers,
extra_query=extra_query, extra_query=extra_query,
extra_body=extra_body, extra_body=extra_body,
timeout=timeout, timeout=timeout,
query=await async_maybe_transform( query=maybe_transform(
{ {
"order_by": order_by, "order_by": order_by,
"order_by_direction": order_by_direction, "order_by_direction": order_by_direction,
"page": page, "page": page,
"per_page": per_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: def __init__(self, evaluation_types: EvaluationTypesResource) -> None:
self._evaluation_types = evaluation_types self._evaluation_types = evaluation_types
self.get = to_raw_response_wrapper( self.list = to_raw_response_wrapper(
evaluation_types.get, evaluation_types.list,
) )
@ -183,8 +179,8 @@ class AsyncEvaluationTypesResourceWithRawResponse:
def __init__(self, evaluation_types: AsyncEvaluationTypesResource) -> None: def __init__(self, evaluation_types: AsyncEvaluationTypesResource) -> None:
self._evaluation_types = evaluation_types self._evaluation_types = evaluation_types
self.get = async_to_raw_response_wrapper( self.list = async_to_raw_response_wrapper(
evaluation_types.get, evaluation_types.list,
) )
@ -192,8 +188,8 @@ class EvaluationTypesResourceWithStreamingResponse:
def __init__(self, evaluation_types: EvaluationTypesResource) -> None: def __init__(self, evaluation_types: EvaluationTypesResource) -> None:
self._evaluation_types = evaluation_types self._evaluation_types = evaluation_types
self.get = to_streamed_response_wrapper( self.list = to_streamed_response_wrapper(
evaluation_types.get, evaluation_types.list,
) )
@ -201,6 +197,6 @@ class AsyncEvaluationTypesResourceWithStreamingResponse:
def __init__(self, evaluation_types: AsyncEvaluationTypesResource) -> None: def __init__(self, evaluation_types: AsyncEvaluationTypesResource) -> None:
self._evaluation_types = evaluation_types self._evaluation_types = evaluation_types
self.get = async_to_streamed_response_wrapper( self.list = async_to_streamed_response_wrapper(
evaluation_types.get, evaluation_types.list,
) )

View file

@ -35,7 +35,7 @@ class EvaluationsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> EvaluationsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncEvaluationsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -36,7 +36,7 @@ class LogsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> LogsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncLogsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -0,0 +1,190 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
from typing import Type, cast
import httpx
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
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.ai_gateway.url_get_response import URLGetResponse
__all__ = ["URLsResource", "AsyncURLsResource"]
class URLsResource(SyncAPIResource):
@cached_property
def with_raw_response(self) -> URLsResourceWithRawResponse:
"""
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 URLsResourceWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> URLsResourceWithStreamingResponse:
"""
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 URLsResourceWithStreamingResponse(self)
def get(
self,
provider: str,
*,
account_id: str,
gateway_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,
) -> str:
"""
Get Gateway URL
Args:
gateway_id: gateway id
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}")
if not gateway_id:
raise ValueError(f"Expected a non-empty value for `gateway_id` but received {gateway_id!r}")
if not provider:
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
return self._get(
f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/url/{provider}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[URLGetResponse]._unwrapper,
),
cast_to=cast(Type[str], ResultWrapper[str]),
)
class AsyncURLsResource(AsyncAPIResource):
@cached_property
def with_raw_response(self) -> AsyncURLsResourceWithRawResponse:
"""
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 AsyncURLsResourceWithRawResponse(self)
@cached_property
def with_streaming_response(self) -> AsyncURLsResourceWithStreamingResponse:
"""
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 AsyncURLsResourceWithStreamingResponse(self)
async def get(
self,
provider: str,
*,
account_id: str,
gateway_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,
) -> str:
"""
Get Gateway URL
Args:
gateway_id: gateway id
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}")
if not gateway_id:
raise ValueError(f"Expected a non-empty value for `gateway_id` but received {gateway_id!r}")
if not provider:
raise ValueError(f"Expected a non-empty value for `provider` but received {provider!r}")
return await self._get(
f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/url/{provider}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[URLGetResponse]._unwrapper,
),
cast_to=cast(Type[str], ResultWrapper[str]),
)
class URLsResourceWithRawResponse:
def __init__(self, urls: URLsResource) -> None:
self._urls = urls
self.get = to_raw_response_wrapper(
urls.get,
)
class AsyncURLsResourceWithRawResponse:
def __init__(self, urls: AsyncURLsResource) -> None:
self._urls = urls
self.get = async_to_raw_response_wrapper(
urls.get,
)
class URLsResourceWithStreamingResponse:
def __init__(self, urls: URLsResource) -> None:
self._urls = urls
self.get = to_streamed_response_wrapper(
urls.get,
)
class AsyncURLsResourceWithStreamingResponse:
def __init__(self, urls: AsyncURLsResource) -> None:
self._urls = urls
self.get = async_to_streamed_response_wrapper(
urls.get,
)

View file

@ -60,7 +60,7 @@ class AlertingResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AlertingResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -97,7 +97,7 @@ class AsyncAlertingResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncAlertingResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -26,7 +26,7 @@ class AvailableAlertsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AvailableAlertsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncAvailableAlertsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -48,7 +48,7 @@ class DestinationsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> DestinationsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -81,7 +81,7 @@ class AsyncDestinationsResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncDestinationsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -26,7 +26,7 @@ class EligibleResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> EligibleResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncEligibleResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -16,8 +16,9 @@ from ...._response import (
async_to_streamed_response_wrapper, async_to_streamed_response_wrapper,
) )
from ...._wrappers import ResultWrapper from ...._wrappers import ResultWrapper
from ...._base_client import make_request_options from ....pagination import SyncSinglePage, AsyncSinglePage
from ....types.alerting.destinations.pagerduty_get_response import PagerdutyGetResponse 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_link_response import PagerdutyLinkResponse
from ....types.alerting.destinations.pagerduty_create_response import PagerdutyCreateResponse from ....types.alerting.destinations.pagerduty_create_response import PagerdutyCreateResponse
from ....types.alerting.destinations.pagerduty_delete_response import PagerdutyDeleteResponse from ....types.alerting.destinations.pagerduty_delete_response import PagerdutyDeleteResponse
@ -29,7 +30,7 @@ class PagerdutyResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> PagerdutyResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -129,7 +130,7 @@ class PagerdutyResource(SyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[PagerdutyGetResponse]: ) -> SyncSinglePage[Pagerduty]:
""" """
Get a list of all configured PagerDuty services. Get a list of all configured PagerDuty services.
@ -146,16 +147,13 @@ class PagerdutyResource(SyncAPIResource):
""" """
if not account_id: if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") 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", f"/accounts/{account_id}/alerting/v3/destinations/pagerduty",
page=SyncSinglePage[Pagerduty],
options=make_request_options( options=make_request_options(
extra_headers=extra_headers, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[PagerdutyGetResponse]]._unwrapper,
), ),
cast_to=cast(Type[Optional[PagerdutyGetResponse]], ResultWrapper[PagerdutyGetResponse]), model=Pagerduty,
) )
def link( def link(
@ -207,7 +205,7 @@ class AsyncPagerdutyResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncPagerdutyResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -297,7 +295,7 @@ class AsyncPagerdutyResource(AsyncAPIResource):
cast_to=PagerdutyDeleteResponse, cast_to=PagerdutyDeleteResponse,
) )
async def get( def get(
self, self,
*, *,
account_id: str, account_id: str,
@ -307,7 +305,7 @@ class AsyncPagerdutyResource(AsyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[PagerdutyGetResponse]: ) -> AsyncPaginator[Pagerduty, AsyncSinglePage[Pagerduty]]:
""" """
Get a list of all configured PagerDuty services. Get a list of all configured PagerDuty services.
@ -324,16 +322,13 @@ class AsyncPagerdutyResource(AsyncAPIResource):
""" """
if not account_id: if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") 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", f"/accounts/{account_id}/alerting/v3/destinations/pagerduty",
page=AsyncSinglePage[Pagerduty],
options=make_request_options( options=make_request_options(
extra_headers=extra_headers, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[PagerdutyGetResponse]]._unwrapper,
), ),
cast_to=cast(Type[Optional[PagerdutyGetResponse]], ResultWrapper[PagerdutyGetResponse]), model=Pagerduty,
) )
async def link( async def link(

View file

@ -35,7 +35,7 @@ class WebhooksResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> WebhooksResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncWebhooksResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -29,7 +29,7 @@ class HistoryResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> HistoryResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncHistoryResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -38,7 +38,7 @@ class PoliciesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> PoliciesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -88,9 +88,9 @@ class PoliciesResource(SyncAPIResource):
"hostname_aop_custom_certificate_expiration_type", "hostname_aop_custom_certificate_expiration_type",
"http_alert_edge_error", "http_alert_edge_error",
"http_alert_origin_error", "http_alert_origin_error",
"incident_alert",
"image_notification", "image_notification",
"image_resizing_notification", "image_resizing_notification",
"incident_alert",
"load_balancing_health_alert", "load_balancing_health_alert",
"load_balancing_pool_enablement_alert", "load_balancing_pool_enablement_alert",
"logo_match_alert", "logo_match_alert",
@ -113,6 +113,7 @@ class PoliciesResource(SyncAPIResource):
"secondary_dns_warning", "secondary_dns_warning",
"secondary_dns_zone_successfully_updated", "secondary_dns_zone_successfully_updated",
"secondary_dns_zone_validation_warning", "secondary_dns_zone_validation_warning",
"security_insights_alert",
"sentinel_alert", "sentinel_alert",
"stream_live_notifications", "stream_live_notifications",
"synthetic_test_latency_alert", "synthetic_test_latency_alert",
@ -233,9 +234,9 @@ class PoliciesResource(SyncAPIResource):
"hostname_aop_custom_certificate_expiration_type", "hostname_aop_custom_certificate_expiration_type",
"http_alert_edge_error", "http_alert_edge_error",
"http_alert_origin_error", "http_alert_origin_error",
"incident_alert",
"image_notification", "image_notification",
"image_resizing_notification", "image_resizing_notification",
"incident_alert",
"load_balancing_health_alert", "load_balancing_health_alert",
"load_balancing_pool_enablement_alert", "load_balancing_pool_enablement_alert",
"logo_match_alert", "logo_match_alert",
@ -258,6 +259,7 @@ class PoliciesResource(SyncAPIResource):
"secondary_dns_warning", "secondary_dns_warning",
"secondary_dns_zone_successfully_updated", "secondary_dns_zone_successfully_updated",
"secondary_dns_zone_validation_warning", "secondary_dns_zone_validation_warning",
"security_insights_alert",
"sentinel_alert", "sentinel_alert",
"stream_live_notifications", "stream_live_notifications",
"synthetic_test_latency_alert", "synthetic_test_latency_alert",
@ -471,7 +473,7 @@ class AsyncPoliciesResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncPoliciesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -521,9 +523,9 @@ class AsyncPoliciesResource(AsyncAPIResource):
"hostname_aop_custom_certificate_expiration_type", "hostname_aop_custom_certificate_expiration_type",
"http_alert_edge_error", "http_alert_edge_error",
"http_alert_origin_error", "http_alert_origin_error",
"incident_alert",
"image_notification", "image_notification",
"image_resizing_notification", "image_resizing_notification",
"incident_alert",
"load_balancing_health_alert", "load_balancing_health_alert",
"load_balancing_pool_enablement_alert", "load_balancing_pool_enablement_alert",
"logo_match_alert", "logo_match_alert",
@ -546,6 +548,7 @@ class AsyncPoliciesResource(AsyncAPIResource):
"secondary_dns_warning", "secondary_dns_warning",
"secondary_dns_zone_successfully_updated", "secondary_dns_zone_successfully_updated",
"secondary_dns_zone_validation_warning", "secondary_dns_zone_validation_warning",
"security_insights_alert",
"sentinel_alert", "sentinel_alert",
"stream_live_notifications", "stream_live_notifications",
"synthetic_test_latency_alert", "synthetic_test_latency_alert",
@ -666,9 +669,9 @@ class AsyncPoliciesResource(AsyncAPIResource):
"hostname_aop_custom_certificate_expiration_type", "hostname_aop_custom_certificate_expiration_type",
"http_alert_edge_error", "http_alert_edge_error",
"http_alert_origin_error", "http_alert_origin_error",
"incident_alert",
"image_notification", "image_notification",
"image_resizing_notification", "image_resizing_notification",
"incident_alert",
"load_balancing_health_alert", "load_balancing_health_alert",
"load_balancing_pool_enablement_alert", "load_balancing_pool_enablement_alert",
"logo_match_alert", "logo_match_alert",
@ -691,6 +694,7 @@ class AsyncPoliciesResource(AsyncAPIResource):
"secondary_dns_warning", "secondary_dns_warning",
"secondary_dns_zone_successfully_updated", "secondary_dns_zone_successfully_updated",
"secondary_dns_zone_validation_warning", "secondary_dns_zone_validation_warning",
"security_insights_alert",
"sentinel_alert", "sentinel_alert",
"stream_live_notifications", "stream_live_notifications",
"synthetic_test_latency_alert", "synthetic_test_latency_alert",

View file

@ -96,7 +96,7 @@ class APIGatewayResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> APIGatewayResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -145,7 +145,7 @@ class AsyncAPIGatewayResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncAPIGatewayResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -33,7 +33,7 @@ class ConfigurationsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ConfigurationsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncConfigurationsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -38,7 +38,7 @@ class DiscoveryResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> DiscoveryResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -103,7 +103,7 @@ class AsyncDiscoveryResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncDiscoveryResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -35,7 +35,7 @@ class OperationsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> OperationsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncOperationsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -24,7 +24,7 @@ class ExpressionTemplateResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ExpressionTemplateResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -49,7 +49,7 @@ class AsyncExpressionTemplateResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncExpressionTemplateResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -31,7 +31,7 @@ class FallthroughResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> FallthroughResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncFallthroughResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -21,7 +21,7 @@ from ...._response import (
async_to_streamed_response_wrapper, async_to_streamed_response_wrapper,
) )
from ...._wrappers import ResultWrapper 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 ...._base_client import AsyncPaginator, make_request_options
from .schema_validation import ( from .schema_validation import (
SchemaValidationResource, SchemaValidationResource,
@ -55,7 +55,7 @@ class OperationsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> OperationsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -265,7 +265,7 @@ class OperationsResource(SyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> OperationBulkCreateResponse: ) -> SyncSinglePage[OperationBulkCreateResponse]:
"""Add one or more operations to a zone. """Add one or more operations to a zone.
Endpoints can contain path variables. Endpoints can contain path variables.
@ -287,17 +287,15 @@ class OperationsResource(SyncAPIResource):
""" """
if not zone_id: if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") 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", f"/zones/{zone_id}/api_gateway/operations",
page=SyncSinglePage[OperationBulkCreateResponse],
body=maybe_transform(body, Iterable[operation_bulk_create_params.Body]), body=maybe_transform(body, Iterable[operation_bulk_create_params.Body]),
options=make_request_options( options=make_request_options(
extra_headers=extra_headers, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[OperationBulkCreateResponse]._unwrapper,
), ),
cast_to=cast(Type[OperationBulkCreateResponse], ResultWrapper[OperationBulkCreateResponse]), model=OperationBulkCreateResponse,
method="post",
) )
def bulk_delete( def bulk_delete(
@ -394,7 +392,7 @@ class AsyncOperationsResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncOperationsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -593,7 +591,7 @@ class AsyncOperationsResource(AsyncAPIResource):
cast_to=OperationDeleteResponse, cast_to=OperationDeleteResponse,
) )
async def bulk_create( def bulk_create(
self, self,
*, *,
zone_id: str, zone_id: str,
@ -604,7 +602,7 @@ class AsyncOperationsResource(AsyncAPIResource):
extra_query: Query | None = None, extra_query: Query | None = None,
extra_body: Body | None = None, extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> OperationBulkCreateResponse: ) -> AsyncPaginator[OperationBulkCreateResponse, AsyncSinglePage[OperationBulkCreateResponse]]:
"""Add one or more operations to a zone. """Add one or more operations to a zone.
Endpoints can contain path variables. Endpoints can contain path variables.
@ -626,17 +624,15 @@ class AsyncOperationsResource(AsyncAPIResource):
""" """
if not zone_id: if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}") 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", 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( options=make_request_options(
extra_headers=extra_headers, extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[OperationBulkCreateResponse]._unwrapper,
), ),
cast_to=cast(Type[OperationBulkCreateResponse], ResultWrapper[OperationBulkCreateResponse]), model=OperationBulkCreateResponse,
method="post",
) )
async def bulk_delete( async def bulk_delete(

View file

@ -39,7 +39,7 @@ class SchemaValidationResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> SchemaValidationResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncSchemaValidationResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -32,7 +32,7 @@ class SchemasResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> SchemasResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncSchemasResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -31,7 +31,7 @@ class SchemaValidationResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> SchemaValidationResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncSchemaValidationResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -24,7 +24,7 @@ class SettingsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> SettingsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -49,7 +49,7 @@ class AsyncSettingsResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncSettingsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -26,7 +26,7 @@ class HostsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> HostsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncHostsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -29,7 +29,7 @@ class OperationsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> OperationsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncOperationsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -66,7 +66,7 @@ class UserSchemasResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> UserSchemasResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -353,7 +353,7 @@ class AsyncUserSchemasResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncUserSchemasResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -36,7 +36,7 @@ class ArgoResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ArgoResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -65,7 +65,7 @@ class AsyncArgoResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncArgoResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -33,7 +33,7 @@ class SmartRoutingResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> SmartRoutingResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncSmartRoutingResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -33,7 +33,7 @@ class TieredCachingResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> TieredCachingResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncTieredCachingResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -30,7 +30,7 @@ class AuditLogsResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AuditLogsResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncAuditLogsResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -24,7 +24,7 @@ class BillingResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> BillingResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -49,7 +49,7 @@ class AsyncBillingResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncBillingResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -26,7 +26,7 @@ class ProfilesResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ProfilesResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncProfilesResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -34,7 +34,7 @@ class BotManagementResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> BotManagementResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncBotManagementResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -33,7 +33,7 @@ class ASNResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> ASNResourceWithRawResponse: 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. 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 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 @cached_property
def with_raw_response(self) -> AsyncASNResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

View file

@ -36,7 +36,7 @@ class BotnetFeedResource(SyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> BotnetFeedResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers
@ -65,7 +65,7 @@ class AsyncBotnetFeedResource(AsyncAPIResource):
@cached_property @cached_property
def with_raw_response(self) -> AsyncBotnetFeedResourceWithRawResponse: 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. 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 For more information, see https://www.github.com/cloudflare/cloudflare-python#accessing-raw-response-data-eg-headers

Some files were not shown because too many files have changed in this diff Show more