diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 58fc28e9381..0722c756e37 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -8,6 +8,10 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
+ pull_request:
+ branches-ignore:
+ - 'stl-preview-head/**'
+ - 'stl-preview-base/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -18,8 +22,9 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Install Rye
run: |
@@ -35,24 +40,40 @@ jobs:
- name: Run lints
run: ./scripts/lint
- upload:
- if: github.repository == 'stainless-sdks/cloudflare-python'
+ build:
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
timeout-minutes: 10
- name: upload
+ name: build
permissions:
contents: read
id-token: write
- runs-on: depot-ubuntu-24.04
+ runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
+
+ - name: Install Rye
+ run: |
+ curl -sSf https://rye.astral.sh/get | bash
+ echo "$HOME/.rye/shims" >> $GITHUB_PATH
+ env:
+ RYE_VERSION: '0.44.0'
+ RYE_INSTALL_OPTION: '--yes'
+
+ - name: Install dependencies
+ run: rye sync --all-features
+
+ - name: Run build
+ run: rye build
- name: Get GitHub OIDC Token
+ if: github.repository == 'stainless-sdks/cloudflare-python'
id: github-oidc
uses: actions/github-script@v6
with:
script: core.setOutput('github_token', await core.getIDToken());
- name: Upload tarball
+ if: github.repository == 'stainless-sdks/cloudflare-python'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
@@ -63,8 +84,9 @@ jobs:
timeout-minutes: 30
name: test
runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
+ if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Install Rye
run: |
@@ -84,10 +106,10 @@ jobs:
timeout-minutes: 10
name: examples
runs-on: ${{ github.repository == 'stainless-sdks/cloudflare-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
- if: github.repository == 'cloudflare/cloudflare-python'
+ if: github.repository == 'cloudflare/cloudflare-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Install Rye
run: |
diff --git a/.github/workflows/detect-breaking-changes.yml b/.github/workflows/detect-breaking-changes.yml
new file mode 100644
index 00000000000..4673c236537
--- /dev/null
+++ b/.github/workflows/detect-breaking-changes.yml
@@ -0,0 +1,42 @@
+name: CI
+on:
+ pull_request:
+ branches:
+ - main
+ - next
+
+jobs:
+ detect_breaking_changes:
+ runs-on: 'ubuntu-latest'
+ name: detect-breaking-changes
+ if: github.repository == 'cloudflare/cloudflare-python'
+ steps:
+ - name: Calculate fetch-depth
+ run: |
+ echo "FETCH_DEPTH=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_ENV
+
+ - uses: actions/checkout@v6
+ with:
+ # Ensure we can check out the pull request base in the script below.
+ fetch-depth: ${{ env.FETCH_DEPTH }}
+
+ - name: Install Rye
+ run: |
+ curl -sSf https://rye.astral.sh/get | bash
+ echo "$HOME/.rye/shims" >> $GITHUB_PATH
+ env:
+ RYE_VERSION: '0.44.0'
+ RYE_INSTALL_OPTION: '--yes'
+ - name: Install dependencies
+ run: |
+ rye sync --all-features
+ - name: Detect removed symbols
+ run: |
+ rye run python scripts/detect-breaking-changes.py "${{ github.event.pull_request.base.sha }}"
+
+ - name: Detect breaking changes
+ run: |
+ # Try to check out previous versions of the breaking change detection script. This ensures that
+ # we still detect breaking changes when entire files and their tests are removed.
+ git checkout "${{ github.event.pull_request.base.sha }}" -- ./scripts/detect-breaking-changes 2>/dev/null || true
+ ./scripts/detect-breaking-changes ${{ github.event.pull_request.base.sha }}
\ No newline at end of file
diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml
index afdcd266e4b..b711a25bda7 100644
--- a/.github/workflows/publish-pypi.yml
+++ b/.github/workflows/publish-pypi.yml
@@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Install Rye
run: |
diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml
index 361c3d7eb2c..41be236b980 100644
--- a/.github/workflows/release-doctor.yml
+++ b/.github/workflows/release-doctor.yml
@@ -18,7 +18,7 @@ jobs:
if: github.repository == 'cloudflare/cloudflare-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Check release environment
run: |
diff --git a/.gitignore b/.gitignore
index 87797408001..95ceb189aa4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
.prism.log
-.vscode
_dev
__pycache__
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 025a1cbcb11..934f2cc033c 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "4.3.1"
+ ".": "4.4.0"
}
\ No newline at end of file
diff --git a/.stats.yml b/.stats.yml
index 590d127c2cb..f755364ac41 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
-configured_endpoints: 1752
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-b15b44e0efd207de48e7e74e742b0b4b190c74f12a941a1a0ef59a51656a5224.yml
-openapi_spec_hash: 83243c9ee06f88d0fa91e9b185d8a42e
-config_hash: 8601d43fd5ccaf9e3d08f26748a5a63a
+configured_endpoints: 2015
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-83f49bc3fa9273ef989d3e8bcd27f6fdaa7d04ae2519a91f4878f46acc501bb9.yml
+openapi_spec_hash: 3f4be3af6f51eea4787dc8345f9ca9c1
+config_hash: 3b5a073ea01bcd6be97d48c78c243b9e
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000000..5b01030785f
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,3 @@
+{
+ "python.analysis.importFormat": "relative",
+}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e63418f4e7a..82d7a3cebe6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,139 @@
# Changelog
+## 4.4.0 (2026-02-10)
+
+Full Changelog: [v4.3.1...v4.4.0](https://github.com/cloudflare/cloudflare-python/compare/v4.3.1...v4.4.0)
+
+### Features
+
+* chore: IAC-312 update Pages models to ref renamed components ([1f77935](https://github.com/cloudflare/cloudflare-python/commit/1f7793527f61ab9d02cea60b1cb4acce4316c6dd))
+* chore: skip ai.tomarkdown prism tests ([42c44fb](https://github.com/cloudflare/cloudflare-python/commit/42c44fbe37f6f7aa6294c42e4fd8276682cf5f17))
+* chore: skip unsupported auth tests ([322d3f1](https://github.com/cloudflare/cloudflare-python/commit/322d3f12f4ccbbb0c7bac84ac9857b7170593fa5))
+* chore: use 'next' branch for go_sdk_version ([e311a42](https://github.com/cloudflare/cloudflare-python/commit/e311a428faedb698d15c2b898c9b0c65077f1158))
+* chore(abuse_report): unsupported auth scheme ([8b51de3](https://github.com/cloudflare/cloudflare-python/commit/8b51de36d9e5ce5d82bfbae12d0c46f9182c0544))
+* chore(abuse): rename path parameter ([dd0b6fb](https://github.com/cloudflare/cloudflare-python/commit/dd0b6fbd8042a4cde1625d945369b28d6e69bbb0))
+* docs: Deprecate API Shield Schema Validation resources ([40082c2](https://github.com/cloudflare/cloudflare-python/commit/40082c20665a01b760c0ad0057af417c6e942c01))
+* docs: WC-4152 Expose subdomain delete for workers ([fd04baa](https://github.com/cloudflare/cloudflare-python/commit/fd04baa03e03fe1601a0d3db991ddad1f4267f7d))
+* docs(zero_trust_gateway_policy): add /rules/tenants endpoint to Gateway API docs ([3c18fd3](https://github.com/cloudflare/cloudflare-python/commit/3c18fd307d5cf804eb9d68c8474d5ecc5f481a3e))
+* feat: add connectivity directory service APIs to openapi.stainless.yml ([fc06837](https://github.com/cloudflare/cloudflare-python/commit/fc06837d768b4291bbaa1d9a5e0d3303d0a82ba1))
+* feat: Add token validation to stainless config ([a1ddf7e](https://github.com/cloudflare/cloudflare-python/commit/a1ddf7ef6249fb36530a787bfa5987d1ce488e7f))
+* feat: DLP-3878 Switch DLP Predefined Profile endpoints ([43e4f93](https://github.com/cloudflare/cloudflare-python/commit/43e4f93b715142791c7fe39dd248e8592d978f34))
+* feat(abuse_reports): add abuse mitigations in Client API ([ce4789c](https://github.com/cloudflare/cloudflare-python/commit/ce4789cabe80d5833e3393fcd93c92d191c8d5f5))
+* feat(abuse_reports): Expose new abuse report endpoints. GET and LIST. ([b0fc29f](https://github.com/cloudflare/cloudflare-python/commit/b0fc29f708cd4c2fb4237dbe74959ff2b22dcac2))
+* feat(api): add AI Gateway Dynamic Routing endpoints ([db75dd8](https://github.com/cloudflare/cloudflare-python/commit/db75dd838142adbec3d22d28a111574dfd476a2b))
+* feat(api): add mcp portals endpoints ([70e068e](https://github.com/cloudflare/cloudflare-python/commit/70e068e9497013d0c8d8e7689ae87b3beafeeb46))
+* feat(api): RAG-395: add AI Search endpoints ([43a4557](https://github.com/cloudflare/cloudflare-python/commit/43a45575096e189de0cf3009fdd3caaf36fdd20f))
+* feat(api): RAG-586: enable terraform for AI Search instances and tokens ([f5c0d88](https://github.com/cloudflare/cloudflare-python/commit/f5c0d886a357bd3b5f8d565d0af62183edd5b0e2))
+* feat(d1): Add time travel `get_bookmark` and `restore` endpoints ([f2464a6](https://github.com/cloudflare/cloudflare-python/commit/f2464a663b082db061da32a6a50126095099e0bb))
+* feat(fraud): public docs for fraud API ([fd98170](https://github.com/cloudflare/cloudflare-python/commit/fd981700eda867a7bc37e087be5e68bb299963a3))
+* feat(iam): Add SSO Connectors resource to SDKs ([77960c9](https://github.com/cloudflare/cloudflare-python/commit/77960c9620d293937886791fb8c72b43abc1e19e))
+* feat(leaked_credentials_check): Add GET endpoint for leaked_credentials_check/detections ([2f1981a](https://github.com/cloudflare/cloudflare-python/commit/2f1981ab773104a1156e6d80b333274f955eb020))
+* feat(mcp_portals): enable sdks generation ([6965762](https://github.com/cloudflare/cloudflare-python/commit/69657624f4f9f83a41de3f4e927a047d798ca89e))
+* feat(pipelines): Configure SDKs/Terraform to use the new Pipelines, Streams, Sinks routes ([008556f](https://github.com/cloudflare/cloudflare-python/commit/008556f6aa27c2292c24c5ff368f37cce91e2e5b))
+* feat(r2_data_catalog): Configure SDKs/Terraform to use R2 Data Catalog routes ([385fea6](https://github.com/cloudflare/cloudflare-python/commit/385fea63a0a62eefe791920a946d0704c7c790db))
+* feat(radar): add BGP RPKI ASPA endpoints and fix SDK casings ([4146d0d](https://github.com/cloudflare/cloudflare-python/commit/4146d0dab88e791211bfd06c83129ebf8fc1835c))
+* feat(radar): add new group by dimension endpoints; deprecate to_markdown endpoint ([845fba2](https://github.com/cloudflare/cloudflare-python/commit/845fba278d6d58c6b4b8de8fa54d02efdc4dddee))
+* feat(silences): add a new alert silencing api ([1c555af](https://github.com/cloudflare/cloudflare-python/commit/1c555aff6759e40aeaf684ded92e51a2e4400345))
+* feat(tomarkdown): add new markdown supported endpoint ([6a4f824](https://github.com/cloudflare/cloudflare-python/commit/6a4f824f942f35cc8467cdaf950cfb2af4017949))
+* fix: Correctly reflect schema validation model <-> openapi mapping ([01fb118](https://github.com/cloudflare/cloudflare-python/commit/01fb1181dd1aedb409872013251a77912f00476b))
+* fix: move wvpc ([c357dad](https://github.com/cloudflare/cloudflare-python/commit/c357dadc80540a78f7505bc8f8dbcd2f1da69070))
+* fix: tabbing on realtime-kit api resources ([a4762dd](https://github.com/cloudflare/cloudflare-python/commit/a4762dd21ecf123322f80c7cba7f2caa5021efe2))
+* fix: unsupported auth scheme ([292a780](https://github.com/cloudflare/cloudflare-python/commit/292a7807015f76384abe88b86034bc5d1796a51b))
+* fix(ai_controls): incorrect use of standalone_api ([ebcb1d6](https://github.com/cloudflare/cloudflare-python/commit/ebcb1d6d9124a355b06ce80efb8869635bae5e3f))
+* fix(kv): use cursor_limit_pagination for KV list keys endpoint ([fc39041](https://github.com/cloudflare/cloudflare-python/commit/fc39041cfc7c93f3f063b2a016347e043d30a60c))
+* fix(total_tls): use upsert pattern for singleton zone setting ([f4f5156](https://github.com/cloudflare/cloudflare-python/commit/f4f51568c7bb95b99e92b5e867f98e4e96d4d538))
+* refactor(terraform): restructure origin_tls_client_auth to peer subresources ([00a2dec](https://github.com/cloudflare/cloudflare-python/commit/00a2decaebf66b8303de8d2c1e92c2f899d1d50e))
+
+
+### Bug Fixes
+
+* addressing issues in error handling for example script upload ([e3ea504](https://github.com/cloudflare/cloudflare-python/commit/e3ea504c648e1655b51d746fa7030df154d52c87))
+* lint ([b2cfe5e](https://github.com/cloudflare/cloudflare-python/commit/b2cfe5e773ebc2280795ad7e3ea3b5bac03891a2))
+* **types:** allow pyright to infer TypedDict types within SequenceNotStr ([5b81cac](https://github.com/cloudflare/cloudflare-python/commit/5b81cac7357d7699cd64425dc8ed983c3f5d6e21))
+
+
+### Chores
+
+* add missing docstrings ([f109470](https://github.com/cloudflare/cloudflare-python/commit/f1094708108fdc4fd20be9558da5a63791267746))
+* **api:** update composite API spec ([8f3ac3d](https://github.com/cloudflare/cloudflare-python/commit/8f3ac3d78abd667f0f513026ada715145db53d97))
+* **api:** update composite API spec ([f59a327](https://github.com/cloudflare/cloudflare-python/commit/f59a32729d5a0e3cc910bfbbce825365408d4f43))
+* **api:** update composite API spec ([44ae23e](https://github.com/cloudflare/cloudflare-python/commit/44ae23e668d8e78733e0c790d3cdfa5d0b828456))
+* **api:** update composite API spec ([2938b45](https://github.com/cloudflare/cloudflare-python/commit/2938b459e52c5fc3d3f90fbfbf7a25e86f2f8b4c))
+* **api:** update composite API spec ([63a5a9b](https://github.com/cloudflare/cloudflare-python/commit/63a5a9b8927addd36909719ef2c37f43592fc717))
+* **api:** update composite API spec ([3964451](https://github.com/cloudflare/cloudflare-python/commit/39644511ae930fe0654ed6c71367b2b2c0792690))
+* **api:** update composite API spec ([7c35696](https://github.com/cloudflare/cloudflare-python/commit/7c35696aacd53eda55f7afed449614dc9051607f))
+* **api:** update composite API spec ([ee266ad](https://github.com/cloudflare/cloudflare-python/commit/ee266ad2d14f1c00cc746e84bbe405cf2f71ffb9))
+* **api:** update composite API spec ([1cfeef4](https://github.com/cloudflare/cloudflare-python/commit/1cfeef43b5baea7c9e82341236049332e0cab369))
+* **api:** update composite API spec ([e4f787b](https://github.com/cloudflare/cloudflare-python/commit/e4f787b60357b0d9c91450378d6d8320effc8a68))
+* **api:** update composite API spec ([3b3e2d5](https://github.com/cloudflare/cloudflare-python/commit/3b3e2d5fe6f0f1b2f5be2e2ff2f25e2d59832a1a))
+* **api:** update composite API spec ([05e0e8a](https://github.com/cloudflare/cloudflare-python/commit/05e0e8a25f0c69e3f6475b70dd685886e4ff748a))
+* **api:** update composite API spec ([716ad5a](https://github.com/cloudflare/cloudflare-python/commit/716ad5a10b16be431dd4e7f086e2609f3ddf3287))
+* **api:** update composite API spec ([fdf3c53](https://github.com/cloudflare/cloudflare-python/commit/fdf3c53ebd686a638c148b594c40dbbc66878df6))
+* **api:** update composite API spec ([c5f5b46](https://github.com/cloudflare/cloudflare-python/commit/c5f5b4689841964444568309925a75f7d44a7106))
+* **api:** update composite API spec ([9468e7b](https://github.com/cloudflare/cloudflare-python/commit/9468e7b0127a3f42f699f9e8fa497883b5cbf667))
+* **api:** update composite API spec ([249fdaa](https://github.com/cloudflare/cloudflare-python/commit/249fdaabf3eccd032b4585a2d529319b624e7009))
+* **api:** update composite API spec ([19ae710](https://github.com/cloudflare/cloudflare-python/commit/19ae710f5a5be1fa2319377d6e311df8ac935b98))
+* **api:** update composite API spec ([9c3c799](https://github.com/cloudflare/cloudflare-python/commit/9c3c799f1ef7ebec5027205d2e975f1bb01331f4))
+* **api:** update composite API spec ([8462991](https://github.com/cloudflare/cloudflare-python/commit/84629915cdd6ed83dc4d4450701723e2cb227f15))
+* **api:** update composite API spec ([a1a9301](https://github.com/cloudflare/cloudflare-python/commit/a1a93016fb248072b68f97d2c6b5c2dc1a36f870))
+* **api:** update composite API spec ([7f435a6](https://github.com/cloudflare/cloudflare-python/commit/7f435a66ad6092c023bb9fa573ca7017b0732536))
+* **api:** update composite API spec ([76513bf](https://github.com/cloudflare/cloudflare-python/commit/76513bfd2cd1a14c2afb3a65f650e1a0edf2749e))
+* **api:** update composite API spec ([4540857](https://github.com/cloudflare/cloudflare-python/commit/4540857c66063e39e4629642d2b2917f40c73b20))
+* **api:** update composite API spec ([640eb58](https://github.com/cloudflare/cloudflare-python/commit/640eb586205bfd8bf88d515ede14028dc2f9fff9))
+* **api:** update composite API spec ([606e4de](https://github.com/cloudflare/cloudflare-python/commit/606e4de5f24a19a7e10fe8824319aa98fe439202))
+* **api:** update composite API spec ([be9579e](https://github.com/cloudflare/cloudflare-python/commit/be9579e6ec8271281f8497e67ec1f7ab76109b3c))
+* **api:** update composite API spec ([ef37bfc](https://github.com/cloudflare/cloudflare-python/commit/ef37bfc0eb3a5dd8f0bdb91d4e6bdf00f9a6b071))
+* **api:** update composite API spec ([f4cc575](https://github.com/cloudflare/cloudflare-python/commit/f4cc575aa429651cf7141fb47f542f1d8cab9a72))
+* **api:** update composite API spec ([0f87157](https://github.com/cloudflare/cloudflare-python/commit/0f8715705d70c0fe7f02f52ae605ce650486e6c5))
+* **api:** update composite API spec ([ac247ff](https://github.com/cloudflare/cloudflare-python/commit/ac247fffebbcbfff58ef6862247f2b72ff74c6f8))
+* **api:** update composite API spec ([3186483](https://github.com/cloudflare/cloudflare-python/commit/318648332d360503d6e0e1738d4ca87202535a96))
+* **api:** update composite API spec ([7464286](https://github.com/cloudflare/cloudflare-python/commit/7464286b3544db010af78b14ebec2e02609ddc75))
+* **api:** update composite API spec ([064478c](https://github.com/cloudflare/cloudflare-python/commit/064478cd35708cb0eb78b35abc5f4636bd514037))
+* **api:** update composite API spec ([a59d1b6](https://github.com/cloudflare/cloudflare-python/commit/a59d1b68755b777fc8a17018cb062d1a33db723a))
+* **api:** update composite API spec ([f5ca4cc](https://github.com/cloudflare/cloudflare-python/commit/f5ca4ccc70428b1e7614420defbde2a463091456))
+* **api:** update composite API spec ([622f384](https://github.com/cloudflare/cloudflare-python/commit/622f38474dcf9bd9e433189ac0e168c66dbebd7d))
+* **api:** update composite API spec ([64bc54f](https://github.com/cloudflare/cloudflare-python/commit/64bc54ff61983ffa129109dd013cf5bedd25d29d))
+* **api:** update composite API spec ([cb197df](https://github.com/cloudflare/cloudflare-python/commit/cb197dfe45ce225e6d441680e11260cb4c39d24f))
+* **api:** update composite API spec ([cd4f924](https://github.com/cloudflare/cloudflare-python/commit/cd4f924e73268c20f1af894dfd4707c8b18c955f))
+* **api:** update composite API spec ([4e9deac](https://github.com/cloudflare/cloudflare-python/commit/4e9deac8efe75518e113cc4d681929c5a1ae1d7d))
+* **api:** update composite API spec ([fee9ce0](https://github.com/cloudflare/cloudflare-python/commit/fee9ce09141ea3c314dfb6d746472e316e3b515d))
+* **api:** update composite API spec ([315c8eb](https://github.com/cloudflare/cloudflare-python/commit/315c8eb85a3f17299cd81a16ac092e4c85a012a5))
+* **api:** update composite API spec ([bb4311f](https://github.com/cloudflare/cloudflare-python/commit/bb4311fb705edab29746297b91f3478cd179afc8))
+* **api:** update composite API spec ([7e1d8b7](https://github.com/cloudflare/cloudflare-python/commit/7e1d8b72aff2b087f5e3a395a445573b74f0a2f7))
+* **api:** update composite API spec ([2cc2a3f](https://github.com/cloudflare/cloudflare-python/commit/2cc2a3fad9f2f1e9eeee0683a9cff9d330fd6357))
+* **api:** update composite API spec ([2cb9ef9](https://github.com/cloudflare/cloudflare-python/commit/2cb9ef9a29a81faff8fa34ee4e4edbe40f50d507))
+* **api:** update composite API spec ([7199aa3](https://github.com/cloudflare/cloudflare-python/commit/7199aa33f07a631aa066df6da6aa25a86bf3aca8))
+* **api:** update composite API spec ([46ce19f](https://github.com/cloudflare/cloudflare-python/commit/46ce19f5f170aa5b74c6071569666dd59186e3e9))
+* **api:** update composite API spec ([4900594](https://github.com/cloudflare/cloudflare-python/commit/49005943c184ab9f713e664434f05270ca97d619))
+* **api:** update composite API spec ([a009bd0](https://github.com/cloudflare/cloudflare-python/commit/a009bd0251a96e2eafee9411bbc669b82dfba342))
+* **api:** update composite API spec ([b07f0d6](https://github.com/cloudflare/cloudflare-python/commit/b07f0d6468e1cc1d8b5009b252b21a4d9bb0543d))
+* **api:** update composite API spec ([353e11e](https://github.com/cloudflare/cloudflare-python/commit/353e11eba442b1d75b1d42549abb26db9fe9f2c7))
+* **api:** update composite API spec ([b7c4b43](https://github.com/cloudflare/cloudflare-python/commit/b7c4b43635c91a1be5852d9542ca29362e80491b))
+* **api:** update composite API spec ([b8d1c66](https://github.com/cloudflare/cloudflare-python/commit/b8d1c661b9b34b6db72d65ef82db61494013b3ba))
+* **api:** update composite API spec ([93e3971](https://github.com/cloudflare/cloudflare-python/commit/93e39713d9e7d19cb67ec65a6fa9b5c9643d75ed))
+* **api:** update composite API spec ([3d5d0e0](https://github.com/cloudflare/cloudflare-python/commit/3d5d0e0407dec974128bcbf09d8c3b789b2dbcf6))
+* **api:** update composite API spec ([35670b1](https://github.com/cloudflare/cloudflare-python/commit/35670b1611cee8629a86f7e2795fac262dd3394f))
+* **api:** update composite API spec ([5fdf07b](https://github.com/cloudflare/cloudflare-python/commit/5fdf07be01036fb1c08e19f31c05ff995d75e01c))
+* **api:** update composite API spec ([2319591](https://github.com/cloudflare/cloudflare-python/commit/231959124ce85fd5cb6a2f639042459189f3626b))
+* **api:** update composite API spec ([3b70a95](https://github.com/cloudflare/cloudflare-python/commit/3b70a9544c85c451ba277875e1f6cb6188d866f3))
+* **api:** update composite API spec ([ea49058](https://github.com/cloudflare/cloudflare-python/commit/ea49058cc07ca8549b0b0e437af0bf80a92fc65a))
+* **api:** update composite API spec ([6734e9b](https://github.com/cloudflare/cloudflare-python/commit/6734e9ba95be37e8abf917e8e034a4fe8403017f))
+* **api:** update composite API spec ([5f5caef](https://github.com/cloudflare/cloudflare-python/commit/5f5caef1eed2c6a2c5cd80b77c2c7e01e19e57fc))
+* **api:** update composite API spec ([5d19869](https://github.com/cloudflare/cloudflare-python/commit/5d1986964f7344c79285a47c9bd4ae6928805ed5))
+* **api:** update composite API spec ([541c9fb](https://github.com/cloudflare/cloudflare-python/commit/541c9fb7974741641bcef74ba99f7b54f142e0b1))
+* **api:** update composite API spec ([ba5b5fc](https://github.com/cloudflare/cloudflare-python/commit/ba5b5fcd1936b0cadb189ba4c2c674dc6ec956e3))
+* **api:** update composite API spec ([7baa51c](https://github.com/cloudflare/cloudflare-python/commit/7baa51ccf00f66c8871156e674214504984dc066))
+* **api:** update composite API spec ([53d59f4](https://github.com/cloudflare/cloudflare-python/commit/53d59f439ba34edaf2628d89c2a1d7363693a38d))
+* **api:** update composite API spec ([25d603f](https://github.com/cloudflare/cloudflare-python/commit/25d603f8cb36473107bb739c1217a10becd82302))
+* **api:** update composite API spec ([9fd6645](https://github.com/cloudflare/cloudflare-python/commit/9fd66450b998a9b0bea72a8f3ac9fdcb26edd88a))
+* **api:** update composite API spec ([19d1d96](https://github.com/cloudflare/cloudflare-python/commit/19d1d96bae88d6af838574218fc09b541a94da81))
+* **api:** update composite API spec ([f9160a4](https://github.com/cloudflare/cloudflare-python/commit/f9160a47dec2c31bc7f591bc73bc9dff420d10f4))
+* **docs:** use environment variables for authentication in code snippets ([0d829a6](https://github.com/cloudflare/cloudflare-python/commit/0d829a65a46827fe7a69d0efc60af031791887f8))
+* **internal:** codegen related update ([0bd5559](https://github.com/cloudflare/cloudflare-python/commit/0bd5559954615d6ef7b18b265af44c27b25988d3))
+* **internal:** codegen related update ([6e5b66f](https://github.com/cloudflare/cloudflare-python/commit/6e5b66f26b600dc345b0579264945fc3311f5269))
+* **internal:** codegen related update ([9fcecd5](https://github.com/cloudflare/cloudflare-python/commit/9fcecd5e59f6b2527c5bd3da7415929f12db34fb))
+* update lockfile ([bd43151](https://github.com/cloudflare/cloudflare-python/commit/bd431513e51b82bff2949adde8d5c1fbfd3cda81))
+
## 4.3.1 (2025-06-16)
Full Changelog: [v4.3.0...v4.3.1](https://github.com/cloudflare/cloudflare-python/compare/v4.3.0...v4.3.1)
diff --git a/LICENSE b/LICENSE
index f303cce4b5e..27db488677c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright 2025 Cloudflare
+ Copyright 2026 Cloudflare
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
diff --git a/README.md b/README.md
index 755e3162353..2172c5eeb64 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,23 @@
# Cloudflare Python API library
-[](https://pypi.org/project/cloudflare/)
+
+[)](https://pypi.org/project/cloudflare/)
-The Cloudflare Python library provides convenient access to the Cloudflare REST API from any Python 3.8+
+The Cloudflare Python library provides convenient access to the Cloudflare REST API from any Python 3.9+
application. The library includes type definitions for all request params and response fields,
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
+It is generated with [Stainless](https://www.stainless.com/).
+
+## MCP Server
+
+Use the Cloudflare MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.
+
+[](https://cursor.com/en-US/install-mcp?name=cloudflare-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsImNsb3VkZmxhcmUtbWNwIl19)
+[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22cloudflare-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22cloudflare-mcp%22%5D%7D)
+
+> Note: You may need to set environment variables in your MCP client.
+
## Documentation
The REST API documentation can be found on [developers.cloudflare.com](https://developers.cloudflare.com/api). The full API of this library can be found in [api.md](api.md).
@@ -70,6 +82,42 @@ asyncio.run(main())
Functionality between the synchronous and asynchronous clients is otherwise identical.
+### With aiohttp
+
+By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.
+
+You can enable this by installing `aiohttp`:
+
+```sh
+# install from PyPI
+pip install cloudflare[aiohttp]
+```
+
+Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
+
+```python
+import os
+import asyncio
+from cloudflare import DefaultAioHttpClient
+from cloudflare import AsyncCloudflare
+
+
+async def main() -> None:
+ async with AsyncCloudflare(
+ api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
+ http_client=DefaultAioHttpClient(),
+ ) as client:
+ zone = await client.zones.create(
+ account={"id": "023e105f4ecef8ad9ca31a8372d0c353"},
+ name="example.com",
+ type="full",
+ )
+ print(zone.id)
+
+
+asyncio.run(main())
+```
+
## Using types
Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
@@ -166,10 +214,11 @@ from cloudflare import Cloudflare
client = Cloudflare()
-client.api_gateway.user_schemas.create(
- zone_id="023e105f4ecef8ad9ca31a8372d0c353",
- file=Path("/path/to/file"),
- kind="openapi_v3",
+client.kv.namespaces.values.update(
+ key_name="My-Key",
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ namespace_id="0f2ac74b498b48028cb68387c421e279",
+ value=Path("/path/to/file"),
)
```
@@ -244,7 +293,7 @@ client.with_options(max_retries=5).zones.get(
### Timeouts
By default requests time out after 1 minute. You can configure this with a `timeout` option,
-which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
+which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
```python
from cloudflare import Cloudflare
@@ -438,7 +487,7 @@ print(cloudflare.__version__)
## Requirements
-Python 3.8 or higher.
+Python 3.9 or higher.
## Contributing
diff --git a/api.md b/api.md
index 04738525ed2..890a848cb44 100644
--- a/api.md
+++ b/api.md
@@ -110,8 +110,8 @@ from cloudflare.types.accounts.tokens import PermissionGroupListResponse, Permis
Methods:
-- client.accounts.tokens.permission_groups.list(\*, account_id) -> SyncSinglePage[PermissionGroupListResponse]
-- client.accounts.tokens.permission_groups.get(\*, account_id) -> SyncSinglePage[PermissionGroupGetResponse]
+- client.accounts.tokens.permission_groups.list(\*, account_id, \*\*params) -> SyncSinglePage[PermissionGroupListResponse]
+- client.accounts.tokens.permission_groups.get(\*, account_id, \*\*params) -> Optional[PermissionGroupGetResponse]
### Value
@@ -131,7 +131,36 @@ from cloudflare.types.accounts.logs import AuditListResponse
Methods:
-- client.accounts.logs.audit.list(\*, account_id, \*\*params) -> SyncCursorLimitPagination[AuditListResponse]
+- client.accounts.logs.audit.list(\*, account_id, \*\*params) -> SyncCursorPaginationAfter[AuditListResponse]
+
+# Organizations
+
+Types:
+
+```python
+from cloudflare.types.organizations import Organization, OrganizationDeleteResponse
+```
+
+Methods:
+
+- client.organizations.create(\*\*params) -> Organization
+- client.organizations.update(organization_id, \*\*params) -> Organization
+- client.organizations.list(\*\*params) -> SyncSinglePage[Organization]
+- client.organizations.delete(organization_id) -> OrganizationDeleteResponse
+- client.organizations.get(organization_id) -> Organization
+
+## OrganizationProfile
+
+Types:
+
+```python
+from cloudflare.types.organizations import OrganizationProfile
+```
+
+Methods:
+
+- client.organizations.organization_profile.update(organization_id, \*\*params) -> None
+- client.organizations.organization_profile.get(organization_id) -> Result
# OriginCACertificates
@@ -297,7 +326,7 @@ from cloudflare.types.user.tokens import PermissionGroupListResponse
Methods:
-- client.user.tokens.permission_groups.list() -> SyncSinglePage[PermissionGroupListResponse]
+- client.user.tokens.permission_groups.list(\*\*params) -> SyncSinglePage[PermissionGroupListResponse]
### Value
@@ -429,11 +458,21 @@ Methods:
## Subscriptions
+Types:
+
+```python
+from cloudflare.types.zones import (
+ SubscriptionCreateResponse,
+ SubscriptionUpdateResponse,
+ SubscriptionGetResponse,
+)
+```
+
Methods:
-- client.zones.subscriptions.create(\*, zone_id, \*\*params) -> Subscription
-- client.zones.subscriptions.update(\*, zone_id, \*\*params) -> Subscription
-- client.zones.subscriptions.get(\*, zone_id) -> Subscription
+- client.zones.subscriptions.create(\*, zone_id, \*\*params) -> SubscriptionCreateResponse
+- client.zones.subscriptions.update(\*, zone_id, \*\*params) -> SubscriptionUpdateResponse
+- client.zones.subscriptions.get(\*, zone_id) -> SubscriptionGetResponse
## Plans
@@ -537,6 +576,23 @@ Methods:
- client.load_balancers.monitors.references.get(monitor_id, \*, account_id) -> SyncSinglePage[ReferenceGetResponse]
+## MonitorGroups
+
+Types:
+
+```python
+from cloudflare.types.load_balancers import MonitorGroup
+```
+
+Methods:
+
+- client.load_balancers.monitor_groups.create(\*, account_id, \*\*params) -> MonitorGroup
+- client.load_balancers.monitor_groups.update(monitor_group_id, \*, account_id, \*\*params) -> MonitorGroup
+- client.load_balancers.monitor_groups.list(\*, account_id) -> SyncSinglePage[MonitorGroup]
+- client.load_balancers.monitor_groups.delete(monitor_group_id, \*, account_id) -> MonitorGroup
+- client.load_balancers.monitor_groups.edit(monitor_group_id, \*, account_id, \*\*params) -> MonitorGroup
+- client.load_balancers.monitor_groups.get(monitor_group_id, \*, account_id) -> MonitorGroup
+
## Pools
Types:
@@ -725,18 +781,20 @@ from cloudflare.types.ssl import (
Status,
ValidationMethod,
CertificatePackCreateResponse,
+ CertificatePackListResponse,
CertificatePackDeleteResponse,
CertificatePackEditResponse,
+ CertificatePackGetResponse,
)
```
Methods:
- client.ssl.certificate_packs.create(\*, zone_id, \*\*params) -> Optional[CertificatePackCreateResponse]
-- client.ssl.certificate_packs.list(\*, zone_id, \*\*params) -> SyncSinglePage[object]
+- client.ssl.certificate_packs.list(\*, zone_id, \*\*params) -> SyncSinglePage[CertificatePackListResponse]
- client.ssl.certificate_packs.delete(certificate_pack_id, \*, zone_id) -> Optional[CertificatePackDeleteResponse]
- client.ssl.certificate_packs.edit(certificate_pack_id, \*, zone_id, \*\*params) -> Optional[CertificatePackEditResponse]
-- client.ssl.certificate_packs.get(certificate_pack_id, \*, zone_id) -> object
+- client.ssl.certificate_packs.get(certificate_pack_id, \*, zone_id) -> Optional[CertificatePackGetResponse]
### Quota
@@ -760,7 +818,7 @@ from cloudflare.types.ssl import RecommendationGetResponse
Methods:
-- client.ssl.recommendations.get(\*, zone_id) -> Optional[RecommendationGetResponse]
+- client.ssl.recommendations.get(\*, zone_id) -> RecommendationGetResponse
## Universal
@@ -797,12 +855,18 @@ Methods:
Types:
```python
-from cloudflare.types.acm import CertificateAuthority, TotalTLSCreateResponse, TotalTLSGetResponse
+from cloudflare.types.acm import (
+ CertificateAuthority,
+ TotalTLSUpdateResponse,
+ TotalTLSEditResponse,
+ TotalTLSGetResponse,
+)
```
Methods:
-- client.acm.total_tls.create(\*, zone_id, \*\*params) -> Optional[TotalTLSCreateResponse]
+- client.acm.total_tls.update(\*, zone_id, \*\*params) -> Optional[TotalTLSUpdateResponse]
+- client.acm.total_tls.edit(\*, zone_id, \*\*params) -> Optional[TotalTLSEditResponse]
- client.acm.total_tls.get(\*, zone_id) -> Optional[TotalTLSGetResponse]
# Argo
@@ -866,7 +930,7 @@ Methods:
- client.client_certificates.create(\*, zone_id, \*\*params) -> Optional[ClientCertificate]
- client.client_certificates.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[ClientCertificate]
- client.client_certificates.delete(client_certificate_id, \*, zone_id) -> Optional[ClientCertificate]
-- client.client_certificates.edit(client_certificate_id, \*, zone_id) -> Optional[ClientCertificate]
+- client.client_certificates.edit(client_certificate_id, \*, zone_id, \*\*params) -> Optional[ClientCertificate]
- client.client_certificates.get(client_certificate_id, \*, zone_id) -> Optional[ClientCertificate]
# CustomCertificates
@@ -1026,12 +1090,6 @@ Methods:
# DNS
-Types:
-
-```python
-from cloudflare.types.dns import DNSAnalyticsNominalMetric, DNSAnalyticsQuery
-```
-
## DNSSEC
Types:
@@ -1083,6 +1141,8 @@ from cloudflare.types.dns import (
RecordExportResponse,
RecordImportResponse,
RecordScanResponse,
+ RecordScanReviewResponse,
+ RecordScanTriggerResponse,
)
```
@@ -1098,15 +1158,12 @@ Methods:
- client.dns.records.get(dns_record_id, \*, zone_id) -> Optional[RecordResponse]
- client.dns.records.import\_(\*, zone_id, \*\*params) -> Optional[RecordImportResponse]
- client.dns.records.scan(\*, zone_id, \*\*params) -> Optional[RecordScanResponse]
+- client.dns.records.scan_list(\*, zone_id) -> SyncSinglePage[RecordResponse]
+- client.dns.records.scan_review(\*, zone_id, \*\*params) -> Optional[RecordScanReviewResponse]
+- client.dns.records.scan_trigger(\*, zone_id) -> RecordScanTriggerResponse
## Settings
-Types:
-
-```python
-from cloudflare.types.dns import DNSSetting
-```
-
### Zone
Types:
@@ -1600,7 +1657,7 @@ Methods:
Types:
```python
-from cloudflare.types.filters import FirewallFilter
+from cloudflare.types.filters import FirewallFilter, FilterDeleteResponse, FilterBulkDeleteResponse
```
Methods:
@@ -1608,9 +1665,9 @@ Methods:
- client.filters.create(\*, zone_id, \*\*params) -> SyncSinglePage[FirewallFilter]
- client.filters.update(filter_id, \*, zone_id, \*\*params) -> FirewallFilter
- client.filters.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[FirewallFilter]
-- client.filters.delete(filter_id, \*, zone_id) -> FirewallFilter
-- client.filters.bulk_delete(\*, zone_id) -> SyncSinglePage[FirewallFilter]
-- client.filters.bulk_update(\*, zone_id) -> SyncSinglePage[FirewallFilter]
+- client.filters.delete(filter_id, \*, zone_id) -> FilterDeleteResponse
+- client.filters.bulk_delete(\*, zone_id, \*\*params) -> Optional[FilterBulkDeleteResponse]
+- client.filters.bulk_update(\*, zone_id, \*\*params) -> SyncSinglePage[FirewallFilter]
- client.filters.get(filter_id, \*, zone_id) -> FirewallFilter
# Firewall
@@ -1862,8 +1919,8 @@ from cloudflare.types.logpush import InstantLogpushJob
Methods:
-- client.logpush.edge.create(\*, zone_id, \*\*params) -> Optional[InstantLogpushJob]
-- client.logpush.edge.get(\*, zone_id) -> SyncSinglePage[Optional[InstantLogpushJob]]
+- client.logpush.edge.create(\*, zone_id, \*\*params) -> Optional[InstantLogpushJob]
+- client.logpush.edge.get(\*, zone_id) -> SyncSinglePage[Optional[InstantLogpushJob]]
## Jobs
@@ -1987,7 +2044,6 @@ Types:
```python
from cloudflare.types.origin_tls_client_auth import (
- ZoneAuthenticatedOriginPull,
OriginTLSClientAuthCreateResponse,
OriginTLSClientAuthListResponse,
OriginTLSClientAuthDeleteResponse,
@@ -2002,6 +2058,27 @@ Methods:
- client.origin_tls_client_auth.delete(certificate_id, \*, zone_id) -> Optional[OriginTLSClientAuthDeleteResponse]
- client.origin_tls_client_auth.get(certificate_id, \*, zone_id) -> Optional[OriginTLSClientAuthGetResponse]
+## ZoneCertificates
+
+Types:
+
+```python
+from cloudflare.types.origin_tls_client_auth import (
+ ZoneAuthenticatedOriginPull,
+ ZoneCertificateCreateResponse,
+ ZoneCertificateListResponse,
+ ZoneCertificateDeleteResponse,
+ ZoneCertificateGetResponse,
+)
+```
+
+Methods:
+
+- client.origin_tls_client_auth.zone_certificates.create(\*, zone_id, \*\*params) -> Optional[ZoneCertificateCreateResponse]
+- client.origin_tls_client_auth.zone_certificates.list(\*, zone_id) -> SyncSinglePage[ZoneCertificateListResponse]
+- client.origin_tls_client_auth.zone_certificates.delete(certificate_id, \*, zone_id) -> Optional[ZoneCertificateDeleteResponse]
+- client.origin_tls_client_auth.zone_certificates.get(certificate_id, \*, zone_id) -> Optional[ZoneCertificateGetResponse]
+
## Hostnames
Types:
@@ -2012,29 +2089,29 @@ from cloudflare.types.origin_tls_client_auth import AuthenticatedOriginPull, Hos
Methods:
-- client.origin_tls_client_auth.hostnames.update(\*, zone_id, \*\*params) -> SyncSinglePage[HostnameUpdateResponse]
-- client.origin_tls_client_auth.hostnames.get(hostname, \*, zone_id) -> Optional[AuthenticatedOriginPull]
+- client.origin_tls_client_auth.hostnames.update(\*, zone_id, \*\*params) -> SyncSinglePage[HostnameUpdateResponse]
+- client.origin_tls_client_auth.hostnames.get(hostname, \*, zone_id) -> Optional[AuthenticatedOriginPull]
-### Certificates
+## HostnameCertificates
Types:
```python
-from cloudflare.types.origin_tls_client_auth.hostnames import (
+from cloudflare.types.origin_tls_client_auth import (
Certificate,
- CertificateCreateResponse,
- CertificateListResponse,
- CertificateDeleteResponse,
- CertificateGetResponse,
+ HostnameCertificateCreateResponse,
+ HostnameCertificateListResponse,
+ HostnameCertificateDeleteResponse,
+ HostnameCertificateGetResponse,
)
```
Methods:
-- client.origin_tls_client_auth.hostnames.certificates.create(\*, zone_id, \*\*params) -> Optional[CertificateCreateResponse]
-- client.origin_tls_client_auth.hostnames.certificates.list(\*, zone_id) -> SyncSinglePage[CertificateListResponse]
-- client.origin_tls_client_auth.hostnames.certificates.delete(certificate_id, \*, zone_id) -> Optional[CertificateDeleteResponse]
-- client.origin_tls_client_auth.hostnames.certificates.get(certificate_id, \*, zone_id) -> Optional[CertificateGetResponse]
+- client.origin_tls_client_auth.hostname_certificates.create(\*, zone_id, \*\*params) -> Optional[HostnameCertificateCreateResponse]
+- client.origin_tls_client_auth.hostname_certificates.list(\*, zone_id) -> SyncSinglePage[HostnameCertificateListResponse]
+- client.origin_tls_client_auth.hostname_certificates.delete(certificate_id, \*, zone_id) -> Optional[HostnameCertificateDeleteResponse]
+- client.origin_tls_client_auth.hostname_certificates.get(certificate_id, \*, zone_id) -> Optional[HostnameCertificateGetResponse]
## Settings
@@ -2261,6 +2338,40 @@ Types:
from cloudflare.types.workers import MigrationStep, SingleStepMigration, WorkerMetadata
```
+## Beta
+
+### Workers
+
+Types:
+
+```python
+from cloudflare.types.workers.beta import Worker, WorkerDeleteResponse
+```
+
+Methods:
+
+- client.workers.beta.workers.create(\*, account_id, \*\*params) -> Worker
+- client.workers.beta.workers.update(worker_id, \*, account_id, \*\*params) -> Worker
+- client.workers.beta.workers.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Worker]
+- client.workers.beta.workers.delete(worker_id, \*, account_id) -> WorkerDeleteResponse
+- client.workers.beta.workers.edit(worker_id, \*, account_id, \*\*params) -> Worker
+- client.workers.beta.workers.get(worker_id, \*, account_id) -> Worker
+
+#### Versions
+
+Types:
+
+```python
+from cloudflare.types.workers.beta.workers import Version, VersionDeleteResponse
+```
+
+Methods:
+
+- client.workers.beta.workers.versions.create(worker_id, \*, account_id, \*\*params) -> Version
+- client.workers.beta.workers.versions.list(worker_id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[Version]
+- client.workers.beta.workers.versions.delete(version_id, \*, account_id, worker_id) -> VersionDeleteResponse
+- client.workers.beta.workers.versions.get(version_id, \*, account_id, worker_id, \*\*params) -> Version
+
## Routes
Types:
@@ -2302,15 +2413,23 @@ Methods:
Types:
```python
-from cloudflare.types.workers import Script, ScriptSetting, ScriptUpdateResponse, ScriptGetResponse
+from cloudflare.types.workers import (
+ Script,
+ ScriptSetting,
+ ScriptUpdateResponse,
+ ScriptListResponse,
+ ScriptGetResponse,
+ ScriptSearchResponse,
+)
```
Methods:
- client.workers.scripts.update(script_name, \*, account_id, \*\*params) -> ScriptUpdateResponse
-- client.workers.scripts.list(\*, account_id) -> SyncSinglePage[Script]
+- client.workers.scripts.list(\*, account_id, \*\*params) -> SyncSinglePage[ScriptListResponse]
- client.workers.scripts.delete(script_name, \*, account_id, \*\*params) -> object
- client.workers.scripts.get(script_name, \*, account_id) -> str
+- client.workers.scripts.search(\*, account_id, \*\*params) -> ScriptSearchResponse
### Assets
@@ -2397,15 +2516,17 @@ Types:
```python
from cloudflare.types.workers.scripts import (
Deployment,
- DeploymentCreateResponse,
- DeploymentGetResponse,
+ DeploymentListResponse,
+ DeploymentDeleteResponse,
)
```
Methods:
-- client.workers.scripts.deployments.create(script_name, \*, account_id, \*\*params) -> Optional[DeploymentCreateResponse]
-- client.workers.scripts.deployments.get(script_name, \*, account_id) -> Optional[DeploymentGetResponse]
+- client.workers.scripts.deployments.create(script_name, \*, account_id, \*\*params) -> Deployment
+- client.workers.scripts.deployments.list(script_name, \*, account_id) -> DeploymentListResponse
+- client.workers.scripts.deployments.delete(deployment_id, \*, account_id, script_name) -> DeploymentDeleteResponse
+- client.workers.scripts.deployments.get(deployment_id, \*, account_id, script_name) -> Deployment
### Versions
@@ -2441,8 +2562,8 @@ Methods:
- client.workers.scripts.secrets.update(script_name, \*, account_id, \*\*params) -> Optional[SecretUpdateResponse]
- client.workers.scripts.secrets.list(script_name, \*, account_id) -> SyncSinglePage[SecretListResponse]
-- client.workers.scripts.secrets.delete(secret_name, \*, account_id, script_name) -> object
-- client.workers.scripts.secrets.get(secret_name, \*, account_id, script_name) -> Optional[SecretGetResponse]
+- client.workers.scripts.secrets.delete(secret_name, \*, account_id, script_name, \*\*params) -> object
+- client.workers.scripts.secrets.get(secret_name, \*, account_id, script_name, \*\*params) -> Optional[SecretGetResponse]
### ScriptAndVersionSettings
@@ -2499,6 +2620,7 @@ from cloudflare.types.workers import SubdomainUpdateResponse, SubdomainGetRespon
Methods:
- client.workers.subdomains.update(\*, account_id, \*\*params) -> SubdomainUpdateResponse
+- client.workers.subdomains.delete(\*, account_id) -> None
- client.workers.subdomains.get(\*, account_id) -> SubdomainGetResponse
## Observability
@@ -2570,15 +2692,9 @@ Methods:
### Metadata
-Types:
-
-```python
-from cloudflare.types.kv.namespaces import MetadataGetResponse
-```
-
Methods:
-- client.kv.namespaces.metadata.get(key_name, \*, account_id, namespace_id) -> Optional[MetadataGetResponse]
+- client.kv.namespaces.metadata.get(key_name, \*, account_id, namespace_id) -> object
### Values
@@ -2606,7 +2722,7 @@ from cloudflare.types.durable_objects import Namespace
Methods:
-- client.durable_objects.namespaces.list(\*, account_id) -> SyncSinglePage[Namespace]
+- client.durable_objects.namespaces.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Namespace]
### Objects
@@ -2618,7 +2734,7 @@ from cloudflare.types.durable_objects.namespaces import DurableObject
Methods:
-- client.durable_objects.namespaces.objects.list(id, \*, account_id, \*\*params) -> SyncCursorLimitPagination[DurableObject]
+- client.durable_objects.namespaces.objects.list(id, \*, account_id, \*\*params) -> SyncCursorPaginationAfter[DurableObject]
# Queues
@@ -2637,21 +2753,6 @@ Methods:
- client.queues.edit(queue_id, \*, account_id, \*\*params) -> Optional[Queue]
- client.queues.get(queue_id, \*, account_id) -> Optional[Queue]
-## Consumers
-
-Types:
-
-```python
-from cloudflare.types.queues import Consumer, ConsumerDeleteResponse
-```
-
-Methods:
-
-- client.queues.consumers.create(queue_id, \*, account_id, \*\*params) -> Optional[Consumer]
-- client.queues.consumers.update(consumer_id, \*, account_id, queue_id, \*\*params) -> Optional[Consumer]
-- client.queues.consumers.delete(consumer_id, \*, account_id, queue_id) -> ConsumerDeleteResponse
-- client.queues.consumers.get(queue_id, \*, account_id) -> SyncSinglePage[Consumer]
-
## Messages
Types:
@@ -2685,6 +2786,44 @@ Methods:
- client.queues.purge.start(queue_id, \*, account_id, \*\*params) -> Optional[Queue]
- client.queues.purge.status(queue_id, \*, account_id) -> Optional[PurgeStatusResponse]
+## Consumers
+
+Types:
+
+```python
+from cloudflare.types.queues import Consumer, ConsumerDeleteResponse
+```
+
+Methods:
+
+- client.queues.consumers.create(queue_id, \*, account_id, \*\*params) -> Optional[Consumer]
+- client.queues.consumers.update(consumer_id, \*, account_id, queue_id, \*\*params) -> Optional[Consumer]
+- client.queues.consumers.list(queue_id, \*, account_id) -> SyncSinglePage[Consumer]
+- client.queues.consumers.delete(consumer_id, \*, account_id, queue_id) -> ConsumerDeleteResponse
+- client.queues.consumers.get(consumer_id, \*, account_id, queue_id) -> Optional[Consumer]
+
+## Subscriptions
+
+Types:
+
+```python
+from cloudflare.types.queues import (
+ SubscriptionCreateResponse,
+ SubscriptionUpdateResponse,
+ SubscriptionListResponse,
+ SubscriptionDeleteResponse,
+ SubscriptionGetResponse,
+)
+```
+
+Methods:
+
+- client.queues.subscriptions.create(\*, account_id, \*\*params) -> Optional[SubscriptionCreateResponse]
+- client.queues.subscriptions.update(subscription_id, \*, account_id, \*\*params) -> Optional[SubscriptionUpdateResponse]
+- client.queues.subscriptions.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[SubscriptionListResponse]
+- client.queues.subscriptions.delete(subscription_id, \*, account_id) -> Optional[SubscriptionDeleteResponse]
+- client.queues.subscriptions.get(subscription_id, \*, account_id) -> Optional[SubscriptionGetResponse]
+
# APIGateway
## Configurations
@@ -2692,12 +2831,12 @@ Methods:
Types:
```python
-from cloudflare.types.api_gateway import Configuration, ConfigurationUpdateResponse
+from cloudflare.types.api_gateway import Configuration
```
Methods:
-- client.api_gateway.configurations.update(\*, zone_id, \*\*params) -> ConfigurationUpdateResponse
+- client.api_gateway.configurations.update(\*, zone_id, \*\*params) -> Configuration
- client.api_gateway.configurations.get(\*, zone_id, \*\*params) -> Configuration
## Discovery
@@ -2804,19 +2943,19 @@ Types:
```python
from cloudflare.types.api_gateway import (
Message,
- PublicSchema,
- SchemaUpload,
+ OldPublicSchema,
+ UserSchemaCreateResponse,
UserSchemaDeleteResponse,
)
```
Methods:
-- client.api_gateway.user_schemas.create(\*, zone_id, \*\*params) -> SchemaUpload
-- client.api_gateway.user_schemas.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[PublicSchema]
+- client.api_gateway.user_schemas.create(\*, zone_id, \*\*params) -> UserSchemaCreateResponse
+- client.api_gateway.user_schemas.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[OldPublicSchema]
- client.api_gateway.user_schemas.delete(schema_id, \*, zone_id) -> UserSchemaDeleteResponse
-- client.api_gateway.user_schemas.edit(schema_id, \*, zone_id, \*\*params) -> PublicSchema
-- client.api_gateway.user_schemas.get(schema_id, \*, zone_id, \*\*params) -> PublicSchema
+- client.api_gateway.user_schemas.edit(schema_id, \*, zone_id, \*\*params) -> OldPublicSchema
+- client.api_gateway.user_schemas.get(schema_id, \*, zone_id, \*\*params) -> OldPublicSchema
### Operations
@@ -3014,7 +3153,6 @@ from cloudflare.types.rulesets import (
ManagedChallengeRule,
RedirectRule,
RewriteRule,
- RewriteURIPart,
RouteRule,
RulesetRule,
ScoreRule,
@@ -3139,7 +3277,7 @@ Methods:
- client.spectrum.apps.create(\*, zone_id, \*\*params) -> Optional[AppCreateResponse]
- client.spectrum.apps.update(app_id, \*, zone_id, \*\*params) -> Optional[AppUpdateResponse]
-- client.spectrum.apps.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[Optional[AppListResponse]]
+- client.spectrum.apps.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[AppListResponse]
- client.spectrum.apps.delete(app_id, \*, zone_id) -> Optional[AppDeleteResponse]
- client.spectrum.apps.get(app_id, \*, zone_id) -> Optional[AppGetResponse]
@@ -3368,17 +3506,63 @@ Types:
```python
from cloudflare.types.brand_protection import (
Info,
- RuleMatch,
- ScanStatus,
Submit,
- URLInfoModelResults,
+ BrandProtectionSubmitResponse,
+ BrandProtectionURLInfoResponse,
)
```
Methods:
-- client.brand_protection.submit(\*, account_id, \*\*params) -> Optional[Submit]
-- client.brand_protection.url_info(\*, account_id, \*\*params) -> Optional[Info]
+- client.brand_protection.submit(\*, account_id) -> BrandProtectionSubmitResponse
+- client.brand_protection.url_info(\*, account_id) -> SyncSinglePage[BrandProtectionURLInfoResponse]
+
+## Queries
+
+Methods:
+
+- client.brand_protection.queries.create(\*, account_id, \*\*params) -> None
+- client.brand_protection.queries.delete(\*, account_id, \*\*params) -> None
+- client.brand_protection.queries.bulk(\*, account_id, \*\*params) -> None
+
+## Matches
+
+Types:
+
+```python
+from cloudflare.types.brand_protection import MatchDownloadResponse, MatchGetResponse
+```
+
+Methods:
+
+- client.brand_protection.matches.download(\*, account_id, \*\*params) -> MatchDownloadResponse
+- client.brand_protection.matches.get(\*, account_id, \*\*params) -> MatchGetResponse
+
+## Logos
+
+Types:
+
+```python
+from cloudflare.types.brand_protection import LogoCreateResponse
+```
+
+Methods:
+
+- client.brand_protection.logos.create(\*, account_id, \*\*params) -> LogoCreateResponse
+- client.brand_protection.logos.delete(logo_id, \*, account_id) -> None
+
+## LogoMatches
+
+Types:
+
+```python
+from cloudflare.types.brand_protection import LogoMatchDownloadResponse, LogoMatchGetResponse
+```
+
+Methods:
+
+- client.brand_protection.logo_matches.download(\*, account_id, \*\*params) -> LogoMatchDownloadResponse
+- client.brand_protection.logo_matches.get(\*, account_id, \*\*params) -> LogoMatchGetResponse
# Diagnostics
@@ -3394,6 +3578,29 @@ Methods:
- client.diagnostics.traceroutes.create(\*, account_id, \*\*params) -> SyncSinglePage[Traceroute]
+## EndpointHealthchecks
+
+Types:
+
+```python
+from cloudflare.types.diagnostics import (
+ EndpointHealthcheck,
+ EndpointHealthcheckCreateResponse,
+ EndpointHealthcheckUpdateResponse,
+ EndpointHealthcheckListResponse,
+ EndpointHealthcheckDeleteResponse,
+ EndpointHealthcheckGetResponse,
+)
+```
+
+Methods:
+
+- client.diagnostics.endpoint_healthchecks.create(\*, account_id, \*\*params) -> Optional[EndpointHealthcheckCreateResponse]
+- client.diagnostics.endpoint_healthchecks.update(id, \*, account_id, \*\*params) -> Optional[EndpointHealthcheckUpdateResponse]
+- client.diagnostics.endpoint_healthchecks.list(\*, account_id) -> Optional[EndpointHealthcheckListResponse]
+- client.diagnostics.endpoint_healthchecks.delete(id, \*, account_id) -> EndpointHealthcheckDeleteResponse
+- client.diagnostics.endpoint_healthchecks.get(id, \*, account_id) -> Optional[EndpointHealthcheckGetResponse]
+
# Images
## V1
@@ -3578,10 +3785,6 @@ Types:
from cloudflare.types.intel import IPList
```
-Methods:
-
-- client.intel.ip_lists.get(\*, account_id) -> SyncSinglePage[IPList]
-
## Miscategorizations
Types:
@@ -3658,18 +3861,6 @@ Methods:
- client.intel.indicator_feeds.permissions.list(\*, account_id) -> Optional[PermissionListResponse]
- client.intel.indicator_feeds.permissions.delete(\*, account_id, \*\*params) -> Optional[PermissionDeleteResponse]
-### Downloads
-
-Types:
-
-```python
-from cloudflare.types.intel.indicator_feeds import DownloadGetResponse
-```
-
-Methods:
-
-- client.intel.indicator_feeds.downloads.get(feed_id, \*, account_id) -> Optional[DownloadGetResponse]
-
## Sinkholes
Types:
@@ -3929,8 +4120,10 @@ Types:
```python
from cloudflare.types.magic_transit import (
+ ConnectorCreateResponse,
ConnectorUpdateResponse,
ConnectorListResponse,
+ ConnectorDeleteResponse,
ConnectorEditResponse,
ConnectorGetResponse,
)
@@ -3938,8 +4131,10 @@ from cloudflare.types.magic_transit import (
Methods:
+- client.magic_transit.connectors.create(\*, account_id, \*\*params) -> ConnectorCreateResponse
- client.magic_transit.connectors.update(connector_id, \*, account_id, \*\*params) -> ConnectorUpdateResponse
- client.magic_transit.connectors.list(\*, account_id) -> SyncSinglePage[ConnectorListResponse]
+- client.magic_transit.connectors.delete(connector_id, \*, account_id) -> ConnectorDeleteResponse
- client.magic_transit.connectors.edit(connector_id, \*, account_id, \*\*params) -> ConnectorEditResponse
- client.magic_transit.connectors.get(connector_id, \*, account_id) -> ConnectorGetResponse
@@ -4349,7 +4544,7 @@ from cloudflare.types.pages import Deployment, Project, Stage
Methods:
- client.pages.projects.create(\*, account_id, \*\*params) -> Project
-- client.pages.projects.list(\*, account_id) -> SyncSinglePage[Deployment]
+- client.pages.projects.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Project]
- client.pages.projects.delete(project_name, \*, account_id) -> object
- client.pages.projects.edit(project_name, \*, account_id, \*\*params) -> Project
- client.pages.projects.get(project_name, \*, account_id) -> Project
@@ -4360,11 +4555,11 @@ Methods:
Methods:
- client.pages.projects.deployments.create(project_name, \*, account_id, \*\*params) -> Deployment
-- client.pages.projects.deployments.list(project_name, \*, account_id, \*\*params) -> SyncSinglePage[Deployment]
+- client.pages.projects.deployments.list(project_name, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[Deployment]
- client.pages.projects.deployments.delete(deployment_id, \*, account_id, project_name) -> object
- client.pages.projects.deployments.get(deployment_id, \*, account_id, project_name) -> Deployment
-- client.pages.projects.deployments.retry(deployment_id, \*, account_id, project_name, \*\*params) -> Deployment
-- client.pages.projects.deployments.rollback(deployment_id, \*, account_id, project_name, \*\*params) -> Deployment
+- client.pages.projects.deployments.retry(deployment_id, \*, account_id, project_name) -> Deployment
+- client.pages.projects.deployments.rollback(deployment_id, \*, account_id, project_name) -> Deployment
#### History
@@ -4395,11 +4590,11 @@ from cloudflare.types.pages.projects import (
Methods:
-- client.pages.projects.domains.create(project_name, \*, account_id, \*\*params) -> Optional[DomainCreateResponse]
+- client.pages.projects.domains.create(project_name, \*, account_id, \*\*params) -> DomainCreateResponse
- client.pages.projects.domains.list(project_name, \*, account_id) -> SyncSinglePage[DomainListResponse]
- client.pages.projects.domains.delete(domain_name, \*, account_id, project_name) -> object
-- client.pages.projects.domains.edit(domain_name, \*, account_id, project_name, \*\*params) -> Optional[DomainEditResponse]
-- client.pages.projects.domains.get(domain_name, \*, account_id, project_name) -> Optional[DomainGetResponse]
+- client.pages.projects.domains.edit(domain_name, \*, account_id, project_name) -> DomainEditResponse
+- client.pages.projects.domains.get(domain_name, \*, account_id, project_name) -> DomainGetResponse
# Registrar
@@ -4444,7 +4639,6 @@ from cloudflare.types.rules import (
Redirect,
ListCreateResponse,
ListUpdateResponse,
- ListListResponse,
ListDeleteResponse,
ListGetResponse,
)
@@ -4454,7 +4648,7 @@ Methods:
- client.rules.lists.create(\*, account_id, \*\*params) -> ListCreateResponse
- client.rules.lists.update(list_id, \*, account_id, \*\*params) -> ListUpdateResponse
-- client.rules.lists.list(\*, account_id) -> ListListResponse
+- client.rules.lists.list(\*, account_id) -> SyncSinglePage[ListsList]
- client.rules.lists.delete(list_id, \*, account_id) -> ListDeleteResponse
- client.rules.lists.get(list_id, \*, account_id) -> ListGetResponse
@@ -4490,8 +4684,8 @@ Methods:
- client.rules.lists.items.create(list_id, \*, account_id, \*\*params) -> ItemCreateResponse
- client.rules.lists.items.update(list_id, \*, account_id, \*\*params) -> ItemUpdateResponse
-- client.rules.lists.items.list(list_id, \*, account_id, \*\*params) -> ItemListResponse
-- client.rules.lists.items.delete(list_id, \*, account_id) -> ItemDeleteResponse
+- client.rules.lists.items.list(list_id, \*, account_id, \*\*params) -> SyncCursorPaginationAfter[ItemListResponse]
+- client.rules.lists.items.delete(list_id, \*, account_id, \*\*params) -> ItemDeleteResponse
- client.rules.lists.items.get(item_id, \*, account_id, list_id) -> ItemGetResponse
# Stream
@@ -4685,14 +4879,18 @@ Methods:
Types:
```python
-from cloudflare.types.stream import DownloadDeleteResponse
+from cloudflare.types.stream import (
+ DownloadCreateResponse,
+ DownloadDeleteResponse,
+ DownloadGetResponse,
+)
```
Methods:
-- client.stream.downloads.create(identifier, \*, account_id, \*\*params) -> object
+- client.stream.downloads.create(identifier, \*, account_id, \*\*params) -> Optional[DownloadCreateResponse]
- client.stream.downloads.delete(identifier, \*, account_id) -> str
-- client.stream.downloads.get(identifier, \*, account_id) -> object
+- client.stream.downloads.get(identifier, \*, account_id) -> Optional[DownloadGetResponse]
## Embed
@@ -4822,6 +5020,28 @@ Methods:
- client.alerting.policies.delete(policy_id, \*, account_id) -> PolicyDeleteResponse
- client.alerting.policies.get(policy_id, \*, account_id) -> Optional[Policy]
+## Silences
+
+Types:
+
+```python
+from cloudflare.types.alerting import (
+ SilenceCreateResponse,
+ SilenceUpdateResponse,
+ SilenceListResponse,
+ SilenceDeleteResponse,
+ SilenceGetResponse,
+)
+```
+
+Methods:
+
+- client.alerting.silences.create(\*, account_id, \*\*params) -> SilenceCreateResponse
+- client.alerting.silences.update(\*, account_id, \*\*params) -> SyncSinglePage[SilenceUpdateResponse]
+- client.alerting.silences.list(\*, account_id) -> SyncSinglePage[SilenceListResponse]
+- client.alerting.silences.delete(silence_id, \*, account_id) -> SilenceDeleteResponse
+- client.alerting.silences.get(silence_id, \*, account_id) -> Optional[SilenceGetResponse]
+
# D1
Types:
@@ -4846,16 +5066,29 @@ from cloudflare.types.d1 import (
Methods:
-- client.d1.database.create(\*, account_id, \*\*params) -> D1
-- client.d1.database.update(database_id, \*, account_id, \*\*params) -> D1
-- client.d1.database.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DatabaseListResponse]
-- client.d1.database.delete(database_id, \*, account_id) -> object
-- client.d1.database.edit(database_id, \*, account_id, \*\*params) -> D1
-- client.d1.database.export(database_id, \*, account_id, \*\*params) -> DatabaseExportResponse
-- client.d1.database.get(database_id, \*, account_id) -> D1
-- client.d1.database.import\_(database_id, \*, account_id, \*\*params) -> DatabaseImportResponse
-- client.d1.database.query(database_id, \*, account_id, \*\*params) -> SyncSinglePage[QueryResult]
-- client.d1.database.raw(database_id, \*, account_id, \*\*params) -> SyncSinglePage[DatabaseRawResponse]
+- client.d1.database.create(\*, account_id, \*\*params) -> D1
+- client.d1.database.update(database_id, \*, account_id, \*\*params) -> D1
+- client.d1.database.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DatabaseListResponse]
+- client.d1.database.delete(database_id, \*, account_id) -> object
+- client.d1.database.edit(database_id, \*, account_id, \*\*params) -> D1
+- client.d1.database.export(database_id, \*, account_id, \*\*params) -> DatabaseExportResponse
+- client.d1.database.get(database_id, \*, account_id) -> D1
+- client.d1.database.import\_(database_id, \*, account_id, \*\*params) -> DatabaseImportResponse
+- client.d1.database.query(database_id, \*, account_id, \*\*params) -> SyncSinglePage[QueryResult]
+- client.d1.database.raw(database_id, \*, account_id, \*\*params) -> SyncSinglePage[DatabaseRawResponse]
+
+### TimeTravel
+
+Types:
+
+```python
+from cloudflare.types.d1.database import TimeTravelGetBookmarkResponse, TimeTravelRestoreResponse
+```
+
+Methods:
+
+- client.d1.database.time_travel.get_bookmark(database_id, \*, account_id, \*\*params) -> TimeTravelGetBookmarkResponse
+- client.d1.database.time_travel.restore(database_id, \*, account_id, \*\*params) -> TimeTravelRestoreResponse
# R2
@@ -5063,110 +5296,191 @@ Methods:
- client.r2.super_slurper.connectivity_precheck.source(\*, account_id, \*\*params) -> Optional[ConnectivityPrecheckSourceResponse]
- client.r2.super_slurper.connectivity_precheck.target(\*, account_id, \*\*params) -> Optional[ConnectivityPrecheckTargetResponse]
-# WorkersForPlatforms
-
-## Dispatch
-
-### Namespaces
+# R2DataCatalog
Types:
```python
-from cloudflare.types.workers_for_platforms.dispatch import (
- NamespaceCreateResponse,
- NamespaceListResponse,
- NamespaceGetResponse,
+from cloudflare.types.r2_data_catalog import (
+ R2DataCatalogListResponse,
+ R2DataCatalogEnableResponse,
+ R2DataCatalogGetResponse,
)
```
Methods:
-- client.workers_for_platforms.dispatch.namespaces.create(\*, account_id, \*\*params) -> Optional[NamespaceCreateResponse]
-- client.workers_for_platforms.dispatch.namespaces.list(\*, account_id) -> SyncSinglePage[NamespaceListResponse]
-- client.workers_for_platforms.dispatch.namespaces.delete(dispatch_namespace, \*, account_id) -> object
-- client.workers_for_platforms.dispatch.namespaces.get(dispatch_namespace, \*, account_id) -> Optional[NamespaceGetResponse]
-
-#### Scripts
-
-Types:
-
-```python
-from cloudflare.types.workers_for_platforms.dispatch.namespaces import Script, ScriptUpdateResponse
-```
-
-Methods:
-
-- client.workers_for_platforms.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> ScriptUpdateResponse
-- client.workers_for_platforms.dispatch.namespaces.scripts.delete(script_name, \*, account_id, dispatch_namespace, \*\*params) -> object
-- client.workers_for_platforms.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> Script
+- client.r2_data_catalog.list(\*, account_id) -> Optional[R2DataCatalogListResponse]
+- client.r2_data_catalog.disable(bucket_name, \*, account_id) -> None
+- client.r2_data_catalog.enable(bucket_name, \*, account_id) -> Optional[R2DataCatalogEnableResponse]
+- client.r2_data_catalog.get(bucket_name, \*, account_id) -> Optional[R2DataCatalogGetResponse]
-##### AssetUpload
+## MaintenanceConfigs
Types:
```python
-from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
- AssetUploadCreateResponse,
+from cloudflare.types.r2_data_catalog import (
+ MaintenanceConfigUpdateResponse,
+ MaintenanceConfigGetResponse,
)
```
Methods:
-- client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.create(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional[AssetUploadCreateResponse]
+- client.r2_data_catalog.maintenance_configs.update(bucket_name, \*, account_id, \*\*params) -> Optional[MaintenanceConfigUpdateResponse]
+- client.r2_data_catalog.maintenance_configs.get(bucket_name, \*, account_id) -> Optional[MaintenanceConfigGetResponse]
-##### Content
+## Credentials
Methods:
-- client.workers_for_platforms.dispatch.namespaces.scripts.content.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Script
-- client.workers_for_platforms.dispatch.namespaces.scripts.content.get(script_name, \*, account_id, dispatch_namespace) -> BinaryAPIResponse
+- client.r2_data_catalog.credentials.create(bucket_name, \*, account_id, \*\*params) -> object
-##### Settings
+## Namespaces
Types:
```python
-from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
- SettingEditResponse,
- SettingGetResponse,
-)
+from cloudflare.types.r2_data_catalog import NamespaceListResponse
```
Methods:
-- client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional[SettingEditResponse]
-- client.workers_for_platforms.dispatch.namespaces.scripts.settings.get(script_name, \*, account_id, dispatch_namespace) -> Optional[SettingGetResponse]
+- client.r2_data_catalog.namespaces.list(bucket_name, \*, account_id, \*\*params) -> Optional[NamespaceListResponse]
-##### Bindings
+### Tables
Types:
```python
-from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse
+from cloudflare.types.r2_data_catalog.namespaces import TableListResponse
```
Methods:
-- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[BindingGetResponse]
+- client.r2_data_catalog.namespaces.tables.list(namespace, \*, account_id, bucket_name, \*\*params) -> Optional[TableListResponse]
-##### Secrets
+#### MaintenanceConfigs
Types:
```python
-from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
- SecretUpdateResponse,
- SecretListResponse,
- SecretGetResponse,
+from cloudflare.types.r2_data_catalog.namespaces.tables import (
+ MaintenanceConfigUpdateResponse,
+ MaintenanceConfigGetResponse,
)
```
Methods:
-- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SecretUpdateResponse
+- client.r2_data_catalog.namespaces.tables.maintenance_configs.update(table_name, \*, account_id, bucket_name, namespace, \*\*params) -> Optional[MaintenanceConfigUpdateResponse]
+- client.r2_data_catalog.namespaces.tables.maintenance_configs.get(table_name, \*, account_id, bucket_name, namespace) -> Optional[MaintenanceConfigGetResponse]
+
+# WorkersForPlatforms
+
+## Dispatch
+
+### Namespaces
+
+Types:
+
+```python
+from cloudflare.types.workers_for_platforms.dispatch import (
+ NamespaceCreateResponse,
+ NamespaceListResponse,
+ NamespaceGetResponse,
+)
+```
+
+Methods:
+
+- client.workers_for_platforms.dispatch.namespaces.create(\*, account_id, \*\*params) -> Optional[NamespaceCreateResponse]
+- client.workers_for_platforms.dispatch.namespaces.list(\*, account_id) -> SyncSinglePage[NamespaceListResponse]
+- client.workers_for_platforms.dispatch.namespaces.delete(dispatch_namespace, \*, account_id) -> object
+- client.workers_for_platforms.dispatch.namespaces.get(dispatch_namespace, \*, account_id) -> Optional[NamespaceGetResponse]
+
+#### Scripts
+
+Types:
+
+```python
+from cloudflare.types.workers_for_platforms.dispatch.namespaces import Script, ScriptUpdateResponse
+```
+
+Methods:
+
+- client.workers_for_platforms.dispatch.namespaces.scripts.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> ScriptUpdateResponse
+- client.workers_for_platforms.dispatch.namespaces.scripts.delete(script_name, \*, account_id, dispatch_namespace, \*\*params) -> object
+- client.workers_for_platforms.dispatch.namespaces.scripts.get(script_name, \*, account_id, dispatch_namespace) -> Script
+
+##### AssetUpload
+
+Types:
+
+```python
+from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
+ AssetUploadCreateResponse,
+)
+```
+
+Methods:
+
+- client.workers_for_platforms.dispatch.namespaces.scripts.asset_upload.create(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional[AssetUploadCreateResponse]
+
+##### Content
+
+Methods:
+
+- client.workers_for_platforms.dispatch.namespaces.scripts.content.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Script
+- client.workers_for_platforms.dispatch.namespaces.scripts.content.get(script_name, \*, account_id, dispatch_namespace) -> BinaryAPIResponse
+
+##### Settings
+
+Types:
+
+```python
+from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
+ SettingEditResponse,
+ SettingGetResponse,
+)
+```
+
+Methods:
+
+- client.workers_for_platforms.dispatch.namespaces.scripts.settings.edit(script_name, \*, account_id, dispatch_namespace, \*\*params) -> Optional[SettingEditResponse]
+- client.workers_for_platforms.dispatch.namespaces.scripts.settings.get(script_name, \*, account_id, dispatch_namespace) -> Optional[SettingGetResponse]
+
+##### Bindings
+
+Types:
+
+```python
+from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse
+```
+
+Methods:
+
+- client.workers_for_platforms.dispatch.namespaces.scripts.bindings.get(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[BindingGetResponse]
+
+##### Secrets
+
+Types:
+
+```python
+from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
+ SecretUpdateResponse,
+ SecretListResponse,
+ SecretGetResponse,
+)
+```
+
+Methods:
+
+- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.update(script_name, \*, account_id, dispatch_namespace, \*\*params) -> SecretUpdateResponse
- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.list(script_name, \*, account_id, dispatch_namespace) -> SyncSinglePage[SecretListResponse]
-- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.delete(secret_name, \*, account_id, dispatch_namespace, script_name) -> object
-- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.get(secret_name, \*, account_id, dispatch_namespace, script_name) -> SecretGetResponse
+- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.delete(secret_name, \*, account_id, dispatch_namespace, script_name, \*\*params) -> object
+- client.workers_for_platforms.dispatch.namespaces.scripts.secrets.get(secret_name, \*, account_id, dispatch_namespace, script_name, \*\*params) -> SecretGetResponse
##### Tags
@@ -5212,7 +5526,7 @@ Methods:
- client.zero*trust.devices.devices.list(\*, account_id, \*\*params) -> SyncCursorPagination[DeviceListResponse]
- client.zero*trust.devices.devices.delete(device_id, \*, account_id) -> object
-- client.zero*trust.devices.devices.get(device_id, \*, account_id) -> DeviceGetResponse
+- client.zero*trust.devices.devices.get(device_id, \*, account_id, \*\*params) -> DeviceGetResponse
- client.zero*trust.devices.devices.revoke(device_id, \*, account_id) -> object
### Resilience
@@ -5246,7 +5560,7 @@ Methods:
- client.zero_trust.devices.registrations.list(\*, account_id, \*\*params) -> SyncCursorPagination[RegistrationListResponse]
- client.zero_trust.devices.registrations.delete(registration_id, \*, account_id) -> object
- client.zero_trust.devices.registrations.bulk_delete(\*, account_id, \*\*params) -> object
-- client.zero_trust.devices.registrations.get(registration_id, \*, account_id) -> RegistrationGetResponse
+- client.zero_trust.devices.registrations.get(registration_id, \*, account_id, \*\*params) -> RegistrationGetResponse
- client.zero_trust.devices.registrations.revoke(\*, account_id, \*\*params) -> object
- client.zero_trust.devices.registrations.unrevoke(\*, account_id, \*\*params) -> object
@@ -5270,7 +5584,7 @@ Methods:
- client.zero_trust.devices.dex_tests.create(\*, account_id, \*\*params) -> Optional[DEXTestCreateResponse]
- client.zero_trust.devices.dex_tests.update(dex_test_id, \*, account_id, \*\*params) -> Optional[DEXTestUpdateResponse]
-- client.zero_trust.devices.dex_tests.list(\*, account_id) -> SyncSinglePage[DEXTestListResponse]
+- client.zero_trust.devices.dex_tests.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[DEXTestListResponse]
- client.zero_trust.devices.dex_tests.delete(dex_test_id, \*, account_id) -> Optional[DEXTestDeleteResponse]
- client.zero_trust.devices.dex_tests.get(dex_test_id, \*, account_id) -> Optional[DEXTestGetResponse]
@@ -5513,7 +5827,7 @@ Methods:
- client.zero_trust.identity_providers.create(\*, account_id, zone_id, \*\*params) -> Optional[IdentityProvider]
- client.zero_trust.identity_providers.update(identity_provider_id, \*, account_id, zone_id, \*\*params) -> Optional[IdentityProvider]
-- client.zero_trust.identity_providers.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[IdentityProviderListResponse]
+- client.zero_trust.identity_providers.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[IdentityProviderListResponse]
- client.zero_trust.identity_providers.delete(identity_provider_id, \*, account_id, zone_id) -> Optional[IdentityProviderDeleteResponse]
- client.zero_trust.identity_providers.get(identity_provider_id, \*, account_id, zone_id) -> Optional[IdentityProvider]
@@ -5523,13 +5837,13 @@ Methods:
Methods:
-- client.zero_trust.identity_providers.scim.groups.list(identity_provider_id, \*, account_id, \*\*params) -> SyncSinglePage[ZeroTrustGroup]
+- client.zero_trust.identity_providers.scim.groups.list(identity_provider_id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[ZeroTrustGroup]
#### Users
Methods:
-- client.zero_trust.identity_providers.scim.users.list(identity_provider_id, \*, account_id, \*\*params) -> SyncSinglePage[AccessUser]
+- client.zero_trust.identity_providers.scim.users.list(identity_provider_id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[AccessUser]
## Organizations
@@ -5573,6 +5887,55 @@ Methods:
## Access
+### AIControls
+
+#### Mcp
+
+##### Portals
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.access.ai_controls.mcp import (
+ PortalCreateResponse,
+ PortalUpdateResponse,
+ PortalListResponse,
+ PortalDeleteResponse,
+ PortalReadResponse,
+)
+```
+
+Methods:
+
+- client.zero_trust.access.ai_controls.mcp.portals.create(\*, account_id, \*\*params) -> PortalCreateResponse
+- client.zero_trust.access.ai_controls.mcp.portals.update(id, \*, account_id, \*\*params) -> PortalUpdateResponse
+- client.zero_trust.access.ai_controls.mcp.portals.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[PortalListResponse]
+- client.zero_trust.access.ai_controls.mcp.portals.delete(id, \*, account_id) -> PortalDeleteResponse
+- client.zero_trust.access.ai_controls.mcp.portals.read(id, \*, account_id) -> PortalReadResponse
+
+##### Servers
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.access.ai_controls.mcp import (
+ ServerCreateResponse,
+ ServerUpdateResponse,
+ ServerListResponse,
+ ServerDeleteResponse,
+ ServerReadResponse,
+)
+```
+
+Methods:
+
+- client.zero_trust.access.ai_controls.mcp.servers.create(\*, account_id, \*\*params) -> ServerCreateResponse
+- client.zero_trust.access.ai_controls.mcp.servers.update(id, \*, account_id, \*\*params) -> ServerUpdateResponse
+- client.zero_trust.access.ai_controls.mcp.servers.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[ServerListResponse]
+- client.zero_trust.access.ai_controls.mcp.servers.delete(id, \*, account_id) -> ServerDeleteResponse
+- client.zero_trust.access.ai_controls.mcp.servers.read(id, \*, account_id) -> ServerReadResponse
+- client.zero_trust.access.ai_controls.mcp.servers.sync(id, \*, account_id) -> object
+
### GatewayCA
Types:
@@ -5655,7 +6018,7 @@ Methods:
- client.zero_trust.access.applications.create(\*, account_id, zone_id, \*\*params) -> Optional[ApplicationCreateResponse]
- client.zero_trust.access.applications.update(app_id, \*, account_id, zone_id, \*\*params) -> Optional[ApplicationUpdateResponse]
-- client.zero_trust.access.applications.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[ApplicationListResponse]
+- client.zero_trust.access.applications.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[ApplicationListResponse]
- client.zero_trust.access.applications.delete(app_id, \*, account_id, zone_id) -> Optional[ApplicationDeleteResponse]
- client.zero_trust.access.applications.get(app_id, \*, account_id, zone_id) -> Optional[ApplicationGetResponse]
- client.zero_trust.access.applications.revoke_tokens(app_id, \*, account_id, zone_id) -> object
@@ -5671,7 +6034,7 @@ from cloudflare.types.zero_trust.access.applications import CA, CADeleteResponse
Methods:
- client.zero_trust.access.applications.cas.create(app_id, \*, account_id, zone_id) -> Optional[CA]
-- client.zero_trust.access.applications.cas.list(\*, account_id, zone_id) -> SyncSinglePage[CA]
+- client.zero_trust.access.applications.cas.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[CA]
- client.zero_trust.access.applications.cas.delete(app_id, \*, account_id, zone_id) -> Optional[CADeleteResponse]
- client.zero_trust.access.applications.cas.get(app_id, \*, account_id, zone_id) -> Optional[CA]
@@ -5728,7 +6091,7 @@ Methods:
- client.zero_trust.access.applications.policies.create(app_id, \*, account_id, zone_id, \*\*params) -> Optional[PolicyCreateResponse]
- client.zero_trust.access.applications.policies.update(policy_id, \*, app_id, account_id, zone_id, \*\*params) -> Optional[PolicyUpdateResponse]
-- client.zero_trust.access.applications.policies.list(app_id, \*, account_id, zone_id) -> SyncSinglePage[PolicyListResponse]
+- client.zero_trust.access.applications.policies.list(app_id, \*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[PolicyListResponse]
- client.zero_trust.access.applications.policies.delete(policy_id, \*, app_id, account_id, zone_id) -> Optional[PolicyDeleteResponse]
- client.zero_trust.access.applications.policies.get(policy_id, \*, app_id, account_id, zone_id) -> Optional[PolicyGetResponse]
@@ -5792,7 +6155,7 @@ Methods:
- client.zero_trust.access.certificates.create(\*, account_id, zone_id, \*\*params) -> Optional[Certificate]
- client.zero_trust.access.certificates.update(certificate_id, \*, account_id, zone_id, \*\*params) -> Optional[Certificate]
-- client.zero_trust.access.certificates.list(\*, account_id, zone_id) -> SyncSinglePage[Certificate]
+- client.zero_trust.access.certificates.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[Certificate]
- client.zero_trust.access.certificates.delete(certificate_id, \*, account_id, zone_id) -> Optional[CertificateDeleteResponse]
- client.zero_trust.access.certificates.get(certificate_id, \*, account_id, zone_id) -> Optional[Certificate]
@@ -5828,7 +6191,7 @@ Methods:
- client.zero_trust.access.groups.create(\*, account_id, zone_id, \*\*params) -> Optional[GroupCreateResponse]
- client.zero_trust.access.groups.update(group_id, \*, account_id, zone_id, \*\*params) -> Optional[GroupUpdateResponse]
-- client.zero_trust.access.groups.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[GroupListResponse]
+- client.zero_trust.access.groups.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[GroupListResponse]
- client.zero_trust.access.groups.delete(group_id, \*, account_id, zone_id) -> Optional[GroupDeleteResponse]
- client.zero_trust.access.groups.get(group_id, \*, account_id, zone_id) -> Optional[GroupGetResponse]
@@ -5848,11 +6211,11 @@ Methods:
- client.zero_trust.access.service_tokens.create(\*, account_id, zone_id, \*\*params) -> Optional[ServiceTokenCreateResponse]
- client.zero_trust.access.service_tokens.update(service_token_id, \*, account_id, zone_id, \*\*params) -> Optional[ServiceToken]
-- client.zero_trust.access.service_tokens.list(\*, account_id, zone_id, \*\*params) -> SyncSinglePage[ServiceToken]
+- client.zero_trust.access.service_tokens.list(\*, account_id, zone_id, \*\*params) -> SyncV4PagePaginationArray[ServiceToken]
- client.zero_trust.access.service_tokens.delete(service_token_id, \*, account_id, zone_id) -> Optional[ServiceToken]
- client.zero_trust.access.service_tokens.get(service_token_id, \*, account_id, zone_id) -> Optional[ServiceToken]
- client.zero_trust.access.service_tokens.refresh(service_token_id, \*, account_id) -> Optional[ServiceToken]
-- client.zero_trust.access.service_tokens.rotate(service_token_id, \*, account_id) -> Optional[ServiceTokenRotateResponse]
+- client.zero_trust.access.service_tokens.rotate(service_token_id, \*, account_id, \*\*params) -> Optional[ServiceTokenRotateResponse]
### Bookmarks
@@ -5916,7 +6279,7 @@ from cloudflare.types.zero_trust.access.logs.scim import UpdateListResponse
Methods:
-- client.zero_trust.access.logs.scim.updates.list(\*, account_id, \*\*params) -> SyncSinglePage[UpdateListResponse]
+- client.zero_trust.access.logs.scim.updates.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[UpdateListResponse]
### Users
@@ -5928,7 +6291,7 @@ from cloudflare.types.zero_trust.access import AccessUser, UserListResponse
Methods:
-- client.zero_trust.access.users.list(\*, account_id, \*\*params) -> SyncSinglePage[UserListResponse]
+- client.zero_trust.access.users.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[UserListResponse]
#### ActiveSessions
@@ -5986,7 +6349,7 @@ Methods:
- client.zero_trust.access.custom_pages.create(\*, account_id, \*\*params) -> Optional[CustomPageWithoutHTML]
- client.zero_trust.access.custom_pages.update(custom_page_id, \*, account_id, \*\*params) -> Optional[CustomPageWithoutHTML]
-- client.zero_trust.access.custom_pages.list(\*, account_id) -> SyncSinglePage[CustomPageWithoutHTML]
+- client.zero_trust.access.custom_pages.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[CustomPageWithoutHTML]
- client.zero_trust.access.custom_pages.delete(custom_page_id, \*, account_id) -> Optional[CustomPageDeleteResponse]
- client.zero_trust.access.custom_pages.get(custom_page_id, \*, account_id) -> Optional[CustomPage]
@@ -6002,7 +6365,7 @@ Methods:
- client.zero_trust.access.tags.create(\*, account_id, \*\*params) -> Optional[Tag]
- client.zero_trust.access.tags.update(tag_name, \*, account_id, \*\*params) -> Optional[Tag]
-- client.zero_trust.access.tags.list(\*, account_id) -> SyncSinglePage[Tag]
+- client.zero_trust.access.tags.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Tag]
- client.zero_trust.access.tags.delete(tag_name, \*, account_id) -> Optional[TagDeleteResponse]
- client.zero_trust.access.tags.get(tag_name, \*, account_id) -> Optional[Tag]
@@ -6026,7 +6389,7 @@ Methods:
- client.zero_trust.access.policies.create(\*, account_id, \*\*params) -> Optional[PolicyCreateResponse]
- client.zero_trust.access.policies.update(policy_id, \*, account_id, \*\*params) -> Optional[PolicyUpdateResponse]
-- client.zero_trust.access.policies.list(\*, account_id) -> SyncSinglePage[PolicyListResponse]
+- client.zero_trust.access.policies.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[PolicyListResponse]
- client.zero_trust.access.policies.delete(policy_id, \*, account_id) -> Optional[PolicyDeleteResponse]
- client.zero_trust.access.policies.get(policy_id, \*, account_id) -> Optional[PolicyGetResponse]
@@ -6100,22 +6463,32 @@ Methods:
### Colos
+Types:
+
+```python
+from cloudflare.types.zero_trust.dex import ColoListResponse
+```
+
Methods:
-- client.zero_trust.dex.colos.list(\*, account_id, \*\*params) -> SyncSinglePage[object]
+- client.zero_trust.dex.colos.list(\*, account_id, \*\*params) -> SyncSinglePage[ColoListResponse]
### FleetStatus
Types:
```python
-from cloudflare.types.zero_trust.dex import LiveStat, FleetStatusLiveResponse
+from cloudflare.types.zero_trust.dex import (
+ LiveStat,
+ FleetStatusLiveResponse,
+ FleetStatusOverTimeResponse,
+)
```
Methods:
- client.zero_trust.dex.fleet_status.live(\*, account_id, \*\*params) -> Optional[FleetStatusLiveResponse]
-- client.zero_trust.dex.fleet_status.over_time(\*, account_id, \*\*params) -> None
+- client.zero_trust.dex.fleet_status.over_time(\*, account_id, \*\*params) -> Optional[FleetStatusOverTimeResponse]
#### Devices
@@ -6219,25 +6592,13 @@ Methods:
### Cloudflared
-Types:
-
-```python
-from cloudflare.types.zero_trust.tunnels import (
- CloudflaredCreateResponse,
- CloudflaredListResponse,
- CloudflaredDeleteResponse,
- CloudflaredEditResponse,
- CloudflaredGetResponse,
-)
-```
-
Methods:
-- client.zero_trust.tunnels.cloudflared.create(\*, account_id, \*\*params) -> CloudflaredCreateResponse
-- client.zero_trust.tunnels.cloudflared.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[CloudflaredListResponse]
-- client.zero_trust.tunnels.cloudflared.delete(tunnel_id, \*, account_id) -> CloudflaredDeleteResponse
-- client.zero_trust.tunnels.cloudflared.edit(tunnel_id, \*, account_id, \*\*params) -> CloudflaredEditResponse
-- client.zero_trust.tunnels.cloudflared.get(tunnel_id, \*, account_id) -> CloudflaredGetResponse
+- client.zero_trust.tunnels.cloudflared.create(\*, account_id, \*\*params) -> CloudflareTunnel
+- client.zero_trust.tunnels.cloudflared.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[CloudflareTunnel]
+- client.zero_trust.tunnels.cloudflared.delete(tunnel_id, \*, account_id) -> CloudflareTunnel
+- client.zero_trust.tunnels.cloudflared.edit(tunnel_id, \*, account_id, \*\*params) -> CloudflareTunnel
+- client.zero_trust.tunnels.cloudflared.get(tunnel_id, \*, account_id) -> CloudflareTunnel
#### Configurations
@@ -6355,29 +6716,40 @@ Methods:
Types:
```python
-from cloudflare.types.zero_trust.dlp import Dataset, DatasetArray, DatasetCreation
+from cloudflare.types.zero_trust.dlp import (
+ Dataset,
+ DatasetArray,
+ DatasetCreation,
+ DatasetCreateResponse,
+ DatasetUpdateResponse,
+ DatasetGetResponse,
+)
```
Methods:
-- client.zero_trust.dlp.datasets.create(\*, account_id, \*\*params) -> Optional[DatasetCreation]
-- client.zero_trust.dlp.datasets.update(dataset_id, \*, account_id, \*\*params) -> Optional[Dataset]
+- client.zero_trust.dlp.datasets.create(\*, account_id, \*\*params) -> Optional[DatasetCreateResponse]
+- client.zero_trust.dlp.datasets.update(dataset_id, \*, account_id, \*\*params) -> Optional[DatasetUpdateResponse]
- client.zero_trust.dlp.datasets.list(\*, account_id) -> SyncSinglePage[Dataset]
- client.zero_trust.dlp.datasets.delete(dataset_id, \*, account_id) -> None
-- client.zero_trust.dlp.datasets.get(dataset_id, \*, account_id) -> Optional[Dataset]
+- client.zero_trust.dlp.datasets.get(dataset_id, \*, account_id) -> Optional[DatasetGetResponse]
#### Upload
Types:
```python
-from cloudflare.types.zero_trust.dlp.datasets import NewVersion
+from cloudflare.types.zero_trust.dlp.datasets import (
+ NewVersion,
+ UploadCreateResponse,
+ UploadEditResponse,
+)
```
Methods:
-- client.zero_trust.dlp.datasets.upload.create(dataset_id, \*, account_id) -> Optional[NewVersion]
-- client.zero_trust.dlp.datasets.upload.edit(version, \*, account_id, dataset_id, \*\*params) -> Optional[Dataset]
+- client.zero_trust.dlp.datasets.upload.create(dataset_id, \*, account_id) -> Optional[UploadCreateResponse]
+- client.zero_trust.dlp.datasets.upload.edit(version, dataset, \*, account_id, dataset_id, \*\*params) -> Optional[UploadEditResponse]
#### Versions
@@ -6401,7 +6773,7 @@ from cloudflare.types.zero_trust.dlp.datasets.versions import EntryCreateRespons
Methods:
-- client.zero_trust.dlp.datasets.versions.entries.create(entry_id, \*, account_id, dataset_id, version, \*\*params) -> Optional[EntryCreateResponse]
+- client.zero_trust.dlp.datasets.versions.entries.create(entry_id, dataset_version_entry, \*, account_id, dataset_id, version, \*\*params) -> Optional[EntryCreateResponse]
### Patterns
@@ -6475,41 +6847,57 @@ Methods:
Types:
```python
-from cloudflare.types.zero_trust.dlp import ContextAwareness, Profile, SkipConfiguration
+from cloudflare.types.zero_trust.dlp import (
+ ContextAwareness,
+ Profile,
+ SkipConfiguration,
+ ProfileGetResponse,
+)
```
Methods:
- client.zero_trust.dlp.profiles.list(\*, account_id, \*\*params) -> SyncSinglePage[Profile]
-- client.zero_trust.dlp.profiles.get(profile_id, \*, account_id) -> Optional[Profile]
+- client.zero_trust.dlp.profiles.get(profile_id, \*, account_id) -> Optional[ProfileGetResponse]
#### Custom
Types:
```python
-from cloudflare.types.zero_trust.dlp.profiles import CustomProfile, Pattern
+from cloudflare.types.zero_trust.dlp.profiles import (
+ CustomProfile,
+ Pattern,
+ CustomCreateResponse,
+ CustomUpdateResponse,
+ CustomGetResponse,
+)
```
Methods:
-- client.zero_trust.dlp.profiles.custom.create(\*, account_id, \*\*params) -> Optional[Profile]
-- client.zero_trust.dlp.profiles.custom.update(profile_id, \*, account_id, \*\*params) -> Optional[Profile]
+- client.zero_trust.dlp.profiles.custom.create(\*, account_id, \*\*params) -> Optional[CustomCreateResponse]
+- client.zero_trust.dlp.profiles.custom.update(profile_id, \*, account_id, \*\*params) -> Optional[CustomUpdateResponse]
- client.zero_trust.dlp.profiles.custom.delete(profile_id, \*, account_id) -> object
-- client.zero_trust.dlp.profiles.custom.get(profile_id, \*, account_id) -> Optional[Profile]
+- client.zero_trust.dlp.profiles.custom.get(profile_id, \*, account_id) -> Optional[CustomGetResponse]
#### Predefined
Types:
```python
-from cloudflare.types.zero_trust.dlp.profiles import PredefinedProfile
+from cloudflare.types.zero_trust.dlp.profiles import (
+ PredefinedProfile,
+ PredefinedUpdateResponse,
+ PredefinedGetResponse,
+)
```
Methods:
-- client.zero_trust.dlp.profiles.predefined.update(profile_id, \*, account_id, \*\*params) -> Optional[Profile]
-- client.zero_trust.dlp.profiles.predefined.get(profile_id, \*, account_id) -> Optional[Profile]
+- client.zero_trust.dlp.profiles.predefined.update(profile_id, \*, account_id, \*\*params) -> Optional[PredefinedUpdateResponse]
+- client.zero_trust.dlp.profiles.predefined.delete(profile_id, \*, account_id) -> object
+- client.zero_trust.dlp.profiles.predefined.get(profile_id, \*, account_id) -> Optional[PredefinedGetResponse]
### Limits
@@ -6538,11 +6926,74 @@ from cloudflare.types.zero_trust.dlp import (
Methods:
-- client.zero_trust.dlp.entries.create(\*, account_id, \*\*params) -> Optional[EntryCreateResponse]
-- client.zero_trust.dlp.entries.update(entry_id, \*, account_id, \*\*params) -> Optional[EntryUpdateResponse]
-- client.zero_trust.dlp.entries.list(\*, account_id) -> SyncSinglePage[EntryListResponse]
-- client.zero_trust.dlp.entries.delete(entry_id, \*, account_id) -> object
-- client.zero_trust.dlp.entries.get(entry_id, \*, account_id) -> Optional[EntryGetResponse]
+- client.zero_trust.dlp.entries.create(\*, account_id, \*\*params) -> Optional[EntryCreateResponse]
+- client.zero_trust.dlp.entries.update(entry_id, \*, account_id, \*\*params) -> Optional[EntryUpdateResponse]
+- client.zero_trust.dlp.entries.list(\*, account_id) -> SyncSinglePage[EntryListResponse]
+- client.zero_trust.dlp.entries.delete(entry_id, \*, account_id) -> object
+- client.zero_trust.dlp.entries.get(entry_id, \*, account_id) -> Optional[EntryGetResponse]
+
+#### Custom
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.dlp.entries import (
+ CustomCreateResponse,
+ CustomUpdateResponse,
+ CustomListResponse,
+ CustomGetResponse,
+)
+```
+
+Methods:
+
+- client.zero_trust.dlp.entries.custom.create(\*, account_id, \*\*params) -> Optional[CustomCreateResponse]
+- client.zero_trust.dlp.entries.custom.update(entry_id, \*, account_id, \*\*params) -> Optional[CustomUpdateResponse]
+- client.zero_trust.dlp.entries.custom.list(\*, account_id) -> SyncSinglePage[CustomListResponse]
+- client.zero_trust.dlp.entries.custom.delete(entry_id, \*, account_id) -> object
+- client.zero_trust.dlp.entries.custom.get(entry_id, \*, account_id) -> Optional[CustomGetResponse]
+
+#### Predefined
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.dlp.entries import (
+ PredefinedCreateResponse,
+ PredefinedUpdateResponse,
+ PredefinedListResponse,
+ PredefinedGetResponse,
+)
+```
+
+Methods:
+
+- client.zero_trust.dlp.entries.predefined.create(\*, account_id, \*\*params) -> Optional[PredefinedCreateResponse]
+- client.zero_trust.dlp.entries.predefined.update(entry_id, \*, account_id, \*\*params) -> Optional[PredefinedUpdateResponse]
+- client.zero_trust.dlp.entries.predefined.list(\*, account_id) -> SyncSinglePage[PredefinedListResponse]
+- client.zero_trust.dlp.entries.predefined.delete(entry_id, \*, account_id) -> object
+- client.zero_trust.dlp.entries.predefined.get(entry_id, \*, account_id) -> Optional[PredefinedGetResponse]
+
+#### Integration
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.dlp.entries import (
+ IntegrationCreateResponse,
+ IntegrationUpdateResponse,
+ IntegrationListResponse,
+ IntegrationGetResponse,
+)
+```
+
+Methods:
+
+- client.zero_trust.dlp.entries.integration.create(\*, account_id, \*\*params) -> Optional[IntegrationCreateResponse]
+- client.zero_trust.dlp.entries.integration.update(entry_id, \*, account_id, \*\*params) -> Optional[IntegrationUpdateResponse]
+- client.zero_trust.dlp.entries.integration.list(\*, account_id) -> SyncSinglePage[IntegrationListResponse]
+- client.zero_trust.dlp.entries.integration.delete(entry_id, \*, account_id) -> object
+- client.zero_trust.dlp.entries.integration.get(entry_id, \*, account_id) -> Optional[IntegrationGetResponse]
## Gateway
@@ -6709,10 +7160,10 @@ from cloudflare.types.zero_trust.gateway import GatewayIPs, ProxyEndpoint
Methods:
- client.zero_trust.gateway.proxy_endpoints.create(\*, account_id, \*\*params) -> Optional[ProxyEndpoint]
-- client.zero_trust.gateway.proxy_endpoints.list(\*, account_id) -> Optional[ProxyEndpoint]
+- client.zero_trust.gateway.proxy_endpoints.list(\*, account_id) -> SyncSinglePage[ProxyEndpoint]
- client.zero_trust.gateway.proxy_endpoints.delete(proxy_endpoint_id, \*, account_id) -> object
- client.zero_trust.gateway.proxy_endpoints.edit(proxy_endpoint_id, \*, account_id, \*\*params) -> Optional[ProxyEndpoint]
-- client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> SyncSinglePage[ProxyEndpoint]
+- client.zero_trust.gateway.proxy_endpoints.get(proxy_endpoint_id, \*, account_id) -> Optional[ProxyEndpoint]
### Rules
@@ -6736,6 +7187,7 @@ Methods:
- client.zero_trust.gateway.rules.list(\*, account_id) -> SyncSinglePage[GatewayRule]
- client.zero_trust.gateway.rules.delete(rule_id, \*, account_id) -> object
- client.zero_trust.gateway.rules.get(rule_id, \*, account_id) -> Optional[GatewayRule]
+- client.zero_trust.gateway.rules.list_tenant(\*, account_id) -> SyncSinglePage[GatewayRule]
- client.zero_trust.gateway.rules.reset_expiration(rule_id, \*, account_id) -> Optional[GatewayRule]
### Certificates
@@ -6834,6 +7286,22 @@ Methods:
- client.zero_trust.networks.subnets.cloudflare_source.update(address_family, \*, account_id, \*\*params) -> CloudflareSourceUpdateResponse
+### HostnameRoutes
+
+Types:
+
+```python
+from cloudflare.types.zero_trust.networks import HostnameRoute
+```
+
+Methods:
+
+- client.zero_trust.networks.hostname_routes.create(\*, account_id, \*\*params) -> HostnameRoute
+- client.zero_trust.networks.hostname_routes.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[HostnameRoute]
+- client.zero_trust.networks.hostname_routes.delete(hostname_route_id, \*, account_id) -> HostnameRoute
+- client.zero_trust.networks.hostname_routes.edit(hostname_route_id, \*, account_id, \*\*params) -> HostnameRoute
+- client.zero_trust.networks.hostname_routes.get(hostname_route_id, \*, account_id) -> HostnameRoute
+
## RiskScoring
Types:
@@ -6924,6 +7392,31 @@ Methods:
- client.turnstile.widgets.get(sitekey, \*, account_id) -> Optional[Widget]
- client.turnstile.widgets.rotate_secret(sitekey, \*, account_id, \*\*params) -> Optional[Widget]
+# Connectivity
+
+## Directory
+
+### Services
+
+Types:
+
+```python
+from cloudflare.types.connectivity.directory import (
+ ServiceCreateResponse,
+ ServiceUpdateResponse,
+ ServiceListResponse,
+ ServiceGetResponse,
+)
+```
+
+Methods:
+
+- client.connectivity.directory.services.create(\*, account_id, \*\*params) -> Optional[ServiceCreateResponse]
+- client.connectivity.directory.services.update(service_id, \*, account_id, \*\*params) -> Optional[ServiceUpdateResponse]
+- client.connectivity.directory.services.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[ServiceListResponse]
+- client.connectivity.directory.services.delete(service_id, \*, account_id) -> None
+- client.connectivity.directory.services.get(service_id, \*, account_id) -> Optional[ServiceGetResponse]
+
# Hyperdrive
Types:
@@ -7000,6 +7493,7 @@ from cloudflare.types.vectorize import (
IndexDeleteByIDsResponse,
IndexInfoResponse,
IndexInsertResponse,
+ IndexListVectorsResponse,
IndexQueryResponse,
IndexUpsertResponse,
)
@@ -7015,6 +7509,7 @@ Methods:
- client.vectorize.indexes.get_by_ids(index_name, \*, account_id, \*\*params) -> object
- client.vectorize.indexes.info(index_name, \*, account_id) -> Optional[IndexInfoResponse]
- client.vectorize.indexes.insert(index_name, \*, account_id, \*\*params) -> Optional[IndexInsertResponse]
+- client.vectorize.indexes.list_vectors(index_name, \*, account_id, \*\*params) -> Optional[IndexListVectorsResponse]
- client.vectorize.indexes.query(index_name, \*, account_id, \*\*params) -> Optional[IndexQueryResponse]
- client.vectorize.indexes.upsert(index_name, \*, account_id, \*\*params) -> Optional[IndexUpsertResponse]
@@ -7099,6 +7594,20 @@ Methods:
### Inference
+Types:
+
+```python
+from cloudflare.types.radar.ai import (
+ InferenceSummaryV2Response,
+ InferenceTimeseriesGroupsV2Response,
+)
+```
+
+Methods:
+
+- client.radar.ai.inference.summary_v2(dimension, \*\*params) -> InferenceSummaryV2Response
+- client.radar.ai.inference.timeseries_groups_v2(dimension, \*\*params) -> InferenceTimeseriesGroupsV2Response
+
#### Summary
Types:
@@ -7132,6 +7641,22 @@ Methods:
### Bots
+Types:
+
+```python
+from cloudflare.types.radar.ai import (
+ BotSummaryV2Response,
+ BotTimeseriesResponse,
+ BotTimeseriesGroupsResponse,
+)
+```
+
+Methods:
+
+- client.radar.ai.bots.summary_v2(dimension, \*\*params) -> BotSummaryV2Response
+- client.radar.ai.bots.timeseries(\*\*params) -> BotTimeseriesResponse
+- client.radar.ai.bots.timeseries_groups(dimension, \*\*params) -> BotTimeseriesGroupsResponse
+
#### Summary
Types:
@@ -7149,75 +7674,127 @@ Methods:
Types:
```python
-from cloudflare.types.radar.ai import TimeseriesGroupUserAgentResponse
+from cloudflare.types.radar.ai import (
+ TimeseriesGroupSummaryResponse,
+ TimeseriesGroupTimeseriesResponse,
+ TimeseriesGroupTimeseriesGroupsResponse,
+ TimeseriesGroupUserAgentResponse,
+)
```
Methods:
+- client.radar.ai.timeseries_groups.summary(dimension, \*\*params) -> TimeseriesGroupSummaryResponse
+- client.radar.ai.timeseries_groups.timeseries(\*\*params) -> TimeseriesGroupTimeseriesResponse
+- client.radar.ai.timeseries_groups.timeseries_groups(dimension, \*\*params) -> TimeseriesGroupTimeseriesGroupsResponse
- client.radar.ai.timeseries_groups.user_agent(\*\*params) -> TimeseriesGroupUserAgentResponse
-## Annotations
+## CT
Types:
```python
-from cloudflare.types.radar import AnnotationListResponse
+from cloudflare.types.radar import (
+ CTSummaryResponse,
+ CTTimeseriesResponse,
+ CTTimeseriesGroupsResponse,
+)
```
Methods:
-- client.radar.annotations.list(\*\*params) -> AnnotationListResponse
+- client.radar.ct.summary(dimension, \*\*params) -> CTSummaryResponse
+- client.radar.ct.timeseries(\*\*params) -> CTTimeseriesResponse
+- client.radar.ct.timeseries_groups(dimension, \*\*params) -> CTTimeseriesGroupsResponse
-### Outages
+### Authorities
Types:
```python
-from cloudflare.types.radar.annotations import OutageGetResponse, OutageLocationsResponse
+from cloudflare.types.radar.ct import AuthorityListResponse, AuthorityGetResponse
```
Methods:
-- client.radar.annotations.outages.get(\*\*params) -> OutageGetResponse
-- client.radar.annotations.outages.locations(\*\*params) -> OutageLocationsResponse
+- client.radar.ct.authorities.list(\*\*params) -> AuthorityListResponse
+- client.radar.ct.authorities.get(ca_slug, \*\*params) -> AuthorityGetResponse
-## BGP
+### Logs
Types:
```python
-from cloudflare.types.radar import BGPTimeseriesResponse
+from cloudflare.types.radar.ct import LogListResponse, LogGetResponse
```
Methods:
-- client.radar.bgp.timeseries(\*\*params) -> BGPTimeseriesResponse
-
-### Leaks
+- client.radar.ct.logs.list(\*\*params) -> LogListResponse
+- client.radar.ct.logs.get(log_slug, \*\*params) -> LogGetResponse
-#### Events
+## Annotations
Types:
```python
-from cloudflare.types.radar.bgp.leaks import EventListResponse
+from cloudflare.types.radar import AnnotationListResponse
```
Methods:
-- client.radar.bgp.leaks.events.list(\*\*params) -> SyncV4PagePagination[EventListResponse]
+- client.radar.annotations.list(\*\*params) -> AnnotationListResponse
-### Top
+### Outages
Types:
```python
-from cloudflare.types.radar.bgp import TopPrefixesResponse
+from cloudflare.types.radar.annotations import OutageGetResponse, OutageLocationsResponse
```
Methods:
-- client.radar.bgp.top.prefixes(\*\*params) -> TopPrefixesResponse
+- client.radar.annotations.outages.get(\*\*params) -> OutageGetResponse
+- client.radar.annotations.outages.locations(\*\*params) -> OutageLocationsResponse
+
+## BGP
+
+Types:
+
+```python
+from cloudflare.types.radar import BGPTimeseriesResponse
+```
+
+Methods:
+
+- client.radar.bgp.timeseries(\*\*params) -> BGPTimeseriesResponse
+
+### Leaks
+
+#### Events
+
+Types:
+
+```python
+from cloudflare.types.radar.bgp.leaks import EventListResponse
+```
+
+Methods:
+
+- client.radar.bgp.leaks.events.list(\*\*params) -> SyncV4PagePagination[EventListResponse]
+
+### Top
+
+Types:
+
+```python
+from cloudflare.types.radar.bgp import TopPrefixesResponse
+```
+
+Methods:
+
+- client.radar.bgp.top.prefixes(\*\*params) -> TopPrefixesResponse
#### Ases
@@ -7280,6 +7857,64 @@ Methods:
- client.radar.bgp.ips.timeseries(\*\*params) -> IPTimeseriesResponse
+### RPKI
+
+#### ASPA
+
+Types:
+
+```python
+from cloudflare.types.radar.bgp.rpki import (
+ ASPAChangesResponse,
+ ASPASnapshotResponse,
+ ASPATimeseriesResponse,
+)
+```
+
+Methods:
+
+- client.radar.bgp.rpki.aspa.changes(\*\*params) -> ASPAChangesResponse
+- client.radar.bgp.rpki.aspa.snapshot(\*\*params) -> ASPASnapshotResponse
+- client.radar.bgp.rpki.aspa.timeseries(\*\*params) -> ASPATimeseriesResponse
+
+## Bots
+
+Types:
+
+```python
+from cloudflare.types.radar import (
+ BotListResponse,
+ BotGetResponse,
+ BotSummaryResponse,
+ BotTimeseriesResponse,
+ BotTimeseriesGroupsResponse,
+)
+```
+
+Methods:
+
+- client.radar.bots.list(\*\*params) -> BotListResponse
+- client.radar.bots.get(bot_slug, \*\*params) -> BotGetResponse
+- client.radar.bots.summary(dimension, \*\*params) -> BotSummaryResponse
+- client.radar.bots.timeseries(\*\*params) -> BotTimeseriesResponse
+- client.radar.bots.timeseries_groups(dimension, \*\*params) -> BotTimeseriesGroupsResponse
+
+### WebCrawlers
+
+Types:
+
+```python
+from cloudflare.types.radar.bots import (
+ WebCrawlerSummaryResponse,
+ WebCrawlerTimeseriesGroupsResponse,
+)
+```
+
+Methods:
+
+- client.radar.bots.web_crawlers.summary(dimension, \*\*params) -> WebCrawlerSummaryResponse
+- client.radar.bots.web_crawlers.timeseries_groups(dimension, \*\*params) -> WebCrawlerTimeseriesGroupsResponse
+
## Datasets
Types:
@@ -7299,12 +7934,18 @@ Methods:
Types:
```python
-from cloudflare.types.radar import DNSTimeseriesResponse
+from cloudflare.types.radar import (
+ DNSSummaryV2Response,
+ DNSTimeseriesResponse,
+ DNSTimeseriesGroupsV2Response,
+)
```
Methods:
+- client.radar.dns.summary_v2(dimension, \*\*params) -> DNSSummaryV2Response
- client.radar.dns.timeseries(\*\*params) -> DNSTimeseriesResponse
+- client.radar.dns.timeseries_groups_v2(dimension, \*\*params) -> DNSTimeseriesGroupsV2Response
### Top
@@ -7383,18 +8024,25 @@ Methods:
- client.radar.dns.timeseries_groups.response_code(\*\*params) -> TimeseriesGroupResponseCodeResponse
- client.radar.dns.timeseries_groups.response_ttl(\*\*params) -> TimeseriesGroupResponseTTLResponse
-## Netflows
+## NetFlows
Types:
```python
-from cloudflare.types.radar import NetflowSummaryResponse, NetflowTimeseriesResponse
+from cloudflare.types.radar import (
+ NetFlowsSummaryResponse,
+ NetFlowsSummaryV2Response,
+ NetFlowsTimeseriesResponse,
+ NetFlowsTimeseriesGroupsResponse,
+)
```
Methods:
-- client.radar.netflows.summary(\*\*params) -> NetflowSummaryResponse
-- client.radar.netflows.timeseries(\*\*params) -> NetflowTimeseriesResponse
+- client.radar.netflows.summary(\*\*params) -> NetFlowsSummaryResponse
+- client.radar.netflows.summary_v2(dimension, \*\*params) -> NetFlowsSummaryV2Response
+- client.radar.netflows.timeseries(\*\*params) -> NetFlowsTimeseriesResponse
+- client.radar.netflows.timeseries_groups(dimension, \*\*params) -> NetFlowsTimeseriesGroupsResponse
### Top
@@ -7441,12 +8089,18 @@ Methods:
Types:
```python
-from cloudflare.types.radar import AS112TimeseriesResponse
+from cloudflare.types.radar import (
+ AS112SummaryV2Response,
+ AS112TimeseriesResponse,
+ AS112TimeseriesGroupsV2Response,
+)
```
Methods:
+- client.radar.as112.summary_v2(dimension, \*\*params) -> AS112SummaryV2Response
- client.radar.as112.timeseries(\*\*params) -> AS112TimeseriesResponse
+- client.radar.as112.timeseries_groups_v2(dimension, \*\*params) -> AS112TimeseriesGroupsV2Response
### Summary
@@ -7526,6 +8180,17 @@ from cloudflare.types.radar import RadarEmailSeries, RadarEmailSummary
### Routing
+Types:
+
+```python
+from cloudflare.types.radar.email import RoutingSummaryV2Response, RoutingTimeseriesGroupsV2Response
+```
+
+Methods:
+
+- client.radar.email.routing.summary_v2(dimension, \*\*params) -> RoutingSummaryV2Response
+- client.radar.email.routing.timeseries_groups_v2(dimension, \*\*params) -> RoutingTimeseriesGroupsV2Response
+
#### Summary
Types:
@@ -7576,19 +8241,33 @@ Methods:
### Security
+Types:
+
+```python
+from cloudflare.types.radar.email import (
+ SecuritySummaryV2Response,
+ SecurityTimeseriesGroupsV2Response,
+)
+```
+
+Methods:
+
+- client.radar.email.security.summary_v2(dimension, \*\*params) -> SecuritySummaryV2Response
+- client.radar.email.security.timeseries_groups_v2(dimension, \*\*params) -> SecurityTimeseriesGroupsV2Response
+
#### Top
-##### Tlds
+##### TLDs
Types:
```python
-from cloudflare.types.radar.email.security.top import TldGetResponse
+from cloudflare.types.radar.email.security.top import TLDGetResponse
```
Methods:
-- client.radar.email.security.top.tlds.get(\*\*params) -> TldGetResponse
+- client.radar.email.security.top.tlds.get(\*\*params) -> TLDGetResponse
###### Malicious
@@ -7693,12 +8372,18 @@ Methods:
Types:
```python
-from cloudflare.types.radar.attacks import Layer3TimeseriesResponse
+from cloudflare.types.radar.attacks import (
+ Layer3SummaryV2Response,
+ Layer3TimeseriesResponse,
+ Layer3TimeseriesGroupsV2Response,
+)
```
Methods:
+- client.radar.attacks.layer3.summary_v2(dimension, \*\*params) -> Layer3SummaryV2Response
- client.radar.attacks.layer3.timeseries(\*\*params) -> Layer3TimeseriesResponse
+- client.radar.attacks.layer3.timeseries_groups_v2(dimension, \*\*params) -> Layer3TimeseriesGroupsV2Response
#### Summary
@@ -7788,12 +8473,18 @@ Methods:
Types:
```python
-from cloudflare.types.radar.attacks import Layer7TimeseriesResponse
+from cloudflare.types.radar.attacks import (
+ Layer7SummaryV2Response,
+ Layer7TimeseriesResponse,
+ Layer7TimeseriesGroupsV2Response,
+)
```
Methods:
+- client.radar.attacks.layer7.summary_v2(dimension, \*\*params) -> Layer7SummaryV2Response
- client.radar.attacks.layer7.timeseries(\*\*params) -> Layer7TimeseriesResponse
+- client.radar.attacks.layer7.timeseries_groups_v2(dimension, \*\*params) -> Layer7TimeseriesGroupsV2Response
#### Summary
@@ -7909,6 +8600,7 @@ Types:
```python
from cloudflare.types.radar.entities import (
ASNListResponse,
+ ASNAsSetResponse,
ASNGetResponse,
ASNIPResponse,
ASNRelResponse,
@@ -7918,6 +8610,7 @@ from cloudflare.types.radar.entities import (
Methods:
- client.radar.entities.asns.list(\*\*params) -> ASNListResponse
+- client.radar.entities.asns.as_set(asn, \*\*params) -> ASNAsSetResponse
- client.radar.entities.asns.get(asn, \*\*params) -> ASNGetResponse
- client.radar.entities.asns.ip(\*\*params) -> ASNIPResponse
- client.radar.entities.asns.rel(asn, \*\*params) -> ASNRelResponse
@@ -7935,17 +8628,36 @@ Methods:
- client.radar.entities.locations.list(\*\*params) -> LocationListResponse
- client.radar.entities.locations.get(location, \*\*params) -> LocationGetResponse
+## Geolocations
+
+Types:
+
+```python
+from cloudflare.types.radar import GeolocationListResponse, GeolocationGetResponse
+```
+
+Methods:
+
+- client.radar.geolocations.list(\*\*params) -> GeolocationListResponse
+- client.radar.geolocations.get(geo_id, \*\*params) -> GeolocationGetResponse
+
## HTTP
Types:
```python
-from cloudflare.types.radar import HTTPTimeseriesResponse
+from cloudflare.types.radar import (
+ HTTPSummaryV2Response,
+ HTTPTimeseriesResponse,
+ HTTPTimeseriesGroupsV2Response,
+)
```
Methods:
+- client.radar.http.summary_v2(dimension, \*\*params) -> HTTPSummaryV2Response
- client.radar.http.timeseries(\*\*params) -> HTTPTimeseriesResponse
+- client.radar.http.timeseries_groups_v2(dimension, \*\*params) -> HTTPTimeseriesGroupsV2Response
### Locations
@@ -8388,6 +9100,20 @@ Methods:
## LeakedCredentials
+Types:
+
+```python
+from cloudflare.types.radar import (
+ LeakedCredentialSummaryV2Response,
+ LeakedCredentialTimeseriesGroupsV2Response,
+)
+```
+
+Methods:
+
+- client.radar.leaked_credentials.summary_v2(dimension, \*\*params) -> LeakedCredentialSummaryV2Response
+- client.radar.leaked_credentials.timeseries_groups_v2(dimension, \*\*params) -> LeakedCredentialTimeseriesGroupsV2Response
+
### Summary
Types:
@@ -8440,6 +9166,19 @@ Methods:
- client.bot_management.update(\*, zone_id, \*\*params) -> Optional[BotManagementUpdateResponse]
- client.bot_management.get(\*, zone_id) -> Optional[BotManagementGetResponse]
+# Fraud
+
+Types:
+
+```python
+from cloudflare.types.fraud import FraudSettings
+```
+
+Methods:
+
+- client.fraud.update(\*, zone_id, \*\*params) -> Optional[FraudSettings]
+- client.fraud.get(\*, zone_id) -> Optional[FraudSettings]
+
# OriginPostQuantumEncryption
Types:
@@ -8644,15 +9383,20 @@ Methods:
Types:
```python
-from cloudflare.types.snippets import Snippet, SnippetDeleteResponse
+from cloudflare.types.snippets import (
+ SnippetUpdateResponse,
+ SnippetListResponse,
+ SnippetDeleteResponse,
+ SnippetGetResponse,
+)
```
Methods:
-- client.snippets.update(snippet_name, \*, zone_id, \*\*params) -> Optional[Snippet]
-- client.snippets.list(\*, zone_id) -> SyncSinglePage[Snippet]
-- client.snippets.delete(snippet_name, \*, zone_id) -> SnippetDeleteResponse
-- client.snippets.get(snippet_name, \*, zone_id) -> Optional[Snippet]
+- client.snippets.update(snippet_name, \*, zone_id, \*\*params) -> SnippetUpdateResponse
+- client.snippets.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[SnippetListResponse]
+- client.snippets.delete(snippet_name, \*, zone_id) -> str
+- client.snippets.get(snippet_name, \*, zone_id) -> SnippetGetResponse
## Content
@@ -8672,7 +9416,218 @@ Methods:
- client.snippets.rules.update(\*, zone_id, \*\*params) -> SyncSinglePage[RuleUpdateResponse]
- client.snippets.rules.list(\*, zone_id) -> SyncSinglePage[RuleListResponse]
-- client.snippets.rules.delete(\*, zone_id) -> RuleDeleteResponse
+- client.snippets.rules.delete(\*, zone_id) -> SyncSinglePage[RuleDeleteResponse]
+
+# RealtimeKit
+
+## Apps
+
+Types:
+
+```python
+from cloudflare.types.realtime_kit import AppGetResponse, AppPostResponse
+```
+
+Methods:
+
+- client.realtime_kit.apps.get(\*, account_id) -> AppGetResponse
+- client.realtime_kit.apps.post(\*, account_id, \*\*params) -> AppPostResponse
+
+## Meetings
+
+Types:
+
+```python
+from cloudflare.types.realtime_kit import (
+ MeetingCreateResponse,
+ MeetingAddParticipantResponse,
+ MeetingDeleteMeetingParticipantResponse,
+ MeetingEditParticipantResponse,
+ MeetingGetResponse,
+ MeetingGetMeetingByIDResponse,
+ MeetingGetMeetingParticipantResponse,
+ MeetingGetMeetingParticipantsResponse,
+ MeetingRefreshParticipantTokenResponse,
+ MeetingReplaceMeetingByIDResponse,
+ MeetingUpdateMeetingByIDResponse,
+)
+```
+
+Methods:
+
+- client.realtime_kit.meetings.create(app_id, \*, account_id, \*\*params) -> MeetingCreateResponse
+- client.realtime_kit.meetings.add_participant(meeting_id, \*, account_id, app_id, \*\*params) -> MeetingAddParticipantResponse
+- client.realtime_kit.meetings.delete_meeting_participant(participant_id, \*, account_id, app_id, meeting_id) -> MeetingDeleteMeetingParticipantResponse
+- client.realtime_kit.meetings.edit_participant(participant_id, \*, account_id, app_id, meeting_id, \*\*params) -> MeetingEditParticipantResponse
+- client.realtime_kit.meetings.get(app_id, \*, account_id, \*\*params) -> MeetingGetResponse
+- client.realtime_kit.meetings.get_meeting_by_id(meeting_id, \*, account_id, app_id, \*\*params) -> MeetingGetMeetingByIDResponse
+- client.realtime_kit.meetings.get_meeting_participant(participant_id, \*, account_id, app_id, meeting_id) -> MeetingGetMeetingParticipantResponse
+- client.realtime_kit.meetings.get_meeting_participants(meeting_id, \*, account_id, app_id, \*\*params) -> MeetingGetMeetingParticipantsResponse
+- client.realtime_kit.meetings.refresh_participant_token(participant_id, \*, account_id, app_id, meeting_id) -> MeetingRefreshParticipantTokenResponse
+- client.realtime_kit.meetings.replace_meeting_by_id(meeting_id, \*, account_id, app_id, \*\*params) -> MeetingReplaceMeetingByIDResponse
+- client.realtime_kit.meetings.update_meeting_by_id(meeting_id, \*, account_id, app_id, \*\*params) -> MeetingUpdateMeetingByIDResponse
+
+## Presets
+
+Types:
+
+```python
+from cloudflare.types.realtime_kit import (
+ PresetCreateResponse,
+ PresetUpdateResponse,
+ PresetDeleteResponse,
+ PresetGetResponse,
+ PresetGetPresetByIDResponse,
+)
+```
+
+Methods:
+
+- client.realtime_kit.presets.create(app_id, \*, account_id, \*\*params) -> PresetCreateResponse
+- client.realtime_kit.presets.update(preset_id, \*, account_id, app_id, \*\*params) -> PresetUpdateResponse
+- client.realtime_kit.presets.delete(preset_id, \*, account_id, app_id) -> PresetDeleteResponse
+- client.realtime_kit.presets.get(app_id, \*, account_id, \*\*params) -> PresetGetResponse
+- client.realtime_kit.presets.get_preset_by_id(preset_id, \*, account_id, app_id) -> PresetGetPresetByIDResponse
+
+## Sessions
+
+Types:
+
+```python
+from cloudflare.types.realtime_kit import (
+ SessionGetParticipantDataFromPeerIDResponse,
+ SessionGetSessionChatResponse,
+ SessionGetSessionDetailsResponse,
+ SessionGetSessionParticipantDetailsResponse,
+ SessionGetSessionParticipantsResponse,
+ SessionGetSessionSummaryResponse,
+ SessionGetSessionTranscriptsResponse,
+ SessionGetSessionsResponse,
+)
+```
+
+Methods:
+
+- client.realtime_kit.sessions.generate_summary_of_transcripts(session_id, \*, account_id, app_id) -> None
+- client.realtime_kit.sessions.get_participant_data_from_peer_id(peer_id, \*, account_id, app_id, \*\*params) -> SessionGetParticipantDataFromPeerIDResponse
+- client.realtime_kit.sessions.get_session_chat(session_id, \*, account_id, app_id) -> SessionGetSessionChatResponse
+- client.realtime_kit.sessions.get_session_details(session_id, \*, account_id, app_id, \*\*params) -> SessionGetSessionDetailsResponse
+- client.realtime_kit.sessions.get_session_participant_details(participant_id, \*, account_id, app_id, session_id, \*\*params) -> SessionGetSessionParticipantDetailsResponse
+- client.realtime_kit.sessions.get_session_participants(session_id, \*, account_id, app_id, \*\*params) -> SessionGetSessionParticipantsResponse
+- client.realtime_kit.sessions.get_session_summary(session_id, \*, account_id, app_id) -> SessionGetSessionSummaryResponse
+- client.realtime_kit.sessions.get_session_transcripts(session_id, \*, account_id, app_id) -> SessionGetSessionTranscriptsResponse
+- client.realtime_kit.sessions.get_sessions(app_id, \*, account_id, \*\*params) -> SessionGetSessionsResponse
+
+## Recordings
+
+Types:
+
+```python
+from cloudflare.types.realtime_kit import (
+ RecordingGetActiveRecordingsResponse,
+ RecordingGetOneRecordingResponse,
+ RecordingGetRecordingsResponse,
+ RecordingPauseResumeStopRecordingResponse,
+ RecordingStartRecordingsResponse,
+)
+```
+
+Methods:
+
+- client.realtime_kit.recordings.get_active_recordings(meeting_id, \*, account_id, app_id) -> RecordingGetActiveRecordingsResponse
+- client.realtime_kit.recordings.get_one_recording(recording_id, \*, account_id, app_id) -> RecordingGetOneRecordingResponse
+- client.realtime_kit.recordings.get_recordings(app_id, \*, account_id, \*\*params) -> RecordingGetRecordingsResponse
+- client.realtime_kit.recordings.pause_resume_stop_recording(recording_id, \*, account_id, app_id, \*\*params) -> RecordingPauseResumeStopRecordingResponse
+- client.realtime_kit.recordings.start_recordings(app_id, \*, account_id, \*\*params) -> RecordingStartRecordingsResponse
+- client.realtime_kit.recordings.start_track_recording(app_id, \*, account_id, \*\*params) -> None
+
+## Webhooks
+
+Types:
+
+```python
+from cloudflare.types.realtime_kit import (
+ WebhookCreateWebhookResponse,
+ WebhookDeleteWebhookResponse,
+ WebhookEditWebhookResponse,
+ WebhookGetWebhookByIDResponse,
+ WebhookGetWebhooksResponse,
+ WebhookReplaceWebhookResponse,
+)
+```
+
+Methods:
+
+- client.realtime_kit.webhooks.create_webhook(app_id, \*, account_id, \*\*params) -> WebhookCreateWebhookResponse
+- client.realtime_kit.webhooks.delete_webhook(webhook_id, \*, account_id, app_id) -> WebhookDeleteWebhookResponse
+- client.realtime_kit.webhooks.edit_webhook(webhook_id, \*, account_id, app_id, \*\*params) -> WebhookEditWebhookResponse
+- client.realtime_kit.webhooks.get_webhook_by_id(webhook_id, \*, account_id, app_id) -> WebhookGetWebhookByIDResponse
+- client.realtime_kit.webhooks.get_webhooks(app_id, \*, account_id) -> WebhookGetWebhooksResponse
+- client.realtime_kit.webhooks.replace_webhook(webhook_id, \*, account_id, app_id, \*\*params) -> WebhookReplaceWebhookResponse
+
+## ActiveSession
+
+Types:
+
+```python
+from cloudflare.types.realtime_kit import (
+ ActiveSessionCreatePollResponse,
+ ActiveSessionGetActiveSessionResponse,
+ ActiveSessionKickAllParticipantsResponse,
+ ActiveSessionKickParticipantsResponse,
+)
+```
+
+Methods:
+
+- client.realtime_kit.active_session.create_poll(meeting_id, \*, account_id, app_id, \*\*params) -> ActiveSessionCreatePollResponse
+- client.realtime_kit.active_session.get_active_session(meeting_id, \*, account_id, app_id) -> ActiveSessionGetActiveSessionResponse
+- client.realtime_kit.active_session.kick_all_participants(meeting_id, \*, account_id, app_id) -> ActiveSessionKickAllParticipantsResponse
+- client.realtime_kit.active_session.kick_participants(meeting_id, \*, account_id, app_id, \*\*params) -> ActiveSessionKickParticipantsResponse
+
+## Livestreams
+
+Types:
+
+```python
+from cloudflare.types.realtime_kit import (
+ LivestreamCreateIndependentLivestreamResponse,
+ LivestreamGetActiveLivestreamsForLivestreamIDResponse,
+ LivestreamGetAllLivestreamsResponse,
+ LivestreamGetLivestreamAnalyticsCompleteResponse,
+ LivestreamGetLivestreamSessionDetailsForSessionIDResponse,
+ LivestreamGetLivestreamSessionForLivestreamIDResponse,
+ LivestreamGetMeetingActiveLivestreamsResponse,
+ LivestreamGetOrgAnalyticsResponse,
+ LivestreamStartLivestreamingAMeetingResponse,
+ LivestreamStopLivestreamingAMeetingResponse,
+)
+```
+
+Methods:
+
+- client.realtime_kit.livestreams.create_independent_livestream(app_id, \*, account_id, \*\*params) -> LivestreamCreateIndependentLivestreamResponse
+- client.realtime_kit.livestreams.get_active_livestreams_for_livestream_id(livestream_id, \*, account_id, app_id) -> LivestreamGetActiveLivestreamsForLivestreamIDResponse
+- client.realtime_kit.livestreams.get_all_livestreams(app_id, \*, account_id, \*\*params) -> LivestreamGetAllLivestreamsResponse
+- client.realtime_kit.livestreams.get_livestream_analytics_complete(app_id, \*, account_id, \*\*params) -> LivestreamGetLivestreamAnalyticsCompleteResponse
+- client.realtime_kit.livestreams.get_livestream_session_details_for_session_id(livestream_session_id, \*, account_id, app_id) -> LivestreamGetLivestreamSessionDetailsForSessionIDResponse
+- client.realtime_kit.livestreams.get_livestream_session_for_livestream_id(livestream_id, \*, account_id, app_id, \*\*params) -> LivestreamGetLivestreamSessionForLivestreamIDResponse
+- client.realtime_kit.livestreams.get_meeting_active_livestreams(meeting_id, \*, account_id, app_id) -> LivestreamGetMeetingActiveLivestreamsResponse
+- client.realtime_kit.livestreams.get_org_analytics(app_id, \*, account_id, \*\*params) -> LivestreamGetOrgAnalyticsResponse
+- client.realtime_kit.livestreams.start_livestreaming_a_meeting(meeting_id, \*, account_id, app_id, \*\*params) -> LivestreamStartLivestreamingAMeetingResponse
+- client.realtime_kit.livestreams.stop_livestreaming_a_meeting(meeting_id, \*, account_id, app_id) -> LivestreamStopLivestreamingAMeetingResponse
+
+## Analytics
+
+Types:
+
+```python
+from cloudflare.types.realtime_kit import AnalyticsGetOrgAnalyticsResponse
+```
+
+Methods:
+
+- client.realtime_kit.analytics.get_org_analytics(app_id, \*, account_id, \*\*params) -> AnalyticsGetOrgAnalyticsResponse
# Calls
@@ -8714,7 +9669,7 @@ from cloudflare.types.calls import (
Methods:
-- client.calls.turn.create(\*, account_id, \*\*params) -> TURNCreateResponse
+- client.calls.turn.create(\*, account_id, \*\*params) -> Optional[TURNCreateResponse]
- client.calls.turn.update(key_id, \*, account_id, \*\*params) -> Optional[TURNUpdateResponse]
- client.calls.turn.list(\*, account_id) -> SyncSinglePage[TURNListResponse]
- client.calls.turn.delete(key_id, \*, account_id) -> Optional[TURNDeleteResponse]
@@ -8755,6 +9710,19 @@ Methods:
- client.cloudforce_one.scans.config.delete(config_id, \*, account_id) -> object
- client.cloudforce_one.scans.config.edit(config_id, \*, account_id, \*\*params) -> Optional[ConfigEditResponse]
+## BinaryStorage
+
+Types:
+
+```python
+from cloudflare.types.cloudforce_one import BinaryStorageCreateResponse
+```
+
+Methods:
+
+- client.cloudforce_one.binary_storage.create(\*, account_id, \*\*params) -> BinaryStorageCreateResponse
+- client.cloudforce_one.binary_storage.get(hash, \*, account_id) -> None
+
## Requests
Types:
@@ -8872,7 +9840,7 @@ from cloudflare.types.cloudforce_one.threat_events import AttackerListResponse
Methods:
-- client.cloudforce_one.threat_events.attackers.list(\*, account_id) -> AttackerListResponse
+- client.cloudforce_one.threat_events.attackers.list(\*, account_id, \*\*params) -> AttackerListResponse
### Categories
@@ -8891,7 +9859,7 @@ from cloudflare.types.cloudforce_one.threat_events import (
Methods:
- client.cloudforce_one.threat_events.categories.create(\*, account_id, \*\*params) -> CategoryCreateResponse
-- client.cloudforce_one.threat_events.categories.list(\*, account_id) -> CategoryListResponse
+- client.cloudforce_one.threat_events.categories.list(\*, account_id, \*\*params) -> CategoryListResponse
- client.cloudforce_one.threat_events.categories.delete(category_id, \*, account_id) -> CategoryDeleteResponse
- client.cloudforce_one.threat_events.categories.edit(category_id, \*, account_id, \*\*params) -> CategoryEditResponse
- client.cloudforce_one.threat_events.categories.get(category_id, \*, account_id) -> CategoryGetResponse
@@ -8908,19 +9876,6 @@ Methods:
- client.cloudforce_one.threat_events.countries.list(\*, account_id) -> CountryListResponse
-### Crons
-
-Types:
-
-```python
-from cloudflare.types.cloudforce_one.threat_events import CronListResponse, CronEditResponse
-```
-
-Methods:
-
-- client.cloudforce_one.threat_events.crons.list(\*, account_id) -> CronListResponse
-- client.cloudforce_one.threat_events.crons.edit(\*, account_id) -> CronEditResponse
-
### Datasets
Types:
@@ -8943,18 +9898,6 @@ Methods:
- client.cloudforce_one.threat_events.datasets.get(dataset_id, \*, account_id) -> DatasetGetResponse
- client.cloudforce_one.threat_events.datasets.raw(event_id, \*, account_id, dataset_id) -> DatasetRawResponse
-#### Health
-
-Types:
-
-```python
-from cloudflare.types.cloudforce_one.threat_events.datasets import HealthGetResponse
-```
-
-Methods:
-
-- client.cloudforce_one.threat_events.datasets.health.get(dataset_id, \*, account_id) -> HealthGetResponse
-
### IndicatorTypes
Types:
@@ -9030,27 +9973,7 @@ from cloudflare.types.cloudforce_one.threat_events import TargetIndustryListResp
Methods:
-- client.cloudforce_one.threat_events.target_industries.list(\*, account_id) -> TargetIndustryListResponse
-
-### Insights
-
-Types:
-
-```python
-from cloudflare.types.cloudforce_one.threat_events import (
- InsightCreateResponse,
- InsightDeleteResponse,
- InsightEditResponse,
- InsightGetResponse,
-)
-```
-
-Methods:
-
-- client.cloudforce_one.threat_events.insights.create(event_id, \*, account_id, \*\*params) -> InsightCreateResponse
-- client.cloudforce_one.threat_events.insights.delete(insight_id, \*, account_id, event_id) -> InsightDeleteResponse
-- client.cloudforce_one.threat_events.insights.edit(insight_id, \*, account_id, event_id, \*\*params) -> InsightEditResponse
-- client.cloudforce_one.threat_events.insights.get(insight_id, \*, account_id, event_id) -> InsightGetResponse
+- client.cloudforce_one.threat_events.target_industries.list(\*, account_id, \*\*params) -> TargetIndustryListResponse
# AIGateway
@@ -9145,6 +10068,51 @@ Methods:
- client.ai_gateway.evaluations.delete(id, \*, account_id, gateway_id) -> EvaluationDeleteResponse
- client.ai_gateway.evaluations.get(id, \*, account_id, gateway_id) -> EvaluationGetResponse
+## DynamicRouting
+
+Types:
+
+```python
+from cloudflare.types.ai_gateway import (
+ DynamicRoutingCreateResponse,
+ DynamicRoutingUpdateResponse,
+ DynamicRoutingListResponse,
+ DynamicRoutingDeleteResponse,
+ DynamicRoutingCreateDeploymentResponse,
+ DynamicRoutingCreateVersionResponse,
+ DynamicRoutingGetResponse,
+ DynamicRoutingGetVersionResponse,
+ DynamicRoutingListDeploymentsResponse,
+ DynamicRoutingListVersionsResponse,
+)
+```
+
+Methods:
+
+- client.ai_gateway.dynamic_routing.create(gateway_id, \*, account_id, \*\*params) -> DynamicRoutingCreateResponse
+- client.ai_gateway.dynamic_routing.update(id, \*, account_id, gateway_id, \*\*params) -> DynamicRoutingUpdateResponse
+- client.ai_gateway.dynamic_routing.list(gateway_id, \*, account_id) -> DynamicRoutingListResponse
+- client.ai_gateway.dynamic_routing.delete(id, \*, account_id, gateway_id) -> DynamicRoutingDeleteResponse
+- client.ai_gateway.dynamic_routing.create_deployment(id, \*, account_id, gateway_id, \*\*params) -> DynamicRoutingCreateDeploymentResponse
+- client.ai_gateway.dynamic_routing.create_version(id, \*, account_id, gateway_id, \*\*params) -> DynamicRoutingCreateVersionResponse
+- client.ai_gateway.dynamic_routing.get(id, \*, account_id, gateway_id) -> DynamicRoutingGetResponse
+- client.ai_gateway.dynamic_routing.get_version(version_id, \*, account_id, gateway_id, id) -> DynamicRoutingGetVersionResponse
+- client.ai_gateway.dynamic_routing.list_deployments(id, \*, account_id, gateway_id) -> DynamicRoutingListDeploymentsResponse
+- client.ai_gateway.dynamic_routing.list_versions(id, \*, account_id, gateway_id) -> DynamicRoutingListVersionsResponse
+
+## ProviderConfigs
+
+Types:
+
+```python
+from cloudflare.types.ai_gateway import ProviderConfigCreateResponse, ProviderConfigListResponse
+```
+
+Methods:
+
+- client.ai_gateway.provider_configs.create(gateway_id, \*, account_id, \*\*params) -> ProviderConfigCreateResponse
+- client.ai_gateway.provider_configs.list(gateway_id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[ProviderConfigListResponse]
+
## URLs
Types:
@@ -9170,7 +10138,7 @@ from cloudflare.types.iam import PermissionGroupListResponse, PermissionGroupGet
Methods:
- client.iam.permission_groups.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[PermissionGroupListResponse]
-- client.iam.permission_groups.get(permission_group_id, \*, account_id) -> PermissionGroupGetResponse
+- client.iam.permission_groups.get(permission_group_id, \*, account_id) -> Optional[PermissionGroupGetResponse]
## ResourceGroups
@@ -9188,11 +10156,11 @@ from cloudflare.types.iam import (
Methods:
-- client.iam.resource_groups.create(\*, account_id, \*\*params) -> ResourceGroupCreateResponse
-- client.iam.resource_groups.update(resource_group_id, \*, account_id, \*\*params) -> ResourceGroupUpdateResponse
-- client.iam.resource_groups.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[ResourceGroupListResponse]
+- client.iam.resource_groups.create(\*, account_id, \*\*params) -> Optional[ResourceGroupCreateResponse]
+- client.iam.resource_groups.update(resource_group_id, \*, account_id, \*\*params) -> Optional[ResourceGroupUpdateResponse]
+- client.iam.resource_groups.list(\*, account_id, \*\*params) -> SyncSinglePage[ResourceGroupListResponse]
- client.iam.resource_groups.delete(resource_group_id, \*, account_id) -> Optional[ResourceGroupDeleteResponse]
-- client.iam.resource_groups.get(resource_group_id, \*, account_id) -> ResourceGroupGetResponse
+- client.iam.resource_groups.get(resource_group_id, \*, account_id) -> Optional[ResourceGroupGetResponse]
## UserGroups
@@ -9236,6 +10204,30 @@ Methods:
- client.iam.user_groups.members.list(user_group_id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[MemberListResponse]
- client.iam.user_groups.members.delete(member_id, \*, account_id, user_group_id) -> Optional[MemberDeleteResponse]
+## SSO
+
+Types:
+
+```python
+from cloudflare.types.iam import (
+ SSOCreateResponse,
+ SSOUpdateResponse,
+ SSOListResponse,
+ SSODeleteResponse,
+ SSOBeginVerificationResponse,
+ SSOGetResponse,
+)
+```
+
+Methods:
+
+- client.iam.sso.create(\*, account_id, \*\*params) -> Optional[SSOCreateResponse]
+- client.iam.sso.update(sso_connector_id, \*, account_id, \*\*params) -> Optional[SSOUpdateResponse]
+- client.iam.sso.list(\*, account_id) -> SyncSinglePage[SSOListResponse]
+- client.iam.sso.delete(sso_connector_id, \*, account_id) -> Optional[SSODeleteResponse]
+- client.iam.sso.begin_verification(sso_connector_id, \*, account_id) -> SSOBeginVerificationResponse
+- client.iam.sso.get(sso_connector_id, \*, account_id) -> Optional[SSOGetResponse]
+
# CloudConnector
## Rules
@@ -9390,7 +10382,7 @@ Methods:
- client.resource_sharing.update(share_id, \*, account_id, \*\*params) -> Optional[ResourceSharingUpdateResponse]
- client.resource_sharing.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[ResourceSharingListResponse]
- client.resource_sharing.delete(share_id, \*, account_id) -> Optional[ResourceSharingDeleteResponse]
-- client.resource_sharing.get(share_id, \*, account_id) -> Optional[ResourceSharingGetResponse]
+- client.resource_sharing.get(share_id, \*, account_id, \*\*params) -> Optional[ResourceSharingGetResponse]
## Recipients
@@ -9410,7 +10402,7 @@ Methods:
- client.resource_sharing.recipients.create(share_id, \*, path_account_id, \*\*params) -> Optional[RecipientCreateResponse]
- client.resource_sharing.recipients.list(share_id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[RecipientListResponse]
- client.resource_sharing.recipients.delete(recipient_id, \*, account_id, share_id) -> Optional[RecipientDeleteResponse]
-- client.resource_sharing.recipients.get(recipient_id, \*, account_id, share_id) -> Optional[RecipientGetResponse]
+- client.resource_sharing.recipients.get(recipient_id, \*, account_id, share_id, \*\*params) -> Optional[RecipientGetResponse]
## Resources
@@ -9459,6 +10451,7 @@ from cloudflare.types.leaked_credential_checks import (
DetectionCreateResponse,
DetectionUpdateResponse,
DetectionListResponse,
+ DetectionGetResponse,
)
```
@@ -9468,13 +10461,27 @@ Methods:
- client.leaked_credential_checks.detections.update(detection_id, \*, zone_id, \*\*params) -> DetectionUpdateResponse
- client.leaked_credential_checks.detections.list(\*, zone_id) -> SyncSinglePage[DetectionListResponse]
- client.leaked_credential_checks.detections.delete(detection_id, \*, zone_id) -> object
+- client.leaked_credential_checks.detections.get(detection_id, \*, zone_id) -> DetectionGetResponse
# ContentScanning
+Types:
+
+```python
+from cloudflare.types.content_scanning import (
+ ContentScanningCreateResponse,
+ ContentScanningUpdateResponse,
+ ContentScanningGetResponse,
+)
+```
+
Methods:
+- client.content_scanning.create(\*, zone_id, \*\*params) -> ContentScanningCreateResponse
+- client.content_scanning.update(\*, zone_id, \*\*params) -> ContentScanningUpdateResponse
- client.content_scanning.disable(\*, zone_id) -> object
- client.content_scanning.enable(\*, zone_id) -> object
+- client.content_scanning.get(\*, zone_id) -> ContentScanningGetResponse
## Payloads
@@ -9511,12 +10518,31 @@ Methods:
Types:
```python
-from cloudflare.types.abuse_reports import AbuseReportCreateResponse
+from cloudflare.types.abuse_reports import (
+ AbuseReportCreateResponse,
+ AbuseReportListResponse,
+ AbuseReportGetResponse,
+)
+```
+
+Methods:
+
+- client.abuse_reports.create(report_param, \*, account_id, \*\*params) -> str
+- client.abuse_reports.list(\*, account_id, \*\*params) -> SyncV4PagePagination[Optional[AbuseReportListResponse]]
+- client.abuse_reports.get(report_param, \*, account_id) -> AbuseReportGetResponse
+
+## Mitigations
+
+Types:
+
+```python
+from cloudflare.types.abuse_reports import MitigationListResponse, MitigationReviewResponse
```
Methods:
-- client.abuse_reports.create(report_type, \*, account_id, \*\*params) -> str
+- client.abuse_reports.mitigations.list(report_id, \*, account_id, \*\*params) -> SyncV4PagePagination[Optional[MitigationListResponse]]
+- client.abuse_reports.mitigations.review(report_id, \*, account_id, \*\*params) -> SyncSinglePage[MitigationReviewResponse]
# AI
@@ -9591,6 +10617,104 @@ Methods:
- client.ai.models.schema.get(\*, account_id, \*\*params) -> object
+## ToMarkdown
+
+Types:
+
+```python
+from cloudflare.types.ai import ToMarkdownSupportedResponse, ToMarkdownTransformResponse
+```
+
+Methods:
+
+- client.ai.to_markdown.supported(\*, account_id) -> SyncSinglePage[ToMarkdownSupportedResponse]
+- client.ai.to_markdown.transform(\*, account_id, \*\*params) -> SyncSinglePage[ToMarkdownTransformResponse]
+
+# AISearch
+
+## Instances
+
+Types:
+
+```python
+from cloudflare.types.aisearch import (
+ InstanceCreateResponse,
+ InstanceUpdateResponse,
+ InstanceListResponse,
+ InstanceDeleteResponse,
+ InstanceChatCompletionsResponse,
+ InstanceReadResponse,
+ InstanceSearchResponse,
+ InstanceStatsResponse,
+)
+```
+
+Methods:
+
+- client.aisearch.instances.create(\*, account_id, \*\*params) -> InstanceCreateResponse
+- client.aisearch.instances.update(id, \*, account_id, \*\*params) -> InstanceUpdateResponse
+- client.aisearch.instances.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[InstanceListResponse]
+- client.aisearch.instances.delete(id, \*, account_id) -> InstanceDeleteResponse
+- client.aisearch.instances.chat_completions(id, \*, account_id, \*\*params) -> InstanceChatCompletionsResponse
+- client.aisearch.instances.read(id, \*, account_id) -> InstanceReadResponse
+- client.aisearch.instances.search(id, \*, account_id, \*\*params) -> InstanceSearchResponse
+- client.aisearch.instances.stats(id, \*, account_id) -> InstanceStatsResponse
+
+### Items
+
+Types:
+
+```python
+from cloudflare.types.aisearch.instances import ItemListResponse, ItemGetResponse
+```
+
+Methods:
+
+- client.aisearch.instances.items.list(id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[ItemListResponse]
+- client.aisearch.instances.items.get(item_id, \*, account_id, id) -> ItemGetResponse
+
+### Jobs
+
+Types:
+
+```python
+from cloudflare.types.aisearch.instances import (
+ JobCreateResponse,
+ JobListResponse,
+ JobGetResponse,
+ JobLogsResponse,
+)
+```
+
+Methods:
+
+- client.aisearch.instances.jobs.create(id, \*, account_id) -> JobCreateResponse
+- client.aisearch.instances.jobs.list(id, \*, account_id, \*\*params) -> SyncV4PagePaginationArray[JobListResponse]
+- client.aisearch.instances.jobs.get(job_id, \*, account_id, id) -> JobGetResponse
+- client.aisearch.instances.jobs.logs(job_id, \*, account_id, id, \*\*params) -> JobLogsResponse
+
+## Tokens
+
+Types:
+
+```python
+from cloudflare.types.aisearch import (
+ TokenCreateResponse,
+ TokenUpdateResponse,
+ TokenListResponse,
+ TokenDeleteResponse,
+ TokenReadResponse,
+)
+```
+
+Methods:
+
+- client.aisearch.tokens.create(\*, account_id, \*\*params) -> TokenCreateResponse
+- client.aisearch.tokens.update(id, \*, account_id, \*\*params) -> TokenUpdateResponse
+- client.aisearch.tokens.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[TokenListResponse]
+- client.aisearch.tokens.delete(id, \*, account_id) -> TokenDeleteResponse
+- client.aisearch.tokens.read(id, \*, account_id) -> TokenReadResponse
+
# SecurityCenter
## Insights
@@ -9739,13 +10863,17 @@ Methods:
Types:
```python
-from cloudflare.types.custom_pages import CustomPageUpdateResponse, CustomPageGetResponse
+from cloudflare.types.custom_pages import (
+ CustomPageUpdateResponse,
+ CustomPageListResponse,
+ CustomPageGetResponse,
+)
```
Methods:
- client.custom_pages.update(identifier, \*, account_id, zone_id, \*\*params) -> Optional[CustomPageUpdateResponse]
-- client.custom_pages.list(\*, account_id, zone_id) -> SyncSinglePage[object]
+- client.custom_pages.list(\*, account_id, zone_id) -> SyncSinglePage[CustomPageListResponse]
- client.custom_pages.get(identifier, \*, account_id, zone_id) -> Optional[CustomPageGetResponse]
# SecretsStore
@@ -9815,17 +10943,62 @@ from cloudflare.types.pipelines import (
PipelineCreateResponse,
PipelineUpdateResponse,
PipelineListResponse,
+ PipelineCreateV1Response,
PipelineGetResponse,
+ PipelineGetV1Response,
+ PipelineListV1Response,
+ PipelineValidateSqlResponse,
+)
+```
+
+Methods:
+
+- client.pipelines.create(\*, account_id, \*\*params) -> PipelineCreateResponse
+- client.pipelines.update(pipeline_name, \*, account_id, \*\*params) -> PipelineUpdateResponse
+- client.pipelines.list(\*, account_id, \*\*params) -> PipelineListResponse
+- client.pipelines.delete(pipeline_name, \*, account_id) -> None
+- client.pipelines.create_v1(\*, account_id, \*\*params) -> PipelineCreateV1Response
+- client.pipelines.delete_v1(pipeline_id, \*, account_id) -> None
+- client.pipelines.get(pipeline_name, \*, account_id) -> PipelineGetResponse
+- client.pipelines.get_v1(pipeline_id, \*, account_id) -> PipelineGetV1Response
+- client.pipelines.list_v1(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[PipelineListV1Response]
+- client.pipelines.validate_sql(\*, account_id, \*\*params) -> PipelineValidateSqlResponse
+
+## Sinks
+
+Types:
+
+```python
+from cloudflare.types.pipelines import SinkCreateResponse, SinkListResponse, SinkGetResponse
+```
+
+Methods:
+
+- client.pipelines.sinks.create(\*, account_id, \*\*params) -> SinkCreateResponse
+- client.pipelines.sinks.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[SinkListResponse]
+- client.pipelines.sinks.delete(sink_id, \*, account_id, \*\*params) -> None
+- client.pipelines.sinks.get(sink_id, \*, account_id) -> SinkGetResponse
+
+## Streams
+
+Types:
+
+```python
+from cloudflare.types.pipelines import (
+ StreamCreateResponse,
+ StreamUpdateResponse,
+ StreamListResponse,
+ StreamGetResponse,
)
```
Methods:
-- client.pipelines.create(\*, account_id, \*\*params) -> PipelineCreateResponse
-- client.pipelines.update(pipeline_name, \*, account_id, \*\*params) -> PipelineUpdateResponse
-- client.pipelines.list(\*, account_id, \*\*params) -> PipelineListResponse
-- client.pipelines.delete(pipeline_name, \*, account_id) -> None
-- client.pipelines.get(pipeline_name, \*, account_id) -> PipelineGetResponse
+- client.pipelines.streams.create(\*, account_id, \*\*params) -> StreamCreateResponse
+- client.pipelines.streams.update(stream_id, \*, account_id, \*\*params) -> StreamUpdateResponse
+- client.pipelines.streams.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[StreamListResponse]
+- client.pipelines.streams.delete(stream_id, \*, account_id, \*\*params) -> None
+- client.pipelines.streams.get(stream_id, \*, account_id) -> StreamGetResponse
# SchemaValidation
@@ -9834,22 +11007,16 @@ Methods:
Types:
```python
-from cloudflare.types.schema_validation import (
- SchemaCreateResponse,
- SchemaListResponse,
- SchemaDeleteResponse,
- SchemaEditResponse,
- SchemaGetResponse,
-)
+from cloudflare.types.schema_validation import PublicSchema, SchemaDeleteResponse
```
Methods:
-- client.schema_validation.schemas.create(\*, zone_id, \*\*params) -> SchemaCreateResponse
-- client.schema_validation.schemas.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[SchemaListResponse]
+- client.schema_validation.schemas.create(\*, zone_id, \*\*params) -> PublicSchema
+- client.schema_validation.schemas.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[PublicSchema]
- client.schema_validation.schemas.delete(schema_id, \*, zone_id) -> SchemaDeleteResponse
-- client.schema_validation.schemas.edit(schema_id, \*, zone_id, \*\*params) -> SchemaEditResponse
-- client.schema_validation.schemas.get(schema_id, \*, zone_id, \*\*params) -> SchemaGetResponse
+- client.schema_validation.schemas.edit(schema_id, \*, zone_id, \*\*params) -> PublicSchema
+- client.schema_validation.schemas.get(schema_id, \*, zone_id, \*\*params) -> PublicSchema
## Settings
@@ -9890,3 +11057,55 @@ Methods:
- client.schema_validation.settings.operations.delete(operation_id, \*, zone_id) -> OperationDeleteResponse
- client.schema_validation.settings.operations.bulk_edit(\*, zone_id, \*\*params) -> OperationBulkEditResponse
- client.schema_validation.settings.operations.get(operation_id, \*, zone_id) -> OperationGetResponse
+
+# TokenValidation
+
+## Configuration
+
+Types:
+
+```python
+from cloudflare.types.token_validation import (
+ TokenConfig,
+ ConfigurationDeleteResponse,
+ ConfigurationEditResponse,
+)
+```
+
+Methods:
+
+- client.token_validation.configuration.create(\*, zone_id, \*\*params) -> TokenConfig
+- client.token_validation.configuration.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[TokenConfig]
+- client.token_validation.configuration.delete(config_id, \*, zone_id) -> ConfigurationDeleteResponse
+- client.token_validation.configuration.edit(config_id, \*, zone_id, \*\*params) -> ConfigurationEditResponse
+- client.token_validation.configuration.get(config_id, \*, zone_id) -> TokenConfig
+
+### Credentials
+
+Types:
+
+```python
+from cloudflare.types.token_validation.configuration import CredentialUpdateResponse
+```
+
+Methods:
+
+- client.token_validation.configuration.credentials.update(config_id, \*, zone_id, \*\*params) -> CredentialUpdateResponse
+
+## Rules
+
+Types:
+
+```python
+from cloudflare.types.token_validation import TokenValidationRule
+```
+
+Methods:
+
+- client.token_validation.rules.create(\*, zone_id, \*\*params) -> TokenValidationRule
+- client.token_validation.rules.list(\*, zone_id, \*\*params) -> SyncV4PagePaginationArray[TokenValidationRule]
+- client.token_validation.rules.delete(rule_id, \*, zone_id) -> object
+- client.token_validation.rules.bulk_create(\*, zone_id, \*\*params) -> SyncSinglePage[TokenValidationRule]
+- client.token_validation.rules.bulk_edit(\*, zone_id, \*\*params) -> SyncSinglePage[TokenValidationRule]
+- client.token_validation.rules.edit(rule_id, \*, zone_id, \*\*params) -> TokenValidationRule
+- client.token_validation.rules.get(rule_id, \*, zone_id) -> TokenValidationRule
diff --git a/bin/check-release-environment b/bin/check-release-environment
index b659e91535b..b845b0f4c96 100644
--- a/bin/check-release-environment
+++ b/bin/check-release-environment
@@ -3,7 +3,7 @@
errors=()
if [ -z "${PYPI_TOKEN}" ]; then
- errors+=("The CLOUDFLARE_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
+ errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi
lenErrors=${#errors[@]}
diff --git a/examples/dns/record.py b/examples/dns/record.py
index 72b89316a58..87b3d4fd17a 100644
--- a/examples/dns/record.py
+++ b/examples/dns/record.py
@@ -14,6 +14,7 @@
type="A",
name="www.mydns.com",
content="198.51.100.1",
+ ttl=1,
proxied=True,
)
assert record is not None
diff --git a/examples/workers/script_upload.py b/examples/workers/script_upload.py
index 2343e0e33d2..d7a1cf5823d 100644
--- a/examples/workers/script_upload.py
+++ b/examples/workers/script_upload.py
@@ -26,7 +26,7 @@
import os
-from cloudflare import Cloudflare, BadRequestError
+from cloudflare import Cloudflare, APIStatusError
API_TOKEN = os.environ.get("CLOUDFLARE_API_TOKEN")
if API_TOKEN is None:
@@ -59,7 +59,7 @@ def main() -> None:
# https://developers.cloudflare.com/api/resources/workers/subresources/scripts/methods/update/
script = client.workers.scripts.update(
script_name,
- account_id=ACCOUNT_ID, # type: ignore
+ account_id=ACCOUNT_ID, # type: ignore
# https://developers.cloudflare.com/workers/configuration/multipart-upload-metadata/
metadata={
"main_module": script_file_name,
@@ -71,25 +71,27 @@ def main() -> None:
}
],
},
- files={
+ files=[
# Add main_module file
- script_file_name: (
+ # Note: Content-Type must be "application/javascript" or "text/javascript"
+ (
script_file_name,
bytes(script_content, "utf-8"),
- "application/javascript+module",
- )
+ "application/javascript",
+ ),
# Can add other files, such as more modules or source maps
- # source_map_file_name: (
- # source_map_file_name,
- # bytes(source_map_content, "utf-8"),
- # "application/source-map"
- #)
- },
+ # (
+ # source_map_file_name,
+ # bytes(source_map_content, "utf-8"),
+ # "application/source-map",
+ # ),
+ ],
)
print("Script Upload success!")
print(script.to_json(indent=2))
- except BadRequestError as err:
+ except APIStatusError as err:
print("Script Upload failure!")
+ print(f"Error code: {err.status_code}")
print(err)
diff --git a/mypy.ini b/mypy.ini
deleted file mode 100644
index e929ff8caa2..00000000000
--- a/mypy.ini
+++ /dev/null
@@ -1,50 +0,0 @@
-[mypy]
-pretty = True
-show_error_codes = True
-
-# Exclude _files.py because mypy isn't smart enough to apply
-# the correct type narrowing and as this is an internal module
-# it's fine to just use Pyright.
-#
-# We also exclude our `tests` as mypy doesn't always infer
-# types correctly and Pyright will still catch any type errors.
-exclude = ^(src/cloudflare/_files\.py|_dev/.*\.py|tests/.*|src/cloudflare/resources/zero_trust/identity_providers\.py|src/cloudflare/resources/zero_trust/access/applications/applications\.py|src/cloudflare/resources/workers/ai\.py|src/cloudflare/resources/magic_transit/apps\.py)$
-
-strict_equality = True
-implicit_reexport = True
-check_untyped_defs = True
-no_implicit_optional = True
-
-warn_return_any = True
-warn_unreachable = True
-warn_unused_configs = True
-
-# Turn these options off as it could cause conflicts
-# with the Pyright options.
-warn_unused_ignores = False
-warn_redundant_casts = False
-
-disallow_any_generics = True
-disallow_untyped_defs = True
-disallow_untyped_calls = True
-disallow_subclassing_any = True
-disallow_incomplete_defs = True
-disallow_untyped_decorators = True
-cache_fine_grained = True
-
-# By default, mypy reports an error if you assign a value to the result
-# of a function call that doesn't return anything. We do this in our test
-# cases:
-# ```
-# result = ...
-# assert result is None
-# ```
-# Changing this codegen to make mypy happy would increase complexity
-# and would not be worth it.
-disable_error_code = func-returns-value,overload-cannot-match
-
-# https://github.com/python/mypy/issues/12162
-[mypy.overrides]
-module = "black.files.*"
-ignore_errors = true
-ignore_missing_imports = true
diff --git a/pyproject.toml b/pyproject.toml
index b1f6854f5f6..3857b8c89e2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,29 +1,32 @@
[project]
name = "cloudflare"
-version = "4.3.1"
+version = "4.4.0"
description = "The official Python library for the cloudflare API"
dynamic = ["readme"]
license = "Apache-2.0"
authors = [
{ name = "Cloudflare", email = "api@cloudflare.com" },
]
+
dependencies = [
- "httpx>=0.23.0, <1",
- "pydantic>=1.9.0, <3",
- "typing-extensions>=4.10, <5",
- "anyio>=3.5.0, <5",
- "distro>=1.7.0, <2",
- "sniffio",
+ "httpx>=0.23.0, <1",
+ "pydantic>=1.9.0, <3",
+ "typing-extensions>=4.10, <5",
+ "anyio>=3.5.0, <5",
+ "distro>=1.7.0, <2",
+ "sniffio",
]
-requires-python = ">= 3.8"
+
+requires-python = ">= 3.9"
classifiers = [
"Typing :: Typed",
"Intended Audience :: Developers",
- "Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
+ "Programming Language :: Python :: 3.14",
"Operating System :: OS Independent",
"Operating System :: POSIX",
"Operating System :: MacOS",
@@ -37,13 +40,15 @@ classifiers = [
Homepage = "https://github.com/cloudflare/cloudflare-python"
Repository = "https://github.com/cloudflare/cloudflare-python"
+[project.optional-dependencies]
+aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"]
[tool.rye]
managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
"pyright==1.1.399",
- "mypy",
+ "mypy==1.17",
"respx",
"pytest",
"pytest-asyncio",
@@ -53,8 +58,8 @@ dev-dependencies = [
"dirty-equals>=0.6.0",
"importlib-metadata>=6.7.0",
"rich>=13.7.1",
- "nest_asyncio==1.6.0",
"pytest-xdist>=3.6.1",
+ "griffe>=1",
]
[tool.rye.scripts]
@@ -139,12 +144,13 @@ filterwarnings = [
# there are a couple of flags that are still disabled by
# default in strict mode as they are experimental and niche.
typeCheckingMode = "strict"
-pythonVersion = "3.8"
+pythonVersion = "3.9"
exclude = [
"_dev",
".venv",
".nox",
+ ".git",
]
reportImplicitOverride = true
@@ -153,10 +159,62 @@ reportOverlappingOverload = false
reportImportCycles = false
reportPrivateUsage = false
+[tool.mypy]
+pretty = true
+show_error_codes = true
+
+# Exclude _files.py because mypy isn't smart enough to apply
+# the correct type narrowing and as this is an internal module
+# it's fine to just use Pyright.
+#
+# We also exclude our `tests` as mypy doesn't always infer
+# types correctly and Pyright will still catch any type errors.
+exclude = ['src/cloudflare/_files.py', '_dev/.*.py', 'tests/.*', 'src/cloudflare/resources/zero_trust/identity_providers\.py', 'src/cloudflare/resources/zero_trust/access/applications/applications\.py', 'src/cloudflare/resources/workers/ai\.py', 'src/cloudflare/resources/magic_transit/apps\.py']
+
+strict_equality = true
+implicit_reexport = true
+check_untyped_defs = true
+no_implicit_optional = true
+
+warn_return_any = true
+warn_unreachable = true
+warn_unused_configs = true
+
+# Turn these options off as it could cause conflicts
+# with the Pyright options.
+warn_unused_ignores = false
+warn_redundant_casts = false
+
+disallow_any_generics = true
+disallow_untyped_defs = true
+disallow_untyped_calls = true
+disallow_subclassing_any = true
+disallow_incomplete_defs = true
+disallow_untyped_decorators = true
+cache_fine_grained = true
+
+# By default, mypy reports an error if you assign a value to the result
+# of a function call that doesn't return anything. We do this in our test
+# cases:
+# ```
+# result = ...
+# assert result is None
+# ```
+# Changing this codegen to make mypy happy would increase complexity
+# and would not be worth it.
+disable_error_code = "func-returns-value,overload-cannot-match"
+
+# https://github.com/python/mypy/issues/12162
+[[tool.mypy.overrides]]
+module = "black.files.*"
+ignore_errors = true
+ignore_missing_imports = true
+
+
[tool.ruff]
line-length = 120
output-format = "grouped"
-target-version = "py37"
+target-version = "py38"
[tool.ruff.format]
docstring-code-format = true
@@ -169,6 +227,8 @@ select = [
"B",
# remove unused imports
"F401",
+ # check for missing future annotations
+ "FA102",
# bare except statements
"E722",
# unused arguments
@@ -191,6 +251,8 @@ unfixable = [
"T203",
]
+extend-safe-fixes = ["FA102"]
+
[tool.ruff.lint.flake8-tidy-imports.banned-api]
"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead"
diff --git a/requirements-dev.lock b/requirements-dev.lock
index d30c3e08170..9fb207c1220 100644
--- a/requirements-dev.lock
+++ b/requirements-dev.lock
@@ -10,99 +10,143 @@
# universal: false
-e file:.
-annotated-types==0.6.0
+aiohappyeyeballs==2.6.1
+ # via aiohttp
+aiohttp==3.13.2
+ # via cloudflare
+ # via httpx-aiohttp
+aiosignal==1.4.0
+ # via aiohttp
+annotated-types==0.7.0
# via pydantic
-anyio==4.4.0
+anyio==4.12.0
# via cloudflare
# via httpx
-argcomplete==3.1.2
+argcomplete==3.6.3
+ # via nox
+async-timeout==5.0.1
+ # via aiohttp
+attrs==25.4.0
+ # via aiohttp
# via nox
-certifi==2023.7.22
+backports-asyncio-runner==1.2.0
+ # via pytest-asyncio
+certifi==2025.11.12
# via httpcore
# via httpx
-colorlog==6.7.0
+colorama==0.4.6
+ # via griffe
+colorlog==6.10.1
+ # via nox
+dependency-groups==1.3.1
# via nox
-dirty-equals==0.6.0
-distlib==0.3.7
+dirty-equals==0.11
+distlib==0.4.0
# via virtualenv
-distro==1.8.0
+distro==1.9.0
# via cloudflare
-exceptiongroup==1.2.2
+exceptiongroup==1.3.1
# via anyio
# via pytest
-execnet==2.1.1
+execnet==2.1.2
# via pytest-xdist
-filelock==3.12.4
+filelock==3.19.1
# via virtualenv
-h11==0.14.0
+frozenlist==1.8.0
+ # via aiohttp
+ # via aiosignal
+griffe==1.14.0
+h11==0.16.0
# via httpcore
-httpcore==1.0.2
+httpcore==1.0.9
# via httpx
httpx==0.28.1
# via cloudflare
+ # via httpx-aiohttp
# via respx
-idna==3.4
+httpx-aiohttp==0.1.9
+ # via cloudflare
+humanize==4.13.0
+ # via nox
+idna==3.11
# via anyio
# via httpx
-importlib-metadata==7.0.0
-iniconfig==2.0.0
+ # via yarl
+importlib-metadata==8.7.0
+iniconfig==2.1.0
# via pytest
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
-mypy==1.14.1
-mypy-extensions==1.0.0
+multidict==6.7.0
+ # via aiohttp
+ # via yarl
+mypy==1.17.0
+mypy-extensions==1.1.0
# via mypy
-nest-asyncio==1.6.0
-nodeenv==1.8.0
+nodeenv==1.9.1
# via pyright
-nox==2023.4.22
-packaging==23.2
+nox==2025.11.12
+packaging==25.0
+ # via dependency-groups
# via nox
# via pytest
-platformdirs==3.11.0
+pathspec==0.12.1
+ # via mypy
+platformdirs==4.4.0
# via virtualenv
-pluggy==1.5.0
+pluggy==1.6.0
# via pytest
-pydantic==2.10.3
+propcache==0.4.1
+ # via aiohttp
+ # via yarl
+pydantic==2.12.5
# via cloudflare
-pydantic-core==2.27.1
+pydantic-core==2.41.5
# via pydantic
-pygments==2.18.0
+pygments==2.19.2
+ # via pytest
# via rich
pyright==1.1.399
-pytest==8.3.3
+pytest==8.4.2
# via pytest-asyncio
# via pytest-xdist
-pytest-asyncio==0.24.0
-pytest-xdist==3.7.0
-python-dateutil==2.8.2
+pytest-asyncio==1.2.0
+pytest-xdist==3.8.0
+python-dateutil==2.9.0.post0
# via time-machine
-pytz==2023.3.post1
- # via dirty-equals
respx==0.22.0
-rich==13.7.1
-ruff==0.9.4
-setuptools==68.2.2
- # via nodeenv
-six==1.16.0
+rich==14.2.0
+ruff==0.14.7
+six==1.17.0
# via python-dateutil
-sniffio==1.3.0
- # via anyio
+sniffio==1.3.1
# via cloudflare
-time-machine==2.9.0
-tomli==2.0.2
+time-machine==2.19.0
+tomli==2.3.0
+ # via dependency-groups
# via mypy
+ # via nox
# via pytest
-typing-extensions==4.12.2
+typing-extensions==4.15.0
+ # via aiosignal
# via anyio
# via cloudflare
+ # via exceptiongroup
+ # via multidict
# via mypy
# via pydantic
# via pydantic-core
# via pyright
-virtualenv==20.24.5
+ # via pytest-asyncio
+ # via typing-inspection
+ # via virtualenv
+typing-inspection==0.4.2
+ # via pydantic
+virtualenv==20.35.4
# via nox
-zipp==3.17.0
+yarl==1.22.0
+ # via aiohttp
+zipp==3.23.0
# via importlib-metadata
diff --git a/requirements.lock b/requirements.lock
index 4752e59fd63..c948e87d644 100644
--- a/requirements.lock
+++ b/requirements.lock
@@ -10,36 +10,67 @@
# universal: false
-e file:.
-annotated-types==0.6.0
+aiohappyeyeballs==2.6.1
+ # via aiohttp
+aiohttp==3.13.2
+ # via cloudflare
+ # via httpx-aiohttp
+aiosignal==1.4.0
+ # via aiohttp
+annotated-types==0.7.0
# via pydantic
-anyio==4.4.0
+anyio==4.12.0
# via cloudflare
# via httpx
-certifi==2023.7.22
+async-timeout==5.0.1
+ # via aiohttp
+attrs==25.4.0
+ # via aiohttp
+certifi==2025.11.12
# via httpcore
# via httpx
-distro==1.8.0
+distro==1.9.0
# via cloudflare
-exceptiongroup==1.2.2
+exceptiongroup==1.3.1
# via anyio
-h11==0.14.0
+frozenlist==1.8.0
+ # via aiohttp
+ # via aiosignal
+h11==0.16.0
# via httpcore
-httpcore==1.0.2
+httpcore==1.0.9
# via httpx
httpx==0.28.1
# via cloudflare
-idna==3.4
+ # via httpx-aiohttp
+httpx-aiohttp==0.1.9
+ # via cloudflare
+idna==3.11
# via anyio
# via httpx
-pydantic==2.10.3
+ # via yarl
+multidict==6.7.0
+ # via aiohttp
+ # via yarl
+propcache==0.4.1
+ # via aiohttp
+ # via yarl
+pydantic==2.12.5
# via cloudflare
-pydantic-core==2.27.1
+pydantic-core==2.41.5
# via pydantic
-sniffio==1.3.0
- # via anyio
+sniffio==1.3.1
# via cloudflare
-typing-extensions==4.12.2
+typing-extensions==4.15.0
+ # via aiosignal
# via anyio
# via cloudflare
+ # via exceptiongroup
+ # via multidict
# via pydantic
# via pydantic-core
+ # via typing-inspection
+typing-inspection==0.4.2
+ # via pydantic
+yarl==1.22.0
+ # via aiohttp
diff --git a/scripts/bootstrap b/scripts/bootstrap
index e84fe62c380..b430fee36d6 100755
--- a/scripts/bootstrap
+++ b/scripts/bootstrap
@@ -4,10 +4,18 @@ set -e
cd "$(dirname "$0")/.."
-if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then
+if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then
brew bundle check >/dev/null 2>&1 || {
- echo "==> Installing Homebrew dependencies…"
- brew bundle
+ echo -n "==> Install Homebrew dependencies? (y/N): "
+ read -r response
+ case "$response" in
+ [yY][eE][sS]|[yY])
+ brew bundle
+ ;;
+ *)
+ ;;
+ esac
+ echo
}
fi
diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes
new file mode 100755
index 00000000000..fb28f3a261a
--- /dev/null
+++ b/scripts/detect-breaking-changes
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+set -e
+
+cd "$(dirname "$0")/.."
+
+echo "==> Detecting breaking changes"
+
+TEST_PATHS=( tests/api_resources tests/test_client.py tests/test_response.py )
+
+for PATHSPEC in "${TEST_PATHS[@]}"; do
+ # Try to check out previous versions of the test files
+ # with the current SDK.
+ git checkout "$1" -- "${PATHSPEC}" 2>/dev/null || true
+done
+
+# Instead of running the tests, use the linter to check if an
+# older test is no longer compatible with the latest SDK.
+./scripts/lint
diff --git a/scripts/detect-breaking-changes.py b/scripts/detect-breaking-changes.py
new file mode 100644
index 00000000000..f8d81890b9b
--- /dev/null
+++ b/scripts/detect-breaking-changes.py
@@ -0,0 +1,79 @@
+from __future__ import annotations
+
+import sys
+from typing import Iterator
+from pathlib import Path
+
+import rich
+import griffe
+from rich.text import Text
+from rich.style import Style
+
+
+def public_members(obj: griffe.Object | griffe.Alias) -> dict[str, griffe.Object | griffe.Alias]:
+ if isinstance(obj, griffe.Alias):
+ # ignore imports for now, they're technically part of the public API
+ # but we don't have good preventative measures in place to prevent
+ # changing them
+ return {}
+
+ return {name: value for name, value in obj.all_members.items() if not name.startswith("_")}
+
+
+def find_breaking_changes(
+ new_obj: griffe.Object | griffe.Alias,
+ old_obj: griffe.Object | griffe.Alias,
+ *,
+ path: list[str],
+) -> Iterator[Text | str]:
+ new_members = public_members(new_obj)
+ old_members = public_members(old_obj)
+
+ for name, old_member in old_members.items():
+ if isinstance(old_member, griffe.Alias) and len(path) > 2:
+ # ignore imports in `/types/` for now, they're technically part of the public API
+ # but we don't have good preventative measures in place to prevent changing them
+ continue
+
+ new_member = new_members.get(name)
+ if new_member is None:
+ cls_name = old_member.__class__.__name__
+ yield Text(f"({cls_name})", style=Style(color="rgb(119, 119, 119)"))
+ yield from [" " for _ in range(10 - len(cls_name))]
+ yield f" {'.'.join(path)}.{name}"
+ yield "\n"
+ continue
+
+ yield from find_breaking_changes(new_member, old_member, path=[*path, name])
+
+
+def main() -> None:
+ try:
+ against_ref = sys.argv[1]
+ except IndexError as err:
+ raise RuntimeError("You must specify a base ref to run breaking change detection against") from err
+
+ package = griffe.load(
+ "cloudflare",
+ search_paths=[Path(__file__).parent.parent.joinpath("src")],
+ )
+ old_package = griffe.load_git(
+ "cloudflare",
+ ref=against_ref,
+ search_paths=["src"],
+ )
+ assert isinstance(package, griffe.Module)
+ assert isinstance(old_package, griffe.Module)
+
+ output = list(find_breaking_changes(package, old_package, path=["cloudflare"]))
+ if output:
+ rich.print(Text("Breaking changes detected!", style=Style(color="rgb(165, 79, 87)")))
+ rich.print()
+
+ for text in output:
+ rich.print(text, end="")
+
+ sys.exit(1)
+
+
+main()
diff --git a/scripts/lint b/scripts/lint
index 9ad76783d44..3c726986511 100755
--- a/scripts/lint
+++ b/scripts/lint
@@ -4,8 +4,13 @@ set -e
cd "$(dirname "$0")/.."
-echo "==> Running lints"
-rye run lint
+if [ "$1" = "--fix" ]; then
+ echo "==> Running lints with --fix"
+ rye run fix:ruff
+else
+ echo "==> Running lints"
+ rye run lint
+fi
echo "==> Making sure it imports"
rye run python -c 'import cloudflare'
diff --git a/scripts/mock b/scripts/mock
index d2814ae6a0c..0b28f6ea23d 100755
--- a/scripts/mock
+++ b/scripts/mock
@@ -21,7 +21,7 @@ echo "==> Starting mock server with URL ${URL}"
# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
- npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log &
+ npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
# Wait for server to come online
echo -n "Waiting for server"
@@ -37,5 +37,5 @@ if [ "$1" == "--daemon" ]; then
echo
else
- npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL"
+ npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
fi
diff --git a/scripts/test b/scripts/test
index 2b87845670b..dbeda2d2176 100755
--- a/scripts/test
+++ b/scripts/test
@@ -43,7 +43,7 @@ elif ! prism_is_running ; then
echo -e "To run the server, pass in the path or url of your OpenAPI"
echo -e "spec to the prism command:"
echo
- echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}"
+ echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
echo
exit 1
diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh
index 6ba857e8d3b..fc6462eccf8 100755
--- a/scripts/utils/upload-artifact.sh
+++ b/scripts/utils/upload-artifact.sh
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
set -exuo pipefail
-RESPONSE=$(curl -X POST "$URL" \
+FILENAME=$(basename dist/*.whl)
+
+RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \
-H "Authorization: Bearer $AUTH" \
-H "Content-Type: application/json")
@@ -12,13 +14,13 @@ if [[ "$SIGNED_URL" == "null" ]]; then
exit 1
fi
-UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
- -H "Content-Type: application/gzip" \
- --data-binary @- "$SIGNED_URL" 2>&1)
+UPLOAD_RESPONSE=$(curl -v -X PUT \
+ -H "Content-Type: binary/octet-stream" \
+ --data-binary "@dist/$FILENAME" "$SIGNED_URL" 2>&1)
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
- echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/cloudflare-python/$SHA'\033[0m"
+ echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/cloudflare-python/$SHA/$FILENAME'\033[0m"
else
echo -e "\033[31mFailed to upload artifact.\033[0m"
exit 1
diff --git a/src/cloudflare/__init__.py b/src/cloudflare/__init__.py
index 9ce8e45d0c0..26a59059d51 100644
--- a/src/cloudflare/__init__.py
+++ b/src/cloudflare/__init__.py
@@ -3,7 +3,7 @@
import typing as _t
from . import types
-from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
+from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given
from ._utils import file_from_path
from ._client import (
Client,
@@ -36,7 +36,7 @@
UnprocessableEntityError,
APIResponseValidationError,
)
-from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
+from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
from ._utils._logs import setup_logging as _setup_logging
__all__ = [
@@ -48,7 +48,9 @@
"ProxiesTypes",
"NotGiven",
"NOT_GIVEN",
+ "not_given",
"Omit",
+ "omit",
"CloudflareError",
"APIError",
"APIStatusError",
@@ -78,6 +80,7 @@
"DEFAULT_CONNECTION_LIMITS",
"DefaultHttpxClient",
"DefaultAsyncHttpxClient",
+ "DefaultAioHttpClient",
]
if not _t.TYPE_CHECKING:
diff --git a/src/cloudflare/_base_client.py b/src/cloudflare/_base_client.py
index d6d981cb568..e6310e5837d 100644
--- a/src/cloudflare/_base_client.py
+++ b/src/cloudflare/_base_client.py
@@ -9,6 +9,7 @@
import inspect
import logging
import platform
+import warnings
import email.utils
from types import TracebackType
from random import random
@@ -42,7 +43,6 @@
from ._qs import Querystring
from ._files import to_httpx_files, async_to_httpx_files
from ._types import (
- NOT_GIVEN,
Body,
Omit,
Query,
@@ -52,16 +52,19 @@
ResponseT,
AnyMapping,
PostParser,
+ BinaryTypes,
RequestFiles,
HttpxSendArgs,
HttpxFileTypes,
RequestOptions,
MultipartSyntax,
+ AsyncBinaryTypes,
HttpxRequestFiles,
ModelBuilderProtocol,
+ not_given,
)
from ._utils import is_dict, is_list, asyncify, is_given, is_tuple, lru_cache, is_mapping, is_mapping_t, is_sequence_t
-from ._compat import PYDANTIC_V2, model_copy, model_dump
+from ._compat import PYDANTIC_V1, model_copy, model_dump
from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type
from ._response import (
APIResponse,
@@ -147,9 +150,9 @@ def __init__(
def __init__(
self,
*,
- url: URL | NotGiven = NOT_GIVEN,
- json: Body | NotGiven = NOT_GIVEN,
- params: Query | NotGiven = NOT_GIVEN,
+ url: URL | NotGiven = not_given,
+ json: Body | NotGiven = not_given,
+ params: Query | NotGiven = not_given,
) -> None:
self.url = url
self.json = json
@@ -234,7 +237,7 @@ def _set_private_attributes(
model: Type[_T],
options: FinalRequestOptions,
) -> None:
- if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
+ if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}
self._model = model
@@ -322,7 +325,7 @@ def _set_private_attributes(
client: AsyncAPIClient,
options: FinalRequestOptions,
) -> None:
- if PYDANTIC_V2 and getattr(self, "__pydantic_private__", None) is None:
+ if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None:
self.__pydantic_private__ = {}
self._model = model
@@ -484,8 +487,19 @@ def _build_request(
retries_taken: int = 0,
) -> httpx.Request:
if log.isEnabledFor(logging.DEBUG):
- log.debug("Request options: %s", model_dump(options, exclude_unset=True))
-
+ log.debug(
+ "Request options: %s",
+ model_dump(
+ options,
+ exclude_unset=True,
+ # Pydantic v1 can't dump every type we support in content, so we exclude it for now.
+ exclude={
+ "content",
+ }
+ if PYDANTIC_V1
+ else {},
+ ),
+ )
kwargs: dict[str, Any] = {}
json_data = options.json_data
@@ -553,6 +567,24 @@ def _build_request(
# work around https://github.com/encode/httpx/discussions/2880
kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")}
+ is_body_allowed = options.method.lower() != "get"
+
+ if is_body_allowed:
+ if options.content is not None and json_data is not None:
+ raise TypeError("Passing both `content` and `json_data` is not supported")
+ if options.content is not None and files is not None:
+ raise TypeError("Passing both `content` and `files` is not supported")
+ if options.content is not None:
+ kwargs["content"] = options.content
+ elif isinstance(json_data, bytes):
+ kwargs["content"] = json_data
+ else:
+ kwargs["json"] = json_data if is_given(json_data) else None
+ kwargs["files"] = files
+ else:
+ headers.pop("Content-Type", None)
+ kwargs.pop("data", None)
+
# TODO: report this error to httpx
return self._client.build_request( # pyright: ignore[reportUnknownMemberType]
headers=headers,
@@ -564,8 +596,6 @@ def _build_request(
# so that passing a `TypedDict` doesn't cause an error.
# https://github.com/microsoft/pyright/issues/3526#event-6715453066
params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None,
- json=json_data if is_given(json_data) else None,
- files=files,
**kwargs,
)
@@ -625,7 +655,7 @@ def _maybe_override_cast_to(self, cast_to: type[ResponseT], options: FinalReques
# we internally support defining a temporary header to override the
# default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response`
# see _response.py for implementation details
- override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN)
+ override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given)
if is_given(override_cast_to):
options.headers = headers
return cast(Type[ResponseT], override_cast_to)
@@ -856,7 +886,7 @@ def __init__(
base_url: str | URL,
api_version: str,
max_retries: int = DEFAULT_MAX_RETRIES,
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | Timeout | None | NotGiven = not_given,
http_client: httpx.Client | None = None,
custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None,
@@ -1226,6 +1256,7 @@ def post(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: BinaryTypes | None = None,
options: RequestOptions = {},
files: RequestFiles | None = None,
stream: Literal[False] = False,
@@ -1238,6 +1269,7 @@ def post(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: BinaryTypes | None = None,
options: RequestOptions = {},
files: RequestFiles | None = None,
stream: Literal[True],
@@ -1251,6 +1283,7 @@ def post(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: BinaryTypes | None = None,
options: RequestOptions = {},
files: RequestFiles | None = None,
stream: bool,
@@ -1263,13 +1296,25 @@ def post(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: BinaryTypes | None = None,
options: RequestOptions = {},
files: RequestFiles | None = None,
stream: bool = False,
stream_cls: type[_StreamT] | None = None,
) -> ResponseT | _StreamT:
+ if body is not None and content is not None:
+ raise TypeError("Passing both `body` and `content` is not supported")
+ if files is not None and content is not None:
+ raise TypeError("Passing both `files` and `content` is not supported")
+ if isinstance(body, bytes):
+ warnings.warn(
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
+ "Please pass raw bytes via the `content` parameter instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
opts = FinalRequestOptions.construct(
- method="post", url=path, json_data=body, files=to_httpx_files(files), **options
+ method="post", url=path, json_data=body, content=content, files=to_httpx_files(files), **options
)
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
@@ -1279,9 +1324,24 @@ def patch(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: BinaryTypes | None = None,
+ files: RequestFiles | None = None,
options: RequestOptions = {},
) -> ResponseT:
- opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options)
+ if body is not None and content is not None:
+ raise TypeError("Passing both `body` and `content` is not supported")
+ if files is not None and content is not None:
+ raise TypeError("Passing both `files` and `content` is not supported")
+ if isinstance(body, bytes):
+ warnings.warn(
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
+ "Please pass raw bytes via the `content` parameter instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ opts = FinalRequestOptions.construct(
+ method="patch", url=path, json_data=body, content=content, files=to_httpx_files(files), **options
+ )
return self.request(cast_to, opts)
def put(
@@ -1290,11 +1350,23 @@ def put(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: BinaryTypes | None = None,
files: RequestFiles | None = None,
options: RequestOptions = {},
) -> ResponseT:
+ if body is not None and content is not None:
+ raise TypeError("Passing both `body` and `content` is not supported")
+ if files is not None and content is not None:
+ raise TypeError("Passing both `files` and `content` is not supported")
+ if isinstance(body, bytes):
+ warnings.warn(
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
+ "Please pass raw bytes via the `content` parameter instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
opts = FinalRequestOptions.construct(
- method="put", url=path, json_data=body, files=to_httpx_files(files), **options
+ method="put", url=path, json_data=body, content=content, files=to_httpx_files(files), **options
)
return self.request(cast_to, opts)
@@ -1304,9 +1376,19 @@ def delete(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: BinaryTypes | None = None,
options: RequestOptions = {},
) -> ResponseT:
- opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options)
+ if body is not None and content is not None:
+ raise TypeError("Passing both `body` and `content` is not supported")
+ if isinstance(body, bytes):
+ warnings.warn(
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
+ "Please pass raw bytes via the `content` parameter instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options)
return self.request(cast_to, opts)
def get_api_list(
@@ -1331,6 +1413,24 @@ def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)
+try:
+ import httpx_aiohttp
+except ImportError:
+
+ class _DefaultAioHttpClient(httpx.AsyncClient):
+ def __init__(self, **_kwargs: Any) -> None:
+ raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
+else:
+
+ class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
+ def __init__(self, **kwargs: Any) -> None:
+ kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
+ kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
+ kwargs.setdefault("follow_redirects", True)
+
+ super().__init__(**kwargs)
+
+
if TYPE_CHECKING:
DefaultAsyncHttpxClient = httpx.AsyncClient
"""An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
@@ -1339,8 +1439,12 @@ def __init__(self, **kwargs: Any) -> None:
This is useful because overriding the `http_client` with your own instance of
`httpx.AsyncClient` will result in httpx's defaults being used, not ours.
"""
+
+ DefaultAioHttpClient = httpx.AsyncClient
+ """An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
else:
DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
+ DefaultAioHttpClient = _DefaultAioHttpClient
class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
@@ -1367,7 +1471,7 @@ def __init__(
api_version: str,
_strict_response_validation: bool,
max_retries: int = DEFAULT_MAX_RETRIES,
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | Timeout | None | NotGiven = not_given,
http_client: httpx.AsyncClient | None = None,
custom_headers: Mapping[str, str] | None = None,
custom_query: Mapping[str, object] | None = None,
@@ -1726,6 +1830,7 @@ async def post(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: AsyncBinaryTypes | None = None,
files: RequestFiles | None = None,
options: RequestOptions = {},
stream: Literal[False] = False,
@@ -1738,6 +1843,7 @@ async def post(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: AsyncBinaryTypes | None = None,
files: RequestFiles | None = None,
options: RequestOptions = {},
stream: Literal[True],
@@ -1751,6 +1857,7 @@ async def post(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: AsyncBinaryTypes | None = None,
files: RequestFiles | None = None,
options: RequestOptions = {},
stream: bool,
@@ -1763,13 +1870,25 @@ async def post(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: AsyncBinaryTypes | None = None,
files: RequestFiles | None = None,
options: RequestOptions = {},
stream: bool = False,
stream_cls: type[_AsyncStreamT] | None = None,
) -> ResponseT | _AsyncStreamT:
+ if body is not None and content is not None:
+ raise TypeError("Passing both `body` and `content` is not supported")
+ if files is not None and content is not None:
+ raise TypeError("Passing both `files` and `content` is not supported")
+ if isinstance(body, bytes):
+ warnings.warn(
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
+ "Please pass raw bytes via the `content` parameter instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
opts = FinalRequestOptions.construct(
- method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options
+ method="post", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options
)
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
@@ -1779,9 +1898,29 @@ async def patch(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: AsyncBinaryTypes | None = None,
+ files: RequestFiles | None = None,
options: RequestOptions = {},
) -> ResponseT:
- opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options)
+ if body is not None and content is not None:
+ raise TypeError("Passing both `body` and `content` is not supported")
+ if files is not None and content is not None:
+ raise TypeError("Passing both `files` and `content` is not supported")
+ if isinstance(body, bytes):
+ warnings.warn(
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
+ "Please pass raw bytes via the `content` parameter instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ opts = FinalRequestOptions.construct(
+ method="patch",
+ url=path,
+ json_data=body,
+ content=content,
+ files=await async_to_httpx_files(files),
+ **options,
+ )
return await self.request(cast_to, opts)
async def put(
@@ -1790,11 +1929,23 @@ async def put(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: AsyncBinaryTypes | None = None,
files: RequestFiles | None = None,
options: RequestOptions = {},
) -> ResponseT:
+ if body is not None and content is not None:
+ raise TypeError("Passing both `body` and `content` is not supported")
+ if files is not None and content is not None:
+ raise TypeError("Passing both `files` and `content` is not supported")
+ if isinstance(body, bytes):
+ warnings.warn(
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
+ "Please pass raw bytes via the `content` parameter instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
opts = FinalRequestOptions.construct(
- method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options
+ method="put", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options
)
return await self.request(cast_to, opts)
@@ -1804,9 +1955,19 @@ async def delete(
*,
cast_to: Type[ResponseT],
body: Body | None = None,
+ content: AsyncBinaryTypes | None = None,
options: RequestOptions = {},
) -> ResponseT:
- opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options)
+ if body is not None and content is not None:
+ raise TypeError("Passing both `body` and `content` is not supported")
+ if isinstance(body, bytes):
+ warnings.warn(
+ "Passing raw bytes as `body` is deprecated and will be removed in a future version. "
+ "Please pass raw bytes via the `content` parameter instead.",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+ opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options)
return await self.request(cast_to, opts)
def get_api_list(
@@ -1830,8 +1991,8 @@ def make_request_options(
extra_query: Query | None = None,
extra_body: Body | None = None,
idempotency_key: str | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- post_parser: PostParser | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ post_parser: PostParser | NotGiven = not_given,
multipart_syntax: MultipartSyntax | None = None,
) -> RequestOptions:
"""Create a dict of type RequestOptions without keys of NotGiven values."""
diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py
index 141eaf0be63..edc473185de 100644
--- a/src/cloudflare/_client.py
+++ b/src/cloudflare/_client.py
@@ -3,7 +3,7 @@
from __future__ import annotations
import os
-from typing import TYPE_CHECKING, Any, Union, Mapping
+from typing import TYPE_CHECKING, Any, Mapping
from datetime import datetime
from typing_extensions import Self, override
@@ -12,7 +12,6 @@
from . import _exceptions
from ._qs import Querystring
from ._types import (
- NOT_GIVEN,
Omit,
Headers,
Timeout,
@@ -20,6 +19,7 @@
Transport,
ProxiesTypes,
RequestOptions,
+ not_given,
)
from ._utils import is_given, get_async_library
from ._compat import cached_property
@@ -50,6 +50,7 @@
web3,
cache,
calls,
+ fraud,
intel,
pages,
radar,
@@ -65,6 +66,7 @@
logpush,
workers,
accounts,
+ aisearch,
alerting,
firewall,
rulesets,
@@ -89,13 +91,16 @@
page_shield,
rate_limits,
url_scanner,
+ connectivity,
custom_pages,
dns_firewall,
healthchecks,
+ realtime_kit,
security_txt,
abuse_reports,
email_routing,
magic_transit,
+ organizations,
secrets_store,
waiting_rooms,
bot_management,
@@ -105,12 +110,14 @@
load_balancers,
cloud_connector,
durable_objects,
+ r2_data_catalog,
request_tracers,
security_center,
brand_protection,
content_scanning,
custom_hostnames,
resource_sharing,
+ token_validation,
browser_rendering,
mtls_certificates,
schema_validation,
@@ -133,6 +140,7 @@
from .resources.ips import IPsResource, AsyncIPsResource
from .resources.ai.ai import AIResource, AsyncAIResource
from .resources.d1.d1 import D1Resource, AsyncD1Resource
+ from .resources.fraud import FraudResource, AsyncFraudResource
from .resources.kv.kv import KVResource, AsyncKVResource
from .resources.r2.r2 import R2Resource, AsyncR2Resource
from .resources.acm.acm import ACMResource, AsyncACMResource
@@ -143,7 +151,6 @@
from .resources.ssl.ssl import SSLResource, AsyncSSLResource
from .resources.argo.argo import ArgoResource, AsyncArgoResource
from .resources.logs.logs import LogsResource, AsyncLogsResource
- from .resources.pipelines import PipelinesResource, AsyncPipelinesResource
from .resources.user.user import UserResource, AsyncUserResource
from .resources.web3.web3 import Web3Resource, AsyncWeb3Resource
from .resources.audit_logs import AuditLogsResource, AsyncAuditLogsResource
@@ -161,7 +168,6 @@
from .resources.zones.zones import ZonesResource, AsyncZonesResource
from .resources.custom_pages import CustomPagesResource, AsyncCustomPagesResource
from .resources.security_txt import SecurityTXTResource, AsyncSecurityTXTResource
- from .resources.abuse_reports import AbuseReportsResource, AsyncAbuseReportsResource
from .resources.images.images import ImagesResource, AsyncImagesResource
from .resources.queues.queues import QueuesResource, AsyncQueuesResource
from .resources.stream.stream import StreamResource, AsyncStreamResource
@@ -170,8 +176,8 @@
from .resources.billing.billing import BillingResource, AsyncBillingResource
from .resources.logpush.logpush import LogpushResource, AsyncLogpushResource
from .resources.workers.workers import WorkersResource, AsyncWorkersResource
- from .resources.brand_protection import BrandProtectionResource, AsyncBrandProtectionResource
from .resources.accounts.accounts import AccountsResource, AsyncAccountsResource
+ from .resources.aisearch.aisearch import AISearchResource, AsyncAISearchResource
from .resources.alerting.alerting import AlertingResource, AsyncAlertingResource
from .resources.firewall.firewall import FirewallResource, AsyncFirewallResource
from .resources.rulesets.rulesets import RulesetsResource, AsyncRulesetsResource
@@ -182,6 +188,7 @@
from .resources.managed_transforms import ManagedTransformsResource, AsyncManagedTransformsResource
from .resources.client_certificates import ClientCertificatesResource, AsyncClientCertificatesResource
from .resources.hostnames.hostnames import HostnamesResource, AsyncHostnamesResource
+ from .resources.pipelines.pipelines import PipelinesResource, AsyncPipelinesResource
from .resources.registrar.registrar import RegistrarResource, AsyncRegistrarResource
from .resources.turnstile.turnstile import TurnstileResource, AsyncTurnstileResource
from .resources.vectorize.vectorize import VectorizeResource, AsyncVectorizeResource
@@ -197,10 +204,14 @@
from .resources.diagnostics.diagnostics import DiagnosticsResource, AsyncDiagnosticsResource
from .resources.page_shield.page_shield import PageShieldResource, AsyncPageShieldResource
from .resources.url_scanner.url_scanner import URLScannerResource, AsyncURLScannerResource
+ from .resources.connectivity.connectivity import ConnectivityResource, AsyncConnectivityResource
from .resources.dns_firewall.dns_firewall import DNSFirewallResource, AsyncDNSFirewallResource
from .resources.healthchecks.healthchecks import HealthchecksResource, AsyncHealthchecksResource
+ from .resources.realtime_kit.realtime_kit import RealtimeKitResource, AsyncRealtimeKitResource
+ from .resources.abuse_reports.abuse_reports import AbuseReportsResource, AsyncAbuseReportsResource
from .resources.email_routing.email_routing import EmailRoutingResource, AsyncEmailRoutingResource
from .resources.magic_transit.magic_transit import MagicTransitResource, AsyncMagicTransitResource
+ from .resources.organizations.organizations import OrganizationsResource, AsyncOrganizationsResource
from .resources.secrets_store.secrets_store import SecretsStoreResource, AsyncSecretsStoreResource
from .resources.waiting_rooms.waiting_rooms import WaitingRoomsResource, AsyncWaitingRoomsResource
from .resources.cloudforce_one.cloudforce_one import CloudforceOneResource, AsyncCloudforceOneResource
@@ -212,11 +223,14 @@
)
from .resources.cloud_connector.cloud_connector import CloudConnectorResource, AsyncCloudConnectorResource
from .resources.durable_objects.durable_objects import DurableObjectsResource, AsyncDurableObjectsResource
+ from .resources.r2_data_catalog.r2_data_catalog import R2DataCatalogResource, AsyncR2DataCatalogResource
from .resources.request_tracers.request_tracers import RequestTracersResource, AsyncRequestTracersResource
from .resources.security_center.security_center import SecurityCenterResource, AsyncSecurityCenterResource
+ from .resources.brand_protection.brand_protection import BrandProtectionResource, AsyncBrandProtectionResource
from .resources.content_scanning.content_scanning import ContentScanningResource, AsyncContentScanningResource
from .resources.custom_hostnames.custom_hostnames import CustomHostnamesResource, AsyncCustomHostnamesResource
from .resources.resource_sharing.resource_sharing import ResourceSharingResource, AsyncResourceSharingResource
+ from .resources.token_validation.token_validation import TokenValidationResource, AsyncTokenValidationResource
from .resources.browser_rendering.browser_rendering import BrowserRenderingResource, AsyncBrowserRenderingResource
from .resources.mtls_certificates.mtls_certificates import MTLSCertificatesResource, AsyncMTLSCertificatesResource
from .resources.schema_validation.schema_validation import SchemaValidationResource, AsyncSchemaValidationResource
@@ -281,7 +295,7 @@ def __init__(
user_service_key: str | None = None,
base_url: str | httpx.URL | None = None,
api_version: str | None = None,
- timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
+ timeout: float | Timeout | None | NotGiven = not_given,
max_retries: int = DEFAULT_MAX_RETRIES,
default_headers: Mapping[str, str] | None = None,
default_query: Mapping[str, object] | None = None,
@@ -349,6 +363,12 @@ def accounts(self) -> AccountsResource:
return AccountsResource(self)
+ @cached_property
+ def organizations(self) -> OrganizationsResource:
+ from .resources.organizations import OrganizationsResource
+
+ return OrganizationsResource(self)
+
@cached_property
def origin_ca_certificates(self) -> OriginCACertificatesResource:
from .resources.origin_ca_certificates import OriginCACertificatesResource
@@ -709,6 +729,12 @@ def r2(self) -> R2Resource:
return R2Resource(self)
+ @cached_property
+ def r2_data_catalog(self) -> R2DataCatalogResource:
+ from .resources.r2_data_catalog import R2DataCatalogResource
+
+ return R2DataCatalogResource(self)
+
@cached_property
def workers_for_platforms(self) -> WorkersForPlatformsResource:
from .resources.workers_for_platforms import WorkersForPlatformsResource
@@ -727,6 +753,12 @@ def turnstile(self) -> TurnstileResource:
return TurnstileResource(self)
+ @cached_property
+ def connectivity(self) -> ConnectivityResource:
+ from .resources.connectivity import ConnectivityResource
+
+ return ConnectivityResource(self)
+
@cached_property
def hyperdrive(self) -> HyperdriveResource:
from .resources.hyperdrive import HyperdriveResource
@@ -763,6 +795,12 @@ def bot_management(self) -> BotManagementResource:
return BotManagementResource(self)
+ @cached_property
+ def fraud(self) -> FraudResource:
+ from .resources.fraud import FraudResource
+
+ return FraudResource(self)
+
@cached_property
def origin_post_quantum_encryption(self) -> OriginPostQuantumEncryptionResource:
from .resources.origin_post_quantum_encryption import OriginPostQuantumEncryptionResource
@@ -799,6 +837,12 @@ def snippets(self) -> SnippetsResource:
return SnippetsResource(self)
+ @cached_property
+ def realtime_kit(self) -> RealtimeKitResource:
+ from .resources.realtime_kit import RealtimeKitResource
+
+ return RealtimeKitResource(self)
+
@cached_property
def calls(self) -> CallsResource:
from .resources.calls import CallsResource
@@ -877,6 +921,12 @@ def ai(self) -> AIResource:
return AIResource(self)
+ @cached_property
+ def aisearch(self) -> AISearchResource:
+ from .resources.aisearch import AISearchResource
+
+ return AISearchResource(self)
+
@cached_property
def security_center(self) -> SecurityCenterResource:
from .resources.security_center import SecurityCenterResource
@@ -913,6 +963,12 @@ def schema_validation(self) -> SchemaValidationResource:
return SchemaValidationResource(self)
+ @cached_property
+ def token_validation(self) -> TokenValidationResource:
+ from .resources.token_validation import TokenValidationResource
+
+ return TokenValidationResource(self)
+
@cached_property
def with_raw_response(self) -> CloudflareWithRawResponse:
return CloudflareWithRawResponse(self)
@@ -980,24 +1036,16 @@ def default_headers(self) -> dict[str, str | Omit]:
@override
def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
- if self.api_email and headers.get("X-Auth-Email"):
- return
- if isinstance(custom_headers.get("X-Auth-Email"), Omit):
+ if headers.get("X-Auth-Email") or isinstance(custom_headers.get("X-Auth-Email"), Omit):
return
- if self.api_key and headers.get("X-Auth-Key"):
- return
- if isinstance(custom_headers.get("X-Auth-Key"), Omit):
+ if headers.get("X-Auth-Key") or isinstance(custom_headers.get("X-Auth-Key"), Omit):
return
- if self.api_token and headers.get("Authorization"):
- return
- if isinstance(custom_headers.get("Authorization"), Omit):
+ if headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit):
return
- if self.user_service_key and headers.get("X-Auth-User-Service-Key"):
- return
- if isinstance(custom_headers.get("X-Auth-User-Service-Key"), Omit):
+ if headers.get("X-Auth-User-Service-Key") or isinstance(custom_headers.get("X-Auth-User-Service-Key"), Omit):
return
raise TypeError(
@@ -1013,9 +1061,9 @@ def copy(
user_service_key: str | None = None,
base_url: str | httpx.URL | None = None,
api_version: str | None = None,
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | Timeout | None | NotGiven = not_given,
http_client: httpx.Client | None = None,
- max_retries: int | NotGiven = NOT_GIVEN,
+ max_retries: int | NotGiven = not_given,
default_headers: Mapping[str, str] | None = None,
set_default_headers: Mapping[str, str] | None = None,
default_query: Mapping[str, object] | None = None,
@@ -1113,7 +1161,7 @@ def __init__(
user_service_key: str | None = None,
base_url: str | httpx.URL | None = None,
api_version: str | None = None,
- timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
+ timeout: float | Timeout | None | NotGiven = not_given,
max_retries: int = DEFAULT_MAX_RETRIES,
default_headers: Mapping[str, str] | None = None,
default_query: Mapping[str, object] | None = None,
@@ -1181,6 +1229,12 @@ def accounts(self) -> AsyncAccountsResource:
return AsyncAccountsResource(self)
+ @cached_property
+ def organizations(self) -> AsyncOrganizationsResource:
+ from .resources.organizations import AsyncOrganizationsResource
+
+ return AsyncOrganizationsResource(self)
+
@cached_property
def origin_ca_certificates(self) -> AsyncOriginCACertificatesResource:
from .resources.origin_ca_certificates import AsyncOriginCACertificatesResource
@@ -1541,6 +1595,12 @@ def r2(self) -> AsyncR2Resource:
return AsyncR2Resource(self)
+ @cached_property
+ def r2_data_catalog(self) -> AsyncR2DataCatalogResource:
+ from .resources.r2_data_catalog import AsyncR2DataCatalogResource
+
+ return AsyncR2DataCatalogResource(self)
+
@cached_property
def workers_for_platforms(self) -> AsyncWorkersForPlatformsResource:
from .resources.workers_for_platforms import AsyncWorkersForPlatformsResource
@@ -1559,6 +1619,12 @@ def turnstile(self) -> AsyncTurnstileResource:
return AsyncTurnstileResource(self)
+ @cached_property
+ def connectivity(self) -> AsyncConnectivityResource:
+ from .resources.connectivity import AsyncConnectivityResource
+
+ return AsyncConnectivityResource(self)
+
@cached_property
def hyperdrive(self) -> AsyncHyperdriveResource:
from .resources.hyperdrive import AsyncHyperdriveResource
@@ -1595,6 +1661,12 @@ def bot_management(self) -> AsyncBotManagementResource:
return AsyncBotManagementResource(self)
+ @cached_property
+ def fraud(self) -> AsyncFraudResource:
+ from .resources.fraud import AsyncFraudResource
+
+ return AsyncFraudResource(self)
+
@cached_property
def origin_post_quantum_encryption(self) -> AsyncOriginPostQuantumEncryptionResource:
from .resources.origin_post_quantum_encryption import AsyncOriginPostQuantumEncryptionResource
@@ -1631,6 +1703,12 @@ def snippets(self) -> AsyncSnippetsResource:
return AsyncSnippetsResource(self)
+ @cached_property
+ def realtime_kit(self) -> AsyncRealtimeKitResource:
+ from .resources.realtime_kit import AsyncRealtimeKitResource
+
+ return AsyncRealtimeKitResource(self)
+
@cached_property
def calls(self) -> AsyncCallsResource:
from .resources.calls import AsyncCallsResource
@@ -1709,6 +1787,12 @@ def ai(self) -> AsyncAIResource:
return AsyncAIResource(self)
+ @cached_property
+ def aisearch(self) -> AsyncAISearchResource:
+ from .resources.aisearch import AsyncAISearchResource
+
+ return AsyncAISearchResource(self)
+
@cached_property
def security_center(self) -> AsyncSecurityCenterResource:
from .resources.security_center import AsyncSecurityCenterResource
@@ -1745,6 +1829,12 @@ def schema_validation(self) -> AsyncSchemaValidationResource:
return AsyncSchemaValidationResource(self)
+ @cached_property
+ def token_validation(self) -> AsyncTokenValidationResource:
+ from .resources.token_validation import AsyncTokenValidationResource
+
+ return AsyncTokenValidationResource(self)
+
@cached_property
def with_raw_response(self) -> AsyncCloudflareWithRawResponse:
return AsyncCloudflareWithRawResponse(self)
@@ -1812,24 +1902,16 @@ def default_headers(self) -> dict[str, str | Omit]:
@override
def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
- if self.api_email and headers.get("X-Auth-Email"):
- return
- if isinstance(custom_headers.get("X-Auth-Email"), Omit):
+ if headers.get("X-Auth-Email") or isinstance(custom_headers.get("X-Auth-Email"), Omit):
return
- if self.api_key and headers.get("X-Auth-Key"):
- return
- if isinstance(custom_headers.get("X-Auth-Key"), Omit):
+ if headers.get("X-Auth-Key") or isinstance(custom_headers.get("X-Auth-Key"), Omit):
return
- if self.api_token and headers.get("Authorization"):
- return
- if isinstance(custom_headers.get("Authorization"), Omit):
+ if headers.get("Authorization") or isinstance(custom_headers.get("Authorization"), Omit):
return
- if self.user_service_key and headers.get("X-Auth-User-Service-Key"):
- return
- if isinstance(custom_headers.get("X-Auth-User-Service-Key"), Omit):
+ if headers.get("X-Auth-User-Service-Key") or isinstance(custom_headers.get("X-Auth-User-Service-Key"), Omit):
return
raise TypeError(
@@ -1845,9 +1927,9 @@ def copy(
user_service_key: str | None = None,
base_url: str | httpx.URL | None = None,
api_version: str | None = None,
- timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | Timeout | None | NotGiven = not_given,
http_client: httpx.AsyncClient | None = None,
- max_retries: int | NotGiven = NOT_GIVEN,
+ max_retries: int | NotGiven = not_given,
default_headers: Mapping[str, str] | None = None,
set_default_headers: Mapping[str, str] | None = None,
default_query: Mapping[str, object] | None = None,
@@ -1941,6 +2023,12 @@ def accounts(self) -> accounts.AccountsResourceWithRawResponse:
return AccountsResourceWithRawResponse(self._client.accounts)
+ @cached_property
+ def organizations(self) -> organizations.OrganizationsResourceWithRawResponse:
+ from .resources.organizations import OrganizationsResourceWithRawResponse
+
+ return OrganizationsResourceWithRawResponse(self._client.organizations)
+
@cached_property
def origin_ca_certificates(self) -> origin_ca_certificates.OriginCACertificatesResourceWithRawResponse:
from .resources.origin_ca_certificates import OriginCACertificatesResourceWithRawResponse
@@ -2301,6 +2389,12 @@ def r2(self) -> r2.R2ResourceWithRawResponse:
return R2ResourceWithRawResponse(self._client.r2)
+ @cached_property
+ def r2_data_catalog(self) -> r2_data_catalog.R2DataCatalogResourceWithRawResponse:
+ from .resources.r2_data_catalog import R2DataCatalogResourceWithRawResponse
+
+ return R2DataCatalogResourceWithRawResponse(self._client.r2_data_catalog)
+
@cached_property
def workers_for_platforms(self) -> workers_for_platforms.WorkersForPlatformsResourceWithRawResponse:
from .resources.workers_for_platforms import WorkersForPlatformsResourceWithRawResponse
@@ -2319,6 +2413,12 @@ def turnstile(self) -> turnstile.TurnstileResourceWithRawResponse:
return TurnstileResourceWithRawResponse(self._client.turnstile)
+ @cached_property
+ def connectivity(self) -> connectivity.ConnectivityResourceWithRawResponse:
+ from .resources.connectivity import ConnectivityResourceWithRawResponse
+
+ return ConnectivityResourceWithRawResponse(self._client.connectivity)
+
@cached_property
def hyperdrive(self) -> hyperdrive.HyperdriveResourceWithRawResponse:
from .resources.hyperdrive import HyperdriveResourceWithRawResponse
@@ -2355,6 +2455,12 @@ def bot_management(self) -> bot_management.BotManagementResourceWithRawResponse:
return BotManagementResourceWithRawResponse(self._client.bot_management)
+ @cached_property
+ def fraud(self) -> fraud.FraudResourceWithRawResponse:
+ from .resources.fraud import FraudResourceWithRawResponse
+
+ return FraudResourceWithRawResponse(self._client.fraud)
+
@cached_property
def origin_post_quantum_encryption(
self,
@@ -2393,6 +2499,12 @@ def snippets(self) -> snippets.SnippetsResourceWithRawResponse:
return SnippetsResourceWithRawResponse(self._client.snippets)
+ @cached_property
+ def realtime_kit(self) -> realtime_kit.RealtimeKitResourceWithRawResponse:
+ from .resources.realtime_kit import RealtimeKitResourceWithRawResponse
+
+ return RealtimeKitResourceWithRawResponse(self._client.realtime_kit)
+
@cached_property
def calls(self) -> calls.CallsResourceWithRawResponse:
from .resources.calls import CallsResourceWithRawResponse
@@ -2471,6 +2583,12 @@ def ai(self) -> ai.AIResourceWithRawResponse:
return AIResourceWithRawResponse(self._client.ai)
+ @cached_property
+ def aisearch(self) -> aisearch.AISearchResourceWithRawResponse:
+ from .resources.aisearch import AISearchResourceWithRawResponse
+
+ return AISearchResourceWithRawResponse(self._client.aisearch)
+
@cached_property
def security_center(self) -> security_center.SecurityCenterResourceWithRawResponse:
from .resources.security_center import SecurityCenterResourceWithRawResponse
@@ -2507,6 +2625,12 @@ def schema_validation(self) -> schema_validation.SchemaValidationResourceWithRaw
return SchemaValidationResourceWithRawResponse(self._client.schema_validation)
+ @cached_property
+ def token_validation(self) -> token_validation.TokenValidationResourceWithRawResponse:
+ from .resources.token_validation import TokenValidationResourceWithRawResponse
+
+ return TokenValidationResourceWithRawResponse(self._client.token_validation)
+
class AsyncCloudflareWithRawResponse:
_client: AsyncCloudflare
@@ -2520,6 +2644,12 @@ def accounts(self) -> accounts.AsyncAccountsResourceWithRawResponse:
return AsyncAccountsResourceWithRawResponse(self._client.accounts)
+ @cached_property
+ def organizations(self) -> organizations.AsyncOrganizationsResourceWithRawResponse:
+ from .resources.organizations import AsyncOrganizationsResourceWithRawResponse
+
+ return AsyncOrganizationsResourceWithRawResponse(self._client.organizations)
+
@cached_property
def origin_ca_certificates(self) -> origin_ca_certificates.AsyncOriginCACertificatesResourceWithRawResponse:
from .resources.origin_ca_certificates import AsyncOriginCACertificatesResourceWithRawResponse
@@ -2880,6 +3010,12 @@ def r2(self) -> r2.AsyncR2ResourceWithRawResponse:
return AsyncR2ResourceWithRawResponse(self._client.r2)
+ @cached_property
+ def r2_data_catalog(self) -> r2_data_catalog.AsyncR2DataCatalogResourceWithRawResponse:
+ from .resources.r2_data_catalog import AsyncR2DataCatalogResourceWithRawResponse
+
+ return AsyncR2DataCatalogResourceWithRawResponse(self._client.r2_data_catalog)
+
@cached_property
def workers_for_platforms(self) -> workers_for_platforms.AsyncWorkersForPlatformsResourceWithRawResponse:
from .resources.workers_for_platforms import AsyncWorkersForPlatformsResourceWithRawResponse
@@ -2898,6 +3034,12 @@ def turnstile(self) -> turnstile.AsyncTurnstileResourceWithRawResponse:
return AsyncTurnstileResourceWithRawResponse(self._client.turnstile)
+ @cached_property
+ def connectivity(self) -> connectivity.AsyncConnectivityResourceWithRawResponse:
+ from .resources.connectivity import AsyncConnectivityResourceWithRawResponse
+
+ return AsyncConnectivityResourceWithRawResponse(self._client.connectivity)
+
@cached_property
def hyperdrive(self) -> hyperdrive.AsyncHyperdriveResourceWithRawResponse:
from .resources.hyperdrive import AsyncHyperdriveResourceWithRawResponse
@@ -2934,6 +3076,12 @@ def bot_management(self) -> bot_management.AsyncBotManagementResourceWithRawResp
return AsyncBotManagementResourceWithRawResponse(self._client.bot_management)
+ @cached_property
+ def fraud(self) -> fraud.AsyncFraudResourceWithRawResponse:
+ from .resources.fraud import AsyncFraudResourceWithRawResponse
+
+ return AsyncFraudResourceWithRawResponse(self._client.fraud)
+
@cached_property
def origin_post_quantum_encryption(
self,
@@ -2972,6 +3120,12 @@ def snippets(self) -> snippets.AsyncSnippetsResourceWithRawResponse:
return AsyncSnippetsResourceWithRawResponse(self._client.snippets)
+ @cached_property
+ def realtime_kit(self) -> realtime_kit.AsyncRealtimeKitResourceWithRawResponse:
+ from .resources.realtime_kit import AsyncRealtimeKitResourceWithRawResponse
+
+ return AsyncRealtimeKitResourceWithRawResponse(self._client.realtime_kit)
+
@cached_property
def calls(self) -> calls.AsyncCallsResourceWithRawResponse:
from .resources.calls import AsyncCallsResourceWithRawResponse
@@ -3050,6 +3204,12 @@ def ai(self) -> ai.AsyncAIResourceWithRawResponse:
return AsyncAIResourceWithRawResponse(self._client.ai)
+ @cached_property
+ def aisearch(self) -> aisearch.AsyncAISearchResourceWithRawResponse:
+ from .resources.aisearch import AsyncAISearchResourceWithRawResponse
+
+ return AsyncAISearchResourceWithRawResponse(self._client.aisearch)
+
@cached_property
def security_center(self) -> security_center.AsyncSecurityCenterResourceWithRawResponse:
from .resources.security_center import AsyncSecurityCenterResourceWithRawResponse
@@ -3086,6 +3246,12 @@ def schema_validation(self) -> schema_validation.AsyncSchemaValidationResourceWi
return AsyncSchemaValidationResourceWithRawResponse(self._client.schema_validation)
+ @cached_property
+ def token_validation(self) -> token_validation.AsyncTokenValidationResourceWithRawResponse:
+ from .resources.token_validation import AsyncTokenValidationResourceWithRawResponse
+
+ return AsyncTokenValidationResourceWithRawResponse(self._client.token_validation)
+
class CloudflareWithStreamedResponse:
_client: Cloudflare
@@ -3099,6 +3265,12 @@ def accounts(self) -> accounts.AccountsResourceWithStreamingResponse:
return AccountsResourceWithStreamingResponse(self._client.accounts)
+ @cached_property
+ def organizations(self) -> organizations.OrganizationsResourceWithStreamingResponse:
+ from .resources.organizations import OrganizationsResourceWithStreamingResponse
+
+ return OrganizationsResourceWithStreamingResponse(self._client.organizations)
+
@cached_property
def origin_ca_certificates(self) -> origin_ca_certificates.OriginCACertificatesResourceWithStreamingResponse:
from .resources.origin_ca_certificates import OriginCACertificatesResourceWithStreamingResponse
@@ -3459,6 +3631,12 @@ def r2(self) -> r2.R2ResourceWithStreamingResponse:
return R2ResourceWithStreamingResponse(self._client.r2)
+ @cached_property
+ def r2_data_catalog(self) -> r2_data_catalog.R2DataCatalogResourceWithStreamingResponse:
+ from .resources.r2_data_catalog import R2DataCatalogResourceWithStreamingResponse
+
+ return R2DataCatalogResourceWithStreamingResponse(self._client.r2_data_catalog)
+
@cached_property
def workers_for_platforms(self) -> workers_for_platforms.WorkersForPlatformsResourceWithStreamingResponse:
from .resources.workers_for_platforms import WorkersForPlatformsResourceWithStreamingResponse
@@ -3477,6 +3655,12 @@ def turnstile(self) -> turnstile.TurnstileResourceWithStreamingResponse:
return TurnstileResourceWithStreamingResponse(self._client.turnstile)
+ @cached_property
+ def connectivity(self) -> connectivity.ConnectivityResourceWithStreamingResponse:
+ from .resources.connectivity import ConnectivityResourceWithStreamingResponse
+
+ return ConnectivityResourceWithStreamingResponse(self._client.connectivity)
+
@cached_property
def hyperdrive(self) -> hyperdrive.HyperdriveResourceWithStreamingResponse:
from .resources.hyperdrive import HyperdriveResourceWithStreamingResponse
@@ -3513,6 +3697,12 @@ def bot_management(self) -> bot_management.BotManagementResourceWithStreamingRes
return BotManagementResourceWithStreamingResponse(self._client.bot_management)
+ @cached_property
+ def fraud(self) -> fraud.FraudResourceWithStreamingResponse:
+ from .resources.fraud import FraudResourceWithStreamingResponse
+
+ return FraudResourceWithStreamingResponse(self._client.fraud)
+
@cached_property
def origin_post_quantum_encryption(
self,
@@ -3551,6 +3741,12 @@ def snippets(self) -> snippets.SnippetsResourceWithStreamingResponse:
return SnippetsResourceWithStreamingResponse(self._client.snippets)
+ @cached_property
+ def realtime_kit(self) -> realtime_kit.RealtimeKitResourceWithStreamingResponse:
+ from .resources.realtime_kit import RealtimeKitResourceWithStreamingResponse
+
+ return RealtimeKitResourceWithStreamingResponse(self._client.realtime_kit)
+
@cached_property
def calls(self) -> calls.CallsResourceWithStreamingResponse:
from .resources.calls import CallsResourceWithStreamingResponse
@@ -3629,6 +3825,12 @@ def ai(self) -> ai.AIResourceWithStreamingResponse:
return AIResourceWithStreamingResponse(self._client.ai)
+ @cached_property
+ def aisearch(self) -> aisearch.AISearchResourceWithStreamingResponse:
+ from .resources.aisearch import AISearchResourceWithStreamingResponse
+
+ return AISearchResourceWithStreamingResponse(self._client.aisearch)
+
@cached_property
def security_center(self) -> security_center.SecurityCenterResourceWithStreamingResponse:
from .resources.security_center import SecurityCenterResourceWithStreamingResponse
@@ -3665,6 +3867,12 @@ def schema_validation(self) -> schema_validation.SchemaValidationResourceWithStr
return SchemaValidationResourceWithStreamingResponse(self._client.schema_validation)
+ @cached_property
+ def token_validation(self) -> token_validation.TokenValidationResourceWithStreamingResponse:
+ from .resources.token_validation import TokenValidationResourceWithStreamingResponse
+
+ return TokenValidationResourceWithStreamingResponse(self._client.token_validation)
+
class AsyncCloudflareWithStreamedResponse:
_client: AsyncCloudflare
@@ -3678,6 +3886,12 @@ def accounts(self) -> accounts.AsyncAccountsResourceWithStreamingResponse:
return AsyncAccountsResourceWithStreamingResponse(self._client.accounts)
+ @cached_property
+ def organizations(self) -> organizations.AsyncOrganizationsResourceWithStreamingResponse:
+ from .resources.organizations import AsyncOrganizationsResourceWithStreamingResponse
+
+ return AsyncOrganizationsResourceWithStreamingResponse(self._client.organizations)
+
@cached_property
def origin_ca_certificates(self) -> origin_ca_certificates.AsyncOriginCACertificatesResourceWithStreamingResponse:
from .resources.origin_ca_certificates import AsyncOriginCACertificatesResourceWithStreamingResponse
@@ -4042,6 +4256,12 @@ def r2(self) -> r2.AsyncR2ResourceWithStreamingResponse:
return AsyncR2ResourceWithStreamingResponse(self._client.r2)
+ @cached_property
+ def r2_data_catalog(self) -> r2_data_catalog.AsyncR2DataCatalogResourceWithStreamingResponse:
+ from .resources.r2_data_catalog import AsyncR2DataCatalogResourceWithStreamingResponse
+
+ return AsyncR2DataCatalogResourceWithStreamingResponse(self._client.r2_data_catalog)
+
@cached_property
def workers_for_platforms(self) -> workers_for_platforms.AsyncWorkersForPlatformsResourceWithStreamingResponse:
from .resources.workers_for_platforms import AsyncWorkersForPlatformsResourceWithStreamingResponse
@@ -4060,6 +4280,12 @@ def turnstile(self) -> turnstile.AsyncTurnstileResourceWithStreamingResponse:
return AsyncTurnstileResourceWithStreamingResponse(self._client.turnstile)
+ @cached_property
+ def connectivity(self) -> connectivity.AsyncConnectivityResourceWithStreamingResponse:
+ from .resources.connectivity import AsyncConnectivityResourceWithStreamingResponse
+
+ return AsyncConnectivityResourceWithStreamingResponse(self._client.connectivity)
+
@cached_property
def hyperdrive(self) -> hyperdrive.AsyncHyperdriveResourceWithStreamingResponse:
from .resources.hyperdrive import AsyncHyperdriveResourceWithStreamingResponse
@@ -4096,6 +4322,12 @@ def bot_management(self) -> bot_management.AsyncBotManagementResourceWithStreami
return AsyncBotManagementResourceWithStreamingResponse(self._client.bot_management)
+ @cached_property
+ def fraud(self) -> fraud.AsyncFraudResourceWithStreamingResponse:
+ from .resources.fraud import AsyncFraudResourceWithStreamingResponse
+
+ return AsyncFraudResourceWithStreamingResponse(self._client.fraud)
+
@cached_property
def origin_post_quantum_encryption(
self,
@@ -4138,6 +4370,12 @@ def snippets(self) -> snippets.AsyncSnippetsResourceWithStreamingResponse:
return AsyncSnippetsResourceWithStreamingResponse(self._client.snippets)
+ @cached_property
+ def realtime_kit(self) -> realtime_kit.AsyncRealtimeKitResourceWithStreamingResponse:
+ from .resources.realtime_kit import AsyncRealtimeKitResourceWithStreamingResponse
+
+ return AsyncRealtimeKitResourceWithStreamingResponse(self._client.realtime_kit)
+
@cached_property
def calls(self) -> calls.AsyncCallsResourceWithStreamingResponse:
from .resources.calls import AsyncCallsResourceWithStreamingResponse
@@ -4218,6 +4456,12 @@ def ai(self) -> ai.AsyncAIResourceWithStreamingResponse:
return AsyncAIResourceWithStreamingResponse(self._client.ai)
+ @cached_property
+ def aisearch(self) -> aisearch.AsyncAISearchResourceWithStreamingResponse:
+ from .resources.aisearch import AsyncAISearchResourceWithStreamingResponse
+
+ return AsyncAISearchResourceWithStreamingResponse(self._client.aisearch)
+
@cached_property
def security_center(self) -> security_center.AsyncSecurityCenterResourceWithStreamingResponse:
from .resources.security_center import AsyncSecurityCenterResourceWithStreamingResponse
@@ -4254,6 +4498,12 @@ def schema_validation(self) -> schema_validation.AsyncSchemaValidationResourceWi
return AsyncSchemaValidationResourceWithStreamingResponse(self._client.schema_validation)
+ @cached_property
+ def token_validation(self) -> token_validation.AsyncTokenValidationResourceWithStreamingResponse:
+ from .resources.token_validation import AsyncTokenValidationResourceWithStreamingResponse
+
+ return AsyncTokenValidationResourceWithStreamingResponse(self._client.token_validation)
+
Client = Cloudflare
diff --git a/src/cloudflare/_compat.py b/src/cloudflare/_compat.py
index 92d9ee61ee9..bdef67f0425 100644
--- a/src/cloudflare/_compat.py
+++ b/src/cloudflare/_compat.py
@@ -12,14 +12,13 @@
_T = TypeVar("_T")
_ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel)
-# --------------- Pydantic v2 compatibility ---------------
+# --------------- Pydantic v2, v3 compatibility ---------------
# Pyright incorrectly reports some of our functions as overriding a method when they don't
# pyright: reportIncompatibleMethodOverride=false
-PYDANTIC_V2 = pydantic.VERSION.startswith("2.")
+PYDANTIC_V1 = pydantic.VERSION.startswith("1.")
-# v1 re-exports
if TYPE_CHECKING:
def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001
@@ -44,90 +43,92 @@ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001
...
else:
- if PYDANTIC_V2:
- from pydantic.v1.typing import (
+ # v1 re-exports
+ if PYDANTIC_V1:
+ from pydantic.typing import (
get_args as get_args,
is_union as is_union,
get_origin as get_origin,
is_typeddict as is_typeddict,
is_literal_type as is_literal_type,
)
- from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
+ from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
else:
- from pydantic.typing import (
+ from ._utils import (
get_args as get_args,
is_union as is_union,
get_origin as get_origin,
+ parse_date as parse_date,
is_typeddict as is_typeddict,
+ parse_datetime as parse_datetime,
is_literal_type as is_literal_type,
)
- from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
# refactored config
if TYPE_CHECKING:
from pydantic import ConfigDict as ConfigDict
else:
- if PYDANTIC_V2:
- from pydantic import ConfigDict
- else:
+ if PYDANTIC_V1:
# TODO: provide an error message here?
ConfigDict = None
+ else:
+ from pydantic import ConfigDict as ConfigDict
# renamed methods / properties
def parse_obj(model: type[_ModelT], value: object) -> _ModelT:
- if PYDANTIC_V2:
- return model.model_validate(value)
- else:
+ if PYDANTIC_V1:
return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
+ else:
+ return model.model_validate(value)
def field_is_required(field: FieldInfo) -> bool:
- if PYDANTIC_V2:
- return field.is_required()
- return field.required # type: ignore
+ if PYDANTIC_V1:
+ return field.required # type: ignore
+ return field.is_required()
def field_get_default(field: FieldInfo) -> Any:
value = field.get_default()
- if PYDANTIC_V2:
- from pydantic_core import PydanticUndefined
-
- if value == PydanticUndefined:
- return None
+ if PYDANTIC_V1:
return value
+ from pydantic_core import PydanticUndefined
+
+ if value == PydanticUndefined:
+ return None
return value
def field_outer_type(field: FieldInfo) -> Any:
- if PYDANTIC_V2:
- return field.annotation
- return field.outer_type_ # type: ignore
+ if PYDANTIC_V1:
+ return field.outer_type_ # type: ignore
+ return field.annotation
def get_model_config(model: type[pydantic.BaseModel]) -> Any:
- if PYDANTIC_V2:
- return model.model_config
- return model.__config__ # type: ignore
+ if PYDANTIC_V1:
+ return model.__config__ # type: ignore
+ return model.model_config
def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]:
- if PYDANTIC_V2:
- return model.model_fields
- return model.__fields__ # type: ignore
+ if PYDANTIC_V1:
+ return model.__fields__ # type: ignore
+ return model.model_fields
def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT:
- if PYDANTIC_V2:
- return model.model_copy(deep=deep)
- return model.copy(deep=deep) # type: ignore
+ if PYDANTIC_V1:
+ return model.copy(deep=deep) # type: ignore
+ return model.model_copy(deep=deep)
def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str:
- if PYDANTIC_V2:
- return model.model_dump_json(indent=indent)
- return model.json(indent=indent) # type: ignore
+ if PYDANTIC_V1:
+ return model.json(indent=indent) # type: ignore
+ return model.model_dump_json(indent=indent)
def model_dump(
@@ -139,14 +140,14 @@ def model_dump(
warnings: bool = True,
mode: Literal["json", "python"] = "python",
) -> dict[str, Any]:
- if PYDANTIC_V2 or hasattr(model, "model_dump"):
+ if (not PYDANTIC_V1) or hasattr(model, "model_dump"):
return model.model_dump(
mode=mode,
exclude=exclude,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
# warnings are not supported in Pydantic v1
- warnings=warnings if PYDANTIC_V2 else True,
+ warnings=True if PYDANTIC_V1 else warnings,
)
return cast(
"dict[str, Any]",
@@ -159,9 +160,9 @@ def model_dump(
def model_parse(model: type[_ModelT], data: Any) -> _ModelT:
- if PYDANTIC_V2:
- return model.model_validate(data)
- return model.parse_obj(data) # pyright: ignore[reportDeprecated]
+ if PYDANTIC_V1:
+ return model.parse_obj(data) # pyright: ignore[reportDeprecated]
+ return model.model_validate(data)
# generic models
@@ -170,17 +171,16 @@ def model_parse(model: type[_ModelT], data: Any) -> _ModelT:
class GenericModel(pydantic.BaseModel): ...
else:
- if PYDANTIC_V2:
+ if PYDANTIC_V1:
+ import pydantic.generics
+
+ class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ...
+ else:
# there no longer needs to be a distinction in v2 but
# we still have to create our own subclass to avoid
# inconsistent MRO ordering errors
class GenericModel(pydantic.BaseModel): ...
- else:
- import pydantic.generics
-
- class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ...
-
# cached properties
if TYPE_CHECKING:
diff --git a/src/cloudflare/_files.py b/src/cloudflare/_files.py
index 8c03622633a..0c0ce12faaa 100644
--- a/src/cloudflare/_files.py
+++ b/src/cloudflare/_files.py
@@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
return file
if is_tuple_t(file):
- return (file[0], _read_file_content(file[1]), *file[2:])
+ return (file[0], read_file_content(file[1]), *file[2:])
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
-def _read_file_content(file: FileContent) -> HttpxFileContent:
+def read_file_content(file: FileContent) -> HttpxFileContent:
if isinstance(file, os.PathLike):
return pathlib.Path(file).read_bytes()
return file
@@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
return file
if is_tuple_t(file):
- return (file[0], await _async_read_file_content(file[1]), *file[2:])
+ return (file[0], await async_read_file_content(file[1]), *file[2:])
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
-async def _async_read_file_content(file: FileContent) -> HttpxFileContent:
+async def async_read_file_content(file: FileContent) -> HttpxFileContent:
if isinstance(file, os.PathLike):
return await anyio.Path(file).read_bytes()
diff --git a/src/cloudflare/_models.py b/src/cloudflare/_models.py
index 7bf82bb0bde..e2736299361 100644
--- a/src/cloudflare/_models.py
+++ b/src/cloudflare/_models.py
@@ -2,9 +2,24 @@
import os
import inspect
-from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast
+import weakref
+from typing import (
+ IO,
+ TYPE_CHECKING,
+ Any,
+ Type,
+ Union,
+ Generic,
+ TypeVar,
+ Callable,
+ Iterable,
+ Optional,
+ AsyncIterable,
+ cast,
+)
from datetime import date, datetime
from typing_extensions import (
+ List,
Unpack,
Literal,
ClassVar,
@@ -50,7 +65,7 @@
strip_annotated_type,
)
from ._compat import (
- PYDANTIC_V2,
+ PYDANTIC_V1,
ConfigDict,
GenericModel as BaseGenericModel,
get_args,
@@ -81,11 +96,7 @@ class _ConfigProtocol(Protocol):
class BaseModel(pydantic.BaseModel):
- if PYDANTIC_V2:
- model_config: ClassVar[ConfigDict] = ConfigDict(
- extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true"))
- )
- else:
+ if PYDANTIC_V1:
@property
@override
@@ -95,6 +106,10 @@ def model_fields_set(self) -> set[str]:
class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated]
extra: Any = pydantic.Extra.allow # type: ignore
+ else:
+ model_config: ClassVar[ConfigDict] = ConfigDict(
+ extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true"))
+ )
def to_dict(
self,
@@ -208,28 +223,32 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride]
else:
fields_values[name] = field_get_default(field)
+ extra_field_type = _get_extra_fields_type(__cls)
+
_extra = {}
for key, value in values.items():
if key not in model_fields:
- if PYDANTIC_V2:
- _extra[key] = value
- else:
+ parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value
+
+ if PYDANTIC_V1:
_fields_set.add(key)
- fields_values[key] = value
+ fields_values[key] = parsed
+ else:
+ _extra[key] = parsed
object.__setattr__(m, "__dict__", fields_values)
- if PYDANTIC_V2:
- # these properties are copied from Pydantic's `model_construct()` method
- object.__setattr__(m, "__pydantic_private__", None)
- object.__setattr__(m, "__pydantic_extra__", _extra)
- object.__setattr__(m, "__pydantic_fields_set__", _fields_set)
- else:
+ if PYDANTIC_V1:
# init_private_attributes() does not exist in v2
m._init_private_attributes() # type: ignore
# copied from Pydantic v1's `construct()` method
object.__setattr__(m, "__fields_set__", _fields_set)
+ else:
+ # these properties are copied from Pydantic's `model_construct()` method
+ object.__setattr__(m, "__pydantic_private__", None)
+ object.__setattr__(m, "__pydantic_extra__", _extra)
+ object.__setattr__(m, "__pydantic_fields_set__", _fields_set)
return m
@@ -239,7 +258,7 @@ def construct( # pyright: ignore[reportIncompatibleMethodOverride]
# although not in practice
model_construct = construct
- if not PYDANTIC_V2:
+ if PYDANTIC_V1:
# we define aliases for some of the new pydantic v2 methods so
# that we can just document these methods without having to specify
# a specific pydantic version as some users may not know which
@@ -252,13 +271,15 @@ def model_dump(
mode: Literal["json", "python"] | str = "python",
include: IncEx | None = None,
exclude: IncEx | None = None,
- by_alias: bool = False,
+ context: Any | None = None,
+ by_alias: bool | None = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
+ exclude_computed_fields: bool = False,
round_trip: bool = False,
warnings: bool | Literal["none", "warn", "error"] = True,
- context: dict[str, Any] | None = None,
+ fallback: Callable[[Any], Any] | None = None,
serialize_as_any: bool = False,
) -> dict[str, Any]:
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
@@ -267,16 +288,24 @@ def model_dump(
Args:
mode: The mode in which `to_python` should run.
- If mode is 'json', the dictionary will only contain JSON serializable types.
- If mode is 'python', the dictionary may contain any Python objects.
- include: A list of fields to include in the output.
- exclude: A list of fields to exclude from the output.
+ If mode is 'json', the output will only contain JSON serializable types.
+ If mode is 'python', the output may contain non-JSON-serializable Python objects.
+ include: A set of fields to include in the output.
+ exclude: A set of fields to exclude from the output.
+ context: Additional context to pass to the serializer.
by_alias: Whether to use the field's alias in the dictionary key if defined.
- exclude_unset: Whether to exclude fields that are unset or None from the output.
- exclude_defaults: Whether to exclude fields that are set to their default value from the output.
- exclude_none: Whether to exclude fields that have a value of `None` from the output.
- round_trip: Whether to enable serialization and deserialization round-trip support.
- warnings: Whether to log warnings when invalid fields are encountered.
+ exclude_unset: Whether to exclude fields that have not been explicitly set.
+ exclude_defaults: Whether to exclude fields that are set to their default value.
+ exclude_none: Whether to exclude fields that have a value of `None`.
+ exclude_computed_fields: Whether to exclude computed fields.
+ While this can be useful for round-tripping, it is usually recommended to use the dedicated
+ `round_trip` parameter instead.
+ round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].
+ warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,
+ "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].
+ fallback: A function to call when an unknown value is encountered. If not provided,
+ a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.
+ serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.
Returns:
A dictionary representation of the model.
@@ -291,31 +320,38 @@ def model_dump(
raise ValueError("context is only supported in Pydantic v2")
if serialize_as_any != False:
raise ValueError("serialize_as_any is only supported in Pydantic v2")
+ if fallback is not None:
+ raise ValueError("fallback is only supported in Pydantic v2")
+ if exclude_computed_fields != False:
+ raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
dumped = super().dict( # pyright: ignore[reportDeprecated]
include=include,
exclude=exclude,
- by_alias=by_alias,
+ by_alias=by_alias if by_alias is not None else False,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
exclude_none=exclude_none,
)
- return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped
+ return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped
@override
def model_dump_json(
self,
*,
indent: int | None = None,
+ ensure_ascii: bool = False,
include: IncEx | None = None,
exclude: IncEx | None = None,
- by_alias: bool = False,
+ context: Any | None = None,
+ by_alias: bool | None = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
+ exclude_computed_fields: bool = False,
round_trip: bool = False,
warnings: bool | Literal["none", "warn", "error"] = True,
- context: dict[str, Any] | None = None,
+ fallback: Callable[[Any], Any] | None = None,
serialize_as_any: bool = False,
) -> str:
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json
@@ -344,11 +380,17 @@ def model_dump_json(
raise ValueError("context is only supported in Pydantic v2")
if serialize_as_any != False:
raise ValueError("serialize_as_any is only supported in Pydantic v2")
+ if fallback is not None:
+ raise ValueError("fallback is only supported in Pydantic v2")
+ if ensure_ascii != False:
+ raise ValueError("ensure_ascii is only supported in Pydantic v2")
+ if exclude_computed_fields != False:
+ raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
return super().json( # type: ignore[reportDeprecated]
indent=indent,
include=include,
exclude=exclude,
- by_alias=by_alias,
+ by_alias=by_alias if by_alias is not None else False,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
exclude_none=exclude_none,
@@ -359,15 +401,32 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object:
if value is None:
return field_get_default(field)
- if PYDANTIC_V2:
- type_ = field.annotation
- else:
+ if PYDANTIC_V1:
type_ = cast(type, field.outer_type_) # type: ignore
+ else:
+ type_ = field.annotation # type: ignore
if type_ is None:
raise RuntimeError(f"Unexpected field type is None for {key}")
- return construct_type(value=value, type_=type_)
+ return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None))
+
+
+def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None:
+ if PYDANTIC_V1:
+ # TODO
+ return None
+
+ schema = cls.__pydantic_core_schema__
+ if schema["type"] == "model":
+ fields = schema["schema"]
+ if fields["type"] == "model-fields":
+ extras = fields.get("extras_schema")
+ if extras and "cls" in extras:
+ # mypy can't narrow the type
+ return extras["cls"] # type: ignore[no-any-return]
+
+ return None
def is_basemodel(type_: type) -> bool:
@@ -421,7 +480,7 @@ def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T:
return cast(_T, construct_type(value=value, type_=type_))
-def construct_type(*, value: object, type_: object) -> object:
+def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object:
"""Loose coercion to the expected type with construction of nested values.
If the given value does not match the expected type then it is returned as-is.
@@ -439,8 +498,10 @@ def construct_type(*, value: object, type_: object) -> object:
type_ = type_.__value__ # type: ignore[unreachable]
# unwrap `Annotated[T, ...]` -> `T`
- if is_annotated_type(type_):
- meta: tuple[Any, ...] = get_args(type_)[1:]
+ if metadata is not None and len(metadata) > 0:
+ meta: tuple[Any, ...] = tuple(metadata)
+ elif is_annotated_type(type_):
+ meta = get_args(type_)[1:]
type_ = extract_type_arg(type_, 0)
else:
meta = tuple()
@@ -544,6 +605,9 @@ class CachedDiscriminatorType(Protocol):
__discriminator__: DiscriminatorDetails
+DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary()
+
+
class DiscriminatorDetails:
field_name: str
"""The name of the discriminator field in the variant class, e.g.
@@ -586,8 +650,9 @@ def __init__(
def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None:
- if isinstance(union, CachedDiscriminatorType):
- return union.__discriminator__
+ cached = DISCRIMINATOR_CACHE.get(union)
+ if cached is not None:
+ return cached
discriminator_field_name: str | None = None
@@ -605,30 +670,30 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
for variant in get_args(union):
variant = strip_annotated_type(variant)
if is_basemodel_type(variant):
- if PYDANTIC_V2:
- field = _extract_field_schema_pv2(variant, discriminator_field_name)
- if not field:
+ if PYDANTIC_V1:
+ field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
+ if not field_info:
continue
# Note: if one variant defines an alias then they all should
- discriminator_alias = field.get("serialization_alias")
-
- field_schema = field["schema"]
+ discriminator_alias = field_info.alias
- if field_schema["type"] == "literal":
- for entry in cast("LiteralSchema", field_schema)["expected"]:
+ if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation):
+ for entry in get_args(annotation):
if isinstance(entry, str):
mapping[entry] = variant
else:
- field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
- if not field_info:
+ field = _extract_field_schema_pv2(variant, discriminator_field_name)
+ if not field:
continue
# Note: if one variant defines an alias then they all should
- discriminator_alias = field_info.alias
+ discriminator_alias = field.get("serialization_alias")
- if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation):
- for entry in get_args(annotation):
+ field_schema = field["schema"]
+
+ if field_schema["type"] == "literal":
+ for entry in cast("LiteralSchema", field_schema)["expected"]:
if isinstance(entry, str):
mapping[entry] = variant
@@ -640,7 +705,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
discriminator_field=discriminator_field_name,
discriminator_alias=discriminator_alias,
)
- cast(CachedDiscriminatorType, union).__discriminator__ = details
+ DISCRIMINATOR_CACHE.setdefault(union, details)
return details
@@ -691,7 +756,7 @@ class GenericModel(BaseGenericModel, BaseModel):
pass
-if PYDANTIC_V2:
+if not PYDANTIC_V1:
from pydantic import TypeAdapter as _TypeAdapter
_CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter))
@@ -736,6 +801,7 @@ class FinalRequestOptionsInput(TypedDict, total=False):
timeout: float | Timeout | None
files: HttpxRequestFiles | None
idempotency_key: str
+ content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None]
json_data: Body
extra_json: AnyMapping
multipart_syntax: MultipartSyntax
@@ -756,17 +822,18 @@ class FinalRequestOptions(pydantic.BaseModel):
post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven()
follow_redirects: Union[bool, None] = None
+ content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None
# It should be noted that we cannot use `json` here as that would override
# a BaseModel method in an incompatible fashion.
json_data: Union[Body, None] = None
extra_json: Union[AnyMapping, None] = None
- if PYDANTIC_V2:
- model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True)
- else:
+ if PYDANTIC_V1:
class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated]
arbitrary_types_allowed: bool = True
+ else:
+ model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True)
def get_max_retries(self, max_retries: int) -> int:
if isinstance(self.max_retries, NotGiven):
@@ -799,9 +866,9 @@ def construct( # type: ignore
key: strip_not_given(value)
for key, value in values.items()
}
- if PYDANTIC_V2:
- return super().model_construct(_fields_set, **kwargs)
- return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated]
+ if PYDANTIC_V1:
+ return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated]
+ return super().model_construct(_fields_set, **kwargs)
if not TYPE_CHECKING:
# type checkers incorrectly complain about this assignment
diff --git a/src/cloudflare/_qs.py b/src/cloudflare/_qs.py
index 274320ca5ee..ada6fd3f721 100644
--- a/src/cloudflare/_qs.py
+++ b/src/cloudflare/_qs.py
@@ -4,7 +4,7 @@
from urllib.parse import parse_qs, urlencode
from typing_extensions import Literal, get_args
-from ._types import NOT_GIVEN, NotGiven, NotGivenOr
+from ._types import NotGiven, not_given
from ._utils import flatten
_T = TypeVar("_T")
@@ -41,8 +41,8 @@ def stringify(
self,
params: Params,
*,
- array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
- nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
+ array_format: ArrayFormat | NotGiven = not_given,
+ nested_format: NestedFormat | NotGiven = not_given,
) -> str:
return urlencode(
self.stringify_items(
@@ -56,8 +56,8 @@ def stringify_items(
self,
params: Params,
*,
- array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
- nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
+ array_format: ArrayFormat | NotGiven = not_given,
+ nested_format: NestedFormat | NotGiven = not_given,
) -> list[tuple[str, str]]:
opts = Options(
qs=self,
@@ -143,8 +143,8 @@ def __init__(
self,
qs: Querystring = _qs,
*,
- array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN,
- nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN,
+ array_format: ArrayFormat | NotGiven = not_given,
+ nested_format: NestedFormat | NotGiven = not_given,
) -> None:
self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format
self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format
diff --git a/src/cloudflare/_streaming.py b/src/cloudflare/_streaming.py
index 0be44fec67a..d26f2aaf70a 100644
--- a/src/cloudflare/_streaming.py
+++ b/src/cloudflare/_streaming.py
@@ -54,12 +54,12 @@ def __stream__(self) -> Iterator[_T]:
process_data = self._client._process_response_data
iterator = self._iter_events()
- for sse in iterator:
- yield process_data(data=sse.json(), cast_to=cast_to, response=response)
-
- # Ensure the entire stream is consumed
- for _sse in iterator:
- ...
+ try:
+ for sse in iterator:
+ yield process_data(data=sse.json(), cast_to=cast_to, response=response)
+ finally:
+ # Ensure the response is closed even if the consumer doesn't read all data
+ response.close()
def __enter__(self) -> Self:
return self
@@ -118,12 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]:
process_data = self._client._process_response_data
iterator = self._iter_events()
- async for sse in iterator:
- yield process_data(data=sse.json(), cast_to=cast_to, response=response)
-
- # Ensure the entire stream is consumed
- async for _sse in iterator:
- ...
+ try:
+ async for sse in iterator:
+ yield process_data(data=sse.json(), cast_to=cast_to, response=response)
+ finally:
+ # Ensure the response is closed even if the consumer doesn't read all data
+ await response.aclose()
async def __aenter__(self) -> Self:
return self
diff --git a/src/cloudflare/_types.py b/src/cloudflare/_types.py
index 1d0b53f5ab8..e5a095d8f3f 100644
--- a/src/cloudflare/_types.py
+++ b/src/cloudflare/_types.py
@@ -13,10 +13,23 @@
Mapping,
TypeVar,
Callable,
+ Iterable,
+ Iterator,
Optional,
Sequence,
+ AsyncIterable,
+)
+from typing_extensions import (
+ Set,
+ Literal,
+ Protocol,
+ TypeAlias,
+ TypedDict,
+ SupportsIndex,
+ overload,
+ override,
+ runtime_checkable,
)
-from typing_extensions import Set, Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable
import httpx
import pydantic
@@ -45,6 +58,13 @@
else:
Base64FileInput = Union[IO[bytes], PathLike]
FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8.
+
+
+# Used for sending raw binary data / streaming data in request bodies
+# e.g. for file uploads without multipart encoding
+BinaryTypes = Union[bytes, bytearray, IO[bytes], Iterable[bytes]]
+AsyncBinaryTypes = Union[bytes, bytearray, IO[bytes], AsyncIterable[bytes]]
+
FileTypes = Union[
# file (or bytes)
FileContent,
@@ -109,18 +129,21 @@ class RequestOptions(TypedDict, total=False):
# Sentinel class used until PEP 0661 is accepted
class NotGiven:
"""
- A sentinel singleton class used to distinguish omitted keyword arguments
- from those passed in with the value None (which may have different behavior).
+ For parameters with a meaningful None value, we need to distinguish between
+ the user explicitly passing None, and the user not passing the parameter at
+ all.
+
+ User code shouldn't need to use not_given directly.
For example:
```py
- def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: ...
+ def create(timeout: Timeout | None | NotGiven = not_given): ...
- get(timeout=1) # 1s timeout
- get(timeout=None) # No timeout
- get() # Default timeout behavior, which may not be statically known at the method definition.
+ create(timeout=1) # 1s timeout
+ create(timeout=None) # No timeout
+ create() # Default timeout behavior
```
"""
@@ -132,13 +155,14 @@ def __repr__(self) -> str:
return "NOT_GIVEN"
-NotGivenOr = Union[_T, NotGiven]
+not_given = NotGiven()
+# for backwards compatibility:
NOT_GIVEN = NotGiven()
class Omit:
- """In certain situations you need to be able to represent a case where a default value has
- to be explicitly removed and `None` is not an appropriate substitute, for example:
+ """
+ To explicitly omit something from being sent in a request, use `omit`.
```py
# as the default `Content-Type` header is `application/json` that will be sent
@@ -148,8 +172,8 @@ class Omit:
# to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983'
client.post(..., headers={"Content-Type": "multipart/form-data"})
- # instead you can remove the default `application/json` header by passing Omit
- client.post(..., headers={"Content-Type": Omit()})
+ # instead you can remove the default `application/json` header by passing omit
+ client.post(..., headers={"Content-Type": omit})
```
"""
@@ -157,6 +181,9 @@ def __bool__(self) -> Literal[False]:
return False
+omit = Omit()
+
+
@runtime_checkable
class ModelBuilderProtocol(Protocol):
@classmethod
@@ -220,3 +247,27 @@ class _GenericAlias(Protocol):
class HttpxSendArgs(TypedDict, total=False):
auth: httpx.Auth
follow_redirects: bool
+
+
+_T_co = TypeVar("_T_co", covariant=True)
+
+
+if TYPE_CHECKING:
+ # This works because str.__contains__ does not accept object (either in typeshed or at runtime)
+ # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
+ #
+ # Note: index() and count() methods are intentionally omitted to allow pyright to properly
+ # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr.
+ class SequenceNotStr(Protocol[_T_co]):
+ @overload
+ def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
+ @overload
+ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ...
+ def __contains__(self, value: object, /) -> bool: ...
+ def __len__(self) -> int: ...
+ def __iter__(self) -> Iterator[_T_co]: ...
+ def __reversed__(self) -> Iterator[_T_co]: ...
+else:
+ # just point this to a normal `Sequence` at runtime to avoid having to special case
+ # deserializing our custom sequence type
+ SequenceNotStr = Sequence
diff --git a/src/cloudflare/_utils/__init__.py b/src/cloudflare/_utils/__init__.py
index d4fda26f3c2..dc64e29a1c0 100644
--- a/src/cloudflare/_utils/__init__.py
+++ b/src/cloudflare/_utils/__init__.py
@@ -10,7 +10,6 @@
lru_cache as lru_cache,
is_mapping as is_mapping,
is_tuple_t as is_tuple_t,
- parse_date as parse_date,
is_iterable as is_iterable,
is_sequence as is_sequence,
coerce_float as coerce_float,
@@ -23,7 +22,6 @@
coerce_boolean as coerce_boolean,
coerce_integer as coerce_integer,
file_from_path as file_from_path,
- parse_datetime as parse_datetime,
strip_not_given as strip_not_given,
deepcopy_minimal as deepcopy_minimal,
get_async_library as get_async_library,
@@ -32,12 +30,20 @@
maybe_coerce_boolean as maybe_coerce_boolean,
maybe_coerce_integer as maybe_coerce_integer,
)
+from ._compat import (
+ get_args as get_args,
+ is_union as is_union,
+ get_origin as get_origin,
+ is_typeddict as is_typeddict,
+ is_literal_type as is_literal_type,
+)
from ._typing import (
is_list_type as is_list_type,
is_union_type as is_union_type,
extract_type_arg as extract_type_arg,
is_iterable_type as is_iterable_type,
is_required_type as is_required_type,
+ is_sequence_type as is_sequence_type,
is_annotated_type as is_annotated_type,
is_type_alias_type as is_type_alias_type,
strip_annotated_type as strip_annotated_type,
@@ -55,3 +61,4 @@
function_has_argument as function_has_argument,
assert_signatures_in_sync as assert_signatures_in_sync,
)
+from ._datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime
diff --git a/src/cloudflare/_utils/_compat.py b/src/cloudflare/_utils/_compat.py
new file mode 100644
index 00000000000..dd703233c56
--- /dev/null
+++ b/src/cloudflare/_utils/_compat.py
@@ -0,0 +1,45 @@
+from __future__ import annotations
+
+import sys
+import typing_extensions
+from typing import Any, Type, Union, Literal, Optional
+from datetime import date, datetime
+from typing_extensions import get_args as _get_args, get_origin as _get_origin
+
+from .._types import StrBytesIntFloat
+from ._datetime_parse import parse_date as _parse_date, parse_datetime as _parse_datetime
+
+_LITERAL_TYPES = {Literal, typing_extensions.Literal}
+
+
+def get_args(tp: type[Any]) -> tuple[Any, ...]:
+ return _get_args(tp)
+
+
+def get_origin(tp: type[Any]) -> type[Any] | None:
+ return _get_origin(tp)
+
+
+def is_union(tp: Optional[Type[Any]]) -> bool:
+ if sys.version_info < (3, 10):
+ return tp is Union # type: ignore[comparison-overlap]
+ else:
+ import types
+
+ return tp is Union or tp is types.UnionType
+
+
+def is_typeddict(tp: Type[Any]) -> bool:
+ return typing_extensions.is_typeddict(tp)
+
+
+def is_literal_type(tp: Type[Any]) -> bool:
+ return get_origin(tp) in _LITERAL_TYPES
+
+
+def parse_date(value: Union[date, StrBytesIntFloat]) -> date:
+ return _parse_date(value)
+
+
+def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime:
+ return _parse_datetime(value)
diff --git a/src/cloudflare/_utils/_datetime_parse.py b/src/cloudflare/_utils/_datetime_parse.py
new file mode 100644
index 00000000000..7cb9d9e668c
--- /dev/null
+++ b/src/cloudflare/_utils/_datetime_parse.py
@@ -0,0 +1,136 @@
+"""
+This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py
+without the Pydantic v1 specific errors.
+"""
+
+from __future__ import annotations
+
+import re
+from typing import Dict, Union, Optional
+from datetime import date, datetime, timezone, timedelta
+
+from .._types import StrBytesIntFloat
+
+date_expr = r"(?P\d{4})-(?P\d{1,2})-(?P\d{1,2})"
+time_expr = (
+ r"(?P\d{1,2}):(?P\d{1,2})"
+ r"(?::(?P\d{1,2})(?:\.(?P\d{1,6})\d{0,6})?)?"
+ r"(?PZ|[+-]\d{2}(?::?\d{2})?)?$"
+)
+
+date_re = re.compile(f"{date_expr}$")
+datetime_re = re.compile(f"{date_expr}[T ]{time_expr}")
+
+
+EPOCH = datetime(1970, 1, 1)
+# if greater than this, the number is in ms, if less than or equal it's in seconds
+# (in seconds this is 11th October 2603, in ms it's 20th August 1970)
+MS_WATERSHED = int(2e10)
+# slightly more than datetime.max in ns - (datetime.max - EPOCH).total_seconds() * 1e9
+MAX_NUMBER = int(3e20)
+
+
+def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]:
+ if isinstance(value, (int, float)):
+ return value
+ try:
+ return float(value)
+ except ValueError:
+ return None
+ except TypeError:
+ raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None
+
+
+def _from_unix_seconds(seconds: Union[int, float]) -> datetime:
+ if seconds > MAX_NUMBER:
+ return datetime.max
+ elif seconds < -MAX_NUMBER:
+ return datetime.min
+
+ while abs(seconds) > MS_WATERSHED:
+ seconds /= 1000
+ dt = EPOCH + timedelta(seconds=seconds)
+ return dt.replace(tzinfo=timezone.utc)
+
+
+def _parse_timezone(value: Optional[str]) -> Union[None, int, timezone]:
+ if value == "Z":
+ return timezone.utc
+ elif value is not None:
+ offset_mins = int(value[-2:]) if len(value) > 3 else 0
+ offset = 60 * int(value[1:3]) + offset_mins
+ if value[0] == "-":
+ offset = -offset
+ return timezone(timedelta(minutes=offset))
+ else:
+ return None
+
+
+def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime:
+ """
+ Parse a datetime/int/float/string and return a datetime.datetime.
+
+ This function supports time zone offsets. When the input contains one,
+ the output uses a timezone with a fixed offset from UTC.
+
+ Raise ValueError if the input is well formatted but not a valid datetime.
+ Raise ValueError if the input isn't well formatted.
+ """
+ if isinstance(value, datetime):
+ return value
+
+ number = _get_numeric(value, "datetime")
+ if number is not None:
+ return _from_unix_seconds(number)
+
+ if isinstance(value, bytes):
+ value = value.decode()
+
+ assert not isinstance(value, (float, int))
+
+ match = datetime_re.match(value)
+ if match is None:
+ raise ValueError("invalid datetime format")
+
+ kw = match.groupdict()
+ if kw["microsecond"]:
+ kw["microsecond"] = kw["microsecond"].ljust(6, "0")
+
+ tzinfo = _parse_timezone(kw.pop("tzinfo"))
+ kw_: Dict[str, Union[None, int, timezone]] = {k: int(v) for k, v in kw.items() if v is not None}
+ kw_["tzinfo"] = tzinfo
+
+ return datetime(**kw_) # type: ignore
+
+
+def parse_date(value: Union[date, StrBytesIntFloat]) -> date:
+ """
+ Parse a date/int/float/string and return a datetime.date.
+
+ Raise ValueError if the input is well formatted but not a valid date.
+ Raise ValueError if the input isn't well formatted.
+ """
+ if isinstance(value, date):
+ if isinstance(value, datetime):
+ return value.date()
+ else:
+ return value
+
+ number = _get_numeric(value, "date")
+ if number is not None:
+ return _from_unix_seconds(number).date()
+
+ if isinstance(value, bytes):
+ value = value.decode()
+
+ assert not isinstance(value, (float, int))
+ match = date_re.match(value)
+ if match is None:
+ raise ValueError("invalid date format")
+
+ kw = {k: int(v) for k, v in match.groupdict().items()}
+
+ try:
+ return date(**kw)
+ except ValueError:
+ raise ValueError("invalid date format") from None
diff --git a/src/cloudflare/_utils/_sync.py b/src/cloudflare/_utils/_sync.py
index ad7ec71b76b..f6027c183d1 100644
--- a/src/cloudflare/_utils/_sync.py
+++ b/src/cloudflare/_utils/_sync.py
@@ -1,10 +1,8 @@
from __future__ import annotations
-import sys
import asyncio
import functools
-import contextvars
-from typing import Any, TypeVar, Callable, Awaitable
+from typing import TypeVar, Callable, Awaitable
from typing_extensions import ParamSpec
import anyio
@@ -15,34 +13,11 @@
T_ParamSpec = ParamSpec("T_ParamSpec")
-if sys.version_info >= (3, 9):
- _asyncio_to_thread = asyncio.to_thread
-else:
- # backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
- # for Python 3.8 support
- async def _asyncio_to_thread(
- func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
- ) -> Any:
- """Asynchronously run function *func* in a separate thread.
-
- Any *args and **kwargs supplied for this function are directly passed
- to *func*. Also, the current :class:`contextvars.Context` is propagated,
- allowing context variables from the main thread to be accessed in the
- separate thread.
-
- Returns a coroutine that can be awaited to get the eventual result of *func*.
- """
- loop = asyncio.events.get_running_loop()
- ctx = contextvars.copy_context()
- func_call = functools.partial(ctx.run, func, *args, **kwargs)
- return await loop.run_in_executor(None, func_call)
-
-
async def to_thread(
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
) -> T_Retval:
if sniffio.current_async_library() == "asyncio":
- return await _asyncio_to_thread(func, *args, **kwargs)
+ return await asyncio.to_thread(func, *args, **kwargs)
return await anyio.to_thread.run_sync(
functools.partial(func, *args, **kwargs),
@@ -53,10 +28,7 @@ async def to_thread(
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
"""
Take a blocking function and create an async one that receives the same
- positional and keyword arguments. For python version 3.9 and above, it uses
- asyncio.to_thread to run the function in a separate thread. For python version
- 3.8, it uses locally defined copy of the asyncio.to_thread function which was
- introduced in python 3.9.
+ positional and keyword arguments.
Usage:
diff --git a/src/cloudflare/_utils/_transform.py b/src/cloudflare/_utils/_transform.py
index b0cc20a7355..5207549207e 100644
--- a/src/cloudflare/_utils/_transform.py
+++ b/src/cloudflare/_utils/_transform.py
@@ -16,18 +16,20 @@
lru_cache,
is_mapping,
is_iterable,
+ is_sequence,
)
from .._files import is_base64_file_input
+from ._compat import get_origin, is_typeddict
from ._typing import (
is_list_type,
is_union_type,
extract_type_arg,
is_iterable_type,
is_required_type,
+ is_sequence_type,
is_annotated_type,
strip_annotated_type,
)
-from .._compat import get_origin, model_dump, is_typeddict
_T = TypeVar("_T")
@@ -167,6 +169,8 @@ def _transform_recursive(
Defaults to the same value as the `annotation` argument.
"""
+ from .._compat import model_dump
+
if inner_type is None:
inner_type = annotation
@@ -184,6 +188,8 @@ def _transform_recursive(
(is_list_type(stripped_type) and is_list(data))
# Iterable[T]
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
+ # Sequence[T]
+ or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
):
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
# intended as an iterable, so we don't transform it.
@@ -262,7 +268,7 @@ def _transform_typeddict(
annotations = get_type_hints(expected_type, include_extras=True)
for key, value in data.items():
if not is_given(value):
- # we don't need to include `NotGiven` values here as they'll
+ # we don't need to include omitted values here as they'll
# be stripped out before the request is sent anyway
continue
@@ -329,6 +335,8 @@ async def _async_transform_recursive(
Defaults to the same value as the `annotation` argument.
"""
+ from .._compat import model_dump
+
if inner_type is None:
inner_type = annotation
@@ -346,6 +354,8 @@ async def _async_transform_recursive(
(is_list_type(stripped_type) and is_list(data))
# Iterable[T]
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
+ # Sequence[T]
+ or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
):
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
# intended as an iterable, so we don't transform it.
@@ -424,7 +434,7 @@ async def _async_transform_typeddict(
annotations = get_type_hints(expected_type, include_extras=True)
for key, value in data.items():
if not is_given(value):
- # we don't need to include `NotGiven` values here as they'll
+ # we don't need to include omitted values here as they'll
# be stripped out before the request is sent anyway
continue
diff --git a/src/cloudflare/_utils/_typing.py b/src/cloudflare/_utils/_typing.py
index 1bac9542e20..193109f3ad2 100644
--- a/src/cloudflare/_utils/_typing.py
+++ b/src/cloudflare/_utils/_typing.py
@@ -15,7 +15,7 @@
from ._utils import lru_cache
from .._types import InheritsGeneric
-from .._compat import is_union as _is_union
+from ._compat import is_union as _is_union
def is_annotated_type(typ: type) -> bool:
@@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
return (get_origin(typ) or typ) == list
+def is_sequence_type(typ: type) -> bool:
+ origin = get_origin(typ) or typ
+ return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence
+
+
def is_iterable_type(typ: type) -> bool:
"""If the given type is `typing.Iterable[T]`"""
origin = get_origin(typ) or typ
diff --git a/src/cloudflare/_utils/_utils.py b/src/cloudflare/_utils/_utils.py
index ea3cf3f2c38..eec7f4a1f23 100644
--- a/src/cloudflare/_utils/_utils.py
+++ b/src/cloudflare/_utils/_utils.py
@@ -21,8 +21,7 @@
import sniffio
-from .._types import NotGiven, FileTypes, NotGivenOr, HeadersLike
-from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
+from .._types import Omit, NotGiven, FileTypes, HeadersLike
_T = TypeVar("_T")
_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
@@ -64,7 +63,7 @@ def _extract_items(
try:
key = path[index]
except IndexError:
- if isinstance(obj, NotGiven):
+ if not is_given(obj):
# no value was provided - we can safely ignore
return []
@@ -127,14 +126,14 @@ def _extract_items(
return []
-def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]:
- return not isinstance(obj, NotGiven)
+def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
+ return not isinstance(obj, NotGiven) and not isinstance(obj, Omit)
# Type safe methods for narrowing types with TypeVars.
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
# however this cause Pyright to rightfully report errors. As we know we don't
-# care about the contained types we can safely use `object` in it's place.
+# care about the contained types we can safely use `object` in its place.
#
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
# `is_*` is for when you're dealing with an unknown input
diff --git a/src/cloudflare/_version.py b/src/cloudflare/_version.py
index 0d479c2e651..d584d122921 100644
--- a/src/cloudflare/_version.py
+++ b/src/cloudflare/_version.py
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
__title__ = "cloudflare"
-__version__ = "4.3.1" # x-release-please-version
+__version__ = "4.4.0" # x-release-please-version
diff --git a/src/cloudflare/pagination.py b/src/cloudflare/pagination.py
index 947aca4121a..ee3916506ff 100644
--- a/src/cloudflare/pagination.py
+++ b/src/cloudflare/pagination.py
@@ -17,6 +17,10 @@
"CursorPaginationResultInfo",
"SyncCursorPagination",
"AsyncCursorPagination",
+ "CursorPaginationAfterResultInfo",
+ "CursorPaginationAfterCursors",
+ "SyncCursorPaginationAfter",
+ "AsyncCursorPaginationAfter",
"CursorLimitPaginationResultInfo",
"SyncCursorLimitPagination",
"AsyncCursorLimitPagination",
@@ -175,6 +179,62 @@ def next_page_info(self) -> Optional[PageInfo]:
return PageInfo(params={"cursor": cursor})
+class CursorPaginationAfterCursors(BaseModel):
+ after: Optional[str] = None
+
+
+class CursorPaginationAfterResultInfo(BaseModel):
+ cursors: Optional[CursorPaginationAfterCursors] = None
+
+
+class SyncCursorPaginationAfter(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
+ result: List[_T]
+ result_info: Optional[CursorPaginationAfterResultInfo] = None
+
+ @override
+ def _get_page_items(self) -> List[_T]:
+ result = self.result
+ if not result:
+ return []
+ return result
+
+ @override
+ def next_page_info(self) -> Optional[PageInfo]:
+ after = None
+ if self.result_info is not None:
+ if self.result_info.cursors is not None:
+ if self.result_info.cursors.after is not None:
+ after = self.result_info.cursors.after
+ if not after:
+ return None
+
+ return PageInfo(params={"cursor": after})
+
+
+class AsyncCursorPaginationAfter(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
+ result: List[_T]
+ result_info: Optional[CursorPaginationAfterResultInfo] = None
+
+ @override
+ def _get_page_items(self) -> List[_T]:
+ result = self.result
+ if not result:
+ return []
+ return result
+
+ @override
+ def next_page_info(self) -> Optional[PageInfo]:
+ after = None
+ if self.result_info is not None:
+ if self.result_info.cursors is not None:
+ if self.result_info.cursors.after is not None:
+ after = self.result_info.cursors.after
+ if not after:
+ return None
+
+ return PageInfo(params={"cursor": after})
+
+
class CursorLimitPaginationResultInfo(BaseModel):
count: Optional[int] = None
diff --git a/src/cloudflare/resources/abuse_reports.py b/src/cloudflare/resources/abuse_reports.py
deleted file mode 100644
index e3e3af888d9..00000000000
--- a/src/cloudflare/resources/abuse_reports.py
+++ /dev/null
@@ -1,2967 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing import Type, cast
-from typing_extensions import Literal, overload
-
-import httpx
-
-from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from .._utils import required_args, maybe_transform, async_maybe_transform
-from .._compat import cached_property
-from .._resource import SyncAPIResource, AsyncAPIResource
-from .._response import (
- to_raw_response_wrapper,
- to_streamed_response_wrapper,
- async_to_raw_response_wrapper,
- async_to_streamed_response_wrapper,
-)
-from .._wrappers import ResultWrapper
-from .._base_client import make_request_options
-from ..types.abuse_reports import abuse_report_create_params
-from ..types.abuse_reports.abuse_report_create_response import AbuseReportCreateResponse
-
-__all__ = ["AbuseReportsResource", "AsyncAbuseReportsResource"]
-
-
-class AbuseReportsResource(SyncAPIResource):
- @cached_property
- def with_raw_response(self) -> AbuseReportsResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return
- the raw 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 AbuseReportsResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AbuseReportsResourceWithStreamingResponse:
- """
- 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 AbuseReportsResourceWithStreamingResponse(self)
-
- @overload
- def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @required_args(["account_id", "act", "email", "email2", "name", "urls"])
- def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- if not account_id:
- raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not report_type:
- raise ValueError(f"Expected a non-empty value for `report_type` but received {report_type!r}")
- return self._post(
- f"/accounts/{account_id}/abuse-reports/{report_type}",
- body=maybe_transform(
- {
- "act": act,
- "email": email,
- "email2": email2,
- "name": name,
- "urls": urls,
- "address1": address1,
- "agent_name": agent_name,
- "agree": agree,
- "city": city,
- "comments": comments,
- "company": company,
- "country": country,
- "destination_ips": destination_ips,
- "host_notification": host_notification,
- "justification": justification,
- "ncmec_notification": ncmec_notification,
- "ncsei_subject_representation": ncsei_subject_representation,
- "original_work": original_work,
- "owner_notification": owner_notification,
- "ports_protocols": ports_protocols,
- "reported_country": reported_country,
- "reported_user_agent": reported_user_agent,
- "signature": signature,
- "source_ips": source_ips,
- "state": state,
- "tele": tele,
- "title": title,
- "trademark_number": trademark_number,
- "trademark_office": trademark_office,
- "trademark_symbol": trademark_symbol,
- },
- abuse_report_create_params.AbuseReportCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[AbuseReportCreateResponse]._unwrapper,
- ),
- cast_to=cast(Type[str], ResultWrapper[str]),
- )
-
-
-class AsyncAbuseReportsResource(AsyncAPIResource):
- @cached_property
- def with_raw_response(self) -> AsyncAbuseReportsResourceWithRawResponse:
- """
- This property can be used as a prefix for any HTTP method call to return
- the raw 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 AsyncAbuseReportsResourceWithRawResponse(self)
-
- @cached_property
- def with_streaming_response(self) -> AsyncAbuseReportsResourceWithStreamingResponse:
- """
- 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 AsyncAbuseReportsResourceWithStreamingResponse(self)
-
- @overload
- async def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- async def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- async def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- async def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- async def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- async def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- async def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @overload
- async def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- """
- Submit the Abuse Report of a particular type
-
- Args:
- report_type: The abuse report type
-
- act: The abuse report type
-
- email: A valid email of the abuse reporter. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- email2: Should match the value provided in `email`
-
- name: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- urls: A list of valid URLs separated by ‘ ’ (new line character). The list of the URLs
- should not exceed 250 URLs. All URLs should have the same hostname. Each URL
- should be unique. This field may be released by Cloudflare to third parties such
- as the Lumen Database (https://lumendatabase.org/).
-
- address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
- may be released by Cloudflare to third parties such as the Lumen Database
- (https://lumendatabase.org/).
-
- agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
-
- city: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- comments: Any additional comments about the infringement not exceeding 2000 characters
-
- company: Text not exceeding 100 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- country: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- destination_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of
- destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
- ought to be unique
-
- host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- justification: A detailed description of the infringement, including any necessary access
- details and the exact steps needed to view the content, not exceeding 5000
- characters
-
- ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
-
- original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
- reports cannot be anonymous.
-
- ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
- size of the field should not exceed 2000 characters. Each individual
- port/protocol should not exceed 100 characters. The list should not have more
- than 30 unique ports and protocols.
-
- reported_country: Text containing 2 characters
-
- reported_user_agent: Text not exceeding 255 characters
-
- signature: Required for DMCA reports, should be same as Name. An affirmation that all
- information in the report is true and accurate while agreeing to the policies of
- Cloudflare's abuse reports
-
- source_ips: A list of IP addresses separated by ‘ ’ (new line character). The list of source
- IPs should not exceed 30 IP addresses. Each one of the IP addresses ought to be
- unique
-
- state: Text not exceeding 255 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
- third parties such as the Lumen Database (https://lumendatabase.org/).
-
- title: Text not exceeding 255 characters
-
- trademark_number: Text not exceeding 1000 characters
-
- trademark_office: Text not exceeding 1000 characters
-
- trademark_symbol: Text not exceeding 1000 characters
-
- 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
- """
- ...
-
- @required_args(["account_id", "act", "email", "email2", "name", "urls"])
- async def create(
- self,
- report_type: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- *,
- account_id: str,
- act: Literal[
- "abuse_dmca",
- "abuse_trademark",
- "abuse_general",
- "abuse_phishing",
- "abuse_children",
- "abuse_threat",
- "abuse_registrar_whois",
- "abuse_ncsei",
- ],
- email: str,
- email2: str,
- name: str,
- urls: str,
- address1: str | NotGiven = NOT_GIVEN,
- agent_name: str | NotGiven = NOT_GIVEN,
- agree: Literal[0, 1] | NotGiven = NOT_GIVEN,
- city: str | NotGiven = NOT_GIVEN,
- comments: str | NotGiven = NOT_GIVEN,
- company: str | NotGiven = NOT_GIVEN,
- country: str | NotGiven = NOT_GIVEN,
- destination_ips: str | NotGiven = NOT_GIVEN,
- host_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- justification: str | NotGiven = NOT_GIVEN,
- ncmec_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ncsei_subject_representation: bool | NotGiven = NOT_GIVEN,
- original_work: str | NotGiven = NOT_GIVEN,
- owner_notification: Literal["send", "send-anon", "none"] | NotGiven = NOT_GIVEN,
- ports_protocols: str | NotGiven = NOT_GIVEN,
- reported_country: str | NotGiven = NOT_GIVEN,
- reported_user_agent: str | NotGiven = NOT_GIVEN,
- signature: str | NotGiven = NOT_GIVEN,
- source_ips: str | NotGiven = NOT_GIVEN,
- state: str | NotGiven = NOT_GIVEN,
- tele: str | NotGiven = NOT_GIVEN,
- title: str | NotGiven = NOT_GIVEN,
- trademark_number: str | NotGiven = NOT_GIVEN,
- trademark_office: str | NotGiven = NOT_GIVEN,
- trademark_symbol: str | NotGiven = NOT_GIVEN,
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
- # The extra values given here take precedence over values defined on the client or passed to this method.
- extra_headers: Headers | None = None,
- extra_query: Query | None = None,
- extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> str:
- if not account_id:
- raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not report_type:
- raise ValueError(f"Expected a non-empty value for `report_type` but received {report_type!r}")
- return await self._post(
- f"/accounts/{account_id}/abuse-reports/{report_type}",
- body=await async_maybe_transform(
- {
- "act": act,
- "email": email,
- "email2": email2,
- "name": name,
- "urls": urls,
- "address1": address1,
- "agent_name": agent_name,
- "agree": agree,
- "city": city,
- "comments": comments,
- "company": company,
- "country": country,
- "destination_ips": destination_ips,
- "host_notification": host_notification,
- "justification": justification,
- "ncmec_notification": ncmec_notification,
- "ncsei_subject_representation": ncsei_subject_representation,
- "original_work": original_work,
- "owner_notification": owner_notification,
- "ports_protocols": ports_protocols,
- "reported_country": reported_country,
- "reported_user_agent": reported_user_agent,
- "signature": signature,
- "source_ips": source_ips,
- "state": state,
- "tele": tele,
- "title": title,
- "trademark_number": trademark_number,
- "trademark_office": trademark_office,
- "trademark_symbol": trademark_symbol,
- },
- abuse_report_create_params.AbuseReportCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[AbuseReportCreateResponse]._unwrapper,
- ),
- cast_to=cast(Type[str], ResultWrapper[str]),
- )
-
-
-class AbuseReportsResourceWithRawResponse:
- def __init__(self, abuse_reports: AbuseReportsResource) -> None:
- self._abuse_reports = abuse_reports
-
- self.create = to_raw_response_wrapper(
- abuse_reports.create,
- )
-
-
-class AsyncAbuseReportsResourceWithRawResponse:
- def __init__(self, abuse_reports: AsyncAbuseReportsResource) -> None:
- self._abuse_reports = abuse_reports
-
- self.create = async_to_raw_response_wrapper(
- abuse_reports.create,
- )
-
-
-class AbuseReportsResourceWithStreamingResponse:
- def __init__(self, abuse_reports: AbuseReportsResource) -> None:
- self._abuse_reports = abuse_reports
-
- self.create = to_streamed_response_wrapper(
- abuse_reports.create,
- )
-
-
-class AsyncAbuseReportsResourceWithStreamingResponse:
- def __init__(self, abuse_reports: AsyncAbuseReportsResource) -> None:
- self._abuse_reports = abuse_reports
-
- self.create = async_to_streamed_response_wrapper(
- abuse_reports.create,
- )
diff --git a/src/cloudflare/resources/abuse_reports/__init__.py b/src/cloudflare/resources/abuse_reports/__init__.py
new file mode 100644
index 00000000000..4283c591bc4
--- /dev/null
+++ b/src/cloudflare/resources/abuse_reports/__init__.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .mitigations import (
+ MitigationsResource,
+ AsyncMitigationsResource,
+ MitigationsResourceWithRawResponse,
+ AsyncMitigationsResourceWithRawResponse,
+ MitigationsResourceWithStreamingResponse,
+ AsyncMitigationsResourceWithStreamingResponse,
+)
+from .abuse_reports import (
+ AbuseReportsResource,
+ AsyncAbuseReportsResource,
+ AbuseReportsResourceWithRawResponse,
+ AsyncAbuseReportsResourceWithRawResponse,
+ AbuseReportsResourceWithStreamingResponse,
+ AsyncAbuseReportsResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "MitigationsResource",
+ "AsyncMitigationsResource",
+ "MitigationsResourceWithRawResponse",
+ "AsyncMitigationsResourceWithRawResponse",
+ "MitigationsResourceWithStreamingResponse",
+ "AsyncMitigationsResourceWithStreamingResponse",
+ "AbuseReportsResource",
+ "AsyncAbuseReportsResource",
+ "AbuseReportsResourceWithRawResponse",
+ "AsyncAbuseReportsResourceWithRawResponse",
+ "AbuseReportsResourceWithStreamingResponse",
+ "AsyncAbuseReportsResourceWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/abuse_reports/abuse_reports.py b/src/cloudflare/resources/abuse_reports/abuse_reports.py
new file mode 100644
index 00000000000..9cf0a64aa03
--- /dev/null
+++ b/src/cloudflare/resources/abuse_reports/abuse_reports.py
@@ -0,0 +1,2164 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, Optional, cast
+from typing_extensions import Literal, overload
+
+import httpx
+
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ..._utils import required_args, maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._wrappers import ResultWrapper
+from .mitigations import (
+ MitigationsResource,
+ AsyncMitigationsResource,
+ MitigationsResourceWithRawResponse,
+ AsyncMitigationsResourceWithRawResponse,
+ MitigationsResourceWithStreamingResponse,
+ AsyncMitigationsResourceWithStreamingResponse,
+)
+from ...pagination import SyncV4PagePagination, AsyncV4PagePagination
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.abuse_reports import abuse_report_list_params, abuse_report_create_params
+from ...types.abuse_reports.abuse_report_get_response import AbuseReportGetResponse
+from ...types.abuse_reports.abuse_report_list_response import AbuseReportListResponse
+from ...types.abuse_reports.abuse_report_create_response import AbuseReportCreateResponse
+
+__all__ = ["AbuseReportsResource", "AsyncAbuseReportsResource"]
+
+
+class AbuseReportsResource(SyncAPIResource):
+ @cached_property
+ def mitigations(self) -> MitigationsResource:
+ return MitigationsResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AbuseReportsResourceWithRawResponse:
+ """
+ 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 AbuseReportsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AbuseReportsResourceWithStreamingResponse:
+ """
+ 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 AbuseReportsResourceWithStreamingResponse(self)
+
+ @overload
+ def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_dmca"],
+ address1: str,
+ agent_name: str,
+ agree: Literal[1],
+ city: str,
+ country: str,
+ email: str,
+ email2: str,
+ host_notification: Literal["send"],
+ name: str,
+ original_work: str,
+ owner_notification: Literal["send"],
+ signature: str,
+ state: str,
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
+ may be released by Cloudflare to third parties such as the Lumen Database
+ (https://lumendatabase.org/).
+
+ agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
+
+ city: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ country: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ signature: Required for DMCA reports, should be same as Name. An affirmation that all
+ information in the report is true and accurate while agreeing to the policies of
+ Cloudflare's abuse reports
+
+ state: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_trademark"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send"],
+ justification: str,
+ name: str,
+ owner_notification: Literal["send"],
+ trademark_number: str,
+ trademark_office: str,
+ trademark_symbol: str,
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ trademark_number: Text not exceeding 1000 characters
+
+ trademark_office: Text not exceeding 1000 characters
+
+ trademark_symbol: Text not exceeding 1000 characters
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_general"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ justification: str,
+ name: str,
+ owner_notification: Literal["send", "send-anon", "none"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ destination_ips: str | Omit = omit,
+ ports_protocols: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ source_ips: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ destination_ips: A list of IP addresses separated by ‘\n’ (new line character). The list of
+ destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
+ ought to be unique.
+
+ ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
+ size of the field should not exceed 2000 characters. Each individual
+ port/protocol should not exceed 100 characters. The list should not have more
+ than 30 unique ports and protocols.
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ source_ips: A list of IP addresses separated by ‘\n’ (new line character). The list of
+ source IPs should not exceed 30 IP addresses. Each one of the IP addresses ought
+ to be unique.
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_phishing"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ justification: str,
+ name: str,
+ owner_notification: Literal["send", "send-anon"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ original_work: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_children"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ justification: str,
+ name: str,
+ ncmec_notification: Literal["send", "send-anon"],
+ owner_notification: Literal["send", "send-anon", "none"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ country: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ country: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_threat"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ justification: str,
+ name: str,
+ owner_notification: Literal["send", "send-anon"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_registrar_whois"],
+ email: str,
+ email2: str,
+ name: str,
+ owner_notification: Literal["send", "send-anon", "none"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_ncsei"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ name: str,
+ ncsei_subject_representation: bool,
+ owner_notification: Literal["send", "send-anon", "none"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ country: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ country: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @required_args(
+ [
+ "account_id",
+ "act",
+ "address1",
+ "agent_name",
+ "agree",
+ "city",
+ "country",
+ "email",
+ "email2",
+ "host_notification",
+ "name",
+ "original_work",
+ "owner_notification",
+ "signature",
+ "state",
+ "urls",
+ ],
+ [
+ "account_id",
+ "act",
+ "email",
+ "email2",
+ "host_notification",
+ "justification",
+ "name",
+ "owner_notification",
+ "trademark_number",
+ "trademark_office",
+ "trademark_symbol",
+ "urls",
+ ],
+ [
+ "account_id",
+ "act",
+ "email",
+ "email2",
+ "host_notification",
+ "justification",
+ "name",
+ "owner_notification",
+ "urls",
+ ],
+ [
+ "account_id",
+ "act",
+ "email",
+ "email2",
+ "host_notification",
+ "justification",
+ "name",
+ "ncmec_notification",
+ "owner_notification",
+ "urls",
+ ],
+ ["account_id", "act", "email", "email2", "name", "owner_notification", "urls"],
+ [
+ "account_id",
+ "act",
+ "email",
+ "email2",
+ "host_notification",
+ "name",
+ "ncsei_subject_representation",
+ "owner_notification",
+ "urls",
+ ],
+ )
+ def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_dmca"]
+ | Literal["abuse_trademark"]
+ | Literal["abuse_general"]
+ | Literal["abuse_phishing"]
+ | Literal["abuse_children"]
+ | Literal["abuse_threat"]
+ | Literal["abuse_registrar_whois"]
+ | Literal["abuse_ncsei"],
+ address1: str | Omit = omit,
+ agent_name: str | Omit = omit,
+ agree: Literal[1] | Omit = omit,
+ city: str | Omit = omit,
+ country: str | Omit = omit,
+ email: str,
+ email2: str,
+ host_notification: Literal["send"] | Literal["send", "send-anon"] | Omit = omit,
+ name: str,
+ original_work: str | Omit = omit,
+ owner_notification: Literal["send"] | Literal["send", "send-anon", "none"] | Literal["send", "send-anon"],
+ signature: str | Omit = omit,
+ state: str | Omit = omit,
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ justification: str | Omit = omit,
+ trademark_number: str | Omit = omit,
+ trademark_office: str | Omit = omit,
+ trademark_symbol: str | Omit = omit,
+ destination_ips: str | Omit = omit,
+ ports_protocols: str | Omit = omit,
+ source_ips: str | Omit = omit,
+ ncmec_notification: Literal["send", "send-anon"] | Omit = omit,
+ ncsei_subject_representation: bool | Omit = omit,
+ # 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:
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not report_param:
+ raise ValueError(f"Expected a non-empty value for `report_param` but received {report_param!r}")
+ return self._post(
+ f"/accounts/{account_id}/abuse-reports/{report_param}",
+ body=maybe_transform(
+ {
+ "act": act,
+ "address1": address1,
+ "agent_name": agent_name,
+ "agree": agree,
+ "city": city,
+ "country": country,
+ "email": email,
+ "email2": email2,
+ "host_notification": host_notification,
+ "name": name,
+ "original_work": original_work,
+ "owner_notification": owner_notification,
+ "signature": signature,
+ "state": state,
+ "urls": urls,
+ "comments": comments,
+ "company": company,
+ "reported_country": reported_country,
+ "reported_user_agent": reported_user_agent,
+ "tele": tele,
+ "title": title,
+ "justification": justification,
+ "trademark_number": trademark_number,
+ "trademark_office": trademark_office,
+ "trademark_symbol": trademark_symbol,
+ "destination_ips": destination_ips,
+ "ports_protocols": ports_protocols,
+ "source_ips": source_ips,
+ "ncmec_notification": ncmec_notification,
+ "ncsei_subject_representation": ncsei_subject_representation,
+ },
+ abuse_report_create_params.AbuseReportCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AbuseReportCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[str], ResultWrapper[str]),
+ )
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ created_after: str | Omit = omit,
+ created_before: str | Omit = omit,
+ domain: str | Omit = omit,
+ mitigation_status: Literal["pending", "active", "in_review", "cancelled", "removed"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ sort: str | Omit = omit,
+ status: Literal["accepted", "in_review"] | Omit = omit,
+ type: Literal["PHISH", "GEN", "THREAT", "DMCA", "EMER", "TM", "REG_WHO", "NCSEI", "NETWORK"] | Omit = omit,
+ # 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,
+ ) -> SyncV4PagePagination[Optional[AbuseReportListResponse]]:
+ """
+ List the abuse reports for a given account
+
+ Args:
+ created_after: Returns reports created after the specified date
+
+ created_before: Returns reports created before the specified date
+
+ domain: Filter by domain name related to the abuse report
+
+ mitigation_status: Filter reports that have any mitigations in the given status.
+
+ page: Where in pagination to start listing abuse reports
+
+ per_page: How many abuse reports per page to list
+
+ sort: A property to sort by, followed by the order (id, cdate, domain, type, status)
+
+ status: Filter by the status of the report.
+
+ type: Filter by the type of the report.
+
+ 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}/abuse-reports",
+ page=SyncV4PagePagination[Optional[AbuseReportListResponse]],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "created_after": created_after,
+ "created_before": created_before,
+ "domain": domain,
+ "mitigation_status": mitigation_status,
+ "page": page,
+ "per_page": per_page,
+ "sort": sort,
+ "status": status,
+ "type": type,
+ },
+ abuse_report_list_params.AbuseReportListParams,
+ ),
+ ),
+ model=AbuseReportListResponse,
+ )
+
+ def get(
+ self,
+ report_param: str,
+ *,
+ 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,
+ ) -> AbuseReportGetResponse:
+ """
+ Retrieve the details of an abuse report.
+
+ Args:
+ 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 report_param:
+ raise ValueError(f"Expected a non-empty value for `report_param` but received {report_param!r}")
+ return self._get(
+ f"/accounts/{account_id}/abuse-reports/{report_param}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AbuseReportGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AbuseReportGetResponse], ResultWrapper[AbuseReportGetResponse]),
+ )
+
+
+class AsyncAbuseReportsResource(AsyncAPIResource):
+ @cached_property
+ def mitigations(self) -> AsyncMitigationsResource:
+ return AsyncMitigationsResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncAbuseReportsResourceWithRawResponse:
+ """
+ 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 AsyncAbuseReportsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncAbuseReportsResourceWithStreamingResponse:
+ """
+ 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 AsyncAbuseReportsResourceWithStreamingResponse(self)
+
+ @overload
+ async def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_dmca"],
+ address1: str,
+ agent_name: str,
+ agree: Literal[1],
+ city: str,
+ country: str,
+ email: str,
+ email2: str,
+ host_notification: Literal["send"],
+ name: str,
+ original_work: str,
+ owner_notification: Literal["send"],
+ signature: str,
+ state: str,
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ address1: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ agent_name: The name of the copyright holder. Text not exceeding 60 characters. This field
+ may be released by Cloudflare to third parties such as the Lumen Database
+ (https://lumendatabase.org/).
+
+ agree: Can be `0` for false or `1` for true. Must be value: 1 for DMCA reports
+
+ city: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ country: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ signature: Required for DMCA reports, should be same as Name. An affirmation that all
+ information in the report is true and accurate while agreeing to the policies of
+ Cloudflare's abuse reports
+
+ state: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ async def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_trademark"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send"],
+ justification: str,
+ name: str,
+ owner_notification: Literal["send"],
+ trademark_number: str,
+ trademark_office: str,
+ trademark_symbol: str,
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ trademark_number: Text not exceeding 1000 characters
+
+ trademark_office: Text not exceeding 1000 characters
+
+ trademark_symbol: Text not exceeding 1000 characters
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ async def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_general"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ justification: str,
+ name: str,
+ owner_notification: Literal["send", "send-anon", "none"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ destination_ips: str | Omit = omit,
+ ports_protocols: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ source_ips: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ destination_ips: A list of IP addresses separated by ‘\n’ (new line character). The list of
+ destination IPs should not exceed 30 IP addresses. Each one of the IP addresses
+ ought to be unique.
+
+ ports_protocols: A comma separated list of ports and protocols e.g. 80/TCP, 22/UDP. The total
+ size of the field should not exceed 2000 characters. Each individual
+ port/protocol should not exceed 100 characters. The list should not have more
+ than 30 unique ports and protocols.
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ source_ips: A list of IP addresses separated by ‘\n’ (new line character). The list of
+ source IPs should not exceed 30 IP addresses. Each one of the IP addresses ought
+ to be unique.
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ async def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_phishing"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ justification: str,
+ name: str,
+ owner_notification: Literal["send", "send-anon"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ original_work: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ original_work: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ async def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_children"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ justification: str,
+ name: str,
+ ncmec_notification: Literal["send", "send-anon"],
+ owner_notification: Literal["send", "send-anon", "none"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ country: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ ncmec_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ country: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ async def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_threat"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ justification: str,
+ name: str,
+ owner_notification: Literal["send", "send-anon"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ justification: A detailed description of the infringement, including any necessary access
+ details and the exact steps needed to view the content, not exceeding 5000
+ characters.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ async def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_registrar_whois"],
+ email: str,
+ email2: str,
+ name: str,
+ owner_notification: Literal["send", "send-anon", "none"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @overload
+ async def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_ncsei"],
+ email: str,
+ email2: str,
+ host_notification: Literal["send", "send-anon"],
+ name: str,
+ ncsei_subject_representation: bool,
+ owner_notification: Literal["send", "send-anon", "none"],
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ country: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ # 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:
+ """
+ Submit the Abuse Report of a particular type
+
+ Args:
+ report_param: The report type for submitted reports.
+
+ act: The report type for submitted reports.
+
+ email: A valid email of the abuse reporter. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ email2: Should match the value provided in `email`
+
+ host_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ name: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ ncsei_subject_representation: If the submitter is the target of NCSEI in the URLs of the abuse report.
+
+ owner_notification: Notification type based on the abuse type. NOTE: Copyright (DMCA) and Trademark
+ reports cannot be anonymous.
+
+ urls: A list of valid URLs separated by ‘\n’ (new line character). The list of the
+ URLs should not exceed 250 URLs. All URLs should have the same hostname. Each
+ URL should be unique. This field may be released by Cloudflare to third parties
+ such as the Lumen Database (https://lumendatabase.org/).
+
+ comments: Any additional comments about the infringement not exceeding 2000 characters
+
+ company: Text not exceeding 100 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ country: Text not exceeding 255 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ reported_country: Text containing 2 characters
+
+ reported_user_agent: Text not exceeding 255 characters
+
+ tele: Text not exceeding 20 characters. This field may be released by Cloudflare to
+ third parties such as the Lumen Database (https://lumendatabase.org/).
+
+ title: Text not exceeding 255 characters
+
+ 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
+ """
+ ...
+
+ @required_args(
+ [
+ "account_id",
+ "act",
+ "address1",
+ "agent_name",
+ "agree",
+ "city",
+ "country",
+ "email",
+ "email2",
+ "host_notification",
+ "name",
+ "original_work",
+ "owner_notification",
+ "signature",
+ "state",
+ "urls",
+ ],
+ [
+ "account_id",
+ "act",
+ "email",
+ "email2",
+ "host_notification",
+ "justification",
+ "name",
+ "owner_notification",
+ "trademark_number",
+ "trademark_office",
+ "trademark_symbol",
+ "urls",
+ ],
+ [
+ "account_id",
+ "act",
+ "email",
+ "email2",
+ "host_notification",
+ "justification",
+ "name",
+ "owner_notification",
+ "urls",
+ ],
+ [
+ "account_id",
+ "act",
+ "email",
+ "email2",
+ "host_notification",
+ "justification",
+ "name",
+ "ncmec_notification",
+ "owner_notification",
+ "urls",
+ ],
+ ["account_id", "act", "email", "email2", "name", "owner_notification", "urls"],
+ [
+ "account_id",
+ "act",
+ "email",
+ "email2",
+ "host_notification",
+ "name",
+ "ncsei_subject_representation",
+ "owner_notification",
+ "urls",
+ ],
+ )
+ async def create(
+ self,
+ report_param: str,
+ *,
+ account_id: str,
+ act: Literal["abuse_dmca"]
+ | Literal["abuse_trademark"]
+ | Literal["abuse_general"]
+ | Literal["abuse_phishing"]
+ | Literal["abuse_children"]
+ | Literal["abuse_threat"]
+ | Literal["abuse_registrar_whois"]
+ | Literal["abuse_ncsei"],
+ address1: str | Omit = omit,
+ agent_name: str | Omit = omit,
+ agree: Literal[1] | Omit = omit,
+ city: str | Omit = omit,
+ country: str | Omit = omit,
+ email: str,
+ email2: str,
+ host_notification: Literal["send"] | Literal["send", "send-anon"] | Omit = omit,
+ name: str,
+ original_work: str | Omit = omit,
+ owner_notification: Literal["send"] | Literal["send", "send-anon", "none"] | Literal["send", "send-anon"],
+ signature: str | Omit = omit,
+ state: str | Omit = omit,
+ urls: str,
+ comments: str | Omit = omit,
+ company: str | Omit = omit,
+ reported_country: str | Omit = omit,
+ reported_user_agent: str | Omit = omit,
+ tele: str | Omit = omit,
+ title: str | Omit = omit,
+ justification: str | Omit = omit,
+ trademark_number: str | Omit = omit,
+ trademark_office: str | Omit = omit,
+ trademark_symbol: str | Omit = omit,
+ destination_ips: str | Omit = omit,
+ ports_protocols: str | Omit = omit,
+ source_ips: str | Omit = omit,
+ ncmec_notification: Literal["send", "send-anon"] | Omit = omit,
+ ncsei_subject_representation: bool | Omit = omit,
+ # 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:
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ if not report_param:
+ raise ValueError(f"Expected a non-empty value for `report_param` but received {report_param!r}")
+ return await self._post(
+ f"/accounts/{account_id}/abuse-reports/{report_param}",
+ body=await async_maybe_transform(
+ {
+ "act": act,
+ "address1": address1,
+ "agent_name": agent_name,
+ "agree": agree,
+ "city": city,
+ "country": country,
+ "email": email,
+ "email2": email2,
+ "host_notification": host_notification,
+ "name": name,
+ "original_work": original_work,
+ "owner_notification": owner_notification,
+ "signature": signature,
+ "state": state,
+ "urls": urls,
+ "comments": comments,
+ "company": company,
+ "reported_country": reported_country,
+ "reported_user_agent": reported_user_agent,
+ "tele": tele,
+ "title": title,
+ "justification": justification,
+ "trademark_number": trademark_number,
+ "trademark_office": trademark_office,
+ "trademark_symbol": trademark_symbol,
+ "destination_ips": destination_ips,
+ "ports_protocols": ports_protocols,
+ "source_ips": source_ips,
+ "ncmec_notification": ncmec_notification,
+ "ncsei_subject_representation": ncsei_subject_representation,
+ },
+ abuse_report_create_params.AbuseReportCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AbuseReportCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[str], ResultWrapper[str]),
+ )
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ created_after: str | Omit = omit,
+ created_before: str | Omit = omit,
+ domain: str | Omit = omit,
+ mitigation_status: Literal["pending", "active", "in_review", "cancelled", "removed"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ sort: str | Omit = omit,
+ status: Literal["accepted", "in_review"] | Omit = omit,
+ type: Literal["PHISH", "GEN", "THREAT", "DMCA", "EMER", "TM", "REG_WHO", "NCSEI", "NETWORK"] | Omit = omit,
+ # 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[Optional[AbuseReportListResponse], AsyncV4PagePagination[Optional[AbuseReportListResponse]]]:
+ """
+ List the abuse reports for a given account
+
+ Args:
+ created_after: Returns reports created after the specified date
+
+ created_before: Returns reports created before the specified date
+
+ domain: Filter by domain name related to the abuse report
+
+ mitigation_status: Filter reports that have any mitigations in the given status.
+
+ page: Where in pagination to start listing abuse reports
+
+ per_page: How many abuse reports per page to list
+
+ sort: A property to sort by, followed by the order (id, cdate, domain, type, status)
+
+ status: Filter by the status of the report.
+
+ type: Filter by the type of the report.
+
+ 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}/abuse-reports",
+ page=AsyncV4PagePagination[Optional[AbuseReportListResponse]],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "created_after": created_after,
+ "created_before": created_before,
+ "domain": domain,
+ "mitigation_status": mitigation_status,
+ "page": page,
+ "per_page": per_page,
+ "sort": sort,
+ "status": status,
+ "type": type,
+ },
+ abuse_report_list_params.AbuseReportListParams,
+ ),
+ ),
+ model=AbuseReportListResponse,
+ )
+
+ async def get(
+ self,
+ report_param: str,
+ *,
+ 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,
+ ) -> AbuseReportGetResponse:
+ """
+ Retrieve the details of an abuse report.
+
+ Args:
+ 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 report_param:
+ raise ValueError(f"Expected a non-empty value for `report_param` but received {report_param!r}")
+ return await self._get(
+ f"/accounts/{account_id}/abuse-reports/{report_param}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[AbuseReportGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[AbuseReportGetResponse], ResultWrapper[AbuseReportGetResponse]),
+ )
+
+
+class AbuseReportsResourceWithRawResponse:
+ def __init__(self, abuse_reports: AbuseReportsResource) -> None:
+ self._abuse_reports = abuse_reports
+
+ self.create = to_raw_response_wrapper(
+ abuse_reports.create,
+ )
+ self.list = to_raw_response_wrapper(
+ abuse_reports.list,
+ )
+ self.get = to_raw_response_wrapper(
+ abuse_reports.get,
+ )
+
+ @cached_property
+ def mitigations(self) -> MitigationsResourceWithRawResponse:
+ return MitigationsResourceWithRawResponse(self._abuse_reports.mitigations)
+
+
+class AsyncAbuseReportsResourceWithRawResponse:
+ def __init__(self, abuse_reports: AsyncAbuseReportsResource) -> None:
+ self._abuse_reports = abuse_reports
+
+ self.create = async_to_raw_response_wrapper(
+ abuse_reports.create,
+ )
+ self.list = async_to_raw_response_wrapper(
+ abuse_reports.list,
+ )
+ self.get = async_to_raw_response_wrapper(
+ abuse_reports.get,
+ )
+
+ @cached_property
+ def mitigations(self) -> AsyncMitigationsResourceWithRawResponse:
+ return AsyncMitigationsResourceWithRawResponse(self._abuse_reports.mitigations)
+
+
+class AbuseReportsResourceWithStreamingResponse:
+ def __init__(self, abuse_reports: AbuseReportsResource) -> None:
+ self._abuse_reports = abuse_reports
+
+ self.create = to_streamed_response_wrapper(
+ abuse_reports.create,
+ )
+ self.list = to_streamed_response_wrapper(
+ abuse_reports.list,
+ )
+ self.get = to_streamed_response_wrapper(
+ abuse_reports.get,
+ )
+
+ @cached_property
+ def mitigations(self) -> MitigationsResourceWithStreamingResponse:
+ return MitigationsResourceWithStreamingResponse(self._abuse_reports.mitigations)
+
+
+class AsyncAbuseReportsResourceWithStreamingResponse:
+ def __init__(self, abuse_reports: AsyncAbuseReportsResource) -> None:
+ self._abuse_reports = abuse_reports
+
+ self.create = async_to_streamed_response_wrapper(
+ abuse_reports.create,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ abuse_reports.list,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ abuse_reports.get,
+ )
+
+ @cached_property
+ def mitigations(self) -> AsyncMitigationsResourceWithStreamingResponse:
+ return AsyncMitigationsResourceWithStreamingResponse(self._abuse_reports.mitigations)
diff --git a/src/cloudflare/resources/abuse_reports/mitigations.py b/src/cloudflare/resources/abuse_reports/mitigations.py
new file mode 100644
index 00000000000..298b58d4143
--- /dev/null
+++ b/src/cloudflare/resources/abuse_reports/mitigations.py
@@ -0,0 +1,394 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Iterable, Optional
+from typing_extensions import Literal
+
+import httpx
+
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ..._utils import maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...pagination import SyncSinglePage, AsyncSinglePage, SyncV4PagePagination, AsyncV4PagePagination
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.abuse_reports import mitigation_list_params, mitigation_review_params
+from ...types.abuse_reports.mitigation_list_response import MitigationListResponse
+from ...types.abuse_reports.mitigation_review_response import MitigationReviewResponse
+
+__all__ = ["MitigationsResource", "AsyncMitigationsResource"]
+
+
+class MitigationsResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> MitigationsResourceWithRawResponse:
+ """
+ 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 MitigationsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> MitigationsResourceWithStreamingResponse:
+ """
+ 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 MitigationsResourceWithStreamingResponse(self)
+
+ def list(
+ self,
+ report_id: str,
+ *,
+ account_id: str,
+ effective_after: str | Omit = omit,
+ effective_before: str | Omit = omit,
+ entity_type: Literal["url_pattern", "account", "zone"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ sort: Literal[
+ "type,asc",
+ "type,desc",
+ "effective_date,asc",
+ "effective_date,desc",
+ "status,asc",
+ "status,desc",
+ "entity_type,asc",
+ "entity_type,desc",
+ ]
+ | Omit = omit,
+ status: Literal["pending", "active", "in_review", "cancelled", "removed"] | Omit = omit,
+ type: Literal[
+ "legal_block",
+ "phishing_interstitial",
+ "network_block",
+ "rate_limit_cache",
+ "account_suspend",
+ "redirect_video_stream",
+ ]
+ | Omit = omit,
+ # 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,
+ ) -> SyncV4PagePagination[Optional[MitigationListResponse]]:
+ """
+ List mitigations done to remediate the abuse report.
+
+ Args:
+ effective_after: Returns mitigation that were dispatched after the given date
+
+ effective_before: Returns mitigations that were dispatched before the given date
+
+ entity_type: Filter by the type of entity the mitigation impacts.
+
+ page: Where in pagination to start listing abuse reports
+
+ per_page: How many abuse reports per page to list
+
+ sort: A property to sort by, followed by the order
+
+ status: Filter by the status of the mitigation.
+
+ type: Filter by the type of mitigation. This filter parameter can be specified
+ multiple times to include multiple types of mitigations in the result set, e.g.
+ ?type=rate_limit_cache&type=legal_block.
+
+ 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 report_id:
+ raise ValueError(f"Expected a non-empty value for `report_id` but received {report_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/abuse-reports/{report_id}/mitigations",
+ page=SyncV4PagePagination[Optional[MitigationListResponse]],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "effective_after": effective_after,
+ "effective_before": effective_before,
+ "entity_type": entity_type,
+ "page": page,
+ "per_page": per_page,
+ "sort": sort,
+ "status": status,
+ "type": type,
+ },
+ mitigation_list_params.MitigationListParams,
+ ),
+ ),
+ model=MitigationListResponse,
+ )
+
+ def review(
+ self,
+ report_id: str,
+ *,
+ account_id: str,
+ appeals: Iterable[mitigation_review_params.Appeal],
+ # 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[MitigationReviewResponse]:
+ """
+ Request a review for mitigations on an account.
+
+ Args:
+ appeals: List of mitigations to appeal.
+
+ 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 report_id:
+ raise ValueError(f"Expected a non-empty value for `report_id` but received {report_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/abuse-reports/{report_id}/mitigations/appeal",
+ page=SyncSinglePage[MitigationReviewResponse],
+ body=maybe_transform({"appeals": appeals}, mitigation_review_params.MitigationReviewParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=MitigationReviewResponse,
+ method="post",
+ )
+
+
+class AsyncMitigationsResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncMitigationsResourceWithRawResponse:
+ """
+ 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 AsyncMitigationsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncMitigationsResourceWithStreamingResponse:
+ """
+ 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 AsyncMitigationsResourceWithStreamingResponse(self)
+
+ def list(
+ self,
+ report_id: str,
+ *,
+ account_id: str,
+ effective_after: str | Omit = omit,
+ effective_before: str | Omit = omit,
+ entity_type: Literal["url_pattern", "account", "zone"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ sort: Literal[
+ "type,asc",
+ "type,desc",
+ "effective_date,asc",
+ "effective_date,desc",
+ "status,asc",
+ "status,desc",
+ "entity_type,asc",
+ "entity_type,desc",
+ ]
+ | Omit = omit,
+ status: Literal["pending", "active", "in_review", "cancelled", "removed"] | Omit = omit,
+ type: Literal[
+ "legal_block",
+ "phishing_interstitial",
+ "network_block",
+ "rate_limit_cache",
+ "account_suspend",
+ "redirect_video_stream",
+ ]
+ | Omit = omit,
+ # 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[Optional[MitigationListResponse], AsyncV4PagePagination[Optional[MitigationListResponse]]]:
+ """
+ List mitigations done to remediate the abuse report.
+
+ Args:
+ effective_after: Returns mitigation that were dispatched after the given date
+
+ effective_before: Returns mitigations that were dispatched before the given date
+
+ entity_type: Filter by the type of entity the mitigation impacts.
+
+ page: Where in pagination to start listing abuse reports
+
+ per_page: How many abuse reports per page to list
+
+ sort: A property to sort by, followed by the order
+
+ status: Filter by the status of the mitigation.
+
+ type: Filter by the type of mitigation. This filter parameter can be specified
+ multiple times to include multiple types of mitigations in the result set, e.g.
+ ?type=rate_limit_cache&type=legal_block.
+
+ 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 report_id:
+ raise ValueError(f"Expected a non-empty value for `report_id` but received {report_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/abuse-reports/{report_id}/mitigations",
+ page=AsyncV4PagePagination[Optional[MitigationListResponse]],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "effective_after": effective_after,
+ "effective_before": effective_before,
+ "entity_type": entity_type,
+ "page": page,
+ "per_page": per_page,
+ "sort": sort,
+ "status": status,
+ "type": type,
+ },
+ mitigation_list_params.MitigationListParams,
+ ),
+ ),
+ model=MitigationListResponse,
+ )
+
+ def review(
+ self,
+ report_id: str,
+ *,
+ account_id: str,
+ appeals: Iterable[mitigation_review_params.Appeal],
+ # 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[MitigationReviewResponse, AsyncSinglePage[MitigationReviewResponse]]:
+ """
+ Request a review for mitigations on an account.
+
+ Args:
+ appeals: List of mitigations to appeal.
+
+ 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 report_id:
+ raise ValueError(f"Expected a non-empty value for `report_id` but received {report_id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/abuse-reports/{report_id}/mitigations/appeal",
+ page=AsyncSinglePage[MitigationReviewResponse],
+ body=maybe_transform({"appeals": appeals}, mitigation_review_params.MitigationReviewParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=MitigationReviewResponse,
+ method="post",
+ )
+
+
+class MitigationsResourceWithRawResponse:
+ def __init__(self, mitigations: MitigationsResource) -> None:
+ self._mitigations = mitigations
+
+ self.list = to_raw_response_wrapper(
+ mitigations.list,
+ )
+ self.review = to_raw_response_wrapper(
+ mitigations.review,
+ )
+
+
+class AsyncMitigationsResourceWithRawResponse:
+ def __init__(self, mitigations: AsyncMitigationsResource) -> None:
+ self._mitigations = mitigations
+
+ self.list = async_to_raw_response_wrapper(
+ mitigations.list,
+ )
+ self.review = async_to_raw_response_wrapper(
+ mitigations.review,
+ )
+
+
+class MitigationsResourceWithStreamingResponse:
+ def __init__(self, mitigations: MitigationsResource) -> None:
+ self._mitigations = mitigations
+
+ self.list = to_streamed_response_wrapper(
+ mitigations.list,
+ )
+ self.review = to_streamed_response_wrapper(
+ mitigations.review,
+ )
+
+
+class AsyncMitigationsResourceWithStreamingResponse:
+ def __init__(self, mitigations: AsyncMitigationsResource) -> None:
+ self._mitigations = mitigations
+
+ self.list = async_to_streamed_response_wrapper(
+ mitigations.list,
+ )
+ self.review = async_to_streamed_response_wrapper(
+ mitigations.review,
+ )
diff --git a/src/cloudflare/resources/accounts/accounts.py b/src/cloudflare/resources/accounts/accounts.py
index aa9779c2552..aedb92f84e7 100644
--- a/src/cloudflare/resources/accounts/accounts.py
+++ b/src/cloudflare/resources/accounts/accounts.py
@@ -23,7 +23,7 @@
MembersResourceWithStreamingResponse,
AsyncMembersResourceWithStreamingResponse,
)
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from .logs.logs import (
@@ -111,14 +111,14 @@ def create(
self,
*,
name: str,
- type: Literal["standard", "enterprise"],
- unit: account_create_params.Unit | NotGiven = NOT_GIVEN,
+ type: Literal["standard", "enterprise"] | Omit = omit,
+ unit: account_create_params.Unit | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Account]:
"""
Create an account (only available for tenant admins at this time)
@@ -126,9 +126,6 @@ def create(
Args:
name: Account name
- type: the type of account being created. For self-serve customers, use standard. for
- enterprise customers, use enterprise.
-
unit: information related to the tenant unit, and optionally, an id of the unit to
create the account on. see
https://developers.cloudflare.com/tenant/how-to/manage-accounts/
@@ -167,13 +164,15 @@ def update(
account_id: str,
id: str,
name: str,
- settings: account_update_params.Settings | NotGiven = NOT_GIVEN,
+ type: Literal["standard", "enterprise"],
+ managed_by: account_update_params.ManagedBy | Omit = omit,
+ settings: account_update_params.Settings | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Account]:
"""
Update an existing account.
@@ -185,6 +184,8 @@ def update(
name: Account name
+ managed_by: Parent container details
+
settings: Account settings
extra_headers: Send extra headers
@@ -203,6 +204,8 @@ def update(
{
"id": id,
"name": name,
+ "type": type,
+ "managed_by": managed_by,
"settings": settings,
},
account_update_params.AccountUpdateParams,
@@ -220,16 +223,16 @@ def update(
def list(
self,
*,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- name: str | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ name: str | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[Account]:
"""
List all accounts you have ownership or verified access to.
@@ -281,7 +284,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AccountDeleteResponse]:
"""Delete a specific account (only available for tenant admins at this time).
@@ -323,7 +326,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Account]:
"""
Get information about a specific account that you are a member of.
@@ -398,14 +401,14 @@ async def create(
self,
*,
name: str,
- type: Literal["standard", "enterprise"],
- unit: account_create_params.Unit | NotGiven = NOT_GIVEN,
+ type: Literal["standard", "enterprise"] | Omit = omit,
+ unit: account_create_params.Unit | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Account]:
"""
Create an account (only available for tenant admins at this time)
@@ -413,9 +416,6 @@ async def create(
Args:
name: Account name
- type: the type of account being created. For self-serve customers, use standard. for
- enterprise customers, use enterprise.
-
unit: information related to the tenant unit, and optionally, an id of the unit to
create the account on. see
https://developers.cloudflare.com/tenant/how-to/manage-accounts/
@@ -454,13 +454,15 @@ async def update(
account_id: str,
id: str,
name: str,
- settings: account_update_params.Settings | NotGiven = NOT_GIVEN,
+ type: Literal["standard", "enterprise"],
+ managed_by: account_update_params.ManagedBy | Omit = omit,
+ settings: account_update_params.Settings | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Account]:
"""
Update an existing account.
@@ -472,6 +474,8 @@ async def update(
name: Account name
+ managed_by: Parent container details
+
settings: Account settings
extra_headers: Send extra headers
@@ -490,6 +494,8 @@ async def update(
{
"id": id,
"name": name,
+ "type": type,
+ "managed_by": managed_by,
"settings": settings,
},
account_update_params.AccountUpdateParams,
@@ -507,16 +513,16 @@ async def update(
def list(
self,
*,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- name: str | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ name: str | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Account, AsyncV4PagePaginationArray[Account]]:
"""
List all accounts you have ownership or verified access to.
@@ -568,7 +574,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AccountDeleteResponse]:
"""Delete a specific account (only available for tenant admins at this time).
@@ -610,7 +616,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Account]:
"""
Get information about a specific account that you are a member of.
diff --git a/src/cloudflare/resources/accounts/logs/audit.py b/src/cloudflare/resources/accounts/logs/audit.py
index 5a080571e45..fd663c7cc68 100644
--- a/src/cloudflare/resources/accounts/logs/audit.py
+++ b/src/cloudflare/resources/accounts/logs/audit.py
@@ -8,7 +8,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -18,7 +18,7 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
-from ....pagination import SyncCursorLimitPagination, AsyncCursorLimitPagination
+from ....pagination import SyncCursorPaginationAfter, AsyncCursorPaginationAfter
from ...._base_client import AsyncPaginator, make_request_options
from ....types.accounts.logs import audit_list_params
from ....types.accounts.logs.audit_list_response import AuditListResponse
@@ -52,37 +52,38 @@ def list(
account_id: str,
before: Union[str, date],
since: Union[str, date],
- account_name: audit_list_params.AccountName | NotGiven = NOT_GIVEN,
- action_result: audit_list_params.ActionResult | NotGiven = NOT_GIVEN,
- action_type: audit_list_params.ActionType | NotGiven = NOT_GIVEN,
- actor_context: audit_list_params.ActorContext | NotGiven = NOT_GIVEN,
- actor_email: audit_list_params.ActorEmail | NotGiven = NOT_GIVEN,
- actor_id: audit_list_params.ActorID | NotGiven = NOT_GIVEN,
- actor_ip_address: audit_list_params.ActorIPAddress | NotGiven = NOT_GIVEN,
- actor_token_id: audit_list_params.ActorTokenID | NotGiven = NOT_GIVEN,
- actor_token_name: audit_list_params.ActorTokenName | NotGiven = NOT_GIVEN,
- actor_type: audit_list_params.ActorType | NotGiven = NOT_GIVEN,
- audit_log_id: audit_list_params.AuditLogID | NotGiven = NOT_GIVEN,
- cursor: str | NotGiven = NOT_GIVEN,
- direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN,
- limit: float | NotGiven = NOT_GIVEN,
- raw_cf_rayid: audit_list_params.RawCfRayID | NotGiven = NOT_GIVEN,
- raw_method: audit_list_params.RawMethod | NotGiven = NOT_GIVEN,
- raw_status_code: audit_list_params.RawStatusCode | NotGiven = NOT_GIVEN,
- raw_uri: audit_list_params.RawURI | NotGiven = NOT_GIVEN,
- resource_id: audit_list_params.ResourceID | NotGiven = NOT_GIVEN,
- resource_product: audit_list_params.ResourceProduct | NotGiven = NOT_GIVEN,
- resource_scope: audit_list_params.ResourceScope | NotGiven = NOT_GIVEN,
- resource_type: audit_list_params.ResourceType | NotGiven = NOT_GIVEN,
- zone_id: audit_list_params.ZoneID | NotGiven = NOT_GIVEN,
- zone_name: audit_list_params.ZoneName | NotGiven = NOT_GIVEN,
+ id: audit_list_params.ID | Omit = omit,
+ account_name: audit_list_params.AccountName | Omit = omit,
+ action_result: audit_list_params.ActionResult | Omit = omit,
+ action_type: audit_list_params.ActionType | Omit = omit,
+ actor_context: audit_list_params.ActorContext | Omit = omit,
+ actor_email: audit_list_params.ActorEmail | Omit = omit,
+ actor_id: audit_list_params.ActorID | Omit = omit,
+ actor_ip_address: audit_list_params.ActorIPAddress | Omit = omit,
+ actor_token_id: audit_list_params.ActorTokenID | Omit = omit,
+ actor_token_name: audit_list_params.ActorTokenName | Omit = omit,
+ actor_type: audit_list_params.ActorType | Omit = omit,
+ audit_log_id: audit_list_params.AuditLogID | Omit = omit,
+ cursor: str | Omit = omit,
+ direction: Literal["desc", "asc"] | Omit = omit,
+ limit: float | Omit = omit,
+ raw_cf_rayid: audit_list_params.RawCfRayID | Omit = omit,
+ raw_method: audit_list_params.RawMethod | Omit = omit,
+ raw_status_code: audit_list_params.RawStatusCode | Omit = omit,
+ raw_uri: audit_list_params.RawURI | Omit = omit,
+ resource_id: audit_list_params.ResourceID | Omit = omit,
+ resource_product: audit_list_params.ResourceProduct | Omit = omit,
+ resource_scope: audit_list_params.ResourceScope | Omit = omit,
+ resource_type: audit_list_params.ResourceType | Omit = omit,
+ zone_id: audit_list_params.ZoneID | Omit = omit,
+ zone_name: audit_list_params.ZoneName | Omit = omit,
# 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,
- ) -> SyncCursorLimitPagination[AuditListResponse]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> SyncCursorPaginationAfter[AuditListResponse]:
"""Gets a list of audit logs for an account.
This is the beta release
@@ -124,7 +125,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
f"/accounts/{account_id}/logs/audit",
- page=SyncCursorLimitPagination[AuditListResponse],
+ page=SyncCursorPaginationAfter[AuditListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -134,6 +135,7 @@ def list(
{
"before": before,
"since": since,
+ "id": id,
"account_name": account_name,
"action_result": action_result,
"action_type": action_type,
@@ -192,37 +194,38 @@ def list(
account_id: str,
before: Union[str, date],
since: Union[str, date],
- account_name: audit_list_params.AccountName | NotGiven = NOT_GIVEN,
- action_result: audit_list_params.ActionResult | NotGiven = NOT_GIVEN,
- action_type: audit_list_params.ActionType | NotGiven = NOT_GIVEN,
- actor_context: audit_list_params.ActorContext | NotGiven = NOT_GIVEN,
- actor_email: audit_list_params.ActorEmail | NotGiven = NOT_GIVEN,
- actor_id: audit_list_params.ActorID | NotGiven = NOT_GIVEN,
- actor_ip_address: audit_list_params.ActorIPAddress | NotGiven = NOT_GIVEN,
- actor_token_id: audit_list_params.ActorTokenID | NotGiven = NOT_GIVEN,
- actor_token_name: audit_list_params.ActorTokenName | NotGiven = NOT_GIVEN,
- actor_type: audit_list_params.ActorType | NotGiven = NOT_GIVEN,
- audit_log_id: audit_list_params.AuditLogID | NotGiven = NOT_GIVEN,
- cursor: str | NotGiven = NOT_GIVEN,
- direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN,
- limit: float | NotGiven = NOT_GIVEN,
- raw_cf_rayid: audit_list_params.RawCfRayID | NotGiven = NOT_GIVEN,
- raw_method: audit_list_params.RawMethod | NotGiven = NOT_GIVEN,
- raw_status_code: audit_list_params.RawStatusCode | NotGiven = NOT_GIVEN,
- raw_uri: audit_list_params.RawURI | NotGiven = NOT_GIVEN,
- resource_id: audit_list_params.ResourceID | NotGiven = NOT_GIVEN,
- resource_product: audit_list_params.ResourceProduct | NotGiven = NOT_GIVEN,
- resource_scope: audit_list_params.ResourceScope | NotGiven = NOT_GIVEN,
- resource_type: audit_list_params.ResourceType | NotGiven = NOT_GIVEN,
- zone_id: audit_list_params.ZoneID | NotGiven = NOT_GIVEN,
- zone_name: audit_list_params.ZoneName | NotGiven = NOT_GIVEN,
+ id: audit_list_params.ID | Omit = omit,
+ account_name: audit_list_params.AccountName | Omit = omit,
+ action_result: audit_list_params.ActionResult | Omit = omit,
+ action_type: audit_list_params.ActionType | Omit = omit,
+ actor_context: audit_list_params.ActorContext | Omit = omit,
+ actor_email: audit_list_params.ActorEmail | Omit = omit,
+ actor_id: audit_list_params.ActorID | Omit = omit,
+ actor_ip_address: audit_list_params.ActorIPAddress | Omit = omit,
+ actor_token_id: audit_list_params.ActorTokenID | Omit = omit,
+ actor_token_name: audit_list_params.ActorTokenName | Omit = omit,
+ actor_type: audit_list_params.ActorType | Omit = omit,
+ audit_log_id: audit_list_params.AuditLogID | Omit = omit,
+ cursor: str | Omit = omit,
+ direction: Literal["desc", "asc"] | Omit = omit,
+ limit: float | Omit = omit,
+ raw_cf_rayid: audit_list_params.RawCfRayID | Omit = omit,
+ raw_method: audit_list_params.RawMethod | Omit = omit,
+ raw_status_code: audit_list_params.RawStatusCode | Omit = omit,
+ raw_uri: audit_list_params.RawURI | Omit = omit,
+ resource_id: audit_list_params.ResourceID | Omit = omit,
+ resource_product: audit_list_params.ResourceProduct | Omit = omit,
+ resource_scope: audit_list_params.ResourceScope | Omit = omit,
+ resource_type: audit_list_params.ResourceType | Omit = omit,
+ zone_id: audit_list_params.ZoneID | Omit = omit,
+ zone_name: audit_list_params.ZoneName | Omit = omit,
# 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[AuditListResponse, AsyncCursorLimitPagination[AuditListResponse]]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> AsyncPaginator[AuditListResponse, AsyncCursorPaginationAfter[AuditListResponse]]:
"""Gets a list of audit logs for an account.
This is the beta release
@@ -264,7 +267,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
f"/accounts/{account_id}/logs/audit",
- page=AsyncCursorLimitPagination[AuditListResponse],
+ page=AsyncCursorPaginationAfter[AuditListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -274,6 +277,7 @@ def list(
{
"before": before,
"since": since,
+ "id": id,
"account_name": account_name,
"action_result": action_result,
"action_type": action_type,
diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py
index cf81af9febe..61eb3ff9fc2 100644
--- a/src/cloudflare/resources/accounts/members.py
+++ b/src/cloudflare/resources/accounts/members.py
@@ -2,12 +2,12 @@
from __future__ import annotations
-from typing import List, Type, Iterable, Optional, cast
+from typing import Type, Iterable, Optional, cast
from typing_extensions import Literal, overload
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ..._utils import required_args, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -54,14 +54,14 @@ def create(
*,
account_id: str,
email: str,
- roles: List[str],
- status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
+ roles: SequenceNotStr[str],
+ status: Literal["accepted", "pending"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Add a user to the list of members for this account.
@@ -90,13 +90,13 @@ def create(
account_id: str,
email: str,
policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy],
- status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
+ status: Literal["accepted", "pending"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Add a user to the list of members for this account.
@@ -124,15 +124,15 @@ def create(
*,
account_id: str,
email: str,
- roles: List[str] | NotGiven = NOT_GIVEN,
- status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
- policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN,
+ roles: SequenceNotStr[str] | Omit = omit,
+ status: Literal["accepted", "pending"] | Omit = omit,
+ policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
@@ -163,13 +163,13 @@ def update(
member_id: str,
*,
account_id: str,
- roles: Iterable[Role] | NotGiven = NOT_GIVEN,
+ roles: Iterable[Role] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Modify an account member.
@@ -203,7 +203,7 @@ def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Modify an account member.
@@ -231,14 +231,14 @@ def update(
member_id: str,
*,
account_id: str,
- roles: Iterable[Role] | NotGiven = NOT_GIVEN,
- policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN,
+ roles: Iterable[Role] | Omit = omit,
+ policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
@@ -267,17 +267,17 @@ def list(
self,
*,
account_id: str,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- order: Literal["user.first_name", "user.last_name", "user.email", "status"] | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
- status: Literal["accepted", "pending", "rejected"] | NotGiven = NOT_GIVEN,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ order: Literal["user.first_name", "user.last_name", "user.email", "status"] | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
+ status: Literal["accepted", "pending", "rejected"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[Member]:
"""
List all members of an account.
@@ -337,7 +337,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[MemberDeleteResponse]:
"""
Remove a member from an account.
@@ -381,7 +381,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Get information about a specific member of an account.
@@ -442,14 +442,14 @@ async def create(
*,
account_id: str,
email: str,
- roles: List[str],
- status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
+ roles: SequenceNotStr[str],
+ status: Literal["accepted", "pending"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Add a user to the list of members for this account.
@@ -478,13 +478,13 @@ async def create(
account_id: str,
email: str,
policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy],
- status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
+ status: Literal["accepted", "pending"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Add a user to the list of members for this account.
@@ -512,15 +512,15 @@ async def create(
*,
account_id: str,
email: str,
- roles: List[str] | NotGiven = NOT_GIVEN,
- status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
- policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN,
+ roles: SequenceNotStr[str] | Omit = omit,
+ status: Literal["accepted", "pending"] | Omit = omit,
+ policies: Iterable[member_create_params.IAMCreateMemberWithPoliciesPolicy] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
@@ -551,13 +551,13 @@ async def update(
member_id: str,
*,
account_id: str,
- roles: Iterable[Role] | NotGiven = NOT_GIVEN,
+ roles: Iterable[Role] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Modify an account member.
@@ -591,7 +591,7 @@ async def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Modify an account member.
@@ -619,14 +619,14 @@ async def update(
member_id: str,
*,
account_id: str,
- roles: Iterable[Role] | NotGiven = NOT_GIVEN,
- policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | NotGiven = NOT_GIVEN,
+ roles: Iterable[Role] | Omit = omit,
+ policies: Iterable[member_update_params.IAMUpdateMemberWithPoliciesPolicy] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
@@ -655,17 +655,17 @@ def list(
self,
*,
account_id: str,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- order: Literal["user.first_name", "user.last_name", "user.email", "status"] | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
- status: Literal["accepted", "pending", "rejected"] | NotGiven = NOT_GIVEN,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ order: Literal["user.first_name", "user.last_name", "user.email", "status"] | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
+ status: Literal["accepted", "pending", "rejected"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Member, AsyncV4PagePaginationArray[Member]]:
"""
List all members of an account.
@@ -725,7 +725,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[MemberDeleteResponse]:
"""
Remove a member from an account.
@@ -769,7 +769,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Member]:
"""
Get information about a specific member of an account.
diff --git a/src/cloudflare/resources/accounts/roles.py b/src/cloudflare/resources/accounts/roles.py
index 8c49fb115a9..399ad9f9449 100644
--- a/src/cloudflare/resources/accounts/roles.py
+++ b/src/cloudflare/resources/accounts/roles.py
@@ -6,7 +6,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -49,14 +49,14 @@ def list(
self,
*,
account_id: str,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[Role]:
"""
Get all available roles for an account.
@@ -107,7 +107,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Role]:
"""
Get information about a specific role for an account.
@@ -166,14 +166,14 @@ def list(
self,
*,
account_id: str,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Role, AsyncV4PagePaginationArray[Role]]:
"""
Get all available roles for an account.
@@ -224,7 +224,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Role]:
"""
Get information about a specific role for an account.
diff --git a/src/cloudflare/resources/accounts/subscriptions.py b/src/cloudflare/resources/accounts/subscriptions.py
index cddf77edb7f..7209c025dfa 100644
--- a/src/cloudflare/resources/accounts/subscriptions.py
+++ b/src/cloudflare/resources/accounts/subscriptions.py
@@ -7,7 +7,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -52,14 +52,14 @@ def create(
self,
*,
account_id: str,
- frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN,
- rate_plan: RatePlan | NotGiven = NOT_GIVEN,
+ frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | Omit = omit,
+ rate_plan: RatePlan | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Subscription:
"""
Creates an account subscription.
@@ -105,14 +105,14 @@ def update(
subscription_identifier: str,
*,
account_id: str,
- frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN,
- rate_plan: RatePlan | NotGiven = NOT_GIVEN,
+ frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | Omit = omit,
+ rate_plan: RatePlan | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Subscription:
"""
Updates an account subscription.
@@ -169,7 +169,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SubscriptionDeleteResponse:
"""
Deletes an account's subscription.
@@ -214,7 +214,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[Subscription]:
"""
Lists all of an account's subscriptions.
@@ -266,14 +266,14 @@ async def create(
self,
*,
account_id: str,
- frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN,
- rate_plan: RatePlan | NotGiven = NOT_GIVEN,
+ frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | Omit = omit,
+ rate_plan: RatePlan | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Subscription:
"""
Creates an account subscription.
@@ -319,14 +319,14 @@ async def update(
subscription_identifier: str,
*,
account_id: str,
- frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | NotGiven = NOT_GIVEN,
- rate_plan: RatePlan | NotGiven = NOT_GIVEN,
+ frequency: Literal["weekly", "monthly", "quarterly", "yearly"] | Omit = omit,
+ rate_plan: RatePlan | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Subscription:
"""
Updates an account subscription.
@@ -383,7 +383,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SubscriptionDeleteResponse:
"""
Deletes an account's subscription.
@@ -428,7 +428,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Subscription, AsyncSinglePage[Subscription]]:
"""
Lists all of an account's subscriptions.
diff --git a/src/cloudflare/resources/accounts/tokens/permission_groups.py b/src/cloudflare/resources/accounts/tokens/permission_groups.py
index d98d5235ce0..2efe092f8ec 100644
--- a/src/cloudflare/resources/accounts/tokens/permission_groups.py
+++ b/src/cloudflare/resources/accounts/tokens/permission_groups.py
@@ -2,9 +2,12 @@
from __future__ import annotations
+from typing import Type, Optional, cast
+
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -13,8 +16,10 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
+from ...._wrappers import ResultWrapper
from ....pagination import SyncSinglePage, AsyncSinglePage
from ...._base_client import AsyncPaginator, make_request_options
+from ....types.accounts.tokens import permission_group_get_params, permission_group_list_params
from ....types.accounts.tokens.permission_group_get_response import PermissionGroupGetResponse
from ....types.accounts.tokens.permission_group_list_response import PermissionGroupListResponse
@@ -45,12 +50,14 @@ def list(
self,
*,
account_id: str,
+ name: str | Omit = omit,
+ scope: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[PermissionGroupListResponse]:
"""
Find all available permission groups for Account Owned API Tokens
@@ -58,6 +65,10 @@ def list(
Args:
account_id: Account identifier tag.
+ name: Filter by the name of the permission group. The value must be URL-encoded.
+
+ scope: Filter by the scope of the permission group. The value must be URL-encoded.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -72,7 +83,17 @@ def list(
f"/accounts/{account_id}/tokens/permission_groups",
page=SyncSinglePage[PermissionGroupListResponse],
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(
+ {
+ "name": name,
+ "scope": scope,
+ },
+ permission_group_list_params.PermissionGroupListParams,
+ ),
),
model=PermissionGroupListResponse,
)
@@ -81,19 +102,25 @@ def get(
self,
*,
account_id: str,
+ name: str | Omit = omit,
+ scope: str | Omit = omit,
# 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]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> Optional[PermissionGroupGetResponse]:
"""
Find all available permission groups for Account Owned API Tokens
Args:
account_id: Account identifier tag.
+ name: Filter by the name of the permission group. The value must be URL-encoded.
+
+ scope: Filter by the scope of the permission group. The value must be URL-encoded.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -104,13 +131,23 @@ def get(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- return self._get_api_list(
+ return self._get(
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
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "name": name,
+ "scope": scope,
+ },
+ permission_group_get_params.PermissionGroupGetParams,
+ ),
+ post_parser=ResultWrapper[Optional[PermissionGroupGetResponse]]._unwrapper,
),
- model=PermissionGroupGetResponse,
+ cast_to=cast(Type[Optional[PermissionGroupGetResponse]], ResultWrapper[PermissionGroupGetResponse]),
)
@@ -138,12 +175,14 @@ def list(
self,
*,
account_id: str,
+ name: str | Omit = omit,
+ scope: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[PermissionGroupListResponse, AsyncSinglePage[PermissionGroupListResponse]]:
"""
Find all available permission groups for Account Owned API Tokens
@@ -151,6 +190,10 @@ def list(
Args:
account_id: Account identifier tag.
+ name: Filter by the name of the permission group. The value must be URL-encoded.
+
+ scope: Filter by the scope of the permission group. The value must be URL-encoded.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -165,28 +208,44 @@ def list(
f"/accounts/{account_id}/tokens/permission_groups",
page=AsyncSinglePage[PermissionGroupListResponse],
options=make_request_options(
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "name": name,
+ "scope": scope,
+ },
+ permission_group_list_params.PermissionGroupListParams,
+ ),
),
model=PermissionGroupListResponse,
)
- def get(
+ async def get(
self,
*,
account_id: str,
+ name: str | Omit = omit,
+ scope: str | Omit = omit,
# 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]]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> Optional[PermissionGroupGetResponse]:
"""
Find all available permission groups for Account Owned API Tokens
Args:
account_id: Account identifier tag.
+ name: Filter by the name of the permission group. The value must be URL-encoded.
+
+ scope: Filter by the scope of the permission group. The value must be URL-encoded.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -197,13 +256,23 @@ def get(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- return self._get_api_list(
+ return await self._get(
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
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "name": name,
+ "scope": scope,
+ },
+ permission_group_get_params.PermissionGroupGetParams,
+ ),
+ post_parser=ResultWrapper[Optional[PermissionGroupGetResponse]]._unwrapper,
),
- model=PermissionGroupGetResponse,
+ cast_to=cast(Type[Optional[PermissionGroupGetResponse]], ResultWrapper[PermissionGroupGetResponse]),
)
diff --git a/src/cloudflare/resources/accounts/tokens/tokens.py b/src/cloudflare/resources/accounts/tokens/tokens.py
index 4f50160a6df..eb6d7826528 100644
--- a/src/cloudflare/resources/accounts/tokens/tokens.py
+++ b/src/cloudflare/resources/accounts/tokens/tokens.py
@@ -16,7 +16,7 @@
ValueResourceWithStreamingResponse,
AsyncValueResourceWithStreamingResponse,
)
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -81,15 +81,15 @@ def create(
account_id: str,
name: str,
policies: Iterable[TokenPolicy],
- condition: token_create_params.Condition | NotGiven = NOT_GIVEN,
- expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN,
- not_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ condition: token_create_params.Condition | Omit = omit,
+ expires_on: Union[str, datetime] | Omit = omit,
+ not_before: Union[str, datetime] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TokenCreateResponse]:
"""
Create a new Account Owned API token.
@@ -145,16 +145,16 @@ def update(
account_id: str,
name: str,
policies: Iterable[TokenPolicy],
- status: Literal["active", "disabled", "expired"],
- condition: token_update_params.Condition | NotGiven = NOT_GIVEN,
- expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN,
- not_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ condition: token_update_params.Condition | Omit = omit,
+ expires_on: Union[str, datetime] | Omit = omit,
+ not_before: Union[str, datetime] | Omit = omit,
+ status: Literal["active", "disabled", "expired"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Token]:
"""
Update an existing token.
@@ -168,13 +168,13 @@ def update(
policies: List of access policies assigned to the token.
- status: Status of the token.
-
expires_on: The expiration time on or after which the JWT MUST NOT be accepted for
processing.
not_before: The time before which the token MUST NOT be accepted for processing.
+ status: Status of the token.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -193,10 +193,10 @@ def update(
{
"name": name,
"policies": policies,
- "status": status,
"condition": condition,
"expires_on": expires_on,
"not_before": not_before,
+ "status": status,
},
token_update_params.TokenUpdateParams,
),
@@ -214,15 +214,15 @@ def list(
self,
*,
account_id: str,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[Token]:
"""
List all Account Owned API tokens created for this account.
@@ -276,7 +276,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TokenDeleteResponse]:
"""
Destroy an Account Owned API token.
@@ -320,7 +320,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Token]:
"""
Get information about a specific Account Owned API token.
@@ -363,7 +363,7 @@ def verify(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TokenVerifyResponse]:
"""
Test whether a token works.
@@ -428,15 +428,15 @@ async def create(
account_id: str,
name: str,
policies: Iterable[TokenPolicy],
- condition: token_create_params.Condition | NotGiven = NOT_GIVEN,
- expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN,
- not_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ condition: token_create_params.Condition | Omit = omit,
+ expires_on: Union[str, datetime] | Omit = omit,
+ not_before: Union[str, datetime] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TokenCreateResponse]:
"""
Create a new Account Owned API token.
@@ -492,16 +492,16 @@ async def update(
account_id: str,
name: str,
policies: Iterable[TokenPolicy],
- status: Literal["active", "disabled", "expired"],
- condition: token_update_params.Condition | NotGiven = NOT_GIVEN,
- expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN,
- not_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ condition: token_update_params.Condition | Omit = omit,
+ expires_on: Union[str, datetime] | Omit = omit,
+ not_before: Union[str, datetime] | Omit = omit,
+ status: Literal["active", "disabled", "expired"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Token]:
"""
Update an existing token.
@@ -515,13 +515,13 @@ async def update(
policies: List of access policies assigned to the token.
- status: Status of the token.
-
expires_on: The expiration time on or after which the JWT MUST NOT be accepted for
processing.
not_before: The time before which the token MUST NOT be accepted for processing.
+ status: Status of the token.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -540,10 +540,10 @@ async def update(
{
"name": name,
"policies": policies,
- "status": status,
"condition": condition,
"expires_on": expires_on,
"not_before": not_before,
+ "status": status,
},
token_update_params.TokenUpdateParams,
),
@@ -561,15 +561,15 @@ def list(
self,
*,
account_id: str,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Token, AsyncV4PagePaginationArray[Token]]:
"""
List all Account Owned API tokens created for this account.
@@ -623,7 +623,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TokenDeleteResponse]:
"""
Destroy an Account Owned API token.
@@ -667,7 +667,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Token]:
"""
Get information about a specific Account Owned API token.
@@ -710,7 +710,7 @@ async def verify(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TokenVerifyResponse]:
"""
Test whether a token works.
diff --git a/src/cloudflare/resources/accounts/tokens/value.py b/src/cloudflare/resources/accounts/tokens/value.py
index 21e9ddc0027..5e76bc54948 100644
--- a/src/cloudflare/resources/accounts/tokens/value.py
+++ b/src/cloudflare/resources/accounts/tokens/value.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -55,7 +55,7 @@ def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> str:
"""
Roll the Account Owned API token secret.
@@ -122,7 +122,7 @@ async def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> str:
"""
Roll the Account Owned API token secret.
diff --git a/src/cloudflare/resources/acm/total_tls.py b/src/cloudflare/resources/acm/total_tls.py
index b815c0c0370..ed1c54d9f7e 100644
--- a/src/cloudflare/resources/acm/total_tls.py
+++ b/src/cloudflare/resources/acm/total_tls.py
@@ -6,7 +6,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -17,11 +17,12 @@
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
-from ...types.acm import CertificateAuthority, total_tls_create_params
+from ...types.acm import CertificateAuthority, total_tls_edit_params, total_tls_update_params
from ..._base_client import make_request_options
from ...types.acm.certificate_authority import CertificateAuthority
from ...types.acm.total_tls_get_response import TotalTLSGetResponse
-from ...types.acm.total_tls_create_response import TotalTLSCreateResponse
+from ...types.acm.total_tls_edit_response import TotalTLSEditResponse
+from ...types.acm.total_tls_update_response import TotalTLSUpdateResponse
__all__ = ["TotalTLSResource", "AsyncTotalTLSResource"]
@@ -46,19 +47,19 @@ def with_streaming_response(self) -> TotalTLSResourceWithStreamingResponse:
"""
return TotalTLSResourceWithStreamingResponse(self)
- def create(
+ def update(
self,
*,
zone_id: str,
enabled: bool,
- certificate_authority: CertificateAuthority | NotGiven = NOT_GIVEN,
+ certificate_authority: CertificateAuthority | Omit = omit,
# 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,
- ) -> Optional[TotalTLSCreateResponse]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> Optional[TotalTLSUpdateResponse]:
"""
Set Total TLS Settings or disable the feature for a Zone.
@@ -87,16 +88,69 @@ def create(
"enabled": enabled,
"certificate_authority": certificate_authority,
},
- total_tls_create_params.TotalTLSCreateParams,
+ total_tls_update_params.TotalTLSUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[Optional[TotalTLSCreateResponse]]._unwrapper,
+ post_parser=ResultWrapper[Optional[TotalTLSUpdateResponse]]._unwrapper,
),
- cast_to=cast(Type[Optional[TotalTLSCreateResponse]], ResultWrapper[TotalTLSCreateResponse]),
+ cast_to=cast(Type[Optional[TotalTLSUpdateResponse]], ResultWrapper[TotalTLSUpdateResponse]),
+ )
+
+ def edit(
+ self,
+ *,
+ zone_id: str,
+ enabled: bool,
+ certificate_authority: CertificateAuthority | Omit = omit,
+ # 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,
+ ) -> Optional[TotalTLSEditResponse]:
+ """
+ Set Total TLS Settings or disable the feature for a Zone.
+
+ Args:
+ zone_id: Identifier.
+
+ enabled: If enabled, Total TLS will order a hostname specific TLS certificate for any
+ proxied A, AAAA, or CNAME record in your zone.
+
+ certificate_authority: The Certificate Authority that Total TLS certificates will be issued through.
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return self._post(
+ f"/zones/{zone_id}/acm/total_tls",
+ body=maybe_transform(
+ {
+ "enabled": enabled,
+ "certificate_authority": certificate_authority,
+ },
+ total_tls_edit_params.TotalTLSEditParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[TotalTLSEditResponse]]._unwrapper,
+ ),
+ cast_to=cast(Type[Optional[TotalTLSEditResponse]], ResultWrapper[TotalTLSEditResponse]),
)
def get(
@@ -108,7 +162,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TotalTLSGetResponse]:
"""
Get Total TLS Settings for a Zone.
@@ -159,19 +213,72 @@ def with_streaming_response(self) -> AsyncTotalTLSResourceWithStreamingResponse:
"""
return AsyncTotalTLSResourceWithStreamingResponse(self)
- async def create(
+ async def update(
+ self,
+ *,
+ zone_id: str,
+ enabled: bool,
+ certificate_authority: CertificateAuthority | Omit = omit,
+ # 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,
+ ) -> Optional[TotalTLSUpdateResponse]:
+ """
+ Set Total TLS Settings or disable the feature for a Zone.
+
+ Args:
+ zone_id: Identifier.
+
+ enabled: If enabled, Total TLS will order a hostname specific TLS certificate for any
+ proxied A, AAAA, or CNAME record in your zone.
+
+ certificate_authority: The Certificate Authority that Total TLS certificates will be issued through.
+
+ 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 zone_id:
+ raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
+ return await self._post(
+ f"/zones/{zone_id}/acm/total_tls",
+ body=await async_maybe_transform(
+ {
+ "enabled": enabled,
+ "certificate_authority": certificate_authority,
+ },
+ total_tls_update_params.TotalTLSUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[TotalTLSUpdateResponse]]._unwrapper,
+ ),
+ cast_to=cast(Type[Optional[TotalTLSUpdateResponse]], ResultWrapper[TotalTLSUpdateResponse]),
+ )
+
+ async def edit(
self,
*,
zone_id: str,
enabled: bool,
- certificate_authority: CertificateAuthority | NotGiven = NOT_GIVEN,
+ certificate_authority: CertificateAuthority | Omit = omit,
# 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,
- ) -> Optional[TotalTLSCreateResponse]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> Optional[TotalTLSEditResponse]:
"""
Set Total TLS Settings or disable the feature for a Zone.
@@ -200,16 +307,16 @@ async def create(
"enabled": enabled,
"certificate_authority": certificate_authority,
},
- total_tls_create_params.TotalTLSCreateParams,
+ total_tls_edit_params.TotalTLSEditParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[Optional[TotalTLSCreateResponse]]._unwrapper,
+ post_parser=ResultWrapper[Optional[TotalTLSEditResponse]]._unwrapper,
),
- cast_to=cast(Type[Optional[TotalTLSCreateResponse]], ResultWrapper[TotalTLSCreateResponse]),
+ cast_to=cast(Type[Optional[TotalTLSEditResponse]], ResultWrapper[TotalTLSEditResponse]),
)
async def get(
@@ -221,7 +328,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TotalTLSGetResponse]:
"""
Get Total TLS Settings for a Zone.
@@ -256,8 +363,11 @@ class TotalTLSResourceWithRawResponse:
def __init__(self, total_tls: TotalTLSResource) -> None:
self._total_tls = total_tls
- self.create = to_raw_response_wrapper(
- total_tls.create,
+ self.update = to_raw_response_wrapper(
+ total_tls.update,
+ )
+ self.edit = to_raw_response_wrapper(
+ total_tls.edit,
)
self.get = to_raw_response_wrapper(
total_tls.get,
@@ -268,8 +378,11 @@ class AsyncTotalTLSResourceWithRawResponse:
def __init__(self, total_tls: AsyncTotalTLSResource) -> None:
self._total_tls = total_tls
- self.create = async_to_raw_response_wrapper(
- total_tls.create,
+ self.update = async_to_raw_response_wrapper(
+ total_tls.update,
+ )
+ self.edit = async_to_raw_response_wrapper(
+ total_tls.edit,
)
self.get = async_to_raw_response_wrapper(
total_tls.get,
@@ -280,8 +393,11 @@ class TotalTLSResourceWithStreamingResponse:
def __init__(self, total_tls: TotalTLSResource) -> None:
self._total_tls = total_tls
- self.create = to_streamed_response_wrapper(
- total_tls.create,
+ self.update = to_streamed_response_wrapper(
+ total_tls.update,
+ )
+ self.edit = to_streamed_response_wrapper(
+ total_tls.edit,
)
self.get = to_streamed_response_wrapper(
total_tls.get,
@@ -292,8 +408,11 @@ class AsyncTotalTLSResourceWithStreamingResponse:
def __init__(self, total_tls: AsyncTotalTLSResource) -> None:
self._total_tls = total_tls
- self.create = async_to_streamed_response_wrapper(
- total_tls.create,
+ self.update = async_to_streamed_response_wrapper(
+ total_tls.update,
+ )
+ self.edit = async_to_streamed_response_wrapper(
+ total_tls.edit,
)
self.get = async_to_streamed_response_wrapper(
total_tls.get,
diff --git a/src/cloudflare/resources/addressing/address_maps/accounts.py b/src/cloudflare/resources/addressing/address_maps/accounts.py
index 42533eb9fc4..9d839d4a42d 100644
--- a/src/cloudflare/resources/addressing/address_maps/accounts.py
+++ b/src/cloudflare/resources/addressing/address_maps/accounts.py
@@ -4,7 +4,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -53,7 +53,7 @@ def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AccountUpdateResponse:
"""
Add an account as a member of a particular address map.
@@ -94,7 +94,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AccountDeleteResponse:
"""
Remove an account as a member of a particular address map.
@@ -156,7 +156,7 @@ async def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AccountUpdateResponse:
"""
Add an account as a member of a particular address map.
@@ -197,7 +197,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AccountDeleteResponse:
"""
Remove an account as a member of a particular address map.
diff --git a/src/cloudflare/resources/addressing/address_maps/address_maps.py b/src/cloudflare/resources/addressing/address_maps/address_maps.py
index 51effb2d79f..af03cd6994b 100644
--- a/src/cloudflare/resources/addressing/address_maps/address_maps.py
+++ b/src/cloudflare/resources/addressing/address_maps/address_maps.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import List, Type, Iterable, Optional, cast
+from typing import Type, Iterable, Optional, cast
import httpx
@@ -30,7 +30,7 @@
AccountsResourceWithStreamingResponse,
AsyncAccountsResourceWithStreamingResponse,
)
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -88,16 +88,16 @@ def create(
self,
*,
account_id: str,
- description: Optional[str] | NotGiven = NOT_GIVEN,
- enabled: Optional[bool] | NotGiven = NOT_GIVEN,
- ips: List[str] | NotGiven = NOT_GIVEN,
- memberships: Iterable[address_map_create_params.Membership] | NotGiven = NOT_GIVEN,
+ description: Optional[str] | Omit = omit,
+ enabled: Optional[bool] | Omit = omit,
+ ips: SequenceNotStr[str] | Omit = omit,
+ memberships: Iterable[address_map_create_params.Membership] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AddressMapCreateResponse]:
"""
Create a new address map under the account.
@@ -154,7 +154,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[AddressMap]:
"""
List all address maps owned by the account.
@@ -191,7 +191,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AddressMapDeleteResponse:
"""Delete a particular address map owned by the account.
@@ -228,15 +228,15 @@ def edit(
address_map_id: str,
*,
account_id: str,
- default_sni: Optional[str] | NotGiven = NOT_GIVEN,
- description: Optional[str] | NotGiven = NOT_GIVEN,
- enabled: Optional[bool] | NotGiven = NOT_GIVEN,
+ default_sni: Optional[str] | Omit = omit,
+ description: Optional[str] | Omit = omit,
+ enabled: Optional[bool] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AddressMap]:
"""
Modify properties of an address map owned by the account.
@@ -300,7 +300,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AddressMapGetResponse]:
"""
Show a particular address map owned by the account.
@@ -371,16 +371,16 @@ async def create(
self,
*,
account_id: str,
- description: Optional[str] | NotGiven = NOT_GIVEN,
- enabled: Optional[bool] | NotGiven = NOT_GIVEN,
- ips: List[str] | NotGiven = NOT_GIVEN,
- memberships: Iterable[address_map_create_params.Membership] | NotGiven = NOT_GIVEN,
+ description: Optional[str] | Omit = omit,
+ enabled: Optional[bool] | Omit = omit,
+ ips: SequenceNotStr[str] | Omit = omit,
+ memberships: Iterable[address_map_create_params.Membership] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AddressMapCreateResponse]:
"""
Create a new address map under the account.
@@ -437,7 +437,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[AddressMap, AsyncSinglePage[AddressMap]]:
"""
List all address maps owned by the account.
@@ -474,7 +474,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AddressMapDeleteResponse:
"""Delete a particular address map owned by the account.
@@ -511,15 +511,15 @@ async def edit(
address_map_id: str,
*,
account_id: str,
- default_sni: Optional[str] | NotGiven = NOT_GIVEN,
- description: Optional[str] | NotGiven = NOT_GIVEN,
- enabled: Optional[bool] | NotGiven = NOT_GIVEN,
+ default_sni: Optional[str] | Omit = omit,
+ description: Optional[str] | Omit = omit,
+ enabled: Optional[bool] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AddressMap]:
"""
Modify properties of an address map owned by the account.
@@ -583,7 +583,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AddressMapGetResponse]:
"""
Show a particular address map owned by the account.
diff --git a/src/cloudflare/resources/addressing/address_maps/ips.py b/src/cloudflare/resources/addressing/address_maps/ips.py
index 7c2831ec8ba..78313356374 100644
--- a/src/cloudflare/resources/addressing/address_maps/ips.py
+++ b/src/cloudflare/resources/addressing/address_maps/ips.py
@@ -4,7 +4,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -54,7 +54,7 @@ def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> IPUpdateResponse:
"""
Add an IP from a prefix owned by the account to a particular address map.
@@ -100,7 +100,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> IPDeleteResponse:
"""
Remove an IP from a particular address map.
@@ -167,7 +167,7 @@ async def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> IPUpdateResponse:
"""
Add an IP from a prefix owned by the account to a particular address map.
@@ -213,7 +213,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> IPDeleteResponse:
"""
Remove an IP from a particular address map.
diff --git a/src/cloudflare/resources/addressing/address_maps/zones.py b/src/cloudflare/resources/addressing/address_maps/zones.py
index fb721f75bbf..e6ac1d4e043 100644
--- a/src/cloudflare/resources/addressing/address_maps/zones.py
+++ b/src/cloudflare/resources/addressing/address_maps/zones.py
@@ -4,7 +4,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -54,7 +54,7 @@ def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ZoneUpdateResponse:
"""
Add a zone as a member of a particular address map.
@@ -100,7 +100,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ZoneDeleteResponse:
"""
Remove a zone as a member of a particular address map.
@@ -167,7 +167,7 @@ async def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ZoneUpdateResponse:
"""
Add a zone as a member of a particular address map.
@@ -213,7 +213,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ZoneDeleteResponse:
"""
Remove a zone as a member of a particular address map.
diff --git a/src/cloudflare/resources/addressing/loa_documents.py b/src/cloudflare/resources/addressing/loa_documents.py
index 211478a293c..a1765c32f97 100644
--- a/src/cloudflare/resources/addressing/loa_documents.py
+++ b/src/cloudflare/resources/addressing/loa_documents.py
@@ -6,7 +6,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Query, Headers, NotGiven, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -62,7 +62,7 @@ def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[LOADocumentCreateResponse]:
"""
Submit LOA document (pdf format) under the account.
@@ -109,7 +109,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> BinaryAPIResponse:
"""
Download specified LOA document under the account.
@@ -171,7 +171,7 @@ async def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[LOADocumentCreateResponse]:
"""
Submit LOA document (pdf format) under the account.
@@ -220,7 +220,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncBinaryAPIResponse:
"""
Download specified LOA document under the account.
diff --git a/src/cloudflare/resources/addressing/prefixes/advertisement_status.py b/src/cloudflare/resources/addressing/prefixes/advertisement_status.py
index 7eee6d184bc..7b71630f5b2 100644
--- a/src/cloudflare/resources/addressing/prefixes/advertisement_status.py
+++ b/src/cloudflare/resources/addressing/prefixes/advertisement_status.py
@@ -7,7 +7,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -58,7 +58,7 @@ def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AdvertisementStatusEditResponse]:
"""
Advertise or withdraw the BGP route for a prefix.
@@ -114,7 +114,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AdvertisementStatusGetResponse]:
"""
View the current advertisement state for a prefix.
@@ -184,7 +184,7 @@ async def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AdvertisementStatusEditResponse]:
"""
Advertise or withdraw the BGP route for a prefix.
@@ -240,7 +240,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AdvertisementStatusGetResponse]:
"""
View the current advertisement state for a prefix.
@@ -284,12 +284,12 @@ def __init__(self, advertisement_status: AdvertisementStatusResource) -> None:
self.edit = ( # pyright: ignore[reportDeprecated]
to_raw_response_wrapper(
- advertisement_status.edit # pyright: ignore[reportDeprecated],
+ advertisement_status.edit, # pyright: ignore[reportDeprecated],
)
)
self.get = ( # pyright: ignore[reportDeprecated]
to_raw_response_wrapper(
- advertisement_status.get # pyright: ignore[reportDeprecated],
+ advertisement_status.get, # pyright: ignore[reportDeprecated],
)
)
@@ -300,12 +300,12 @@ def __init__(self, advertisement_status: AsyncAdvertisementStatusResource) -> No
self.edit = ( # pyright: ignore[reportDeprecated]
async_to_raw_response_wrapper(
- advertisement_status.edit # pyright: ignore[reportDeprecated],
+ advertisement_status.edit, # pyright: ignore[reportDeprecated],
)
)
self.get = ( # pyright: ignore[reportDeprecated]
async_to_raw_response_wrapper(
- advertisement_status.get # pyright: ignore[reportDeprecated],
+ advertisement_status.get, # pyright: ignore[reportDeprecated],
)
)
@@ -316,12 +316,12 @@ def __init__(self, advertisement_status: AdvertisementStatusResource) -> None:
self.edit = ( # pyright: ignore[reportDeprecated]
to_streamed_response_wrapper(
- advertisement_status.edit # pyright: ignore[reportDeprecated],
+ advertisement_status.edit, # pyright: ignore[reportDeprecated],
)
)
self.get = ( # pyright: ignore[reportDeprecated]
to_streamed_response_wrapper(
- advertisement_status.get # pyright: ignore[reportDeprecated],
+ advertisement_status.get, # pyright: ignore[reportDeprecated],
)
)
@@ -332,11 +332,11 @@ def __init__(self, advertisement_status: AsyncAdvertisementStatusResource) -> No
self.edit = ( # pyright: ignore[reportDeprecated]
async_to_streamed_response_wrapper(
- advertisement_status.edit # pyright: ignore[reportDeprecated],
+ advertisement_status.edit, # pyright: ignore[reportDeprecated],
)
)
self.get = ( # pyright: ignore[reportDeprecated]
async_to_streamed_response_wrapper(
- advertisement_status.get # pyright: ignore[reportDeprecated],
+ advertisement_status.get, # pyright: ignore[reportDeprecated],
)
)
diff --git a/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py b/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py
index c93b5901764..2f997e3a34f 100644
--- a/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py
+++ b/src/cloudflare/resources/addressing/prefixes/bgp_prefixes.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -50,13 +50,13 @@ def create(
prefix_id: str,
*,
account_id: str,
- cidr: str | NotGiven = NOT_GIVEN,
+ cidr: 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BGPPrefix]:
"""
Create a BGP prefix, controlling the BGP advertisement status of a specific
@@ -105,7 +105,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[BGPPrefix]:
"""List all BGP Prefixes within the specified IP Prefix.
@@ -146,15 +146,15 @@ def edit(
*,
account_id: str,
prefix_id: str,
- asn_prepend_count: int | NotGiven = NOT_GIVEN,
- on_demand: bgp_prefix_edit_params.OnDemand | NotGiven = NOT_GIVEN,
- withdraw_if_no_route: bool | NotGiven = NOT_GIVEN,
+ asn_prepend_count: int | Omit = omit,
+ auto_advertise_withdraw: bool | Omit = omit,
+ on_demand: bgp_prefix_edit_params.OnDemand | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BGPPrefix]:
"""
Update the properties of a BGP Prefix, such as the on demand advertisement
@@ -169,9 +169,10 @@ def edit(
asn_prepend_count: Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute
- withdraw_if_no_route: Controls whether the BGP prefix is automatically withdrawn when prefix is
- withdrawn from Magic routing table (for Magic Transit customers using Direct
- CNI)
+ auto_advertise_withdraw: Determines if Cloudflare advertises a BYOIP BGP prefix even when there is no
+ matching BGP prefix in the Magic routing table. When true, Cloudflare will
+ automatically withdraw the BGP prefix when there are no matching BGP routes, and
+ will resume advertising when there is at least one matching BGP route.
extra_headers: Send extra headers
@@ -192,8 +193,8 @@ def edit(
body=maybe_transform(
{
"asn_prepend_count": asn_prepend_count,
+ "auto_advertise_withdraw": auto_advertise_withdraw,
"on_demand": on_demand,
- "withdraw_if_no_route": withdraw_if_no_route,
},
bgp_prefix_edit_params.BGPPrefixEditParams,
),
@@ -218,7 +219,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BGPPrefix]:
"""
Retrieve a single BGP Prefix according to its identifier
@@ -282,13 +283,13 @@ async def create(
prefix_id: str,
*,
account_id: str,
- cidr: str | NotGiven = NOT_GIVEN,
+ cidr: 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BGPPrefix]:
"""
Create a BGP prefix, controlling the BGP advertisement status of a specific
@@ -337,7 +338,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[BGPPrefix, AsyncSinglePage[BGPPrefix]]:
"""List all BGP Prefixes within the specified IP Prefix.
@@ -378,15 +379,15 @@ async def edit(
*,
account_id: str,
prefix_id: str,
- asn_prepend_count: int | NotGiven = NOT_GIVEN,
- on_demand: bgp_prefix_edit_params.OnDemand | NotGiven = NOT_GIVEN,
- withdraw_if_no_route: bool | NotGiven = NOT_GIVEN,
+ asn_prepend_count: int | Omit = omit,
+ auto_advertise_withdraw: bool | Omit = omit,
+ on_demand: bgp_prefix_edit_params.OnDemand | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BGPPrefix]:
"""
Update the properties of a BGP Prefix, such as the on demand advertisement
@@ -401,9 +402,10 @@ async def edit(
asn_prepend_count: Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute
- withdraw_if_no_route: Controls whether the BGP prefix is automatically withdrawn when prefix is
- withdrawn from Magic routing table (for Magic Transit customers using Direct
- CNI)
+ auto_advertise_withdraw: Determines if Cloudflare advertises a BYOIP BGP prefix even when there is no
+ matching BGP prefix in the Magic routing table. When true, Cloudflare will
+ automatically withdraw the BGP prefix when there are no matching BGP routes, and
+ will resume advertising when there is at least one matching BGP route.
extra_headers: Send extra headers
@@ -424,8 +426,8 @@ async def edit(
body=await async_maybe_transform(
{
"asn_prepend_count": asn_prepend_count,
+ "auto_advertise_withdraw": auto_advertise_withdraw,
"on_demand": on_demand,
- "withdraw_if_no_route": withdraw_if_no_route,
},
bgp_prefix_edit_params.BGPPrefixEditParams,
),
@@ -450,7 +452,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BGPPrefix]:
"""
Retrieve a single BGP Prefix according to its identifier
diff --git a/src/cloudflare/resources/addressing/prefixes/delegations.py b/src/cloudflare/resources/addressing/prefixes/delegations.py
index d71656994f4..cdc8824f1d3 100644
--- a/src/cloudflare/resources/addressing/prefixes/delegations.py
+++ b/src/cloudflare/resources/addressing/prefixes/delegations.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -58,7 +58,7 @@ def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Delegations]:
"""
Create a new account delegation for a given IP prefix.
@@ -113,7 +113,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[Delegations]:
"""
List all delegations for a given account IP prefix.
@@ -155,7 +155,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[DelegationDeleteResponse]:
"""
Delete an account delegation for a given IP prefix.
@@ -226,7 +226,7 @@ async def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Delegations]:
"""
Create a new account delegation for a given IP prefix.
@@ -281,7 +281,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Delegations, AsyncSinglePage[Delegations]]:
"""
List all delegations for a given account IP prefix.
@@ -323,7 +323,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[DelegationDeleteResponse]:
"""
Delete an account delegation for a given IP prefix.
diff --git a/src/cloudflare/resources/addressing/prefixes/prefixes.py b/src/cloudflare/resources/addressing/prefixes/prefixes.py
index 2cb1ed99c12..6c9785fa6cf 100644
--- a/src/cloudflare/resources/addressing/prefixes/prefixes.py
+++ b/src/cloudflare/resources/addressing/prefixes/prefixes.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from .delegations import (
@@ -98,15 +98,17 @@ def create(
self,
*,
account_id: str,
- asn: Optional[int],
+ asn: int,
cidr: str,
- loa_document_id: Optional[str],
+ delegate_loa_creation: bool | Omit = omit,
+ description: str | Omit = omit,
+ loa_document_id: Optional[str] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Prefix]:
"""
Add a new prefix under the account.
@@ -118,6 +120,11 @@ def create(
cidr: IP Prefix in Classless Inter-Domain Routing format.
+ delegate_loa_creation: Whether Cloudflare is allowed to generate the LOA document on behalf of the
+ prefix owner.
+
+ description: Description of the prefix.
+
loa_document_id: Identifier for the uploaded LOA document.
extra_headers: Send extra headers
@@ -136,6 +143,8 @@ def create(
{
"asn": asn,
"cidr": cidr,
+ "delegate_loa_creation": delegate_loa_creation,
+ "description": description,
"loa_document_id": loa_document_id,
},
prefix_create_params.PrefixCreateParams,
@@ -159,7 +168,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[Prefix]:
"""
List all prefixes owned by the account.
@@ -196,7 +205,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> PrefixDeleteResponse:
"""
Delete an unapproved prefix owned by the account.
@@ -237,7 +246,7 @@ def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Prefix]:
"""
Modify the description for a prefix owned by the account.
@@ -284,7 +293,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Prefix]:
"""
List a particular prefix owned by the account.
@@ -359,15 +368,17 @@ async def create(
self,
*,
account_id: str,
- asn: Optional[int],
+ asn: int,
cidr: str,
- loa_document_id: Optional[str],
+ delegate_loa_creation: bool | Omit = omit,
+ description: str | Omit = omit,
+ loa_document_id: Optional[str] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Prefix]:
"""
Add a new prefix under the account.
@@ -379,6 +390,11 @@ async def create(
cidr: IP Prefix in Classless Inter-Domain Routing format.
+ delegate_loa_creation: Whether Cloudflare is allowed to generate the LOA document on behalf of the
+ prefix owner.
+
+ description: Description of the prefix.
+
loa_document_id: Identifier for the uploaded LOA document.
extra_headers: Send extra headers
@@ -397,6 +413,8 @@ async def create(
{
"asn": asn,
"cidr": cidr,
+ "delegate_loa_creation": delegate_loa_creation,
+ "description": description,
"loa_document_id": loa_document_id,
},
prefix_create_params.PrefixCreateParams,
@@ -420,7 +438,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Prefix, AsyncSinglePage[Prefix]]:
"""
List all prefixes owned by the account.
@@ -457,7 +475,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> PrefixDeleteResponse:
"""
Delete an unapproved prefix owned by the account.
@@ -498,7 +516,7 @@ async def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Prefix]:
"""
Modify the description for a prefix owned by the account.
@@ -545,7 +563,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Prefix]:
"""
List a particular prefix owned by the account.
diff --git a/src/cloudflare/resources/addressing/prefixes/service_bindings.py b/src/cloudflare/resources/addressing/prefixes/service_bindings.py
index 1517b22c602..163f77b5a40 100644
--- a/src/cloudflare/resources/addressing/prefixes/service_bindings.py
+++ b/src/cloudflare/resources/addressing/prefixes/service_bindings.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -51,21 +51,22 @@ def create(
prefix_id: str,
*,
account_id: str,
- cidr: str | NotGiven = NOT_GIVEN,
- service_id: str | NotGiven = NOT_GIVEN,
+ cidr: str,
+ service_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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ServiceBinding]:
"""
Creates a new Service Binding, routing traffic to IPs within the given CIDR to a
- service running on Cloudflare's network. **Note:** This API may only be used on
- prefixes currently configured with a Magic Transit/Cloudflare CDN/Cloudflare
- Spectrum service binding, and only allows creating upgrade service bindings for
- the Cloudflare CDN or Cloudflare Spectrum.
+ service running on Cloudflare's network. **NOTE:** The first Service Binding
+ created for an IP Prefix must exactly match the IP Prefix's CIDR. Subsequent
+ Service Bindings may be created with a more-specific CIDR. Refer to the
+ [Service Bindings Documentation](https://developers.cloudflare.com/byoip/service-bindings/)
+ for compatibility details.
Args:
account_id: Identifier of a Cloudflare account.
@@ -118,7 +119,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[ServiceBinding]:
"""List the Cloudflare services this prefix is currently bound to.
@@ -166,7 +167,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ServiceBindingDeleteResponse:
"""
Delete a Service Binding
@@ -211,7 +212,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ServiceBinding]:
"""
Fetch a single Service Binding
@@ -275,21 +276,22 @@ async def create(
prefix_id: str,
*,
account_id: str,
- cidr: str | NotGiven = NOT_GIVEN,
- service_id: str | NotGiven = NOT_GIVEN,
+ cidr: str,
+ service_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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ServiceBinding]:
"""
Creates a new Service Binding, routing traffic to IPs within the given CIDR to a
- service running on Cloudflare's network. **Note:** This API may only be used on
- prefixes currently configured with a Magic Transit/Cloudflare CDN/Cloudflare
- Spectrum service binding, and only allows creating upgrade service bindings for
- the Cloudflare CDN or Cloudflare Spectrum.
+ service running on Cloudflare's network. **NOTE:** The first Service Binding
+ created for an IP Prefix must exactly match the IP Prefix's CIDR. Subsequent
+ Service Bindings may be created with a more-specific CIDR. Refer to the
+ [Service Bindings Documentation](https://developers.cloudflare.com/byoip/service-bindings/)
+ for compatibility details.
Args:
account_id: Identifier of a Cloudflare account.
@@ -342,7 +344,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[ServiceBinding, AsyncSinglePage[ServiceBinding]]:
"""List the Cloudflare services this prefix is currently bound to.
@@ -390,7 +392,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ServiceBindingDeleteResponse:
"""
Delete a Service Binding
@@ -435,7 +437,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ServiceBinding]:
"""
Fetch a single Service Binding
diff --git a/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py b/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py
index f490caebc34..e404f48a4d1 100644
--- a/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py
+++ b/src/cloudflare/resources/addressing/regional_hostnames/regional_hostnames.py
@@ -14,7 +14,7 @@
RegionsResourceWithStreamingResponse,
AsyncRegionsResourceWithStreamingResponse,
)
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -67,13 +67,13 @@ def create(
zone_id: str,
hostname: str,
region_key: str,
- routing: str | NotGiven = NOT_GIVEN,
+ routing: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[RegionalHostnameCreateResponse]:
"""Create a new Regional Hostname entry.
@@ -131,7 +131,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[RegionalHostnameListResponse]:
"""
List all Regional Hostnames within a zone.
@@ -168,7 +168,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> RegionalHostnameDeleteResponse:
"""
Delete the region configuration for a specific Regional Hostname.
@@ -210,7 +210,7 @@ def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[RegionalHostnameEditResponse]:
"""Update the configuration for a specific Regional Hostname.
@@ -260,7 +260,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[RegionalHostnameGetResponse]:
"""
Fetch the configuration for a specific Regional Hostname, within a zone.
@@ -326,13 +326,13 @@ async def create(
zone_id: str,
hostname: str,
region_key: str,
- routing: str | NotGiven = NOT_GIVEN,
+ routing: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[RegionalHostnameCreateResponse]:
"""Create a new Regional Hostname entry.
@@ -390,7 +390,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[RegionalHostnameListResponse, AsyncSinglePage[RegionalHostnameListResponse]]:
"""
List all Regional Hostnames within a zone.
@@ -427,7 +427,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> RegionalHostnameDeleteResponse:
"""
Delete the region configuration for a specific Regional Hostname.
@@ -469,7 +469,7 @@ async def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[RegionalHostnameEditResponse]:
"""Update the configuration for a specific Regional Hostname.
@@ -521,7 +521,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[RegionalHostnameGetResponse]:
"""
Fetch the configuration for a specific Regional Hostname, within a zone.
diff --git a/src/cloudflare/resources/addressing/regional_hostnames/regions.py b/src/cloudflare/resources/addressing/regional_hostnames/regions.py
index 77bd67a298d..e94af76ff04 100644
--- a/src/cloudflare/resources/addressing/regional_hostnames/regions.py
+++ b/src/cloudflare/resources/addressing/regional_hostnames/regions.py
@@ -4,7 +4,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -49,7 +49,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[RegionListResponse]:
"""
List all Regional Services regions available for use by this account.
@@ -106,7 +106,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[RegionListResponse, AsyncSinglePage[RegionListResponse]]:
"""
List all Regional Services regions available for use by this account.
diff --git a/src/cloudflare/resources/addressing/services.py b/src/cloudflare/resources/addressing/services.py
index 799ce7f0980..959ced7ff44 100644
--- a/src/cloudflare/resources/addressing/services.py
+++ b/src/cloudflare/resources/addressing/services.py
@@ -4,7 +4,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Query, Headers, NotGiven, not_given
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -49,7 +49,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[ServiceListResponse]:
"""
Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a
@@ -109,7 +109,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[ServiceListResponse, AsyncSinglePage[ServiceListResponse]]:
"""
Bring-Your-Own IP (BYOIP) prefixes onboarded to Cloudflare must be bound to a
diff --git a/src/cloudflare/resources/ai/__init__.py b/src/cloudflare/resources/ai/__init__.py
index 26c6c71d160..ccf8b736c39 100644
--- a/src/cloudflare/resources/ai/__init__.py
+++ b/src/cloudflare/resources/ai/__init__.py
@@ -40,6 +40,14 @@
FinetunesResourceWithStreamingResponse,
AsyncFinetunesResourceWithStreamingResponse,
)
+from .to_markdown import (
+ ToMarkdownResource,
+ AsyncToMarkdownResource,
+ ToMarkdownResourceWithRawResponse,
+ AsyncToMarkdownResourceWithRawResponse,
+ ToMarkdownResourceWithStreamingResponse,
+ AsyncToMarkdownResourceWithStreamingResponse,
+)
__all__ = [
"FinetunesResource",
@@ -66,6 +74,12 @@
"AsyncModelsResourceWithRawResponse",
"ModelsResourceWithStreamingResponse",
"AsyncModelsResourceWithStreamingResponse",
+ "ToMarkdownResource",
+ "AsyncToMarkdownResource",
+ "ToMarkdownResourceWithRawResponse",
+ "AsyncToMarkdownResourceWithRawResponse",
+ "ToMarkdownResourceWithStreamingResponse",
+ "AsyncToMarkdownResourceWithStreamingResponse",
"AIResource",
"AsyncAIResource",
"AIResourceWithRawResponse",
diff --git a/src/cloudflare/resources/ai/ai.py b/src/cloudflare/resources/ai/ai.py
index 7f9f0462bbc..9a53d1b3df5 100644
--- a/src/cloudflare/resources/ai/ai.py
+++ b/src/cloudflare/resources/ai/ai.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Any, List, Union, Iterable, Optional, cast
+from typing import Any, Union, Iterable, Optional, cast
from typing_extensions import overload
import httpx
@@ -23,7 +23,7 @@
AuthorsResourceWithStreamingResponse,
AsyncAuthorsResourceWithStreamingResponse,
)
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ..._utils import required_args, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ...types.ai import ai_run_params
@@ -35,6 +35,14 @@
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
+from .to_markdown import (
+ ToMarkdownResource,
+ AsyncToMarkdownResource,
+ ToMarkdownResourceWithRawResponse,
+ AsyncToMarkdownResourceWithRawResponse,
+ ToMarkdownResourceWithStreamingResponse,
+ AsyncToMarkdownResourceWithStreamingResponse,
+)
from .models.models import (
ModelsResource,
AsyncModelsResource,
@@ -74,6 +82,10 @@ def tasks(self) -> TasksResource:
def models(self) -> ModelsResource:
return ModelsResource(self._client)
+ @cached_property
+ def to_markdown(self) -> ToMarkdownResource:
+ return ToMarkdownResource(self._client)
+
@cached_property
def with_raw_response(self) -> AIResourceWithRawResponse:
"""
@@ -105,7 +117,7 @@ def run(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -138,22 +150,22 @@ def run(
*,
account_id: str,
prompt: str,
- guidance: float | NotGiven = NOT_GIVEN,
- height: int | NotGiven = NOT_GIVEN,
- image: Iterable[float] | NotGiven = NOT_GIVEN,
- image_b64: str | NotGiven = NOT_GIVEN,
- mask: Iterable[float] | NotGiven = NOT_GIVEN,
- negative_prompt: str | NotGiven = NOT_GIVEN,
- num_steps: int | NotGiven = NOT_GIVEN,
- seed: int | NotGiven = NOT_GIVEN,
- strength: float | NotGiven = NOT_GIVEN,
- width: int | NotGiven = NOT_GIVEN,
+ guidance: float | Omit = omit,
+ height: int | Omit = omit,
+ image: Iterable[float] | Omit = omit,
+ image_b64: str | Omit = omit,
+ mask: Iterable[float] | Omit = omit,
+ negative_prompt: str | Omit = omit,
+ num_steps: int | Omit = omit,
+ seed: int | Omit = omit,
+ strength: float | Omit = omit,
+ width: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -210,13 +222,13 @@ def run(
*,
account_id: str,
prompt: str,
- lang: str | NotGiven = NOT_GIVEN,
+ lang: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -251,13 +263,13 @@ def run(
model_name: str,
*,
account_id: str,
- text: Union[str, List[str]],
+ text: Union[str, SequenceNotStr[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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -290,14 +302,14 @@ def run(
*,
account_id: str,
audio: Iterable[float],
- source_lang: str | NotGiven = NOT_GIVEN,
- target_lang: str | NotGiven = NOT_GIVEN,
+ source_lang: str | Omit = omit,
+ target_lang: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -341,7 +353,7 @@ def run(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -374,13 +386,13 @@ def run(
model_name: str,
*,
account_id: str,
- image: Iterable[float] | NotGiven = NOT_GIVEN,
+ image: Iterable[float] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -414,24 +426,24 @@ def run(
*,
account_id: str,
prompt: str,
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- lora: str | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- raw: bool | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN,
- seed: int | NotGiven = NOT_GIVEN,
- stream: bool | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: int | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ lora: str | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ raw: bool | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ response_format: ai_run_params.PromptResponseFormat | Omit = omit,
+ seed: int | Omit = omit,
+ stream: bool | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: int | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -493,25 +505,25 @@ def run(
*,
account_id: str,
messages: Iterable[ai_run_params.MessagesMessage],
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- raw: bool | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- response_format: ai_run_params.MessagesResponseFormat | NotGiven = NOT_GIVEN,
- seed: int | NotGiven = NOT_GIVEN,
- stream: bool | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- tools: Iterable[ai_run_params.MessagesTool] | NotGiven = NOT_GIVEN,
- top_k: int | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ functions: Iterable[ai_run_params.MessagesFunction] | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ raw: bool | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ response_format: ai_run_params.MessagesResponseFormat | Omit = omit,
+ seed: int | Omit = omit,
+ stream: bool | Omit = omit,
+ temperature: float | Omit = omit,
+ tools: Iterable[ai_run_params.MessagesTool] | Omit = omit,
+ top_k: int | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -574,13 +586,13 @@ def run(
account_id: str,
target_lang: str,
text: str,
- source_lang: str | NotGiven = NOT_GIVEN,
+ source_lang: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -618,13 +630,13 @@ def run(
*,
account_id: str,
input_text: str,
- max_length: int | NotGiven = NOT_GIVEN,
+ max_length: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -659,22 +671,22 @@ def run(
*,
account_id: str,
image: Iterable[float],
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- prompt: str | NotGiven = NOT_GIVEN,
- raw: bool | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- seed: float | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: float | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ prompt: str | Omit = omit,
+ raw: bool | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ seed: float | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: float | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -735,21 +747,21 @@ def run(
account_id: str,
image: str,
prompt: str,
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- ignore_eos: bool | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- seed: float | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: float | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ ignore_eos: bool | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ seed: float | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: float | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -809,21 +821,21 @@ def run(
account_id: str,
image: str,
messages: Iterable[ai_run_params.Variant13Message],
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- ignore_eos: bool | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- seed: float | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: float | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ ignore_eos: bool | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ seed: float | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: float | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -875,6 +887,45 @@ def run(
"""
...
+ @overload
+ def run(
+ self,
+ model_name: str,
+ *,
+ account_id: str,
+ image: str | Omit = omit,
+ text: SequenceNotStr[str] | Omit = omit,
+ # 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,
+ ) -> Optional[AIRunResponse]:
+ """
+ This endpoint provides users with the capability to run specific AI models
+ on-demand.
+
+ By submitting the required input data, users can receive real-time predictions
+ or results generated by the chosen AI model. The endpoint supports various AI
+ model types, ensuring flexibility and adaptability for diverse use cases.
+
+ Model specific inputs available in
+ [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/).
+
+ Args:
+ image: Image in base64 encoded format.
+
+ 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
+ """
+ ...
+
@required_args(
["account_id", "text"],
["account_id", "prompt"],
@@ -892,45 +943,45 @@ def run(
model_name: str,
*,
account_id: str,
- text: str | Union[str, List[str]] | NotGiven = NOT_GIVEN,
- prompt: str | NotGiven = NOT_GIVEN,
- guidance: float | NotGiven = NOT_GIVEN,
- height: int | NotGiven = NOT_GIVEN,
- image: Iterable[float] | str | NotGiven = NOT_GIVEN,
- image_b64: str | NotGiven = NOT_GIVEN,
- mask: Iterable[float] | NotGiven = NOT_GIVEN,
- negative_prompt: str | NotGiven = NOT_GIVEN,
- num_steps: int | NotGiven = NOT_GIVEN,
- seed: int | float | NotGiven = NOT_GIVEN,
- strength: float | NotGiven = NOT_GIVEN,
- width: int | NotGiven = NOT_GIVEN,
- lang: str | NotGiven = NOT_GIVEN,
- audio: Iterable[float] | NotGiven = NOT_GIVEN,
- source_lang: str | NotGiven = NOT_GIVEN,
- target_lang: str | NotGiven = NOT_GIVEN,
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- lora: str | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- raw: bool | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN,
- stream: bool | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: int | float | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
- messages: Iterable[ai_run_params.MessagesMessage] | NotGiven = NOT_GIVEN,
- functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN,
- tools: Iterable[ai_run_params.MessagesTool] | NotGiven = NOT_GIVEN,
- input_text: str | NotGiven = NOT_GIVEN,
- max_length: int | NotGiven = NOT_GIVEN,
- ignore_eos: bool | NotGiven = NOT_GIVEN,
+ text: str | Union[str, SequenceNotStr[str]] | SequenceNotStr[str] | Omit = omit,
+ prompt: str | Omit = omit,
+ guidance: float | Omit = omit,
+ height: int | Omit = omit,
+ image: Iterable[float] | str | Omit = omit,
+ image_b64: str | Omit = omit,
+ mask: Iterable[float] | Omit = omit,
+ negative_prompt: str | Omit = omit,
+ num_steps: int | Omit = omit,
+ seed: int | float | Omit = omit,
+ strength: float | Omit = omit,
+ width: int | Omit = omit,
+ lang: str | Omit = omit,
+ audio: Iterable[float] | Omit = omit,
+ source_lang: str | Omit = omit,
+ target_lang: str | Omit = omit,
+ frequency_penalty: float | Omit = omit,
+ lora: str | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ raw: bool | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ response_format: ai_run_params.PromptResponseFormat | ai_run_params.MessagesResponseFormat | Omit = omit,
+ stream: bool | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: int | float | Omit = omit,
+ top_p: float | Omit = omit,
+ messages: Iterable[ai_run_params.MessagesMessage] | Iterable[ai_run_params.Variant13Message] | Omit = omit,
+ functions: Iterable[ai_run_params.MessagesFunction] | Omit = omit,
+ tools: Iterable[ai_run_params.MessagesTool] | Omit = omit,
+ input_text: str | Omit = omit,
+ max_length: int | Omit = omit,
+ ignore_eos: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
@@ -1009,6 +1060,10 @@ def tasks(self) -> AsyncTasksResource:
def models(self) -> AsyncModelsResource:
return AsyncModelsResource(self._client)
+ @cached_property
+ def to_markdown(self) -> AsyncToMarkdownResource:
+ return AsyncToMarkdownResource(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncAIResourceWithRawResponse:
"""
@@ -1040,7 +1095,7 @@ async def run(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1073,22 +1128,22 @@ async def run(
*,
account_id: str,
prompt: str,
- guidance: float | NotGiven = NOT_GIVEN,
- height: int | NotGiven = NOT_GIVEN,
- image: Iterable[float] | NotGiven = NOT_GIVEN,
- image_b64: str | NotGiven = NOT_GIVEN,
- mask: Iterable[float] | NotGiven = NOT_GIVEN,
- negative_prompt: str | NotGiven = NOT_GIVEN,
- num_steps: int | NotGiven = NOT_GIVEN,
- seed: int | NotGiven = NOT_GIVEN,
- strength: float | NotGiven = NOT_GIVEN,
- width: int | NotGiven = NOT_GIVEN,
+ guidance: float | Omit = omit,
+ height: int | Omit = omit,
+ image: Iterable[float] | Omit = omit,
+ image_b64: str | Omit = omit,
+ mask: Iterable[float] | Omit = omit,
+ negative_prompt: str | Omit = omit,
+ num_steps: int | Omit = omit,
+ seed: int | Omit = omit,
+ strength: float | Omit = omit,
+ width: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1145,13 +1200,13 @@ async def run(
*,
account_id: str,
prompt: str,
- lang: str | NotGiven = NOT_GIVEN,
+ lang: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1186,13 +1241,13 @@ async def run(
model_name: str,
*,
account_id: str,
- text: Union[str, List[str]],
+ text: Union[str, SequenceNotStr[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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1225,14 +1280,14 @@ async def run(
*,
account_id: str,
audio: Iterable[float],
- source_lang: str | NotGiven = NOT_GIVEN,
- target_lang: str | NotGiven = NOT_GIVEN,
+ source_lang: str | Omit = omit,
+ target_lang: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1276,7 +1331,7 @@ async def run(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1309,13 +1364,13 @@ async def run(
model_name: str,
*,
account_id: str,
- image: Iterable[float] | NotGiven = NOT_GIVEN,
+ image: Iterable[float] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1349,24 +1404,24 @@ async def run(
*,
account_id: str,
prompt: str,
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- lora: str | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- raw: bool | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN,
- seed: int | NotGiven = NOT_GIVEN,
- stream: bool | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: int | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ lora: str | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ raw: bool | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ response_format: ai_run_params.PromptResponseFormat | Omit = omit,
+ seed: int | Omit = omit,
+ stream: bool | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: int | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1428,25 +1483,25 @@ async def run(
*,
account_id: str,
messages: Iterable[ai_run_params.MessagesMessage],
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- raw: bool | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- response_format: ai_run_params.MessagesResponseFormat | NotGiven = NOT_GIVEN,
- seed: int | NotGiven = NOT_GIVEN,
- stream: bool | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- tools: Iterable[ai_run_params.MessagesTool] | NotGiven = NOT_GIVEN,
- top_k: int | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ functions: Iterable[ai_run_params.MessagesFunction] | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ raw: bool | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ response_format: ai_run_params.MessagesResponseFormat | Omit = omit,
+ seed: int | Omit = omit,
+ stream: bool | Omit = omit,
+ temperature: float | Omit = omit,
+ tools: Iterable[ai_run_params.MessagesTool] | Omit = omit,
+ top_k: int | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1509,13 +1564,13 @@ async def run(
account_id: str,
target_lang: str,
text: str,
- source_lang: str | NotGiven = NOT_GIVEN,
+ source_lang: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1553,13 +1608,13 @@ async def run(
*,
account_id: str,
input_text: str,
- max_length: int | NotGiven = NOT_GIVEN,
+ max_length: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1594,22 +1649,22 @@ async def run(
*,
account_id: str,
image: Iterable[float],
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- prompt: str | NotGiven = NOT_GIVEN,
- raw: bool | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- seed: float | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: float | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ prompt: str | Omit = omit,
+ raw: bool | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ seed: float | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: float | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1670,21 +1725,21 @@ async def run(
account_id: str,
image: str,
prompt: str,
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- ignore_eos: bool | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- seed: float | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: float | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ ignore_eos: bool | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ seed: float | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: float | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1744,21 +1799,21 @@ async def run(
account_id: str,
image: str,
messages: Iterable[ai_run_params.Variant13Message],
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- ignore_eos: bool | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- seed: float | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: float | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
+ frequency_penalty: float | Omit = omit,
+ ignore_eos: bool | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ seed: float | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: float | Omit = omit,
+ top_p: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
"""
This endpoint provides users with the capability to run specific AI models
@@ -1810,6 +1865,45 @@ async def run(
"""
...
+ @overload
+ async def run(
+ self,
+ model_name: str,
+ *,
+ account_id: str,
+ image: str | Omit = omit,
+ text: SequenceNotStr[str] | Omit = omit,
+ # 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,
+ ) -> Optional[AIRunResponse]:
+ """
+ This endpoint provides users with the capability to run specific AI models
+ on-demand.
+
+ By submitting the required input data, users can receive real-time predictions
+ or results generated by the chosen AI model. The endpoint supports various AI
+ model types, ensuring flexibility and adaptability for diverse use cases.
+
+ Model specific inputs available in
+ [Cloudflare Docs](https://developers.cloudflare.com/workers-ai/models/).
+
+ Args:
+ image: Image in base64 encoded format.
+
+ 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
+ """
+ ...
+
@required_args(
["account_id", "text"],
["account_id", "prompt"],
@@ -1827,45 +1921,45 @@ async def run(
model_name: str,
*,
account_id: str,
- text: str | Union[str, List[str]] | NotGiven = NOT_GIVEN,
- prompt: str | NotGiven = NOT_GIVEN,
- guidance: float | NotGiven = NOT_GIVEN,
- height: int | NotGiven = NOT_GIVEN,
- image: Iterable[float] | str | NotGiven = NOT_GIVEN,
- image_b64: str | NotGiven = NOT_GIVEN,
- mask: Iterable[float] | NotGiven = NOT_GIVEN,
- negative_prompt: str | NotGiven = NOT_GIVEN,
- num_steps: int | NotGiven = NOT_GIVEN,
- seed: int | float | NotGiven = NOT_GIVEN,
- strength: float | NotGiven = NOT_GIVEN,
- width: int | NotGiven = NOT_GIVEN,
- lang: str | NotGiven = NOT_GIVEN,
- audio: Iterable[float] | NotGiven = NOT_GIVEN,
- source_lang: str | NotGiven = NOT_GIVEN,
- target_lang: str | NotGiven = NOT_GIVEN,
- frequency_penalty: float | NotGiven = NOT_GIVEN,
- lora: str | NotGiven = NOT_GIVEN,
- max_tokens: int | NotGiven = NOT_GIVEN,
- presence_penalty: float | NotGiven = NOT_GIVEN,
- raw: bool | NotGiven = NOT_GIVEN,
- repetition_penalty: float | NotGiven = NOT_GIVEN,
- response_format: ai_run_params.PromptResponseFormat | NotGiven = NOT_GIVEN,
- stream: bool | NotGiven = NOT_GIVEN,
- temperature: float | NotGiven = NOT_GIVEN,
- top_k: int | float | NotGiven = NOT_GIVEN,
- top_p: float | NotGiven = NOT_GIVEN,
- messages: Iterable[ai_run_params.MessagesMessage] | NotGiven = NOT_GIVEN,
- functions: Iterable[ai_run_params.MessagesFunction] | NotGiven = NOT_GIVEN,
- tools: Iterable[ai_run_params.MessagesTool] | NotGiven = NOT_GIVEN,
- input_text: str | NotGiven = NOT_GIVEN,
- max_length: int | NotGiven = NOT_GIVEN,
- ignore_eos: bool | NotGiven = NOT_GIVEN,
+ text: str | Union[str, SequenceNotStr[str]] | SequenceNotStr[str] | Omit = omit,
+ prompt: str | Omit = omit,
+ guidance: float | Omit = omit,
+ height: int | Omit = omit,
+ image: Iterable[float] | str | Omit = omit,
+ image_b64: str | Omit = omit,
+ mask: Iterable[float] | Omit = omit,
+ negative_prompt: str | Omit = omit,
+ num_steps: int | Omit = omit,
+ seed: int | float | Omit = omit,
+ strength: float | Omit = omit,
+ width: int | Omit = omit,
+ lang: str | Omit = omit,
+ audio: Iterable[float] | Omit = omit,
+ source_lang: str | Omit = omit,
+ target_lang: str | Omit = omit,
+ frequency_penalty: float | Omit = omit,
+ lora: str | Omit = omit,
+ max_tokens: int | Omit = omit,
+ presence_penalty: float | Omit = omit,
+ raw: bool | Omit = omit,
+ repetition_penalty: float | Omit = omit,
+ response_format: ai_run_params.PromptResponseFormat | ai_run_params.MessagesResponseFormat | Omit = omit,
+ stream: bool | Omit = omit,
+ temperature: float | Omit = omit,
+ top_k: int | float | Omit = omit,
+ top_p: float | Omit = omit,
+ messages: Iterable[ai_run_params.MessagesMessage] | Iterable[ai_run_params.Variant13Message] | Omit = omit,
+ functions: Iterable[ai_run_params.MessagesFunction] | Omit = omit,
+ tools: Iterable[ai_run_params.MessagesTool] | Omit = omit,
+ input_text: str | Omit = omit,
+ max_length: int | Omit = omit,
+ ignore_eos: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AIRunResponse]:
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
@@ -1951,6 +2045,10 @@ def tasks(self) -> TasksResourceWithRawResponse:
def models(self) -> ModelsResourceWithRawResponse:
return ModelsResourceWithRawResponse(self._ai.models)
+ @cached_property
+ def to_markdown(self) -> ToMarkdownResourceWithRawResponse:
+ return ToMarkdownResourceWithRawResponse(self._ai.to_markdown)
+
class AsyncAIResourceWithRawResponse:
def __init__(self, ai: AsyncAIResource) -> None:
@@ -1976,6 +2074,10 @@ def tasks(self) -> AsyncTasksResourceWithRawResponse:
def models(self) -> AsyncModelsResourceWithRawResponse:
return AsyncModelsResourceWithRawResponse(self._ai.models)
+ @cached_property
+ def to_markdown(self) -> AsyncToMarkdownResourceWithRawResponse:
+ return AsyncToMarkdownResourceWithRawResponse(self._ai.to_markdown)
+
class AIResourceWithStreamingResponse:
def __init__(self, ai: AIResource) -> None:
@@ -2001,6 +2103,10 @@ def tasks(self) -> TasksResourceWithStreamingResponse:
def models(self) -> ModelsResourceWithStreamingResponse:
return ModelsResourceWithStreamingResponse(self._ai.models)
+ @cached_property
+ def to_markdown(self) -> ToMarkdownResourceWithStreamingResponse:
+ return ToMarkdownResourceWithStreamingResponse(self._ai.to_markdown)
+
class AsyncAIResourceWithStreamingResponse:
def __init__(self, ai: AsyncAIResource) -> None:
@@ -2025,3 +2131,7 @@ def tasks(self) -> AsyncTasksResourceWithStreamingResponse:
@cached_property
def models(self) -> AsyncModelsResourceWithStreamingResponse:
return AsyncModelsResourceWithStreamingResponse(self._ai.models)
+
+ @cached_property
+ def to_markdown(self) -> AsyncToMarkdownResourceWithStreamingResponse:
+ return AsyncToMarkdownResourceWithStreamingResponse(self._ai.to_markdown)
diff --git a/src/cloudflare/resources/ai/authors.py b/src/cloudflare/resources/ai/authors.py
index f5c5ce9877d..8f3ceeb8486 100644
--- a/src/cloudflare/resources/ai/authors.py
+++ b/src/cloudflare/resources/ai/authors.py
@@ -4,7 +4,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Query, Headers, NotGiven, not_given
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -48,7 +48,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | 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]:
"""
Author Search
@@ -103,7 +103,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | 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]]:
"""
Author Search
diff --git a/src/cloudflare/resources/ai/finetunes/assets.py b/src/cloudflare/resources/ai/finetunes/assets.py
index f1da603332b..50ce6bb6cae 100644
--- a/src/cloudflare/resources/ai/finetunes/assets.py
+++ b/src/cloudflare/resources/ai/finetunes/assets.py
@@ -2,11 +2,11 @@
from __future__ import annotations
-from typing import Type, Mapping, cast
+from typing import Mapping, cast
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
+from ...._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given
from ...._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -16,7 +16,6 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
-from ...._wrappers import ResultWrapper
from ...._base_client import make_request_options
from ....types.ai.finetunes import asset_create_params
from ....types.ai.finetunes.asset_create_response import AssetCreateResponse
@@ -49,14 +48,14 @@ def create(
finetune_id: str,
*,
account_id: str,
- file: FileTypes | NotGiven = NOT_GIVEN,
- file_name: str | NotGiven = NOT_GIVEN,
+ file: FileTypes | Omit = omit,
+ file_name: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AssetCreateResponse:
"""
Upload a Finetune Asset
@@ -90,13 +89,9 @@ def create(
body=maybe_transform(body, asset_create_params.AssetCreateParams),
files=files,
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[AssetCreateResponse]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=cast(Type[AssetCreateResponse], ResultWrapper[AssetCreateResponse]),
+ cast_to=AssetCreateResponse,
)
@@ -125,14 +120,14 @@ async def create(
finetune_id: str,
*,
account_id: str,
- file: FileTypes | NotGiven = NOT_GIVEN,
- file_name: str | NotGiven = NOT_GIVEN,
+ file: FileTypes | Omit = omit,
+ file_name: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AssetCreateResponse:
"""
Upload a Finetune Asset
@@ -166,13 +161,9 @@ async def create(
body=await async_maybe_transform(body, asset_create_params.AssetCreateParams),
files=files,
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[AssetCreateResponse]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=cast(Type[AssetCreateResponse], ResultWrapper[AssetCreateResponse]),
+ cast_to=AssetCreateResponse,
)
diff --git a/src/cloudflare/resources/ai/finetunes/finetunes.py b/src/cloudflare/resources/ai/finetunes/finetunes.py
index 47de3973b44..e998763b6f2 100644
--- a/src/cloudflare/resources/ai/finetunes/finetunes.py
+++ b/src/cloudflare/resources/ai/finetunes/finetunes.py
@@ -22,7 +22,7 @@
PublicResourceWithStreamingResponse,
AsyncPublicResourceWithStreamingResponse,
)
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ....types.ai import finetune_create_params
@@ -75,14 +75,14 @@ def create(
account_id: str,
model: str,
name: str,
- description: str | NotGiven = NOT_GIVEN,
- public: bool | NotGiven = NOT_GIVEN,
+ description: str | Omit = omit,
+ public: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> FinetuneCreateResponse:
"""
Create a new Finetune
@@ -128,7 +128,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> FinetuneListResponse:
"""
List Finetunes
@@ -191,14 +191,14 @@ async def create(
account_id: str,
model: str,
name: str,
- description: str | NotGiven = NOT_GIVEN,
- public: bool | NotGiven = NOT_GIVEN,
+ description: str | Omit = omit,
+ public: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> FinetuneCreateResponse:
"""
Create a new Finetune
@@ -244,7 +244,7 @@ async def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> FinetuneListResponse:
"""
List Finetunes
diff --git a/src/cloudflare/resources/ai/finetunes/public.py b/src/cloudflare/resources/ai/finetunes/public.py
index c8d542c985e..0e8f9e74988 100644
--- a/src/cloudflare/resources/ai/finetunes/public.py
+++ b/src/cloudflare/resources/ai/finetunes/public.py
@@ -4,7 +4,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -46,15 +46,15 @@ def list(
self,
*,
account_id: str,
- limit: float | NotGiven = NOT_GIVEN,
- offset: float | NotGiven = NOT_GIVEN,
- order_by: str | NotGiven = NOT_GIVEN,
+ limit: float | Omit = omit,
+ offset: float | Omit = omit,
+ order_by: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[PublicListResponse]:
"""
List Public Finetunes
@@ -121,15 +121,15 @@ def list(
self,
*,
account_id: str,
- limit: float | NotGiven = NOT_GIVEN,
- offset: float | NotGiven = NOT_GIVEN,
- order_by: str | NotGiven = NOT_GIVEN,
+ limit: float | Omit = omit,
+ offset: float | Omit = omit,
+ order_by: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[PublicListResponse, AsyncSinglePage[PublicListResponse]]:
"""
List Public Finetunes
diff --git a/src/cloudflare/resources/ai/models/models.py b/src/cloudflare/resources/ai/models/models.py
index 74f1ac1ad34..9d6d4f9c83d 100644
--- a/src/cloudflare/resources/ai/models/models.py
+++ b/src/cloudflare/resources/ai/models/models.py
@@ -12,7 +12,7 @@
SchemaResourceWithStreamingResponse,
AsyncSchemaResourceWithStreamingResponse,
)
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform
from ...._compat import cached_property
from ....types.ai import model_list_params
@@ -57,19 +57,19 @@ def list(
self,
*,
account_id: str,
- author: str | NotGiven = NOT_GIVEN,
- hide_experimental: bool | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
- source: float | NotGiven = NOT_GIVEN,
- task: str | NotGiven = NOT_GIVEN,
+ author: str | Omit = omit,
+ hide_experimental: bool | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
+ source: float | Omit = omit,
+ task: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[object]:
"""
Model Search
@@ -148,19 +148,19 @@ def list(
self,
*,
account_id: str,
- author: str | NotGiven = NOT_GIVEN,
- hide_experimental: bool | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
- source: float | NotGiven = NOT_GIVEN,
- task: str | NotGiven = NOT_GIVEN,
+ author: str | Omit = omit,
+ hide_experimental: bool | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
+ source: float | Omit = omit,
+ task: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[object, AsyncV4PagePaginationArray[object]]:
"""
Model Search
diff --git a/src/cloudflare/resources/ai/models/schema.py b/src/cloudflare/resources/ai/models/schema.py
index a388ffb8beb..2f12236dd38 100644
--- a/src/cloudflare/resources/ai/models/schema.py
+++ b/src/cloudflare/resources/ai/models/schema.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -53,7 +53,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> object:
"""
Get Model Schema
@@ -115,7 +115,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> object:
"""
Get Model Schema
diff --git a/src/cloudflare/resources/ai/tasks.py b/src/cloudflare/resources/ai/tasks.py
index 16b130e6805..26fcd51f8b0 100644
--- a/src/cloudflare/resources/ai/tasks.py
+++ b/src/cloudflare/resources/ai/tasks.py
@@ -4,7 +4,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Query, Headers, NotGiven, not_given
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -48,7 +48,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | 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]:
"""
Task Search
@@ -103,7 +103,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | 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]]:
"""
Task Search
diff --git a/src/cloudflare/resources/ai/to_markdown.py b/src/cloudflare/resources/ai/to_markdown.py
new file mode 100644
index 00000000000..3a3a7f4b58f
--- /dev/null
+++ b/src/cloudflare/resources/ai/to_markdown.py
@@ -0,0 +1,271 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Mapping, cast
+
+import httpx
+
+from ..._types import Body, Query, Headers, NotGiven, not_given
+from ..._utils import extract_files, maybe_transform, deepcopy_minimal
+from ..._compat import cached_property
+from ...types.ai import to_markdown_transform_params
+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 ...pagination import SyncSinglePage, AsyncSinglePage
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.ai.to_markdown_supported_response import ToMarkdownSupportedResponse
+from ...types.ai.to_markdown_transform_response import ToMarkdownTransformResponse
+
+__all__ = ["ToMarkdownResource", "AsyncToMarkdownResource"]
+
+
+class ToMarkdownResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> ToMarkdownResourceWithRawResponse:
+ """
+ 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 ToMarkdownResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> ToMarkdownResourceWithStreamingResponse:
+ """
+ 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 ToMarkdownResourceWithStreamingResponse(self)
+
+ def supported(
+ 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[ToMarkdownSupportedResponse]:
+ """
+ Get all converted formats supported
+
+ Args:
+ 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}/ai/tomarkdown/supported",
+ page=SyncSinglePage[ToMarkdownSupportedResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=ToMarkdownSupportedResponse,
+ )
+
+ def transform(
+ self,
+ *,
+ account_id: str,
+ file: to_markdown_transform_params.File,
+ # 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[ToMarkdownTransformResponse]:
+ """
+ Convert Files into Markdown
+
+ Args:
+ 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}")
+ body = deepcopy_minimal(file)
+ files = extract_files(cast(Mapping[str, object], body), paths=[["files", ""]])
+ # It should be noted that the actual Content-Type header that will be
+ # sent to the server will contain a `boundary` parameter, e.g.
+ # multipart/form-data; boundary=---abc--
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai/tomarkdown",
+ page=SyncSinglePage[ToMarkdownTransformResponse],
+ body=maybe_transform(body, to_markdown_transform_params.ToMarkdownTransformParams),
+ files=files,
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=ToMarkdownTransformResponse,
+ method="post",
+ )
+
+
+class AsyncToMarkdownResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncToMarkdownResourceWithRawResponse:
+ """
+ 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 AsyncToMarkdownResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncToMarkdownResourceWithStreamingResponse:
+ """
+ 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 AsyncToMarkdownResourceWithStreamingResponse(self)
+
+ def supported(
+ 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[ToMarkdownSupportedResponse, AsyncSinglePage[ToMarkdownSupportedResponse]]:
+ """
+ Get all converted formats supported
+
+ Args:
+ 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}/ai/tomarkdown/supported",
+ page=AsyncSinglePage[ToMarkdownSupportedResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=ToMarkdownSupportedResponse,
+ )
+
+ def transform(
+ self,
+ *,
+ account_id: str,
+ file: to_markdown_transform_params.File,
+ # 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[ToMarkdownTransformResponse, AsyncSinglePage[ToMarkdownTransformResponse]]:
+ """
+ Convert Files into Markdown
+
+ Args:
+ 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}")
+ body = deepcopy_minimal(file)
+ files = extract_files(cast(Mapping[str, object], body), paths=[["files", ""]])
+ # It should be noted that the actual Content-Type header that will be
+ # sent to the server will contain a `boundary` parameter, e.g.
+ # multipart/form-data; boundary=---abc--
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai/tomarkdown",
+ page=AsyncSinglePage[ToMarkdownTransformResponse],
+ body=maybe_transform(body, to_markdown_transform_params.ToMarkdownTransformParams),
+ files=files,
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=ToMarkdownTransformResponse,
+ method="post",
+ )
+
+
+class ToMarkdownResourceWithRawResponse:
+ def __init__(self, to_markdown: ToMarkdownResource) -> None:
+ self._to_markdown = to_markdown
+
+ self.supported = to_raw_response_wrapper(
+ to_markdown.supported,
+ )
+ self.transform = to_raw_response_wrapper(
+ to_markdown.transform,
+ )
+
+
+class AsyncToMarkdownResourceWithRawResponse:
+ def __init__(self, to_markdown: AsyncToMarkdownResource) -> None:
+ self._to_markdown = to_markdown
+
+ self.supported = async_to_raw_response_wrapper(
+ to_markdown.supported,
+ )
+ self.transform = async_to_raw_response_wrapper(
+ to_markdown.transform,
+ )
+
+
+class ToMarkdownResourceWithStreamingResponse:
+ def __init__(self, to_markdown: ToMarkdownResource) -> None:
+ self._to_markdown = to_markdown
+
+ self.supported = to_streamed_response_wrapper(
+ to_markdown.supported,
+ )
+ self.transform = to_streamed_response_wrapper(
+ to_markdown.transform,
+ )
+
+
+class AsyncToMarkdownResourceWithStreamingResponse:
+ def __init__(self, to_markdown: AsyncToMarkdownResource) -> None:
+ self._to_markdown = to_markdown
+
+ self.supported = async_to_streamed_response_wrapper(
+ to_markdown.supported,
+ )
+ self.transform = async_to_streamed_response_wrapper(
+ to_markdown.transform,
+ )
diff --git a/src/cloudflare/resources/ai_gateway/__init__.py b/src/cloudflare/resources/ai_gateway/__init__.py
index 48aa9d93225..d149a1d44cb 100644
--- a/src/cloudflare/resources/ai_gateway/__init__.py
+++ b/src/cloudflare/resources/ai_gateway/__init__.py
@@ -40,6 +40,14 @@
EvaluationsResourceWithStreamingResponse,
AsyncEvaluationsResourceWithStreamingResponse,
)
+from .dynamic_routing import (
+ DynamicRoutingResource,
+ AsyncDynamicRoutingResource,
+ DynamicRoutingResourceWithRawResponse,
+ AsyncDynamicRoutingResourceWithRawResponse,
+ DynamicRoutingResourceWithStreamingResponse,
+ AsyncDynamicRoutingResourceWithStreamingResponse,
+)
from .evaluation_types import (
EvaluationTypesResource,
AsyncEvaluationTypesResource,
@@ -48,6 +56,14 @@
EvaluationTypesResourceWithStreamingResponse,
AsyncEvaluationTypesResourceWithStreamingResponse,
)
+from .provider_configs import (
+ ProviderConfigsResource,
+ AsyncProviderConfigsResource,
+ ProviderConfigsResourceWithRawResponse,
+ AsyncProviderConfigsResourceWithRawResponse,
+ ProviderConfigsResourceWithStreamingResponse,
+ AsyncProviderConfigsResourceWithStreamingResponse,
+)
__all__ = [
"EvaluationTypesResource",
@@ -74,6 +90,18 @@
"AsyncEvaluationsResourceWithRawResponse",
"EvaluationsResourceWithStreamingResponse",
"AsyncEvaluationsResourceWithStreamingResponse",
+ "DynamicRoutingResource",
+ "AsyncDynamicRoutingResource",
+ "DynamicRoutingResourceWithRawResponse",
+ "AsyncDynamicRoutingResourceWithRawResponse",
+ "DynamicRoutingResourceWithStreamingResponse",
+ "AsyncDynamicRoutingResourceWithStreamingResponse",
+ "ProviderConfigsResource",
+ "AsyncProviderConfigsResource",
+ "ProviderConfigsResourceWithRawResponse",
+ "AsyncProviderConfigsResourceWithRawResponse",
+ "ProviderConfigsResourceWithStreamingResponse",
+ "AsyncProviderConfigsResourceWithStreamingResponse",
"URLsResource",
"AsyncURLsResource",
"URLsResourceWithRawResponse",
diff --git a/src/cloudflare/resources/ai_gateway/ai_gateway.py b/src/cloudflare/resources/ai_gateway/ai_gateway.py
index d665650c3d4..545ad9b28e6 100644
--- a/src/cloudflare/resources/ai_gateway/ai_gateway.py
+++ b/src/cloudflare/resources/ai_gateway/ai_gateway.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Type, Optional, cast
+from typing import Type, Iterable, Optional, cast
from typing_extensions import Literal
import httpx
@@ -23,7 +23,7 @@
URLsResourceWithStreamingResponse,
AsyncURLsResourceWithStreamingResponse,
)
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from .datasets import (
DatasetsResource,
@@ -52,6 +52,14 @@
)
from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from ..._base_client import AsyncPaginator, make_request_options
+from .dynamic_routing import (
+ DynamicRoutingResource,
+ AsyncDynamicRoutingResource,
+ DynamicRoutingResourceWithRawResponse,
+ AsyncDynamicRoutingResourceWithRawResponse,
+ DynamicRoutingResourceWithStreamingResponse,
+ AsyncDynamicRoutingResourceWithStreamingResponse,
+)
from .evaluation_types import (
EvaluationTypesResource,
AsyncEvaluationTypesResource,
@@ -60,6 +68,14 @@
EvaluationTypesResourceWithStreamingResponse,
AsyncEvaluationTypesResourceWithStreamingResponse,
)
+from .provider_configs import (
+ ProviderConfigsResource,
+ AsyncProviderConfigsResource,
+ ProviderConfigsResourceWithRawResponse,
+ AsyncProviderConfigsResourceWithRawResponse,
+ ProviderConfigsResourceWithStreamingResponse,
+ AsyncProviderConfigsResourceWithStreamingResponse,
+)
from ...types.ai_gateway import ai_gateway_list_params, ai_gateway_create_params, ai_gateway_update_params
from ...types.ai_gateway.ai_gateway_get_response import AIGatewayGetResponse
from ...types.ai_gateway.ai_gateway_list_response import AIGatewayListResponse
@@ -87,6 +103,14 @@ def datasets(self) -> DatasetsResource:
def evaluations(self) -> EvaluationsResource:
return EvaluationsResource(self._client)
+ @cached_property
+ def dynamic_routing(self) -> DynamicRoutingResource:
+ return DynamicRoutingResource(self._client)
+
+ @cached_property
+ def provider_configs(self) -> ProviderConfigsResource:
+ return ProviderConfigsResource(self._client)
+
@cached_property
def urls(self) -> URLsResource:
return URLsResource(self._client)
@@ -121,17 +145,19 @@ def create(
rate_limiting_interval: Optional[int],
rate_limiting_limit: Optional[int],
rate_limiting_technique: Literal["fixed", "sliding"],
- authentication: bool | NotGiven = NOT_GIVEN,
- log_management: Optional[int] | NotGiven = NOT_GIVEN,
- log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | NotGiven = NOT_GIVEN,
- logpush: bool | NotGiven = NOT_GIVEN,
- logpush_public_key: Optional[str] | NotGiven = NOT_GIVEN,
+ authentication: bool | Omit = omit,
+ is_default: bool | Omit = omit,
+ log_management: Optional[int] | Omit = omit,
+ log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | Omit = omit,
+ logpush: bool | Omit = omit,
+ logpush_public_key: Optional[str] | Omit = omit,
+ zdr: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AIGatewayCreateResponse:
"""
Create a new Gateway
@@ -161,10 +187,12 @@ def create(
"rate_limiting_limit": rate_limiting_limit,
"rate_limiting_technique": rate_limiting_technique,
"authentication": authentication,
+ "is_default": is_default,
"log_management": log_management,
"log_management_strategy": log_management_strategy,
"logpush": logpush,
"logpush_public_key": logpush_public_key,
+ "zdr": zdr,
},
ai_gateway_create_params.AIGatewayCreateParams,
),
@@ -189,17 +217,23 @@ def update(
rate_limiting_interval: Optional[int],
rate_limiting_limit: Optional[int],
rate_limiting_technique: Literal["fixed", "sliding"],
- authentication: bool | NotGiven = NOT_GIVEN,
- log_management: Optional[int] | NotGiven = NOT_GIVEN,
- log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | NotGiven = NOT_GIVEN,
- logpush: bool | NotGiven = NOT_GIVEN,
- logpush_public_key: Optional[str] | NotGiven = NOT_GIVEN,
+ authentication: bool | Omit = omit,
+ dlp: ai_gateway_update_params.DLP | Omit = omit,
+ is_default: bool | Omit = omit,
+ log_management: Optional[int] | Omit = omit,
+ log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | Omit = omit,
+ logpush: bool | Omit = omit,
+ logpush_public_key: Optional[str] | Omit = omit,
+ otel: Optional[Iterable[ai_gateway_update_params.Otel]] | Omit = omit,
+ store_id: Optional[str] | Omit = omit,
+ stripe: Optional[ai_gateway_update_params.Stripe] | Omit = omit,
+ zdr: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AIGatewayUpdateResponse:
"""
Update a Gateway
@@ -230,10 +264,16 @@ def update(
"rate_limiting_limit": rate_limiting_limit,
"rate_limiting_technique": rate_limiting_technique,
"authentication": authentication,
+ "dlp": dlp,
+ "is_default": is_default,
"log_management": log_management,
"log_management_strategy": log_management_strategy,
"logpush": logpush,
"logpush_public_key": logpush_public_key,
+ "otel": otel,
+ "store_id": store_id,
+ "stripe": stripe,
+ "zdr": zdr,
},
ai_gateway_update_params.AIGatewayUpdateParams,
),
@@ -251,15 +291,15 @@ def list(
self,
*,
account_id: str,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[AIGatewayListResponse]:
"""
List Gateways
@@ -307,7 +347,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AIGatewayDeleteResponse:
"""
Delete a Gateway
@@ -349,7 +389,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AIGatewayGetResponse:
"""
Fetch a Gateway
@@ -399,6 +439,14 @@ def datasets(self) -> AsyncDatasetsResource:
def evaluations(self) -> AsyncEvaluationsResource:
return AsyncEvaluationsResource(self._client)
+ @cached_property
+ def dynamic_routing(self) -> AsyncDynamicRoutingResource:
+ return AsyncDynamicRoutingResource(self._client)
+
+ @cached_property
+ def provider_configs(self) -> AsyncProviderConfigsResource:
+ return AsyncProviderConfigsResource(self._client)
+
@cached_property
def urls(self) -> AsyncURLsResource:
return AsyncURLsResource(self._client)
@@ -433,17 +481,19 @@ async def create(
rate_limiting_interval: Optional[int],
rate_limiting_limit: Optional[int],
rate_limiting_technique: Literal["fixed", "sliding"],
- authentication: bool | NotGiven = NOT_GIVEN,
- log_management: Optional[int] | NotGiven = NOT_GIVEN,
- log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | NotGiven = NOT_GIVEN,
- logpush: bool | NotGiven = NOT_GIVEN,
- logpush_public_key: Optional[str] | NotGiven = NOT_GIVEN,
+ authentication: bool | Omit = omit,
+ is_default: bool | Omit = omit,
+ log_management: Optional[int] | Omit = omit,
+ log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | Omit = omit,
+ logpush: bool | Omit = omit,
+ logpush_public_key: Optional[str] | Omit = omit,
+ zdr: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AIGatewayCreateResponse:
"""
Create a new Gateway
@@ -473,10 +523,12 @@ async def create(
"rate_limiting_limit": rate_limiting_limit,
"rate_limiting_technique": rate_limiting_technique,
"authentication": authentication,
+ "is_default": is_default,
"log_management": log_management,
"log_management_strategy": log_management_strategy,
"logpush": logpush,
"logpush_public_key": logpush_public_key,
+ "zdr": zdr,
},
ai_gateway_create_params.AIGatewayCreateParams,
),
@@ -501,17 +553,23 @@ async def update(
rate_limiting_interval: Optional[int],
rate_limiting_limit: Optional[int],
rate_limiting_technique: Literal["fixed", "sliding"],
- authentication: bool | NotGiven = NOT_GIVEN,
- log_management: Optional[int] | NotGiven = NOT_GIVEN,
- log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | NotGiven = NOT_GIVEN,
- logpush: bool | NotGiven = NOT_GIVEN,
- logpush_public_key: Optional[str] | NotGiven = NOT_GIVEN,
+ authentication: bool | Omit = omit,
+ dlp: ai_gateway_update_params.DLP | Omit = omit,
+ is_default: bool | Omit = omit,
+ log_management: Optional[int] | Omit = omit,
+ log_management_strategy: Optional[Literal["STOP_INSERTING", "DELETE_OLDEST"]] | Omit = omit,
+ logpush: bool | Omit = omit,
+ logpush_public_key: Optional[str] | Omit = omit,
+ otel: Optional[Iterable[ai_gateway_update_params.Otel]] | Omit = omit,
+ store_id: Optional[str] | Omit = omit,
+ stripe: Optional[ai_gateway_update_params.Stripe] | Omit = omit,
+ zdr: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AIGatewayUpdateResponse:
"""
Update a Gateway
@@ -542,10 +600,16 @@ async def update(
"rate_limiting_limit": rate_limiting_limit,
"rate_limiting_technique": rate_limiting_technique,
"authentication": authentication,
+ "dlp": dlp,
+ "is_default": is_default,
"log_management": log_management,
"log_management_strategy": log_management_strategy,
"logpush": logpush,
"logpush_public_key": logpush_public_key,
+ "otel": otel,
+ "store_id": store_id,
+ "stripe": stripe,
+ "zdr": zdr,
},
ai_gateway_update_params.AIGatewayUpdateParams,
),
@@ -563,15 +627,15 @@ def list(
self,
*,
account_id: str,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[AIGatewayListResponse, AsyncV4PagePaginationArray[AIGatewayListResponse]]:
"""
List Gateways
@@ -619,7 +683,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AIGatewayDeleteResponse:
"""
Delete a Gateway
@@ -661,7 +725,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AIGatewayGetResponse:
"""
Fetch a Gateway
@@ -730,6 +794,14 @@ def datasets(self) -> DatasetsResourceWithRawResponse:
def evaluations(self) -> EvaluationsResourceWithRawResponse:
return EvaluationsResourceWithRawResponse(self._ai_gateway.evaluations)
+ @cached_property
+ def dynamic_routing(self) -> DynamicRoutingResourceWithRawResponse:
+ return DynamicRoutingResourceWithRawResponse(self._ai_gateway.dynamic_routing)
+
+ @cached_property
+ def provider_configs(self) -> ProviderConfigsResourceWithRawResponse:
+ return ProviderConfigsResourceWithRawResponse(self._ai_gateway.provider_configs)
+
@cached_property
def urls(self) -> URLsResourceWithRawResponse:
return URLsResourceWithRawResponse(self._ai_gateway.urls)
@@ -771,6 +843,14 @@ def datasets(self) -> AsyncDatasetsResourceWithRawResponse:
def evaluations(self) -> AsyncEvaluationsResourceWithRawResponse:
return AsyncEvaluationsResourceWithRawResponse(self._ai_gateway.evaluations)
+ @cached_property
+ def dynamic_routing(self) -> AsyncDynamicRoutingResourceWithRawResponse:
+ return AsyncDynamicRoutingResourceWithRawResponse(self._ai_gateway.dynamic_routing)
+
+ @cached_property
+ def provider_configs(self) -> AsyncProviderConfigsResourceWithRawResponse:
+ return AsyncProviderConfigsResourceWithRawResponse(self._ai_gateway.provider_configs)
+
@cached_property
def urls(self) -> AsyncURLsResourceWithRawResponse:
return AsyncURLsResourceWithRawResponse(self._ai_gateway.urls)
@@ -812,6 +892,14 @@ def datasets(self) -> DatasetsResourceWithStreamingResponse:
def evaluations(self) -> EvaluationsResourceWithStreamingResponse:
return EvaluationsResourceWithStreamingResponse(self._ai_gateway.evaluations)
+ @cached_property
+ def dynamic_routing(self) -> DynamicRoutingResourceWithStreamingResponse:
+ return DynamicRoutingResourceWithStreamingResponse(self._ai_gateway.dynamic_routing)
+
+ @cached_property
+ def provider_configs(self) -> ProviderConfigsResourceWithStreamingResponse:
+ return ProviderConfigsResourceWithStreamingResponse(self._ai_gateway.provider_configs)
+
@cached_property
def urls(self) -> URLsResourceWithStreamingResponse:
return URLsResourceWithStreamingResponse(self._ai_gateway.urls)
@@ -853,6 +941,14 @@ def datasets(self) -> AsyncDatasetsResourceWithStreamingResponse:
def evaluations(self) -> AsyncEvaluationsResourceWithStreamingResponse:
return AsyncEvaluationsResourceWithStreamingResponse(self._ai_gateway.evaluations)
+ @cached_property
+ def dynamic_routing(self) -> AsyncDynamicRoutingResourceWithStreamingResponse:
+ return AsyncDynamicRoutingResourceWithStreamingResponse(self._ai_gateway.dynamic_routing)
+
+ @cached_property
+ def provider_configs(self) -> AsyncProviderConfigsResourceWithStreamingResponse:
+ return AsyncProviderConfigsResourceWithStreamingResponse(self._ai_gateway.provider_configs)
+
@cached_property
def urls(self) -> AsyncURLsResourceWithStreamingResponse:
return AsyncURLsResourceWithStreamingResponse(self._ai_gateway.urls)
diff --git a/src/cloudflare/resources/ai_gateway/datasets.py b/src/cloudflare/resources/ai_gateway/datasets.py
index 1f7a6f69882..bb256a33205 100644
--- a/src/cloudflare/resources/ai_gateway/datasets.py
+++ b/src/cloudflare/resources/ai_gateway/datasets.py
@@ -6,7 +6,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -62,7 +62,7 @@ def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DatasetCreateResponse:
"""
Create a new Dataset
@@ -116,7 +116,7 @@ def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DatasetUpdateResponse:
"""
Update a Dataset
@@ -163,17 +163,17 @@ def list(
gateway_id: str,
*,
account_id: str,
- enable: bool | NotGiven = NOT_GIVEN,
- name: str | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
+ enable: bool | Omit = omit,
+ name: str | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[DatasetListResponse]:
"""
List Datasets
@@ -228,7 +228,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DatasetDeleteResponse:
"""
Delete a Dataset
@@ -273,7 +273,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DatasetGetResponse:
"""
Fetch a Dataset
@@ -341,7 +341,7 @@ async def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DatasetCreateResponse:
"""
Create a new Dataset
@@ -395,7 +395,7 @@ async def update(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DatasetUpdateResponse:
"""
Update a Dataset
@@ -442,17 +442,17 @@ def list(
gateway_id: str,
*,
account_id: str,
- enable: bool | NotGiven = NOT_GIVEN,
- name: str | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
+ enable: bool | Omit = omit,
+ name: str | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[DatasetListResponse, AsyncV4PagePaginationArray[DatasetListResponse]]:
"""
List Datasets
@@ -507,7 +507,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DatasetDeleteResponse:
"""
Delete a Dataset
@@ -552,7 +552,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DatasetGetResponse:
"""
Fetch a Dataset
diff --git a/src/cloudflare/resources/ai_gateway/dynamic_routing.py b/src/cloudflare/resources/ai_gateway/dynamic_routing.py
new file mode 100644
index 00000000000..719f7e12ff7
--- /dev/null
+++ b/src/cloudflare/resources/ai_gateway/dynamic_routing.py
@@ -0,0 +1,1108 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, Iterable, cast
+
+import httpx
+
+from ..._types import Body, Query, Headers, NotGiven, not_given
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._wrappers import ResultWrapper
+from ..._base_client import make_request_options
+from ...types.ai_gateway import (
+ dynamic_routing_create_params,
+ dynamic_routing_update_params,
+ dynamic_routing_create_version_params,
+ dynamic_routing_create_deployment_params,
+)
+from ...types.ai_gateway.dynamic_routing_get_response import DynamicRoutingGetResponse
+from ...types.ai_gateway.dynamic_routing_list_response import DynamicRoutingListResponse
+from ...types.ai_gateway.dynamic_routing_create_response import DynamicRoutingCreateResponse
+from ...types.ai_gateway.dynamic_routing_delete_response import DynamicRoutingDeleteResponse
+from ...types.ai_gateway.dynamic_routing_update_response import DynamicRoutingUpdateResponse
+from ...types.ai_gateway.dynamic_routing_get_version_response import DynamicRoutingGetVersionResponse
+from ...types.ai_gateway.dynamic_routing_list_versions_response import DynamicRoutingListVersionsResponse
+from ...types.ai_gateway.dynamic_routing_create_version_response import DynamicRoutingCreateVersionResponse
+from ...types.ai_gateway.dynamic_routing_list_deployments_response import DynamicRoutingListDeploymentsResponse
+from ...types.ai_gateway.dynamic_routing_create_deployment_response import DynamicRoutingCreateDeploymentResponse
+
+__all__ = ["DynamicRoutingResource", "AsyncDynamicRoutingResource"]
+
+
+class DynamicRoutingResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> DynamicRoutingResourceWithRawResponse:
+ """
+ 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 DynamicRoutingResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> DynamicRoutingResourceWithStreamingResponse:
+ """
+ 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 DynamicRoutingResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ gateway_id: str,
+ *,
+ account_id: str,
+ elements: Iterable[dynamic_routing_create_params.Element],
+ name: 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,
+ ) -> DynamicRoutingCreateResponse:
+ """
+ Create a new AI Gateway Dynamic Route.
+
+ Args:
+ 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}")
+ return self._post(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes",
+ body=maybe_transform(
+ {
+ "elements": elements,
+ "name": name,
+ },
+ dynamic_routing_create_params.DynamicRoutingCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingCreateResponse], ResultWrapper[DynamicRoutingCreateResponse]),
+ )
+
+ def update(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ gateway_id: str,
+ name: 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,
+ ) -> DynamicRoutingUpdateResponse:
+ """
+ Update an AI Gateway Dynamic Route.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._patch(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}",
+ body=maybe_transform({"name": name}, dynamic_routing_update_params.DynamicRoutingUpdateParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DynamicRoutingUpdateResponse,
+ )
+
+ def list(
+ self,
+ gateway_id: str,
+ *,
+ 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,
+ ) -> DynamicRoutingListResponse:
+ """
+ List all AI Gateway Dynamic Routes.
+
+ Args:
+ 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}")
+ return self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DynamicRoutingListResponse,
+ )
+
+ def delete(
+ self,
+ id: 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,
+ ) -> DynamicRoutingDeleteResponse:
+ """
+ Delete an AI Gateway Dynamic Route.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._delete(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingDeleteResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingDeleteResponse], ResultWrapper[DynamicRoutingDeleteResponse]),
+ )
+
+ def create_deployment(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ gateway_id: str,
+ comment: str,
+ version_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,
+ ) -> DynamicRoutingCreateDeploymentResponse:
+ """
+ Create a new AI Gateway Dynamic Route Deployment.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._post(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments",
+ body=maybe_transform(
+ {
+ "comment": comment,
+ "version_id": version_id,
+ },
+ dynamic_routing_create_deployment_params.DynamicRoutingCreateDeploymentParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingCreateDeploymentResponse]._unwrapper,
+ ),
+ cast_to=cast(
+ Type[DynamicRoutingCreateDeploymentResponse], ResultWrapper[DynamicRoutingCreateDeploymentResponse]
+ ),
+ )
+
+ def create_version(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ gateway_id: str,
+ comment: str,
+ elements: Iterable[dynamic_routing_create_version_params.Element],
+ # 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,
+ ) -> DynamicRoutingCreateVersionResponse:
+ """
+ Create a new AI Gateway Dynamic Route Version.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._post(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions",
+ body=maybe_transform(
+ {
+ "comment": comment,
+ "elements": elements,
+ },
+ dynamic_routing_create_version_params.DynamicRoutingCreateVersionParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingCreateVersionResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingCreateVersionResponse], ResultWrapper[DynamicRoutingCreateVersionResponse]),
+ )
+
+ def get(
+ self,
+ id: 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,
+ ) -> DynamicRoutingGetResponse:
+ """
+ Get an AI Gateway Dynamic Route.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingGetResponse], ResultWrapper[DynamicRoutingGetResponse]),
+ )
+
+ def get_version(
+ self,
+ version_id: str,
+ *,
+ account_id: str,
+ gateway_id: str,
+ 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,
+ ) -> DynamicRoutingGetVersionResponse:
+ """
+ Get an AI Gateway Dynamic Route Version.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ if not version_id:
+ raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions/{version_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingGetVersionResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingGetVersionResponse], ResultWrapper[DynamicRoutingGetVersionResponse]),
+ )
+
+ def list_deployments(
+ self,
+ id: 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,
+ ) -> DynamicRoutingListDeploymentsResponse:
+ """
+ List all AI Gateway Dynamic Route Deployments.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DynamicRoutingListDeploymentsResponse,
+ )
+
+ def list_versions(
+ self,
+ id: 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,
+ ) -> DynamicRoutingListVersionsResponse:
+ """
+ List all AI Gateway Dynamic Route Versions.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DynamicRoutingListVersionsResponse,
+ )
+
+
+class AsyncDynamicRoutingResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncDynamicRoutingResourceWithRawResponse:
+ """
+ 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 AsyncDynamicRoutingResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncDynamicRoutingResourceWithStreamingResponse:
+ """
+ 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 AsyncDynamicRoutingResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ gateway_id: str,
+ *,
+ account_id: str,
+ elements: Iterable[dynamic_routing_create_params.Element],
+ name: 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,
+ ) -> DynamicRoutingCreateResponse:
+ """
+ Create a new AI Gateway Dynamic Route.
+
+ Args:
+ 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}")
+ return await self._post(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes",
+ body=await async_maybe_transform(
+ {
+ "elements": elements,
+ "name": name,
+ },
+ dynamic_routing_create_params.DynamicRoutingCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingCreateResponse], ResultWrapper[DynamicRoutingCreateResponse]),
+ )
+
+ async def update(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ gateway_id: str,
+ name: 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,
+ ) -> DynamicRoutingUpdateResponse:
+ """
+ Update an AI Gateway Dynamic Route.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._patch(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}",
+ body=await async_maybe_transform({"name": name}, dynamic_routing_update_params.DynamicRoutingUpdateParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DynamicRoutingUpdateResponse,
+ )
+
+ async def list(
+ self,
+ gateway_id: str,
+ *,
+ 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,
+ ) -> DynamicRoutingListResponse:
+ """
+ List all AI Gateway Dynamic Routes.
+
+ Args:
+ 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}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DynamicRoutingListResponse,
+ )
+
+ async def delete(
+ self,
+ id: 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,
+ ) -> DynamicRoutingDeleteResponse:
+ """
+ Delete an AI Gateway Dynamic Route.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._delete(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingDeleteResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingDeleteResponse], ResultWrapper[DynamicRoutingDeleteResponse]),
+ )
+
+ async def create_deployment(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ gateway_id: str,
+ comment: str,
+ version_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,
+ ) -> DynamicRoutingCreateDeploymentResponse:
+ """
+ Create a new AI Gateway Dynamic Route Deployment.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments",
+ body=await async_maybe_transform(
+ {
+ "comment": comment,
+ "version_id": version_id,
+ },
+ dynamic_routing_create_deployment_params.DynamicRoutingCreateDeploymentParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingCreateDeploymentResponse]._unwrapper,
+ ),
+ cast_to=cast(
+ Type[DynamicRoutingCreateDeploymentResponse], ResultWrapper[DynamicRoutingCreateDeploymentResponse]
+ ),
+ )
+
+ async def create_version(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ gateway_id: str,
+ comment: str,
+ elements: Iterable[dynamic_routing_create_version_params.Element],
+ # 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,
+ ) -> DynamicRoutingCreateVersionResponse:
+ """
+ Create a new AI Gateway Dynamic Route Version.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions",
+ body=await async_maybe_transform(
+ {
+ "comment": comment,
+ "elements": elements,
+ },
+ dynamic_routing_create_version_params.DynamicRoutingCreateVersionParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingCreateVersionResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingCreateVersionResponse], ResultWrapper[DynamicRoutingCreateVersionResponse]),
+ )
+
+ async def get(
+ self,
+ id: 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,
+ ) -> DynamicRoutingGetResponse:
+ """
+ Get an AI Gateway Dynamic Route.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingGetResponse], ResultWrapper[DynamicRoutingGetResponse]),
+ )
+
+ async def get_version(
+ self,
+ version_id: str,
+ *,
+ account_id: str,
+ gateway_id: str,
+ 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,
+ ) -> DynamicRoutingGetVersionResponse:
+ """
+ Get an AI Gateway Dynamic Route Version.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ if not version_id:
+ raise ValueError(f"Expected a non-empty value for `version_id` but received {version_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions/{version_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[DynamicRoutingGetVersionResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[DynamicRoutingGetVersionResponse], ResultWrapper[DynamicRoutingGetVersionResponse]),
+ )
+
+ async def list_deployments(
+ self,
+ id: 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,
+ ) -> DynamicRoutingListDeploymentsResponse:
+ """
+ List all AI Gateway Dynamic Route Deployments.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/deployments",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DynamicRoutingListDeploymentsResponse,
+ )
+
+ async def list_versions(
+ self,
+ id: 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,
+ ) -> DynamicRoutingListVersionsResponse:
+ """
+ List all AI Gateway Dynamic Route Versions.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/routes/{id}/versions",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=DynamicRoutingListVersionsResponse,
+ )
+
+
+class DynamicRoutingResourceWithRawResponse:
+ def __init__(self, dynamic_routing: DynamicRoutingResource) -> None:
+ self._dynamic_routing = dynamic_routing
+
+ self.create = to_raw_response_wrapper(
+ dynamic_routing.create,
+ )
+ self.update = to_raw_response_wrapper(
+ dynamic_routing.update,
+ )
+ self.list = to_raw_response_wrapper(
+ dynamic_routing.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ dynamic_routing.delete,
+ )
+ self.create_deployment = to_raw_response_wrapper(
+ dynamic_routing.create_deployment,
+ )
+ self.create_version = to_raw_response_wrapper(
+ dynamic_routing.create_version,
+ )
+ self.get = to_raw_response_wrapper(
+ dynamic_routing.get,
+ )
+ self.get_version = to_raw_response_wrapper(
+ dynamic_routing.get_version,
+ )
+ self.list_deployments = to_raw_response_wrapper(
+ dynamic_routing.list_deployments,
+ )
+ self.list_versions = to_raw_response_wrapper(
+ dynamic_routing.list_versions,
+ )
+
+
+class AsyncDynamicRoutingResourceWithRawResponse:
+ def __init__(self, dynamic_routing: AsyncDynamicRoutingResource) -> None:
+ self._dynamic_routing = dynamic_routing
+
+ self.create = async_to_raw_response_wrapper(
+ dynamic_routing.create,
+ )
+ self.update = async_to_raw_response_wrapper(
+ dynamic_routing.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ dynamic_routing.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ dynamic_routing.delete,
+ )
+ self.create_deployment = async_to_raw_response_wrapper(
+ dynamic_routing.create_deployment,
+ )
+ self.create_version = async_to_raw_response_wrapper(
+ dynamic_routing.create_version,
+ )
+ self.get = async_to_raw_response_wrapper(
+ dynamic_routing.get,
+ )
+ self.get_version = async_to_raw_response_wrapper(
+ dynamic_routing.get_version,
+ )
+ self.list_deployments = async_to_raw_response_wrapper(
+ dynamic_routing.list_deployments,
+ )
+ self.list_versions = async_to_raw_response_wrapper(
+ dynamic_routing.list_versions,
+ )
+
+
+class DynamicRoutingResourceWithStreamingResponse:
+ def __init__(self, dynamic_routing: DynamicRoutingResource) -> None:
+ self._dynamic_routing = dynamic_routing
+
+ self.create = to_streamed_response_wrapper(
+ dynamic_routing.create,
+ )
+ self.update = to_streamed_response_wrapper(
+ dynamic_routing.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ dynamic_routing.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ dynamic_routing.delete,
+ )
+ self.create_deployment = to_streamed_response_wrapper(
+ dynamic_routing.create_deployment,
+ )
+ self.create_version = to_streamed_response_wrapper(
+ dynamic_routing.create_version,
+ )
+ self.get = to_streamed_response_wrapper(
+ dynamic_routing.get,
+ )
+ self.get_version = to_streamed_response_wrapper(
+ dynamic_routing.get_version,
+ )
+ self.list_deployments = to_streamed_response_wrapper(
+ dynamic_routing.list_deployments,
+ )
+ self.list_versions = to_streamed_response_wrapper(
+ dynamic_routing.list_versions,
+ )
+
+
+class AsyncDynamicRoutingResourceWithStreamingResponse:
+ def __init__(self, dynamic_routing: AsyncDynamicRoutingResource) -> None:
+ self._dynamic_routing = dynamic_routing
+
+ self.create = async_to_streamed_response_wrapper(
+ dynamic_routing.create,
+ )
+ self.update = async_to_streamed_response_wrapper(
+ dynamic_routing.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ dynamic_routing.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ dynamic_routing.delete,
+ )
+ self.create_deployment = async_to_streamed_response_wrapper(
+ dynamic_routing.create_deployment,
+ )
+ self.create_version = async_to_streamed_response_wrapper(
+ dynamic_routing.create_version,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ dynamic_routing.get,
+ )
+ self.get_version = async_to_streamed_response_wrapper(
+ dynamic_routing.get_version,
+ )
+ self.list_deployments = async_to_streamed_response_wrapper(
+ dynamic_routing.list_deployments,
+ )
+ self.list_versions = async_to_streamed_response_wrapper(
+ dynamic_routing.list_versions,
+ )
diff --git a/src/cloudflare/resources/ai_gateway/evaluation_types.py b/src/cloudflare/resources/ai_gateway/evaluation_types.py
index 047c5936dec..ed06314835d 100644
--- a/src/cloudflare/resources/ai_gateway/evaluation_types.py
+++ b/src/cloudflare/resources/ai_gateway/evaluation_types.py
@@ -6,7 +6,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -48,16 +48,16 @@ def list(
self,
*,
account_id: str,
- order_by: str | NotGiven = NOT_GIVEN,
- order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
+ order_by: str | Omit = omit,
+ order_by_direction: Literal["asc", "desc"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[EvaluationTypeListResponse]:
"""
List Evaluators
@@ -119,16 +119,16 @@ def list(
self,
*,
account_id: str,
- order_by: str | NotGiven = NOT_GIVEN,
- order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
+ order_by: str | Omit = omit,
+ order_by_direction: Literal["asc", "desc"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[EvaluationTypeListResponse, AsyncV4PagePaginationArray[EvaluationTypeListResponse]]:
"""
List Evaluators
diff --git a/src/cloudflare/resources/ai_gateway/evaluations.py b/src/cloudflare/resources/ai_gateway/evaluations.py
index b57f840d9b3..e3d9fd87309 100644
--- a/src/cloudflare/resources/ai_gateway/evaluations.py
+++ b/src/cloudflare/resources/ai_gateway/evaluations.py
@@ -2,11 +2,11 @@
from __future__ import annotations
-from typing import List, Type, cast
+from typing import Type, cast
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -53,15 +53,15 @@ def create(
gateway_id: str,
*,
account_id: str,
- dataset_ids: List[str],
- evaluation_type_ids: List[str],
+ dataset_ids: SequenceNotStr[str],
+ evaluation_type_ids: SequenceNotStr[str],
name: 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> EvaluationCreateResponse:
"""
Create a new Evaluation
@@ -106,17 +106,17 @@ def list(
gateway_id: str,
*,
account_id: str,
- name: str | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- processed: bool | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
+ name: str | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ processed: bool | Omit = omit,
+ search: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[EvaluationListResponse]:
"""
List Evaluations
@@ -171,7 +171,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> EvaluationDeleteResponse:
"""
Delete a Evaluation
@@ -216,7 +216,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> EvaluationGetResponse:
"""
Fetch a Evaluation
@@ -276,15 +276,15 @@ async def create(
gateway_id: str,
*,
account_id: str,
- dataset_ids: List[str],
- evaluation_type_ids: List[str],
+ dataset_ids: SequenceNotStr[str],
+ evaluation_type_ids: SequenceNotStr[str],
name: 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> EvaluationCreateResponse:
"""
Create a new Evaluation
@@ -329,17 +329,17 @@ def list(
gateway_id: str,
*,
account_id: str,
- name: str | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- processed: bool | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
+ name: str | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ processed: bool | Omit = omit,
+ search: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[EvaluationListResponse, AsyncV4PagePaginationArray[EvaluationListResponse]]:
"""
List Evaluations
@@ -394,7 +394,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> EvaluationDeleteResponse:
"""
Delete a Evaluation
@@ -439,7 +439,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> EvaluationGetResponse:
"""
Fetch a Evaluation
diff --git a/src/cloudflare/resources/ai_gateway/logs.py b/src/cloudflare/resources/ai_gateway/logs.py
index d2336f16603..8518d36781c 100644
--- a/src/cloudflare/resources/ai_gateway/logs.py
+++ b/src/cloudflare/resources/ai_gateway/logs.py
@@ -8,7 +8,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -54,40 +54,40 @@ def list(
gateway_id: str,
*,
account_id: str,
- cached: bool | NotGiven = NOT_GIVEN,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- end_date: Union[str, datetime] | NotGiven = NOT_GIVEN,
- feedback: Literal[0, 1] | NotGiven = NOT_GIVEN,
- filters: Iterable[log_list_params.Filter] | NotGiven = NOT_GIVEN,
- max_cost: float | NotGiven = NOT_GIVEN,
- max_duration: float | NotGiven = NOT_GIVEN,
- max_tokens_in: float | NotGiven = NOT_GIVEN,
- max_tokens_out: float | NotGiven = NOT_GIVEN,
- max_total_tokens: float | NotGiven = NOT_GIVEN,
- meta_info: bool | NotGiven = NOT_GIVEN,
- min_cost: float | NotGiven = NOT_GIVEN,
- min_duration: float | NotGiven = NOT_GIVEN,
- min_tokens_in: float | NotGiven = NOT_GIVEN,
- min_tokens_out: float | NotGiven = NOT_GIVEN,
- min_total_tokens: float | NotGiven = NOT_GIVEN,
- model: str | NotGiven = NOT_GIVEN,
- model_type: str | NotGiven = NOT_GIVEN,
- order_by: Literal["created_at", "provider", "model", "model_type", "success", "cached"] | NotGiven = NOT_GIVEN,
- order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- provider: str | NotGiven = NOT_GIVEN,
- request_content_type: str | NotGiven = NOT_GIVEN,
- response_content_type: str | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
- start_date: Union[str, datetime] | NotGiven = NOT_GIVEN,
- success: bool | NotGiven = NOT_GIVEN,
+ cached: bool | Omit = omit,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ end_date: Union[str, datetime] | Omit = omit,
+ feedback: Literal[0, 1] | Omit = omit,
+ filters: Iterable[log_list_params.Filter] | Omit = omit,
+ max_cost: float | Omit = omit,
+ max_duration: float | Omit = omit,
+ max_tokens_in: float | Omit = omit,
+ max_tokens_out: float | Omit = omit,
+ max_total_tokens: float | Omit = omit,
+ meta_info: bool | Omit = omit,
+ min_cost: float | Omit = omit,
+ min_duration: float | Omit = omit,
+ min_tokens_in: float | Omit = omit,
+ min_tokens_out: float | Omit = omit,
+ min_total_tokens: float | Omit = omit,
+ model: str | Omit = omit,
+ model_type: str | Omit = omit,
+ order_by: Literal["created_at", "provider", "model", "model_type", "success", "cached"] | Omit = omit,
+ order_by_direction: Literal["asc", "desc"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ provider: str | Omit = omit,
+ request_content_type: str | Omit = omit,
+ response_content_type: str | Omit = omit,
+ search: str | Omit = omit,
+ start_date: Union[str, datetime] | Omit = omit,
+ success: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[LogListResponse]:
"""
List Gateway Logs
@@ -157,8 +157,8 @@ def delete(
gateway_id: str,
*,
account_id: str,
- filters: Iterable[log_delete_params.Filter] | NotGiven = NOT_GIVEN,
- limit: int | NotGiven = NOT_GIVEN,
+ filters: Iterable[log_delete_params.Filter] | Omit = omit,
+ limit: int | Omit = omit,
order_by: Literal[
"created_at",
"provider",
@@ -172,14 +172,14 @@ def delete(
"duration",
"feedback",
]
- | NotGiven = NOT_GIVEN,
- order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
+ | Omit = omit,
+ order_by_direction: Literal["asc", "desc"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> LogDeleteResponse:
"""
Delete Gateway Logs
@@ -225,15 +225,15 @@ def edit(
*,
account_id: str,
gateway_id: str,
- feedback: Optional[float] | NotGiven = NOT_GIVEN,
- metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
- score: Optional[float] | NotGiven = NOT_GIVEN,
+ feedback: Optional[float] | Omit = omit,
+ metadata: Optional[Dict[str, Union[str, float, bool]]] | Omit = omit,
+ score: Optional[float] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> object:
"""
Patch Gateway Log
@@ -286,7 +286,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> LogGetResponse:
"""
Get Gateway Log Detail
@@ -331,7 +331,7 @@ def request(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> object:
"""
Get Gateway Log Request
@@ -372,7 +372,7 @@ def response(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> object:
"""
Get Gateway Log Response
@@ -428,40 +428,40 @@ def list(
gateway_id: str,
*,
account_id: str,
- cached: bool | NotGiven = NOT_GIVEN,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- end_date: Union[str, datetime] | NotGiven = NOT_GIVEN,
- feedback: Literal[0, 1] | NotGiven = NOT_GIVEN,
- filters: Iterable[log_list_params.Filter] | NotGiven = NOT_GIVEN,
- max_cost: float | NotGiven = NOT_GIVEN,
- max_duration: float | NotGiven = NOT_GIVEN,
- max_tokens_in: float | NotGiven = NOT_GIVEN,
- max_tokens_out: float | NotGiven = NOT_GIVEN,
- max_total_tokens: float | NotGiven = NOT_GIVEN,
- meta_info: bool | NotGiven = NOT_GIVEN,
- min_cost: float | NotGiven = NOT_GIVEN,
- min_duration: float | NotGiven = NOT_GIVEN,
- min_tokens_in: float | NotGiven = NOT_GIVEN,
- min_tokens_out: float | NotGiven = NOT_GIVEN,
- min_total_tokens: float | NotGiven = NOT_GIVEN,
- model: str | NotGiven = NOT_GIVEN,
- model_type: str | NotGiven = NOT_GIVEN,
- order_by: Literal["created_at", "provider", "model", "model_type", "success", "cached"] | NotGiven = NOT_GIVEN,
- order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- provider: str | NotGiven = NOT_GIVEN,
- request_content_type: str | NotGiven = NOT_GIVEN,
- response_content_type: str | NotGiven = NOT_GIVEN,
- search: str | NotGiven = NOT_GIVEN,
- start_date: Union[str, datetime] | NotGiven = NOT_GIVEN,
- success: bool | NotGiven = NOT_GIVEN,
+ cached: bool | Omit = omit,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ end_date: Union[str, datetime] | Omit = omit,
+ feedback: Literal[0, 1] | Omit = omit,
+ filters: Iterable[log_list_params.Filter] | Omit = omit,
+ max_cost: float | Omit = omit,
+ max_duration: float | Omit = omit,
+ max_tokens_in: float | Omit = omit,
+ max_tokens_out: float | Omit = omit,
+ max_total_tokens: float | Omit = omit,
+ meta_info: bool | Omit = omit,
+ min_cost: float | Omit = omit,
+ min_duration: float | Omit = omit,
+ min_tokens_in: float | Omit = omit,
+ min_tokens_out: float | Omit = omit,
+ min_total_tokens: float | Omit = omit,
+ model: str | Omit = omit,
+ model_type: str | Omit = omit,
+ order_by: Literal["created_at", "provider", "model", "model_type", "success", "cached"] | Omit = omit,
+ order_by_direction: Literal["asc", "desc"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ provider: str | Omit = omit,
+ request_content_type: str | Omit = omit,
+ response_content_type: str | Omit = omit,
+ search: str | Omit = omit,
+ start_date: Union[str, datetime] | Omit = omit,
+ success: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[LogListResponse, AsyncV4PagePaginationArray[LogListResponse]]:
"""
List Gateway Logs
@@ -531,8 +531,8 @@ async def delete(
gateway_id: str,
*,
account_id: str,
- filters: Iterable[log_delete_params.Filter] | NotGiven = NOT_GIVEN,
- limit: int | NotGiven = NOT_GIVEN,
+ filters: Iterable[log_delete_params.Filter] | Omit = omit,
+ limit: int | Omit = omit,
order_by: Literal[
"created_at",
"provider",
@@ -546,14 +546,14 @@ async def delete(
"duration",
"feedback",
]
- | NotGiven = NOT_GIVEN,
- order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
+ | Omit = omit,
+ order_by_direction: Literal["asc", "desc"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> LogDeleteResponse:
"""
Delete Gateway Logs
@@ -599,15 +599,15 @@ async def edit(
*,
account_id: str,
gateway_id: str,
- feedback: Optional[float] | NotGiven = NOT_GIVEN,
- metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
- score: Optional[float] | NotGiven = NOT_GIVEN,
+ feedback: Optional[float] | Omit = omit,
+ metadata: Optional[Dict[str, Union[str, float, bool]]] | Omit = omit,
+ score: Optional[float] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> object:
"""
Patch Gateway Log
@@ -660,7 +660,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> LogGetResponse:
"""
Get Gateway Log Detail
@@ -705,7 +705,7 @@ async def request(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> object:
"""
Get Gateway Log Request
@@ -746,7 +746,7 @@ async def response(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> object:
"""
Get Gateway Log Response
diff --git a/src/cloudflare/resources/ai_gateway/provider_configs.py b/src/cloudflare/resources/ai_gateway/provider_configs.py
new file mode 100644
index 00000000000..60c7fc5f891
--- /dev/null
+++ b/src/cloudflare/resources/ai_gateway/provider_configs.py
@@ -0,0 +1,340 @@
+# 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 Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._wrappers import ResultWrapper
+from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.ai_gateway import provider_config_list_params, provider_config_create_params
+from ...types.ai_gateway.provider_config_list_response import ProviderConfigListResponse
+from ...types.ai_gateway.provider_config_create_response import ProviderConfigCreateResponse
+
+__all__ = ["ProviderConfigsResource", "AsyncProviderConfigsResource"]
+
+
+class ProviderConfigsResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> ProviderConfigsResourceWithRawResponse:
+ """
+ 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 ProviderConfigsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> ProviderConfigsResourceWithStreamingResponse:
+ """
+ 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 ProviderConfigsResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ gateway_id: str,
+ *,
+ account_id: str,
+ alias: str,
+ default_config: bool,
+ provider_slug: str,
+ secret: str,
+ secret_id: str,
+ rate_limit: float | Omit = omit,
+ rate_limit_period: float | Omit = omit,
+ # 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,
+ ) -> ProviderConfigCreateResponse:
+ """
+ Create a new Provider Configs
+
+ 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}")
+ return self._post(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs",
+ body=maybe_transform(
+ {
+ "alias": alias,
+ "default_config": default_config,
+ "provider_slug": provider_slug,
+ "secret": secret,
+ "secret_id": secret_id,
+ "rate_limit": rate_limit,
+ "rate_limit_period": rate_limit_period,
+ },
+ provider_config_create_params.ProviderConfigCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[ProviderConfigCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[ProviderConfigCreateResponse], ResultWrapper[ProviderConfigCreateResponse]),
+ )
+
+ def list(
+ self,
+ gateway_id: str,
+ *,
+ account_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ # 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,
+ ) -> SyncV4PagePaginationArray[ProviderConfigListResponse]:
+ """
+ List Provider Configs
+
+ 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}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs",
+ page=SyncV4PagePaginationArray[ProviderConfigListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ },
+ provider_config_list_params.ProviderConfigListParams,
+ ),
+ ),
+ model=ProviderConfigListResponse,
+ )
+
+
+class AsyncProviderConfigsResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncProviderConfigsResourceWithRawResponse:
+ """
+ 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 AsyncProviderConfigsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncProviderConfigsResourceWithStreamingResponse:
+ """
+ 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 AsyncProviderConfigsResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ gateway_id: str,
+ *,
+ account_id: str,
+ alias: str,
+ default_config: bool,
+ provider_slug: str,
+ secret: str,
+ secret_id: str,
+ rate_limit: float | Omit = omit,
+ rate_limit_period: float | Omit = omit,
+ # 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,
+ ) -> ProviderConfigCreateResponse:
+ """
+ Create a new Provider Configs
+
+ 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}")
+ return await self._post(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs",
+ body=await async_maybe_transform(
+ {
+ "alias": alias,
+ "default_config": default_config,
+ "provider_slug": provider_slug,
+ "secret": secret,
+ "secret_id": secret_id,
+ "rate_limit": rate_limit,
+ "rate_limit_period": rate_limit_period,
+ },
+ provider_config_create_params.ProviderConfigCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[ProviderConfigCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[ProviderConfigCreateResponse], ResultWrapper[ProviderConfigCreateResponse]),
+ )
+
+ def list(
+ self,
+ gateway_id: str,
+ *,
+ account_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ # 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[ProviderConfigListResponse, AsyncV4PagePaginationArray[ProviderConfigListResponse]]:
+ """
+ List Provider Configs
+
+ 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}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai-gateway/gateways/{gateway_id}/provider_configs",
+ page=AsyncV4PagePaginationArray[ProviderConfigListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ },
+ provider_config_list_params.ProviderConfigListParams,
+ ),
+ ),
+ model=ProviderConfigListResponse,
+ )
+
+
+class ProviderConfigsResourceWithRawResponse:
+ def __init__(self, provider_configs: ProviderConfigsResource) -> None:
+ self._provider_configs = provider_configs
+
+ self.create = to_raw_response_wrapper(
+ provider_configs.create,
+ )
+ self.list = to_raw_response_wrapper(
+ provider_configs.list,
+ )
+
+
+class AsyncProviderConfigsResourceWithRawResponse:
+ def __init__(self, provider_configs: AsyncProviderConfigsResource) -> None:
+ self._provider_configs = provider_configs
+
+ self.create = async_to_raw_response_wrapper(
+ provider_configs.create,
+ )
+ self.list = async_to_raw_response_wrapper(
+ provider_configs.list,
+ )
+
+
+class ProviderConfigsResourceWithStreamingResponse:
+ def __init__(self, provider_configs: ProviderConfigsResource) -> None:
+ self._provider_configs = provider_configs
+
+ self.create = to_streamed_response_wrapper(
+ provider_configs.create,
+ )
+ self.list = to_streamed_response_wrapper(
+ provider_configs.list,
+ )
+
+
+class AsyncProviderConfigsResourceWithStreamingResponse:
+ def __init__(self, provider_configs: AsyncProviderConfigsResource) -> None:
+ self._provider_configs = provider_configs
+
+ self.create = async_to_streamed_response_wrapper(
+ provider_configs.create,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ provider_configs.list,
+ )
diff --git a/src/cloudflare/resources/ai_gateway/urls.py b/src/cloudflare/resources/ai_gateway/urls.py
index d29f1b62794..8f660faa164 100644
--- a/src/cloudflare/resources/ai_gateway/urls.py
+++ b/src/cloudflare/resources/ai_gateway/urls.py
@@ -6,7 +6,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Query, Headers, NotGiven, not_given
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -53,7 +53,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> str:
"""
Get Gateway URL
@@ -119,7 +119,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> str:
"""
Get Gateway URL
diff --git a/src/cloudflare/resources/aisearch/__init__.py b/src/cloudflare/resources/aisearch/__init__.py
new file mode 100644
index 00000000000..e7d15dd59ad
--- /dev/null
+++ b/src/cloudflare/resources/aisearch/__init__.py
@@ -0,0 +1,47 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .tokens import (
+ TokensResource,
+ AsyncTokensResource,
+ TokensResourceWithRawResponse,
+ AsyncTokensResourceWithRawResponse,
+ TokensResourceWithStreamingResponse,
+ AsyncTokensResourceWithStreamingResponse,
+)
+from .aisearch import (
+ AISearchResource,
+ AsyncAISearchResource,
+ AISearchResourceWithRawResponse,
+ AsyncAISearchResourceWithRawResponse,
+ AISearchResourceWithStreamingResponse,
+ AsyncAISearchResourceWithStreamingResponse,
+)
+from .instances import (
+ InstancesResource,
+ AsyncInstancesResource,
+ InstancesResourceWithRawResponse,
+ AsyncInstancesResourceWithRawResponse,
+ InstancesResourceWithStreamingResponse,
+ AsyncInstancesResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "InstancesResource",
+ "AsyncInstancesResource",
+ "InstancesResourceWithRawResponse",
+ "AsyncInstancesResourceWithRawResponse",
+ "InstancesResourceWithStreamingResponse",
+ "AsyncInstancesResourceWithStreamingResponse",
+ "TokensResource",
+ "AsyncTokensResource",
+ "TokensResourceWithRawResponse",
+ "AsyncTokensResourceWithRawResponse",
+ "TokensResourceWithStreamingResponse",
+ "AsyncTokensResourceWithStreamingResponse",
+ "AISearchResource",
+ "AsyncAISearchResource",
+ "AISearchResourceWithRawResponse",
+ "AsyncAISearchResourceWithRawResponse",
+ "AISearchResourceWithStreamingResponse",
+ "AsyncAISearchResourceWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/aisearch/aisearch.py b/src/cloudflare/resources/aisearch/aisearch.py
new file mode 100644
index 00000000000..483739a1224
--- /dev/null
+++ b/src/cloudflare/resources/aisearch/aisearch.py
@@ -0,0 +1,134 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .tokens import (
+ TokensResource,
+ AsyncTokensResource,
+ TokensResourceWithRawResponse,
+ AsyncTokensResourceWithRawResponse,
+ TokensResourceWithStreamingResponse,
+ AsyncTokensResourceWithStreamingResponse,
+)
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from .instances.instances import (
+ InstancesResource,
+ AsyncInstancesResource,
+ InstancesResourceWithRawResponse,
+ AsyncInstancesResourceWithRawResponse,
+ InstancesResourceWithStreamingResponse,
+ AsyncInstancesResourceWithStreamingResponse,
+)
+
+__all__ = ["AISearchResource", "AsyncAISearchResource"]
+
+
+class AISearchResource(SyncAPIResource):
+ @cached_property
+ def instances(self) -> InstancesResource:
+ return InstancesResource(self._client)
+
+ @cached_property
+ def tokens(self) -> TokensResource:
+ return TokensResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AISearchResourceWithRawResponse:
+ """
+ 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 AISearchResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AISearchResourceWithStreamingResponse:
+ """
+ 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 AISearchResourceWithStreamingResponse(self)
+
+
+class AsyncAISearchResource(AsyncAPIResource):
+ @cached_property
+ def instances(self) -> AsyncInstancesResource:
+ return AsyncInstancesResource(self._client)
+
+ @cached_property
+ def tokens(self) -> AsyncTokensResource:
+ return AsyncTokensResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncAISearchResourceWithRawResponse:
+ """
+ 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 AsyncAISearchResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncAISearchResourceWithStreamingResponse:
+ """
+ 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 AsyncAISearchResourceWithStreamingResponse(self)
+
+
+class AISearchResourceWithRawResponse:
+ def __init__(self, aisearch: AISearchResource) -> None:
+ self._aisearch = aisearch
+
+ @cached_property
+ def instances(self) -> InstancesResourceWithRawResponse:
+ return InstancesResourceWithRawResponse(self._aisearch.instances)
+
+ @cached_property
+ def tokens(self) -> TokensResourceWithRawResponse:
+ return TokensResourceWithRawResponse(self._aisearch.tokens)
+
+
+class AsyncAISearchResourceWithRawResponse:
+ def __init__(self, aisearch: AsyncAISearchResource) -> None:
+ self._aisearch = aisearch
+
+ @cached_property
+ def instances(self) -> AsyncInstancesResourceWithRawResponse:
+ return AsyncInstancesResourceWithRawResponse(self._aisearch.instances)
+
+ @cached_property
+ def tokens(self) -> AsyncTokensResourceWithRawResponse:
+ return AsyncTokensResourceWithRawResponse(self._aisearch.tokens)
+
+
+class AISearchResourceWithStreamingResponse:
+ def __init__(self, aisearch: AISearchResource) -> None:
+ self._aisearch = aisearch
+
+ @cached_property
+ def instances(self) -> InstancesResourceWithStreamingResponse:
+ return InstancesResourceWithStreamingResponse(self._aisearch.instances)
+
+ @cached_property
+ def tokens(self) -> TokensResourceWithStreamingResponse:
+ return TokensResourceWithStreamingResponse(self._aisearch.tokens)
+
+
+class AsyncAISearchResourceWithStreamingResponse:
+ def __init__(self, aisearch: AsyncAISearchResource) -> None:
+ self._aisearch = aisearch
+
+ @cached_property
+ def instances(self) -> AsyncInstancesResourceWithStreamingResponse:
+ return AsyncInstancesResourceWithStreamingResponse(self._aisearch.instances)
+
+ @cached_property
+ def tokens(self) -> AsyncTokensResourceWithStreamingResponse:
+ return AsyncTokensResourceWithStreamingResponse(self._aisearch.tokens)
diff --git a/src/cloudflare/resources/aisearch/instances/__init__.py b/src/cloudflare/resources/aisearch/instances/__init__.py
new file mode 100644
index 00000000000..bcd3fe82f43
--- /dev/null
+++ b/src/cloudflare/resources/aisearch/instances/__init__.py
@@ -0,0 +1,47 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .jobs import (
+ JobsResource,
+ AsyncJobsResource,
+ JobsResourceWithRawResponse,
+ AsyncJobsResourceWithRawResponse,
+ JobsResourceWithStreamingResponse,
+ AsyncJobsResourceWithStreamingResponse,
+)
+from .items import (
+ ItemsResource,
+ AsyncItemsResource,
+ ItemsResourceWithRawResponse,
+ AsyncItemsResourceWithRawResponse,
+ ItemsResourceWithStreamingResponse,
+ AsyncItemsResourceWithStreamingResponse,
+)
+from .instances import (
+ InstancesResource,
+ AsyncInstancesResource,
+ InstancesResourceWithRawResponse,
+ AsyncInstancesResourceWithRawResponse,
+ InstancesResourceWithStreamingResponse,
+ AsyncInstancesResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "ItemsResource",
+ "AsyncItemsResource",
+ "ItemsResourceWithRawResponse",
+ "AsyncItemsResourceWithRawResponse",
+ "ItemsResourceWithStreamingResponse",
+ "AsyncItemsResourceWithStreamingResponse",
+ "JobsResource",
+ "AsyncJobsResource",
+ "JobsResourceWithRawResponse",
+ "AsyncJobsResourceWithRawResponse",
+ "JobsResourceWithStreamingResponse",
+ "AsyncJobsResourceWithStreamingResponse",
+ "InstancesResource",
+ "AsyncInstancesResource",
+ "InstancesResourceWithRawResponse",
+ "AsyncInstancesResourceWithRawResponse",
+ "InstancesResourceWithStreamingResponse",
+ "AsyncInstancesResourceWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/aisearch/instances/instances.py b/src/cloudflare/resources/aisearch/instances/instances.py
new file mode 100644
index 00000000000..44984f27f89
--- /dev/null
+++ b/src/cloudflare/resources/aisearch/instances/instances.py
@@ -0,0 +1,1569 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, Iterable, cast
+from typing_extensions import Literal
+
+import httpx
+
+from .jobs import (
+ JobsResource,
+ AsyncJobsResource,
+ JobsResourceWithRawResponse,
+ AsyncJobsResourceWithRawResponse,
+ JobsResourceWithStreamingResponse,
+ AsyncJobsResourceWithStreamingResponse,
+)
+from .items import (
+ ItemsResource,
+ AsyncItemsResource,
+ ItemsResourceWithRawResponse,
+ AsyncItemsResourceWithRawResponse,
+ ItemsResourceWithStreamingResponse,
+ AsyncItemsResourceWithStreamingResponse,
+)
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ...._utils import maybe_transform, async_maybe_transform
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from ...._base_client import AsyncPaginator, make_request_options
+from ....types.aisearch import (
+ instance_list_params,
+ instance_create_params,
+ instance_search_params,
+ instance_update_params,
+ instance_chat_completions_params,
+)
+from ....types.aisearch.instance_list_response import InstanceListResponse
+from ....types.aisearch.instance_read_response import InstanceReadResponse
+from ....types.aisearch.instance_stats_response import InstanceStatsResponse
+from ....types.aisearch.instance_create_response import InstanceCreateResponse
+from ....types.aisearch.instance_delete_response import InstanceDeleteResponse
+from ....types.aisearch.instance_search_response import InstanceSearchResponse
+from ....types.aisearch.instance_update_response import InstanceUpdateResponse
+from ....types.aisearch.instance_chat_completions_response import InstanceChatCompletionsResponse
+
+__all__ = ["InstancesResource", "AsyncInstancesResource"]
+
+
+class InstancesResource(SyncAPIResource):
+ @cached_property
+ def items(self) -> ItemsResource:
+ return ItemsResource(self._client)
+
+ @cached_property
+ def jobs(self) -> JobsResource:
+ return JobsResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> InstancesResourceWithRawResponse:
+ """
+ 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 InstancesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> InstancesResourceWithStreamingResponse:
+ """
+ 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 InstancesResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ account_id: str,
+ id: str,
+ source: str,
+ type: Literal["r2", "web-crawler"],
+ ai_gateway_id: str | Omit = omit,
+ aisearch_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ chunk: bool | Omit = omit,
+ chunk_overlap: int | Omit = omit,
+ chunk_size: int | Omit = omit,
+ custom_metadata: Iterable[instance_create_params.CustomMetadata] | Omit = omit,
+ embedding_model: Literal[
+ "@cf/qwen/qwen3-embedding-0.6b",
+ "@cf/baai/bge-m3",
+ "@cf/baai/bge-large-en-v1.5",
+ "@cf/google/embeddinggemma-300m",
+ "google-ai-studio/gemini-embedding-001",
+ "openai/text-embedding-3-small",
+ "openai/text-embedding-3-large",
+ "",
+ ]
+ | Omit = omit,
+ hybrid_search_enabled: bool | Omit = omit,
+ max_num_results: int | Omit = omit,
+ metadata: instance_create_params.Metadata | Omit = omit,
+ public_endpoint_params: instance_create_params.PublicEndpointParams | Omit = omit,
+ reranking: bool | Omit = omit,
+ reranking_model: Literal["@cf/baai/bge-reranker-base", ""] | Omit = omit,
+ rewrite_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ rewrite_query: bool | Omit = omit,
+ score_threshold: float | Omit = omit,
+ source_params: instance_create_params.SourceParams | Omit = omit,
+ token_id: str | Omit = omit,
+ # 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,
+ ) -> InstanceCreateResponse:
+ """
+ Create new instances.
+
+ Args:
+ id: Use your AI Search 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}")
+ return self._post(
+ f"/accounts/{account_id}/ai-search/instances",
+ body=maybe_transform(
+ {
+ "id": id,
+ "source": source,
+ "type": type,
+ "ai_gateway_id": ai_gateway_id,
+ "aisearch_model": aisearch_model,
+ "chunk": chunk,
+ "chunk_overlap": chunk_overlap,
+ "chunk_size": chunk_size,
+ "custom_metadata": custom_metadata,
+ "embedding_model": embedding_model,
+ "hybrid_search_enabled": hybrid_search_enabled,
+ "max_num_results": max_num_results,
+ "metadata": metadata,
+ "public_endpoint_params": public_endpoint_params,
+ "reranking": reranking,
+ "reranking_model": reranking_model,
+ "rewrite_model": rewrite_model,
+ "rewrite_query": rewrite_query,
+ "score_threshold": score_threshold,
+ "source_params": source_params,
+ "token_id": token_id,
+ },
+ instance_create_params.InstanceCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceCreateResponse], ResultWrapper[InstanceCreateResponse]),
+ )
+
+ def update(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ ai_gateway_id: str | Omit = omit,
+ aisearch_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ cache: bool | Omit = omit,
+ cache_threshold: Literal["super_strict_match", "close_enough", "flexible_friend", "anything_goes"]
+ | Omit = omit,
+ chunk: bool | Omit = omit,
+ chunk_overlap: int | Omit = omit,
+ chunk_size: int | Omit = omit,
+ custom_metadata: Iterable[instance_update_params.CustomMetadata] | Omit = omit,
+ embedding_model: Literal[
+ "@cf/qwen/qwen3-embedding-0.6b",
+ "@cf/baai/bge-m3",
+ "@cf/baai/bge-large-en-v1.5",
+ "@cf/google/embeddinggemma-300m",
+ "google-ai-studio/gemini-embedding-001",
+ "openai/text-embedding-3-small",
+ "openai/text-embedding-3-large",
+ "",
+ ]
+ | Omit = omit,
+ hybrid_search_enabled: bool | Omit = omit,
+ max_num_results: int | Omit = omit,
+ metadata: instance_update_params.Metadata | Omit = omit,
+ paused: bool | Omit = omit,
+ public_endpoint_params: instance_update_params.PublicEndpointParams | Omit = omit,
+ reranking: bool | Omit = omit,
+ reranking_model: Literal["@cf/baai/bge-reranker-base", ""] | Omit = omit,
+ rewrite_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ rewrite_query: bool | Omit = omit,
+ score_threshold: float | Omit = omit,
+ source_params: instance_update_params.SourceParams | Omit = omit,
+ summarization: bool | Omit = omit,
+ summarization_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ system_prompt_aisearch: str | Omit = omit,
+ system_prompt_index_summarization: str | Omit = omit,
+ system_prompt_rewrite_query: str | Omit = omit,
+ token_id: str | Omit = omit,
+ # 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,
+ ) -> InstanceUpdateResponse:
+ """
+ Update instances.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._put(
+ f"/accounts/{account_id}/ai-search/instances/{id}",
+ body=maybe_transform(
+ {
+ "ai_gateway_id": ai_gateway_id,
+ "aisearch_model": aisearch_model,
+ "cache": cache,
+ "cache_threshold": cache_threshold,
+ "chunk": chunk,
+ "chunk_overlap": chunk_overlap,
+ "chunk_size": chunk_size,
+ "custom_metadata": custom_metadata,
+ "embedding_model": embedding_model,
+ "hybrid_search_enabled": hybrid_search_enabled,
+ "max_num_results": max_num_results,
+ "metadata": metadata,
+ "paused": paused,
+ "public_endpoint_params": public_endpoint_params,
+ "reranking": reranking,
+ "reranking_model": reranking_model,
+ "rewrite_model": rewrite_model,
+ "rewrite_query": rewrite_query,
+ "score_threshold": score_threshold,
+ "source_params": source_params,
+ "summarization": summarization,
+ "summarization_model": summarization_model,
+ "system_prompt_aisearch": system_prompt_aisearch,
+ "system_prompt_index_summarization": system_prompt_index_summarization,
+ "system_prompt_rewrite_query": system_prompt_rewrite_query,
+ "token_id": token_id,
+ },
+ instance_update_params.InstanceUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceUpdateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceUpdateResponse], ResultWrapper[InstanceUpdateResponse]),
+ )
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
+ # 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,
+ ) -> SyncV4PagePaginationArray[InstanceListResponse]:
+ """
+ List instances.
+
+ Args:
+ search: Search by 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}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai-search/instances",
+ page=SyncV4PagePaginationArray[InstanceListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ "search": search,
+ },
+ instance_list_params.InstanceListParams,
+ ),
+ ),
+ model=InstanceListResponse,
+ )
+
+ def delete(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> InstanceDeleteResponse:
+ """
+ Delete instances.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._delete(
+ f"/accounts/{account_id}/ai-search/instances/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceDeleteResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceDeleteResponse], ResultWrapper[InstanceDeleteResponse]),
+ )
+
+ def chat_completions(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ messages: Iterable[instance_chat_completions_params.Message],
+ aisearch_options: instance_chat_completions_params.AISearchOptions | Omit = omit,
+ model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ stream: bool | Omit = omit,
+ # 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,
+ ) -> InstanceChatCompletionsResponse:
+ """
+ Chat Completions
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._post(
+ f"/accounts/{account_id}/ai-search/instances/{id}/chat/completions",
+ body=maybe_transform(
+ {
+ "messages": messages,
+ "aisearch_options": aisearch_options,
+ "model": model,
+ "stream": stream,
+ },
+ instance_chat_completions_params.InstanceChatCompletionsParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=InstanceChatCompletionsResponse,
+ )
+
+ def read(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> InstanceReadResponse:
+ """
+ Read instances.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai-search/instances/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceReadResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceReadResponse], ResultWrapper[InstanceReadResponse]),
+ )
+
+ def search(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ messages: Iterable[instance_search_params.Message],
+ aisearch_options: instance_search_params.AISearchOptions | Omit = omit,
+ # 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,
+ ) -> InstanceSearchResponse:
+ """
+ Search
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._post(
+ f"/accounts/{account_id}/ai-search/instances/{id}/search",
+ body=maybe_transform(
+ {
+ "messages": messages,
+ "aisearch_options": aisearch_options,
+ },
+ instance_search_params.InstanceSearchParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceSearchResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceSearchResponse], ResultWrapper[InstanceSearchResponse]),
+ )
+
+ def stats(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> InstanceStatsResponse:
+ """
+ Stats
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai-search/instances/{id}/stats",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceStatsResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceStatsResponse], ResultWrapper[InstanceStatsResponse]),
+ )
+
+
+class AsyncInstancesResource(AsyncAPIResource):
+ @cached_property
+ def items(self) -> AsyncItemsResource:
+ return AsyncItemsResource(self._client)
+
+ @cached_property
+ def jobs(self) -> AsyncJobsResource:
+ return AsyncJobsResource(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncInstancesResourceWithRawResponse:
+ """
+ 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 AsyncInstancesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncInstancesResourceWithStreamingResponse:
+ """
+ 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 AsyncInstancesResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ account_id: str,
+ id: str,
+ source: str,
+ type: Literal["r2", "web-crawler"],
+ ai_gateway_id: str | Omit = omit,
+ aisearch_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ chunk: bool | Omit = omit,
+ chunk_overlap: int | Omit = omit,
+ chunk_size: int | Omit = omit,
+ custom_metadata: Iterable[instance_create_params.CustomMetadata] | Omit = omit,
+ embedding_model: Literal[
+ "@cf/qwen/qwen3-embedding-0.6b",
+ "@cf/baai/bge-m3",
+ "@cf/baai/bge-large-en-v1.5",
+ "@cf/google/embeddinggemma-300m",
+ "google-ai-studio/gemini-embedding-001",
+ "openai/text-embedding-3-small",
+ "openai/text-embedding-3-large",
+ "",
+ ]
+ | Omit = omit,
+ hybrid_search_enabled: bool | Omit = omit,
+ max_num_results: int | Omit = omit,
+ metadata: instance_create_params.Metadata | Omit = omit,
+ public_endpoint_params: instance_create_params.PublicEndpointParams | Omit = omit,
+ reranking: bool | Omit = omit,
+ reranking_model: Literal["@cf/baai/bge-reranker-base", ""] | Omit = omit,
+ rewrite_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ rewrite_query: bool | Omit = omit,
+ score_threshold: float | Omit = omit,
+ source_params: instance_create_params.SourceParams | Omit = omit,
+ token_id: str | Omit = omit,
+ # 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,
+ ) -> InstanceCreateResponse:
+ """
+ Create new instances.
+
+ Args:
+ id: Use your AI Search 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}")
+ return await self._post(
+ f"/accounts/{account_id}/ai-search/instances",
+ body=await async_maybe_transform(
+ {
+ "id": id,
+ "source": source,
+ "type": type,
+ "ai_gateway_id": ai_gateway_id,
+ "aisearch_model": aisearch_model,
+ "chunk": chunk,
+ "chunk_overlap": chunk_overlap,
+ "chunk_size": chunk_size,
+ "custom_metadata": custom_metadata,
+ "embedding_model": embedding_model,
+ "hybrid_search_enabled": hybrid_search_enabled,
+ "max_num_results": max_num_results,
+ "metadata": metadata,
+ "public_endpoint_params": public_endpoint_params,
+ "reranking": reranking,
+ "reranking_model": reranking_model,
+ "rewrite_model": rewrite_model,
+ "rewrite_query": rewrite_query,
+ "score_threshold": score_threshold,
+ "source_params": source_params,
+ "token_id": token_id,
+ },
+ instance_create_params.InstanceCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceCreateResponse], ResultWrapper[InstanceCreateResponse]),
+ )
+
+ async def update(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ ai_gateway_id: str | Omit = omit,
+ aisearch_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ cache: bool | Omit = omit,
+ cache_threshold: Literal["super_strict_match", "close_enough", "flexible_friend", "anything_goes"]
+ | Omit = omit,
+ chunk: bool | Omit = omit,
+ chunk_overlap: int | Omit = omit,
+ chunk_size: int | Omit = omit,
+ custom_metadata: Iterable[instance_update_params.CustomMetadata] | Omit = omit,
+ embedding_model: Literal[
+ "@cf/qwen/qwen3-embedding-0.6b",
+ "@cf/baai/bge-m3",
+ "@cf/baai/bge-large-en-v1.5",
+ "@cf/google/embeddinggemma-300m",
+ "google-ai-studio/gemini-embedding-001",
+ "openai/text-embedding-3-small",
+ "openai/text-embedding-3-large",
+ "",
+ ]
+ | Omit = omit,
+ hybrid_search_enabled: bool | Omit = omit,
+ max_num_results: int | Omit = omit,
+ metadata: instance_update_params.Metadata | Omit = omit,
+ paused: bool | Omit = omit,
+ public_endpoint_params: instance_update_params.PublicEndpointParams | Omit = omit,
+ reranking: bool | Omit = omit,
+ reranking_model: Literal["@cf/baai/bge-reranker-base", ""] | Omit = omit,
+ rewrite_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ rewrite_query: bool | Omit = omit,
+ score_threshold: float | Omit = omit,
+ source_params: instance_update_params.SourceParams | Omit = omit,
+ summarization: bool | Omit = omit,
+ summarization_model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ system_prompt_aisearch: str | Omit = omit,
+ system_prompt_index_summarization: str | Omit = omit,
+ system_prompt_rewrite_query: str | Omit = omit,
+ token_id: str | Omit = omit,
+ # 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,
+ ) -> InstanceUpdateResponse:
+ """
+ Update instances.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._put(
+ f"/accounts/{account_id}/ai-search/instances/{id}",
+ body=await async_maybe_transform(
+ {
+ "ai_gateway_id": ai_gateway_id,
+ "aisearch_model": aisearch_model,
+ "cache": cache,
+ "cache_threshold": cache_threshold,
+ "chunk": chunk,
+ "chunk_overlap": chunk_overlap,
+ "chunk_size": chunk_size,
+ "custom_metadata": custom_metadata,
+ "embedding_model": embedding_model,
+ "hybrid_search_enabled": hybrid_search_enabled,
+ "max_num_results": max_num_results,
+ "metadata": metadata,
+ "paused": paused,
+ "public_endpoint_params": public_endpoint_params,
+ "reranking": reranking,
+ "reranking_model": reranking_model,
+ "rewrite_model": rewrite_model,
+ "rewrite_query": rewrite_query,
+ "score_threshold": score_threshold,
+ "source_params": source_params,
+ "summarization": summarization,
+ "summarization_model": summarization_model,
+ "system_prompt_aisearch": system_prompt_aisearch,
+ "system_prompt_index_summarization": system_prompt_index_summarization,
+ "system_prompt_rewrite_query": system_prompt_rewrite_query,
+ "token_id": token_id,
+ },
+ instance_update_params.InstanceUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceUpdateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceUpdateResponse], ResultWrapper[InstanceUpdateResponse]),
+ )
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
+ # 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[InstanceListResponse, AsyncV4PagePaginationArray[InstanceListResponse]]:
+ """
+ List instances.
+
+ Args:
+ search: Search by 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}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai-search/instances",
+ page=AsyncV4PagePaginationArray[InstanceListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ "search": search,
+ },
+ instance_list_params.InstanceListParams,
+ ),
+ ),
+ model=InstanceListResponse,
+ )
+
+ async def delete(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> InstanceDeleteResponse:
+ """
+ Delete instances.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._delete(
+ f"/accounts/{account_id}/ai-search/instances/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceDeleteResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceDeleteResponse], ResultWrapper[InstanceDeleteResponse]),
+ )
+
+ async def chat_completions(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ messages: Iterable[instance_chat_completions_params.Message],
+ aisearch_options: instance_chat_completions_params.AISearchOptions | Omit = omit,
+ model: Literal[
+ "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fast",
+ "@cf/meta/llama-3.1-8b-instruct-fp8",
+ "@cf/meta/llama-4-scout-17b-16e-instruct",
+ "@cf/qwen/qwen3-30b-a3b-fp8",
+ "@cf/deepseek-ai/deepseek-r1-distill-qwen-32b",
+ "@cf/moonshotai/kimi-k2-instruct",
+ "anthropic/claude-3-7-sonnet",
+ "anthropic/claude-sonnet-4",
+ "anthropic/claude-opus-4",
+ "anthropic/claude-3-5-haiku",
+ "cerebras/qwen-3-235b-a22b-instruct",
+ "cerebras/qwen-3-235b-a22b-thinking",
+ "cerebras/llama-3.3-70b",
+ "cerebras/llama-4-maverick-17b-128e-instruct",
+ "cerebras/llama-4-scout-17b-16e-instruct",
+ "cerebras/gpt-oss-120b",
+ "google-ai-studio/gemini-2.5-flash",
+ "google-ai-studio/gemini-2.5-pro",
+ "grok/grok-4",
+ "groq/llama-3.3-70b-versatile",
+ "groq/llama-3.1-8b-instant",
+ "openai/gpt-5",
+ "openai/gpt-5-mini",
+ "openai/gpt-5-nano",
+ "",
+ ]
+ | Omit = omit,
+ stream: bool | Omit = omit,
+ # 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,
+ ) -> InstanceChatCompletionsResponse:
+ """
+ Chat Completions
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/ai-search/instances/{id}/chat/completions",
+ body=await async_maybe_transform(
+ {
+ "messages": messages,
+ "aisearch_options": aisearch_options,
+ "model": model,
+ "stream": stream,
+ },
+ instance_chat_completions_params.InstanceChatCompletionsParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=InstanceChatCompletionsResponse,
+ )
+
+ async def read(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> InstanceReadResponse:
+ """
+ Read instances.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-search/instances/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceReadResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceReadResponse], ResultWrapper[InstanceReadResponse]),
+ )
+
+ async def search(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ messages: Iterable[instance_search_params.Message],
+ aisearch_options: instance_search_params.AISearchOptions | Omit = omit,
+ # 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,
+ ) -> InstanceSearchResponse:
+ """
+ Search
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/ai-search/instances/{id}/search",
+ body=await async_maybe_transform(
+ {
+ "messages": messages,
+ "aisearch_options": aisearch_options,
+ },
+ instance_search_params.InstanceSearchParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceSearchResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceSearchResponse], ResultWrapper[InstanceSearchResponse]),
+ )
+
+ async def stats(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> InstanceStatsResponse:
+ """
+ Stats
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-search/instances/{id}/stats",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[InstanceStatsResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[InstanceStatsResponse], ResultWrapper[InstanceStatsResponse]),
+ )
+
+
+class InstancesResourceWithRawResponse:
+ def __init__(self, instances: InstancesResource) -> None:
+ self._instances = instances
+
+ self.create = to_raw_response_wrapper(
+ instances.create,
+ )
+ self.update = to_raw_response_wrapper(
+ instances.update,
+ )
+ self.list = to_raw_response_wrapper(
+ instances.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ instances.delete,
+ )
+ self.chat_completions = to_raw_response_wrapper(
+ instances.chat_completions,
+ )
+ self.read = to_raw_response_wrapper(
+ instances.read,
+ )
+ self.search = to_raw_response_wrapper(
+ instances.search,
+ )
+ self.stats = to_raw_response_wrapper(
+ instances.stats,
+ )
+
+ @cached_property
+ def items(self) -> ItemsResourceWithRawResponse:
+ return ItemsResourceWithRawResponse(self._instances.items)
+
+ @cached_property
+ def jobs(self) -> JobsResourceWithRawResponse:
+ return JobsResourceWithRawResponse(self._instances.jobs)
+
+
+class AsyncInstancesResourceWithRawResponse:
+ def __init__(self, instances: AsyncInstancesResource) -> None:
+ self._instances = instances
+
+ self.create = async_to_raw_response_wrapper(
+ instances.create,
+ )
+ self.update = async_to_raw_response_wrapper(
+ instances.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ instances.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ instances.delete,
+ )
+ self.chat_completions = async_to_raw_response_wrapper(
+ instances.chat_completions,
+ )
+ self.read = async_to_raw_response_wrapper(
+ instances.read,
+ )
+ self.search = async_to_raw_response_wrapper(
+ instances.search,
+ )
+ self.stats = async_to_raw_response_wrapper(
+ instances.stats,
+ )
+
+ @cached_property
+ def items(self) -> AsyncItemsResourceWithRawResponse:
+ return AsyncItemsResourceWithRawResponse(self._instances.items)
+
+ @cached_property
+ def jobs(self) -> AsyncJobsResourceWithRawResponse:
+ return AsyncJobsResourceWithRawResponse(self._instances.jobs)
+
+
+class InstancesResourceWithStreamingResponse:
+ def __init__(self, instances: InstancesResource) -> None:
+ self._instances = instances
+
+ self.create = to_streamed_response_wrapper(
+ instances.create,
+ )
+ self.update = to_streamed_response_wrapper(
+ instances.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ instances.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ instances.delete,
+ )
+ self.chat_completions = to_streamed_response_wrapper(
+ instances.chat_completions,
+ )
+ self.read = to_streamed_response_wrapper(
+ instances.read,
+ )
+ self.search = to_streamed_response_wrapper(
+ instances.search,
+ )
+ self.stats = to_streamed_response_wrapper(
+ instances.stats,
+ )
+
+ @cached_property
+ def items(self) -> ItemsResourceWithStreamingResponse:
+ return ItemsResourceWithStreamingResponse(self._instances.items)
+
+ @cached_property
+ def jobs(self) -> JobsResourceWithStreamingResponse:
+ return JobsResourceWithStreamingResponse(self._instances.jobs)
+
+
+class AsyncInstancesResourceWithStreamingResponse:
+ def __init__(self, instances: AsyncInstancesResource) -> None:
+ self._instances = instances
+
+ self.create = async_to_streamed_response_wrapper(
+ instances.create,
+ )
+ self.update = async_to_streamed_response_wrapper(
+ instances.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ instances.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ instances.delete,
+ )
+ self.chat_completions = async_to_streamed_response_wrapper(
+ instances.chat_completions,
+ )
+ self.read = async_to_streamed_response_wrapper(
+ instances.read,
+ )
+ self.search = async_to_streamed_response_wrapper(
+ instances.search,
+ )
+ self.stats = async_to_streamed_response_wrapper(
+ instances.stats,
+ )
+
+ @cached_property
+ def items(self) -> AsyncItemsResourceWithStreamingResponse:
+ return AsyncItemsResourceWithStreamingResponse(self._instances.items)
+
+ @cached_property
+ def jobs(self) -> AsyncJobsResourceWithStreamingResponse:
+ return AsyncJobsResourceWithStreamingResponse(self._instances.jobs)
diff --git a/src/cloudflare/resources/aisearch/instances/items.py b/src/cloudflare/resources/aisearch/instances/items.py
new file mode 100644
index 00000000000..7ed961721d2
--- /dev/null
+++ b/src/cloudflare/resources/aisearch/instances/items.py
@@ -0,0 +1,317 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, cast
+from typing_extensions import Literal
+
+import httpx
+
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ...._utils import maybe_transform
+from ...._compat import cached_property
+from ...._resource import SyncAPIResource, AsyncAPIResource
+from ...._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ...._wrappers import ResultWrapper
+from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from ...._base_client import AsyncPaginator, make_request_options
+from ....types.aisearch.instances import item_list_params
+from ....types.aisearch.instances.item_get_response import ItemGetResponse
+from ....types.aisearch.instances.item_list_response import ItemListResponse
+
+__all__ = ["ItemsResource", "AsyncItemsResource"]
+
+
+class ItemsResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> ItemsResourceWithRawResponse:
+ """
+ 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 ItemsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> ItemsResourceWithStreamingResponse:
+ """
+ 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 ItemsResourceWithStreamingResponse(self)
+
+ def list(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
+ status: Literal["queued", "running", "completed", "error", "skipped"] | Omit = omit,
+ # 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,
+ ) -> SyncV4PagePaginationArray[ItemListResponse]:
+ """
+ Items List.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai-search/instances/{id}/items",
+ page=SyncV4PagePaginationArray[ItemListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ "search": search,
+ "status": status,
+ },
+ item_list_params.ItemListParams,
+ ),
+ ),
+ model=ItemListResponse,
+ )
+
+ def get(
+ self,
+ item_id: str,
+ *,
+ account_id: str,
+ 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,
+ ) -> ItemGetResponse:
+ """
+ Get Item.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ if not item_id:
+ raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai-search/instances/{id}/items/{item_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[ItemGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]),
+ )
+
+
+class AsyncItemsResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncItemsResourceWithRawResponse:
+ """
+ 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 AsyncItemsResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncItemsResourceWithStreamingResponse:
+ """
+ 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 AsyncItemsResourceWithStreamingResponse(self)
+
+ def list(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ search: str | Omit = omit,
+ status: Literal["queued", "running", "completed", "error", "skipped"] | Omit = omit,
+ # 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[ItemListResponse, AsyncV4PagePaginationArray[ItemListResponse]]:
+ """
+ Items List.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai-search/instances/{id}/items",
+ page=AsyncV4PagePaginationArray[ItemListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ "search": search,
+ "status": status,
+ },
+ item_list_params.ItemListParams,
+ ),
+ ),
+ model=ItemListResponse,
+ )
+
+ async def get(
+ self,
+ item_id: str,
+ *,
+ account_id: str,
+ 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,
+ ) -> ItemGetResponse:
+ """
+ Get Item.
+
+ Args:
+ id: Use your AI Search 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ if not item_id:
+ raise ValueError(f"Expected a non-empty value for `item_id` but received {item_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-search/instances/{id}/items/{item_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[ItemGetResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[ItemGetResponse], ResultWrapper[ItemGetResponse]),
+ )
+
+
+class ItemsResourceWithRawResponse:
+ def __init__(self, items: ItemsResource) -> None:
+ self._items = items
+
+ self.list = to_raw_response_wrapper(
+ items.list,
+ )
+ self.get = to_raw_response_wrapper(
+ items.get,
+ )
+
+
+class AsyncItemsResourceWithRawResponse:
+ def __init__(self, items: AsyncItemsResource) -> None:
+ self._items = items
+
+ self.list = async_to_raw_response_wrapper(
+ items.list,
+ )
+ self.get = async_to_raw_response_wrapper(
+ items.get,
+ )
+
+
+class ItemsResourceWithStreamingResponse:
+ def __init__(self, items: ItemsResource) -> None:
+ self._items = items
+
+ self.list = to_streamed_response_wrapper(
+ items.list,
+ )
+ self.get = to_streamed_response_wrapper(
+ items.get,
+ )
+
+
+class AsyncItemsResourceWithStreamingResponse:
+ def __init__(self, items: AsyncItemsResource) -> None:
+ self._items = items
+
+ self.list = async_to_streamed_response_wrapper(
+ items.list,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ items.get,
+ )
diff --git a/src/cloudflare/resources/cloudforce_one/threat_events/insights.py b/src/cloudflare/resources/aisearch/instances/jobs.py
similarity index 56%
rename from src/cloudflare/resources/cloudforce_one/threat_events/insights.py
rename to src/cloudflare/resources/aisearch/instances/jobs.py
index 97373be775d..2c6bb4226f5 100644
--- a/src/cloudflare/resources/cloudforce_one/threat_events/insights.py
+++ b/src/cloudflare/resources/aisearch/instances/jobs.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -17,56 +17,54 @@
async_to_streamed_response_wrapper,
)
from ...._wrappers import ResultWrapper
-from ...._base_client import make_request_options
-from ....types.cloudforce_one.threat_events import insight_edit_params, insight_create_params
-from ....types.cloudforce_one.threat_events.insight_get_response import InsightGetResponse
-from ....types.cloudforce_one.threat_events.insight_edit_response import InsightEditResponse
-from ....types.cloudforce_one.threat_events.insight_create_response import InsightCreateResponse
-from ....types.cloudforce_one.threat_events.insight_delete_response import InsightDeleteResponse
+from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from ...._base_client import AsyncPaginator, make_request_options
+from ....types.aisearch.instances import job_list_params, job_logs_params
+from ....types.aisearch.instances.job_get_response import JobGetResponse
+from ....types.aisearch.instances.job_list_response import JobListResponse
+from ....types.aisearch.instances.job_logs_response import JobLogsResponse
+from ....types.aisearch.instances.job_create_response import JobCreateResponse
-__all__ = ["InsightsResource", "AsyncInsightsResource"]
+__all__ = ["JobsResource", "AsyncJobsResource"]
-class InsightsResource(SyncAPIResource):
+class JobsResource(SyncAPIResource):
@cached_property
- def with_raw_response(self) -> InsightsResourceWithRawResponse:
+ def with_raw_response(self) -> JobsResourceWithRawResponse:
"""
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 InsightsResourceWithRawResponse(self)
+ return JobsResourceWithRawResponse(self)
@cached_property
- def with_streaming_response(self) -> InsightsResourceWithStreamingResponse:
+ def with_streaming_response(self) -> JobsResourceWithStreamingResponse:
"""
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 InsightsResourceWithStreamingResponse(self)
+ return JobsResourceWithStreamingResponse(self)
def create(
self,
- event_id: str,
+ id: str,
*,
account_id: str,
- content: 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,
- ) -> InsightCreateResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> JobCreateResponse:
"""
- Adds an insight to an event
+ Create new job
Args:
- account_id: Account ID.
-
- event_id: Event UUID.
+ id: Use your AI Search ID.
extra_headers: Send extra headers
@@ -78,43 +76,39 @@ def create(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not event_id:
- raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
+ if not id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return self._post(
- f"/accounts/{account_id}/cloudforce-one/events/{event_id}/insight/create",
- body=maybe_transform({"content": content}, insight_create_params.InsightCreateParams),
+ f"/accounts/{account_id}/ai-search/instances/{id}/jobs",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[InsightCreateResponse]._unwrapper,
+ post_parser=ResultWrapper[JobCreateResponse]._unwrapper,
),
- cast_to=cast(Type[InsightCreateResponse], ResultWrapper[InsightCreateResponse]),
+ cast_to=cast(Type[JobCreateResponse], ResultWrapper[JobCreateResponse]),
)
- def delete(
+ def list(
self,
- insight_id: str,
+ id: str,
*,
account_id: str,
- event_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
- ) -> InsightDeleteResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> SyncV4PagePaginationArray[JobListResponse]:
"""
- Deletes an event insight
+ List Jobs
Args:
- account_id: Account ID.
-
- event_id: Event UUID.
-
- insight_id: Insight UUID.
+ id: Use your AI Search ID.
extra_headers: Send extra headers
@@ -126,45 +120,45 @@ def delete(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not event_id:
- raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
- if not insight_id:
- raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}")
- return self._delete(
- f"/accounts/{account_id}/cloudforce-one/events/{event_id}/insight/{insight_id}",
+ if not id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai-search/instances/{id}/jobs",
+ page=SyncV4PagePaginationArray[JobListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[InsightDeleteResponse]._unwrapper,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ },
+ job_list_params.JobListParams,
+ ),
),
- cast_to=cast(Type[InsightDeleteResponse], ResultWrapper[InsightDeleteResponse]),
+ model=JobListResponse,
)
- def edit(
+ def get(
self,
- insight_id: str,
+ job_id: str,
*,
account_id: str,
- event_id: str,
- content: str,
+ 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,
- ) -> InsightEditResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> JobGetResponse:
"""
- Updates an event insight
+ Get a Job Details
Args:
- account_id: Account ID.
-
- event_id: Event UUID.
-
- insight_id: Insight UUID.
+ id: Use your AI Search ID.
extra_headers: Send extra headers
@@ -176,45 +170,42 @@ def edit(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not event_id:
- raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
- if not insight_id:
- raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}")
- return self._patch(
- f"/accounts/{account_id}/cloudforce-one/events/{event_id}/insight/{insight_id}",
- body=maybe_transform({"content": content}, insight_edit_params.InsightEditParams),
+ if not id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ if not job_id:
+ raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai-search/instances/{id}/jobs/{job_id}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[InsightEditResponse]._unwrapper,
+ post_parser=ResultWrapper[JobGetResponse]._unwrapper,
),
- cast_to=cast(Type[InsightEditResponse], ResultWrapper[InsightEditResponse]),
+ cast_to=cast(Type[JobGetResponse], ResultWrapper[JobGetResponse]),
)
- def get(
+ def logs(
self,
- insight_id: str,
+ job_id: str,
*,
account_id: str,
- event_id: str,
+ id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
- ) -> InsightGetResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> JobLogsResponse:
"""
- Reads an event insight
+ List Job Logs
Args:
- account_id: Account ID.
-
- event_id: Event UUID.
-
- insight_id: Insight UUID.
+ id: Use your AI Search ID.
extra_headers: Send extra headers
@@ -226,63 +217,67 @@ def get(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not event_id:
- raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
- if not insight_id:
- raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}")
+ if not id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ if not job_id:
+ raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}")
return self._get(
- f"/accounts/{account_id}/cloudforce-one/events/{event_id}/insight/{insight_id}",
+ f"/accounts/{account_id}/ai-search/instances/{id}/jobs/{job_id}/logs",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[InsightGetResponse]._unwrapper,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ },
+ job_logs_params.JobLogsParams,
+ ),
+ post_parser=ResultWrapper[JobLogsResponse]._unwrapper,
),
- cast_to=cast(Type[InsightGetResponse], ResultWrapper[InsightGetResponse]),
+ cast_to=cast(Type[JobLogsResponse], ResultWrapper[JobLogsResponse]),
)
-class AsyncInsightsResource(AsyncAPIResource):
+class AsyncJobsResource(AsyncAPIResource):
@cached_property
- def with_raw_response(self) -> AsyncInsightsResourceWithRawResponse:
+ def with_raw_response(self) -> AsyncJobsResourceWithRawResponse:
"""
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 AsyncInsightsResourceWithRawResponse(self)
+ return AsyncJobsResourceWithRawResponse(self)
@cached_property
- def with_streaming_response(self) -> AsyncInsightsResourceWithStreamingResponse:
+ def with_streaming_response(self) -> AsyncJobsResourceWithStreamingResponse:
"""
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 AsyncInsightsResourceWithStreamingResponse(self)
+ return AsyncJobsResourceWithStreamingResponse(self)
async def create(
self,
- event_id: str,
+ id: str,
*,
account_id: str,
- content: 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,
- ) -> InsightCreateResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> JobCreateResponse:
"""
- Adds an insight to an event
+ Create new job
Args:
- account_id: Account ID.
-
- event_id: Event UUID.
+ id: Use your AI Search ID.
extra_headers: Send extra headers
@@ -294,43 +289,39 @@ async def create(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not event_id:
- raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
+ if not id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
return await self._post(
- f"/accounts/{account_id}/cloudforce-one/events/{event_id}/insight/create",
- body=await async_maybe_transform({"content": content}, insight_create_params.InsightCreateParams),
+ f"/accounts/{account_id}/ai-search/instances/{id}/jobs",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[InsightCreateResponse]._unwrapper,
+ post_parser=ResultWrapper[JobCreateResponse]._unwrapper,
),
- cast_to=cast(Type[InsightCreateResponse], ResultWrapper[InsightCreateResponse]),
+ cast_to=cast(Type[JobCreateResponse], ResultWrapper[JobCreateResponse]),
)
- async def delete(
+ def list(
self,
- insight_id: str,
+ id: str,
*,
account_id: str,
- event_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
- ) -> InsightDeleteResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> AsyncPaginator[JobListResponse, AsyncV4PagePaginationArray[JobListResponse]]:
"""
- Deletes an event insight
+ List Jobs
Args:
- account_id: Account ID.
-
- event_id: Event UUID.
-
- insight_id: Insight UUID.
+ id: Use your AI Search ID.
extra_headers: Send extra headers
@@ -342,45 +333,45 @@ async def delete(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not event_id:
- raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
- if not insight_id:
- raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}")
- return await self._delete(
- f"/accounts/{account_id}/cloudforce-one/events/{event_id}/insight/{insight_id}",
+ if not id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/ai-search/instances/{id}/jobs",
+ page=AsyncV4PagePaginationArray[JobListResponse],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[InsightDeleteResponse]._unwrapper,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ },
+ job_list_params.JobListParams,
+ ),
),
- cast_to=cast(Type[InsightDeleteResponse], ResultWrapper[InsightDeleteResponse]),
+ model=JobListResponse,
)
- async def edit(
+ async def get(
self,
- insight_id: str,
+ job_id: str,
*,
account_id: str,
- event_id: str,
- content: str,
+ 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,
- ) -> InsightEditResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> JobGetResponse:
"""
- Updates an event insight
+ Get a Job Details
Args:
- account_id: Account ID.
-
- event_id: Event UUID.
-
- insight_id: Insight UUID.
+ id: Use your AI Search ID.
extra_headers: Send extra headers
@@ -392,45 +383,42 @@ async def edit(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not event_id:
- raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
- if not insight_id:
- raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}")
- return await self._patch(
- f"/accounts/{account_id}/cloudforce-one/events/{event_id}/insight/{insight_id}",
- body=await async_maybe_transform({"content": content}, insight_edit_params.InsightEditParams),
+ if not id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ if not job_id:
+ raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-search/instances/{id}/jobs/{job_id}",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[InsightEditResponse]._unwrapper,
+ post_parser=ResultWrapper[JobGetResponse]._unwrapper,
),
- cast_to=cast(Type[InsightEditResponse], ResultWrapper[InsightEditResponse]),
+ cast_to=cast(Type[JobGetResponse], ResultWrapper[JobGetResponse]),
)
- async def get(
+ async def logs(
self,
- insight_id: str,
+ job_id: str,
*,
account_id: str,
- event_id: str,
+ id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
- ) -> InsightGetResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> JobLogsResponse:
"""
- Reads an event insight
+ List Job Logs
Args:
- account_id: Account ID.
-
- event_id: Event UUID.
-
- insight_id: Insight UUID.
+ id: Use your AI Search ID.
extra_headers: Send extra headers
@@ -442,90 +430,97 @@ async def get(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- if not event_id:
- raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}")
- if not insight_id:
- raise ValueError(f"Expected a non-empty value for `insight_id` but received {insight_id!r}")
+ if not id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ if not job_id:
+ raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}")
return await self._get(
- f"/accounts/{account_id}/cloudforce-one/events/{event_id}/insight/{insight_id}",
+ f"/accounts/{account_id}/ai-search/instances/{id}/jobs/{job_id}/logs",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[InsightGetResponse]._unwrapper,
+ query=await async_maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ },
+ job_logs_params.JobLogsParams,
+ ),
+ post_parser=ResultWrapper[JobLogsResponse]._unwrapper,
),
- cast_to=cast(Type[InsightGetResponse], ResultWrapper[InsightGetResponse]),
+ cast_to=cast(Type[JobLogsResponse], ResultWrapper[JobLogsResponse]),
)
-class InsightsResourceWithRawResponse:
- def __init__(self, insights: InsightsResource) -> None:
- self._insights = insights
+class JobsResourceWithRawResponse:
+ def __init__(self, jobs: JobsResource) -> None:
+ self._jobs = jobs
self.create = to_raw_response_wrapper(
- insights.create,
- )
- self.delete = to_raw_response_wrapper(
- insights.delete,
+ jobs.create,
)
- self.edit = to_raw_response_wrapper(
- insights.edit,
+ self.list = to_raw_response_wrapper(
+ jobs.list,
)
self.get = to_raw_response_wrapper(
- insights.get,
+ jobs.get,
+ )
+ self.logs = to_raw_response_wrapper(
+ jobs.logs,
)
-class AsyncInsightsResourceWithRawResponse:
- def __init__(self, insights: AsyncInsightsResource) -> None:
- self._insights = insights
+class AsyncJobsResourceWithRawResponse:
+ def __init__(self, jobs: AsyncJobsResource) -> None:
+ self._jobs = jobs
self.create = async_to_raw_response_wrapper(
- insights.create,
- )
- self.delete = async_to_raw_response_wrapper(
- insights.delete,
+ jobs.create,
)
- self.edit = async_to_raw_response_wrapper(
- insights.edit,
+ self.list = async_to_raw_response_wrapper(
+ jobs.list,
)
self.get = async_to_raw_response_wrapper(
- insights.get,
+ jobs.get,
+ )
+ self.logs = async_to_raw_response_wrapper(
+ jobs.logs,
)
-class InsightsResourceWithStreamingResponse:
- def __init__(self, insights: InsightsResource) -> None:
- self._insights = insights
+class JobsResourceWithStreamingResponse:
+ def __init__(self, jobs: JobsResource) -> None:
+ self._jobs = jobs
self.create = to_streamed_response_wrapper(
- insights.create,
- )
- self.delete = to_streamed_response_wrapper(
- insights.delete,
+ jobs.create,
)
- self.edit = to_streamed_response_wrapper(
- insights.edit,
+ self.list = to_streamed_response_wrapper(
+ jobs.list,
)
self.get = to_streamed_response_wrapper(
- insights.get,
+ jobs.get,
+ )
+ self.logs = to_streamed_response_wrapper(
+ jobs.logs,
)
-class AsyncInsightsResourceWithStreamingResponse:
- def __init__(self, insights: AsyncInsightsResource) -> None:
- self._insights = insights
+class AsyncJobsResourceWithStreamingResponse:
+ def __init__(self, jobs: AsyncJobsResource) -> None:
+ self._jobs = jobs
self.create = async_to_streamed_response_wrapper(
- insights.create,
- )
- self.delete = async_to_streamed_response_wrapper(
- insights.delete,
+ jobs.create,
)
- self.edit = async_to_streamed_response_wrapper(
- insights.edit,
+ self.list = async_to_streamed_response_wrapper(
+ jobs.list,
)
self.get = async_to_streamed_response_wrapper(
- insights.get,
+ jobs.get,
+ )
+ self.logs = async_to_streamed_response_wrapper(
+ jobs.logs,
)
diff --git a/src/cloudflare/resources/aisearch/tokens.py b/src/cloudflare/resources/aisearch/tokens.py
new file mode 100644
index 00000000000..1834a9b0c6a
--- /dev/null
+++ b/src/cloudflare/resources/aisearch/tokens.py
@@ -0,0 +1,605 @@
+# 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 Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._wrappers import ResultWrapper
+from ...pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.aisearch import token_list_params, token_create_params, token_update_params
+from ...types.aisearch.token_list_response import TokenListResponse
+from ...types.aisearch.token_read_response import TokenReadResponse
+from ...types.aisearch.token_create_response import TokenCreateResponse
+from ...types.aisearch.token_delete_response import TokenDeleteResponse
+from ...types.aisearch.token_update_response import TokenUpdateResponse
+
+__all__ = ["TokensResource", "AsyncTokensResource"]
+
+
+class TokensResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> TokensResourceWithRawResponse:
+ """
+ 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 TokensResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> TokensResourceWithStreamingResponse:
+ """
+ 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 TokensResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ account_id: str,
+ cf_api_id: str,
+ cf_api_key: str,
+ name: 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,
+ ) -> TokenCreateResponse:
+ """
+ Create new tokens.
+
+ Args:
+ 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._post(
+ f"/accounts/{account_id}/ai-search/tokens",
+ body=maybe_transform(
+ {
+ "cf_api_id": cf_api_id,
+ "cf_api_key": cf_api_key,
+ "name": name,
+ },
+ token_create_params.TokenCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TokenCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]),
+ )
+
+ def update(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ cf_api_id: str,
+ cf_api_key: str,
+ name: 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,
+ ) -> TokenUpdateResponse:
+ """
+ Update tokens.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._put(
+ f"/accounts/{account_id}/ai-search/tokens/{id}",
+ body=maybe_transform(
+ {
+ "cf_api_id": cf_api_id,
+ "cf_api_key": cf_api_key,
+ "name": name,
+ },
+ token_update_params.TokenUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TokenUpdateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TokenUpdateResponse], ResultWrapper[TokenUpdateResponse]),
+ )
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ # 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,
+ ) -> SyncV4PagePaginationArray[TokenListResponse]:
+ """
+ List tokens.
+
+ Args:
+ 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}/ai-search/tokens",
+ page=SyncV4PagePaginationArray[TokenListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ },
+ token_list_params.TokenListParams,
+ ),
+ ),
+ model=TokenListResponse,
+ )
+
+ def delete(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> TokenDeleteResponse:
+ """
+ Delete tokens.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._delete(
+ f"/accounts/{account_id}/ai-search/tokens/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TokenDeleteResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TokenDeleteResponse], ResultWrapper[TokenDeleteResponse]),
+ )
+
+ def read(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> TokenReadResponse:
+ """
+ Read tokens.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return self._get(
+ f"/accounts/{account_id}/ai-search/tokens/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TokenReadResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TokenReadResponse], ResultWrapper[TokenReadResponse]),
+ )
+
+
+class AsyncTokensResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncTokensResourceWithRawResponse:
+ """
+ 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 AsyncTokensResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncTokensResourceWithStreamingResponse:
+ """
+ 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 AsyncTokensResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ account_id: str,
+ cf_api_id: str,
+ cf_api_key: str,
+ name: 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,
+ ) -> TokenCreateResponse:
+ """
+ Create new tokens.
+
+ Args:
+ 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 await self._post(
+ f"/accounts/{account_id}/ai-search/tokens",
+ body=await async_maybe_transform(
+ {
+ "cf_api_id": cf_api_id,
+ "cf_api_key": cf_api_key,
+ "name": name,
+ },
+ token_create_params.TokenCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TokenCreateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]),
+ )
+
+ async def update(
+ self,
+ id: str,
+ *,
+ account_id: str,
+ cf_api_id: str,
+ cf_api_key: str,
+ name: 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,
+ ) -> TokenUpdateResponse:
+ """
+ Update tokens.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._put(
+ f"/accounts/{account_id}/ai-search/tokens/{id}",
+ body=await async_maybe_transform(
+ {
+ "cf_api_id": cf_api_id,
+ "cf_api_key": cf_api_key,
+ "name": name,
+ },
+ token_update_params.TokenUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TokenUpdateResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TokenUpdateResponse], ResultWrapper[TokenUpdateResponse]),
+ )
+
+ def list(
+ self,
+ *,
+ account_id: str,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ # 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[TokenListResponse, AsyncV4PagePaginationArray[TokenListResponse]]:
+ """
+ List tokens.
+
+ Args:
+ 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}/ai-search/tokens",
+ page=AsyncV4PagePaginationArray[TokenListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "page": page,
+ "per_page": per_page,
+ },
+ token_list_params.TokenListParams,
+ ),
+ ),
+ model=TokenListResponse,
+ )
+
+ async def delete(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> TokenDeleteResponse:
+ """
+ Delete tokens.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._delete(
+ f"/accounts/{account_id}/ai-search/tokens/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TokenDeleteResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TokenDeleteResponse], ResultWrapper[TokenDeleteResponse]),
+ )
+
+ async def read(
+ self,
+ id: str,
+ *,
+ 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,
+ ) -> TokenReadResponse:
+ """
+ Read tokens.
+
+ Args:
+ 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 id:
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/ai-search/tokens/{id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[TokenReadResponse]._unwrapper,
+ ),
+ cast_to=cast(Type[TokenReadResponse], ResultWrapper[TokenReadResponse]),
+ )
+
+
+class TokensResourceWithRawResponse:
+ def __init__(self, tokens: TokensResource) -> None:
+ self._tokens = tokens
+
+ self.create = to_raw_response_wrapper(
+ tokens.create,
+ )
+ self.update = to_raw_response_wrapper(
+ tokens.update,
+ )
+ self.list = to_raw_response_wrapper(
+ tokens.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ tokens.delete,
+ )
+ self.read = to_raw_response_wrapper(
+ tokens.read,
+ )
+
+
+class AsyncTokensResourceWithRawResponse:
+ def __init__(self, tokens: AsyncTokensResource) -> None:
+ self._tokens = tokens
+
+ self.create = async_to_raw_response_wrapper(
+ tokens.create,
+ )
+ self.update = async_to_raw_response_wrapper(
+ tokens.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ tokens.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ tokens.delete,
+ )
+ self.read = async_to_raw_response_wrapper(
+ tokens.read,
+ )
+
+
+class TokensResourceWithStreamingResponse:
+ def __init__(self, tokens: TokensResource) -> None:
+ self._tokens = tokens
+
+ self.create = to_streamed_response_wrapper(
+ tokens.create,
+ )
+ self.update = to_streamed_response_wrapper(
+ tokens.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ tokens.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ tokens.delete,
+ )
+ self.read = to_streamed_response_wrapper(
+ tokens.read,
+ )
+
+
+class AsyncTokensResourceWithStreamingResponse:
+ def __init__(self, tokens: AsyncTokensResource) -> None:
+ self._tokens = tokens
+
+ self.create = async_to_streamed_response_wrapper(
+ tokens.create,
+ )
+ self.update = async_to_streamed_response_wrapper(
+ tokens.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ tokens.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ tokens.delete,
+ )
+ self.read = async_to_streamed_response_wrapper(
+ tokens.read,
+ )
diff --git a/src/cloudflare/resources/alerting/__init__.py b/src/cloudflare/resources/alerting/__init__.py
index 2bf1c17a8f3..28d682d357e 100644
--- a/src/cloudflare/resources/alerting/__init__.py
+++ b/src/cloudflare/resources/alerting/__init__.py
@@ -24,6 +24,14 @@
PoliciesResourceWithStreamingResponse,
AsyncPoliciesResourceWithStreamingResponse,
)
+from .silences import (
+ SilencesResource,
+ AsyncSilencesResource,
+ SilencesResourceWithRawResponse,
+ AsyncSilencesResourceWithRawResponse,
+ SilencesResourceWithStreamingResponse,
+ AsyncSilencesResourceWithStreamingResponse,
+)
from .destinations import (
DestinationsResource,
AsyncDestinationsResource,
@@ -66,6 +74,12 @@
"AsyncPoliciesResourceWithRawResponse",
"PoliciesResourceWithStreamingResponse",
"AsyncPoliciesResourceWithStreamingResponse",
+ "SilencesResource",
+ "AsyncSilencesResource",
+ "SilencesResourceWithRawResponse",
+ "AsyncSilencesResourceWithRawResponse",
+ "SilencesResourceWithStreamingResponse",
+ "AsyncSilencesResourceWithStreamingResponse",
"AlertingResource",
"AsyncAlertingResource",
"AlertingResourceWithRawResponse",
diff --git a/src/cloudflare/resources/alerting/alerting.py b/src/cloudflare/resources/alerting/alerting.py
index faa242b37cb..861ef11fc49 100644
--- a/src/cloudflare/resources/alerting/alerting.py
+++ b/src/cloudflare/resources/alerting/alerting.py
@@ -18,6 +18,14 @@
PoliciesResourceWithStreamingResponse,
AsyncPoliciesResourceWithStreamingResponse,
)
+from .silences import (
+ SilencesResource,
+ AsyncSilencesResource,
+ SilencesResourceWithRawResponse,
+ AsyncSilencesResourceWithRawResponse,
+ SilencesResourceWithStreamingResponse,
+ AsyncSilencesResourceWithStreamingResponse,
+)
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from .available_alerts import (
@@ -57,6 +65,10 @@ def history(self) -> HistoryResource:
def policies(self) -> PoliciesResource:
return PoliciesResource(self._client)
+ @cached_property
+ def silences(self) -> SilencesResource:
+ return SilencesResource(self._client)
+
@cached_property
def with_raw_response(self) -> AlertingResourceWithRawResponse:
"""
@@ -94,6 +106,10 @@ def history(self) -> AsyncHistoryResource:
def policies(self) -> AsyncPoliciesResource:
return AsyncPoliciesResource(self._client)
+ @cached_property
+ def silences(self) -> AsyncSilencesResource:
+ return AsyncSilencesResource(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncAlertingResourceWithRawResponse:
"""
@@ -134,6 +150,10 @@ def history(self) -> HistoryResourceWithRawResponse:
def policies(self) -> PoliciesResourceWithRawResponse:
return PoliciesResourceWithRawResponse(self._alerting.policies)
+ @cached_property
+ def silences(self) -> SilencesResourceWithRawResponse:
+ return SilencesResourceWithRawResponse(self._alerting.silences)
+
class AsyncAlertingResourceWithRawResponse:
def __init__(self, alerting: AsyncAlertingResource) -> None:
@@ -155,6 +175,10 @@ def history(self) -> AsyncHistoryResourceWithRawResponse:
def policies(self) -> AsyncPoliciesResourceWithRawResponse:
return AsyncPoliciesResourceWithRawResponse(self._alerting.policies)
+ @cached_property
+ def silences(self) -> AsyncSilencesResourceWithRawResponse:
+ return AsyncSilencesResourceWithRawResponse(self._alerting.silences)
+
class AlertingResourceWithStreamingResponse:
def __init__(self, alerting: AlertingResource) -> None:
@@ -176,6 +200,10 @@ def history(self) -> HistoryResourceWithStreamingResponse:
def policies(self) -> PoliciesResourceWithStreamingResponse:
return PoliciesResourceWithStreamingResponse(self._alerting.policies)
+ @cached_property
+ def silences(self) -> SilencesResourceWithStreamingResponse:
+ return SilencesResourceWithStreamingResponse(self._alerting.silences)
+
class AsyncAlertingResourceWithStreamingResponse:
def __init__(self, alerting: AsyncAlertingResource) -> None:
@@ -196,3 +224,7 @@ def history(self) -> AsyncHistoryResourceWithStreamingResponse:
@cached_property
def policies(self) -> AsyncPoliciesResourceWithStreamingResponse:
return AsyncPoliciesResourceWithStreamingResponse(self._alerting.policies)
+
+ @cached_property
+ def silences(self) -> AsyncSilencesResourceWithStreamingResponse:
+ return AsyncSilencesResourceWithStreamingResponse(self._alerting.silences)
diff --git a/src/cloudflare/resources/alerting/available_alerts.py b/src/cloudflare/resources/alerting/available_alerts.py
index 713f9e8db34..1286d27f1e6 100644
--- a/src/cloudflare/resources/alerting/available_alerts.py
+++ b/src/cloudflare/resources/alerting/available_alerts.py
@@ -6,7 +6,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Query, Headers, NotGiven, not_given
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -51,7 +51,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AvailableAlertListResponse]:
"""
Gets a list of all alert types for which an account is eligible.
@@ -111,7 +111,7 @@ async def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[AvailableAlertListResponse]:
"""
Gets a list of all alert types for which an account is eligible.
diff --git a/src/cloudflare/resources/alerting/destinations/eligible.py b/src/cloudflare/resources/alerting/destinations/eligible.py
index b93d17a6409..76a61c05f51 100644
--- a/src/cloudflare/resources/alerting/destinations/eligible.py
+++ b/src/cloudflare/resources/alerting/destinations/eligible.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -51,7 +51,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[EligibleGetResponse]:
"""
Get a list of all delivery mechanism types for which an account is eligible.
@@ -111,7 +111,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[EligibleGetResponse]:
"""
Get a list of all delivery mechanism types for which an account is eligible.
diff --git a/src/cloudflare/resources/alerting/destinations/pagerduty.py b/src/cloudflare/resources/alerting/destinations/pagerduty.py
index 035b26f0af8..223dfead7a8 100644
--- a/src/cloudflare/resources/alerting/destinations/pagerduty.py
+++ b/src/cloudflare/resources/alerting/destinations/pagerduty.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -55,7 +55,7 @@ def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[PagerdutyCreateResponse]:
"""
Creates a new token for integrating with PagerDuty.
@@ -94,7 +94,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> PagerdutyDeleteResponse:
"""
Deletes all the PagerDuty Services connected to the account.
@@ -129,7 +129,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[Pagerduty]:
"""
Get a list of all configured PagerDuty services.
@@ -166,7 +166,7 @@ def link(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[PagerdutyLinkResponse]:
"""
Links PagerDuty with the account using the integration token.
@@ -230,7 +230,7 @@ async def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[PagerdutyCreateResponse]:
"""
Creates a new token for integrating with PagerDuty.
@@ -269,7 +269,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> PagerdutyDeleteResponse:
"""
Deletes all the PagerDuty Services connected to the account.
@@ -304,7 +304,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Pagerduty, AsyncSinglePage[Pagerduty]]:
"""
Get a list of all configured PagerDuty services.
@@ -341,7 +341,7 @@ async def link(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[PagerdutyLinkResponse]:
"""
Links PagerDuty with the account using the integration token.
diff --git a/src/cloudflare/resources/alerting/destinations/webhooks.py b/src/cloudflare/resources/alerting/destinations/webhooks.py
index 09c887d2d93..9a83705a4fd 100644
--- a/src/cloudflare/resources/alerting/destinations/webhooks.py
+++ b/src/cloudflare/resources/alerting/destinations/webhooks.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -54,13 +54,13 @@ def create(
account_id: str,
name: str,
url: str,
- secret: str | NotGiven = NOT_GIVEN,
+ secret: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[WebhookCreateResponse]:
"""
Creates a new webhook destination.
@@ -114,13 +114,13 @@ def update(
account_id: str,
name: str,
url: str,
- secret: str | NotGiven = NOT_GIVEN,
+ secret: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[WebhookUpdateResponse]:
"""
Update a webhook destination.
@@ -180,7 +180,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[Webhooks]:
"""
Gets a list of all configured webhook destinations.
@@ -217,7 +217,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebhookDeleteResponse:
"""
Delete a configured webhook destination.
@@ -257,7 +257,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Webhooks]:
"""
Get details for a single webhooks destination.
@@ -318,13 +318,13 @@ async def create(
account_id: str,
name: str,
url: str,
- secret: str | NotGiven = NOT_GIVEN,
+ secret: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[WebhookCreateResponse]:
"""
Creates a new webhook destination.
@@ -378,13 +378,13 @@ async def update(
account_id: str,
name: str,
url: str,
- secret: str | NotGiven = NOT_GIVEN,
+ secret: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[WebhookUpdateResponse]:
"""
Update a webhook destination.
@@ -444,7 +444,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Webhooks, AsyncSinglePage[Webhooks]]:
"""
Gets a list of all configured webhook destinations.
@@ -481,7 +481,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> WebhookDeleteResponse:
"""
Delete a configured webhook destination.
@@ -521,7 +521,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Webhooks]:
"""
Get details for a single webhooks destination.
diff --git a/src/cloudflare/resources/alerting/history.py b/src/cloudflare/resources/alerting/history.py
index 23733d5fa65..8eee416174e 100644
--- a/src/cloudflare/resources/alerting/history.py
+++ b/src/cloudflare/resources/alerting/history.py
@@ -7,7 +7,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -49,16 +49,16 @@ def list(
self,
*,
account_id: str,
- before: Union[str, datetime] | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
- since: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ before: Union[str, datetime] | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
+ since: Union[str, datetime] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[History]:
"""Gets a list of history records for notifications sent to an account.
@@ -135,16 +135,16 @@ def list(
self,
*,
account_id: str,
- before: Union[str, datetime] | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
- since: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ before: Union[str, datetime] | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
+ since: Union[str, datetime] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[History, AsyncV4PagePaginationArray[History]]:
"""Gets a list of history records for notifications sent to an account.
diff --git a/src/cloudflare/resources/alerting/policies.py b/src/cloudflare/resources/alerting/policies.py
index 352c836cc12..8f8115ecd60 100644
--- a/src/cloudflare/resources/alerting/policies.py
+++ b/src/cloudflare/resources/alerting/policies.py
@@ -7,7 +7,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -56,6 +56,7 @@ def create(
*,
account_id: str,
alert_type: Literal[
+ "abuse_report_alert",
"access_custom_certificate_expiration_type",
"advanced_ddos_attack_l4_alert",
"advanced_ddos_attack_l7_alert",
@@ -127,15 +128,15 @@ def create(
enabled: bool,
mechanisms: MechanismParam,
name: str,
- alert_interval: str | NotGiven = NOT_GIVEN,
- description: str | NotGiven = NOT_GIVEN,
- filters: PolicyFilterParam | NotGiven = NOT_GIVEN,
+ alert_interval: str | Omit = omit,
+ description: str | Omit = omit,
+ filters: PolicyFilterParam | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[PolicyCreateResponse]:
"""
Creates a new Notification policy.
@@ -202,8 +203,9 @@ def update(
policy_id: str,
*,
account_id: str,
- alert_interval: str | NotGiven = NOT_GIVEN,
+ alert_interval: str | Omit = omit,
alert_type: Literal[
+ "abuse_report_alert",
"access_custom_certificate_expiration_type",
"advanced_ddos_attack_l4_alert",
"advanced_ddos_attack_l7_alert",
@@ -272,18 +274,18 @@ def update(
"web_analytics_metrics_update",
"zone_aop_custom_certificate_expiration_type",
]
- | NotGiven = NOT_GIVEN,
- description: str | NotGiven = NOT_GIVEN,
- enabled: bool | NotGiven = NOT_GIVEN,
- filters: PolicyFilterParam | NotGiven = NOT_GIVEN,
- mechanisms: MechanismParam | NotGiven = NOT_GIVEN,
- name: str | NotGiven = NOT_GIVEN,
+ | Omit = omit,
+ description: str | Omit = omit,
+ enabled: bool | Omit = omit,
+ filters: PolicyFilterParam | Omit = omit,
+ mechanisms: MechanismParam | Omit = omit,
+ name: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[PolicyUpdateResponse]:
"""
Update a Notification policy.
@@ -358,7 +360,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[Policy]:
"""
Get a list of all Notification policies.
@@ -395,7 +397,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> PolicyDeleteResponse:
"""
Delete a Notification policy.
@@ -435,7 +437,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Policy]:
"""
Get details for a single policy.
@@ -495,6 +497,7 @@ async def create(
*,
account_id: str,
alert_type: Literal[
+ "abuse_report_alert",
"access_custom_certificate_expiration_type",
"advanced_ddos_attack_l4_alert",
"advanced_ddos_attack_l7_alert",
@@ -566,15 +569,15 @@ async def create(
enabled: bool,
mechanisms: MechanismParam,
name: str,
- alert_interval: str | NotGiven = NOT_GIVEN,
- description: str | NotGiven = NOT_GIVEN,
- filters: PolicyFilterParam | NotGiven = NOT_GIVEN,
+ alert_interval: str | Omit = omit,
+ description: str | Omit = omit,
+ filters: PolicyFilterParam | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[PolicyCreateResponse]:
"""
Creates a new Notification policy.
@@ -641,8 +644,9 @@ async def update(
policy_id: str,
*,
account_id: str,
- alert_interval: str | NotGiven = NOT_GIVEN,
+ alert_interval: str | Omit = omit,
alert_type: Literal[
+ "abuse_report_alert",
"access_custom_certificate_expiration_type",
"advanced_ddos_attack_l4_alert",
"advanced_ddos_attack_l7_alert",
@@ -711,18 +715,18 @@ async def update(
"web_analytics_metrics_update",
"zone_aop_custom_certificate_expiration_type",
]
- | NotGiven = NOT_GIVEN,
- description: str | NotGiven = NOT_GIVEN,
- enabled: bool | NotGiven = NOT_GIVEN,
- filters: PolicyFilterParam | NotGiven = NOT_GIVEN,
- mechanisms: MechanismParam | NotGiven = NOT_GIVEN,
- name: str | NotGiven = NOT_GIVEN,
+ | Omit = omit,
+ description: str | Omit = omit,
+ enabled: bool | Omit = omit,
+ filters: PolicyFilterParam | Omit = omit,
+ mechanisms: MechanismParam | Omit = omit,
+ name: str | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[PolicyUpdateResponse]:
"""
Update a Notification policy.
@@ -797,7 +801,7 @@ def list(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[Policy, AsyncSinglePage[Policy]]:
"""
Get a list of all Notification policies.
@@ -834,7 +838,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> PolicyDeleteResponse:
"""
Delete a Notification policy.
@@ -874,7 +878,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[Policy]:
"""
Get details for a single policy.
diff --git a/src/cloudflare/resources/alerting/silences.py b/src/cloudflare/resources/alerting/silences.py
new file mode 100644
index 00000000000..a024012b058
--- /dev/null
+++ b/src/cloudflare/resources/alerting/silences.py
@@ -0,0 +1,547 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Type, Iterable, Optional, cast
+
+import httpx
+
+from ..._types import Body, Query, Headers, NotGiven, not_given
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._wrappers import ResultWrapper
+from ...pagination import SyncSinglePage, AsyncSinglePage
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.alerting import silence_create_params, silence_update_params
+from ...types.alerting.silence_get_response import SilenceGetResponse
+from ...types.alerting.silence_list_response import SilenceListResponse
+from ...types.alerting.silence_create_response import SilenceCreateResponse
+from ...types.alerting.silence_delete_response import SilenceDeleteResponse
+from ...types.alerting.silence_update_response import SilenceUpdateResponse
+
+__all__ = ["SilencesResource", "AsyncSilencesResource"]
+
+
+class SilencesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> SilencesResourceWithRawResponse:
+ """
+ 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 SilencesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> SilencesResourceWithStreamingResponse:
+ """
+ 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 SilencesResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ account_id: str,
+ body: Iterable[silence_create_params.Body],
+ # 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,
+ ) -> SilenceCreateResponse:
+ """
+ Creates a new silence for an account.
+
+ Args:
+ account_id: The account 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}")
+ return self._post(
+ f"/accounts/{account_id}/alerting/v3/silences",
+ body=maybe_transform(body, Iterable[silence_create_params.Body]),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=SilenceCreateResponse,
+ )
+
+ def update(
+ self,
+ *,
+ account_id: str,
+ body: Iterable[silence_update_params.Body],
+ # 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[SilenceUpdateResponse]:
+ """
+ Updates existing silences for an account.
+
+ Args:
+ account_id: The account 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}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/alerting/v3/silences",
+ page=SyncSinglePage[SilenceUpdateResponse],
+ body=maybe_transform(body, Iterable[silence_update_params.Body]),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=SilenceUpdateResponse,
+ method="put",
+ )
+
+ def list(
+ 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[SilenceListResponse]:
+ """
+ Gets a list of silences for an account.
+
+ Args:
+ account_id: The account 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}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/alerting/v3/silences",
+ page=SyncSinglePage[SilenceListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=SilenceListResponse,
+ )
+
+ def delete(
+ self,
+ silence_id: str,
+ *,
+ 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,
+ ) -> SilenceDeleteResponse:
+ """
+ Deletes an existing silence for an account.
+
+ Args:
+ account_id: The account id
+
+ silence_id: Silence 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 silence_id:
+ raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}")
+ return self._delete(
+ f"/accounts/{account_id}/alerting/v3/silences/{silence_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=SilenceDeleteResponse,
+ )
+
+ def get(
+ self,
+ silence_id: str,
+ *,
+ 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,
+ ) -> Optional[SilenceGetResponse]:
+ """
+ Gets a specific silence for an account.
+
+ Args:
+ account_id: The account id
+
+ silence_id: Silence 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 silence_id:
+ raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}")
+ return self._get(
+ f"/accounts/{account_id}/alerting/v3/silences/{silence_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[SilenceGetResponse]]._unwrapper,
+ ),
+ cast_to=cast(Type[Optional[SilenceGetResponse]], ResultWrapper[SilenceGetResponse]),
+ )
+
+
+class AsyncSilencesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncSilencesResourceWithRawResponse:
+ """
+ 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 AsyncSilencesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncSilencesResourceWithStreamingResponse:
+ """
+ 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 AsyncSilencesResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ account_id: str,
+ body: Iterable[silence_create_params.Body],
+ # 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,
+ ) -> SilenceCreateResponse:
+ """
+ Creates a new silence for an account.
+
+ Args:
+ account_id: The account 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}")
+ return await self._post(
+ f"/accounts/{account_id}/alerting/v3/silences",
+ body=await async_maybe_transform(body, Iterable[silence_create_params.Body]),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=SilenceCreateResponse,
+ )
+
+ def update(
+ self,
+ *,
+ account_id: str,
+ body: Iterable[silence_update_params.Body],
+ # 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[SilenceUpdateResponse, AsyncSinglePage[SilenceUpdateResponse]]:
+ """
+ Updates existing silences for an account.
+
+ Args:
+ account_id: The account 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}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/alerting/v3/silences",
+ page=AsyncSinglePage[SilenceUpdateResponse],
+ body=maybe_transform(body, Iterable[silence_update_params.Body]),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=SilenceUpdateResponse,
+ method="put",
+ )
+
+ def list(
+ 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[SilenceListResponse, AsyncSinglePage[SilenceListResponse]]:
+ """
+ Gets a list of silences for an account.
+
+ Args:
+ account_id: The account 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}")
+ return self._get_api_list(
+ f"/accounts/{account_id}/alerting/v3/silences",
+ page=AsyncSinglePage[SilenceListResponse],
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ model=SilenceListResponse,
+ )
+
+ async def delete(
+ self,
+ silence_id: str,
+ *,
+ 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,
+ ) -> SilenceDeleteResponse:
+ """
+ Deletes an existing silence for an account.
+
+ Args:
+ account_id: The account id
+
+ silence_id: Silence 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 silence_id:
+ raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}")
+ return await self._delete(
+ f"/accounts/{account_id}/alerting/v3/silences/{silence_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=SilenceDeleteResponse,
+ )
+
+ async def get(
+ self,
+ silence_id: str,
+ *,
+ 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,
+ ) -> Optional[SilenceGetResponse]:
+ """
+ Gets a specific silence for an account.
+
+ Args:
+ account_id: The account id
+
+ silence_id: Silence 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 silence_id:
+ raise ValueError(f"Expected a non-empty value for `silence_id` but received {silence_id!r}")
+ return await self._get(
+ f"/accounts/{account_id}/alerting/v3/silences/{silence_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[SilenceGetResponse]]._unwrapper,
+ ),
+ cast_to=cast(Type[Optional[SilenceGetResponse]], ResultWrapper[SilenceGetResponse]),
+ )
+
+
+class SilencesResourceWithRawResponse:
+ def __init__(self, silences: SilencesResource) -> None:
+ self._silences = silences
+
+ self.create = to_raw_response_wrapper(
+ silences.create,
+ )
+ self.update = to_raw_response_wrapper(
+ silences.update,
+ )
+ self.list = to_raw_response_wrapper(
+ silences.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ silences.delete,
+ )
+ self.get = to_raw_response_wrapper(
+ silences.get,
+ )
+
+
+class AsyncSilencesResourceWithRawResponse:
+ def __init__(self, silences: AsyncSilencesResource) -> None:
+ self._silences = silences
+
+ self.create = async_to_raw_response_wrapper(
+ silences.create,
+ )
+ self.update = async_to_raw_response_wrapper(
+ silences.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ silences.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ silences.delete,
+ )
+ self.get = async_to_raw_response_wrapper(
+ silences.get,
+ )
+
+
+class SilencesResourceWithStreamingResponse:
+ def __init__(self, silences: SilencesResource) -> None:
+ self._silences = silences
+
+ self.create = to_streamed_response_wrapper(
+ silences.create,
+ )
+ self.update = to_streamed_response_wrapper(
+ silences.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ silences.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ silences.delete,
+ )
+ self.get = to_streamed_response_wrapper(
+ silences.get,
+ )
+
+
+class AsyncSilencesResourceWithStreamingResponse:
+ def __init__(self, silences: AsyncSilencesResource) -> None:
+ self._silences = silences
+
+ self.create = async_to_streamed_response_wrapper(
+ silences.create,
+ )
+ self.update = async_to_streamed_response_wrapper(
+ silences.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ silences.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ silences.delete,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ silences.get,
+ )
diff --git a/src/cloudflare/resources/api_gateway/configurations.py b/src/cloudflare/resources/api_gateway/configurations.py
index 7e9a062efaa..96cebe13223 100644
--- a/src/cloudflare/resources/api_gateway/configurations.py
+++ b/src/cloudflare/resources/api_gateway/configurations.py
@@ -2,12 +2,11 @@
from __future__ import annotations
-from typing import List, Type, Iterable, cast
-from typing_extensions import Literal
+from typing import Type, Iterable, cast
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -21,7 +20,6 @@
from ..._base_client import make_request_options
from ...types.api_gateway import configuration_get_params, configuration_update_params
from ...types.api_gateway.configuration import Configuration
-from ...types.api_gateway.configuration_update_response import ConfigurationUpdateResponse
__all__ = ["ConfigurationsResource", "AsyncConfigurationsResource"]
@@ -51,19 +49,22 @@ def update(
*,
zone_id: str,
auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic],
+ normalize: bool | Omit = omit,
# 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,
- ) -> ConfigurationUpdateResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> Configuration:
"""
- Set configuration properties
+ Update configuration properties
Args:
zone_id: Identifier.
+ normalize: Ensures that the configuration is written or retrieved in normalized fashion
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -81,22 +82,27 @@ def update(
configuration_update_params.ConfigurationUpdateParams,
),
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({"normalize": normalize}, configuration_update_params.ConfigurationUpdateParams),
+ post_parser=ResultWrapper[Configuration]._unwrapper,
),
- cast_to=ConfigurationUpdateResponse,
+ cast_to=cast(Type[Configuration], ResultWrapper[Configuration]),
)
def get(
self,
*,
zone_id: str,
- properties: List[Literal["auth_id_characteristics"]] | NotGiven = NOT_GIVEN,
+ normalize: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Configuration:
"""
Retrieve information about specific configuration properties
@@ -104,7 +110,7 @@ def get(
Args:
zone_id: Identifier.
- properties: Requests information about certain properties.
+ normalize: Ensures that the configuration is written or retrieved in normalized fashion
extra_headers: Send extra headers
@@ -123,7 +129,7 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- query=maybe_transform({"properties": properties}, configuration_get_params.ConfigurationGetParams),
+ query=maybe_transform({"normalize": normalize}, configuration_get_params.ConfigurationGetParams),
post_parser=ResultWrapper[Configuration]._unwrapper,
),
cast_to=cast(Type[Configuration], ResultWrapper[Configuration]),
@@ -155,19 +161,22 @@ async def update(
*,
zone_id: str,
auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic],
+ normalize: bool | Omit = omit,
# 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,
- ) -> ConfigurationUpdateResponse:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> Configuration:
"""
- Set configuration properties
+ Update configuration properties
Args:
zone_id: Identifier.
+ normalize: Ensures that the configuration is written or retrieved in normalized fashion
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -185,22 +194,29 @@ async def update(
configuration_update_params.ConfigurationUpdateParams,
),
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=await async_maybe_transform(
+ {"normalize": normalize}, configuration_update_params.ConfigurationUpdateParams
+ ),
+ post_parser=ResultWrapper[Configuration]._unwrapper,
),
- cast_to=ConfigurationUpdateResponse,
+ cast_to=cast(Type[Configuration], ResultWrapper[Configuration]),
)
async def get(
self,
*,
zone_id: str,
- properties: List[Literal["auth_id_characteristics"]] | NotGiven = NOT_GIVEN,
+ normalize: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Configuration:
"""
Retrieve information about specific configuration properties
@@ -208,7 +224,7 @@ async def get(
Args:
zone_id: Identifier.
- properties: Requests information about certain properties.
+ normalize: Ensures that the configuration is written or retrieved in normalized fashion
extra_headers: Send extra headers
@@ -228,7 +244,7 @@ async def get(
extra_body=extra_body,
timeout=timeout,
query=await async_maybe_transform(
- {"properties": properties}, configuration_get_params.ConfigurationGetParams
+ {"normalize": normalize}, configuration_get_params.ConfigurationGetParams
),
post_parser=ResultWrapper[Configuration]._unwrapper,
),
diff --git a/src/cloudflare/resources/api_gateway/discovery/discovery.py b/src/cloudflare/resources/api_gateway/discovery/discovery.py
index a55f40cb832..a465c6fc4a9 100644
--- a/src/cloudflare/resources/api_gateway/discovery/discovery.py
+++ b/src/cloudflare/resources/api_gateway/discovery/discovery.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._compat import cached_property
from .operations import (
OperationsResource,
@@ -63,7 +63,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DiscoveryGetResponse:
"""
Retrieve the most up to date view of discovered operations, rendered as OpenAPI
@@ -128,7 +128,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> DiscoveryGetResponse:
"""
Retrieve the most up to date view of discovered operations, rendered as OpenAPI
diff --git a/src/cloudflare/resources/api_gateway/discovery/operations.py b/src/cloudflare/resources/api_gateway/discovery/operations.py
index db65d954216..76aeb31fde9 100644
--- a/src/cloudflare/resources/api_gateway/discovery/operations.py
+++ b/src/cloudflare/resources/api_gateway/discovery/operations.py
@@ -2,12 +2,12 @@
from __future__ import annotations
-from typing import Dict, List, Type, cast
+from typing import Dict, Type, cast
from typing_extensions import Literal
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -52,23 +52,23 @@ def list(
self,
*,
zone_id: str,
- diff: bool | NotGiven = NOT_GIVEN,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- endpoint: str | NotGiven = NOT_GIVEN,
- host: List[str] | NotGiven = NOT_GIVEN,
- method: List[str] | NotGiven = NOT_GIVEN,
+ diff: bool | Omit = omit,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ endpoint: str | Omit = omit,
+ host: SequenceNotStr[str] | Omit = omit,
+ method: SequenceNotStr[str] | Omit = omit,
order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"]
- | NotGiven = NOT_GIVEN,
- origin: Literal["ML", "SessionIdentifier", "LabelDiscovery"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- state: Literal["review", "saved", "ignored"] | NotGiven = NOT_GIVEN,
+ | Omit = omit,
+ origin: Literal["ML", "SessionIdentifier", "LabelDiscovery"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ state: Literal["review", "saved", "ignored"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[DiscoveryOperation]:
"""
Retrieve the most up to date view of discovered operations
@@ -156,7 +156,7 @@ def bulk_edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationBulkEditResponse:
"""
Update the `state` on one or more discovered operations
@@ -192,13 +192,13 @@ def edit(
operation_id: str,
*,
zone_id: str,
- state: Literal["review", "ignored"] | NotGiven = NOT_GIVEN,
+ state: Literal["review", "ignored"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationEditResponse:
"""
Update the `state` on a discovered operation
@@ -263,23 +263,23 @@ def list(
self,
*,
zone_id: str,
- diff: bool | NotGiven = NOT_GIVEN,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- endpoint: str | NotGiven = NOT_GIVEN,
- host: List[str] | NotGiven = NOT_GIVEN,
- method: List[str] | NotGiven = NOT_GIVEN,
+ diff: bool | Omit = omit,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ endpoint: str | Omit = omit,
+ host: SequenceNotStr[str] | Omit = omit,
+ method: SequenceNotStr[str] | Omit = omit,
order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"]
- | NotGiven = NOT_GIVEN,
- origin: Literal["ML", "SessionIdentifier", "LabelDiscovery"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- state: Literal["review", "saved", "ignored"] | NotGiven = NOT_GIVEN,
+ | Omit = omit,
+ origin: Literal["ML", "SessionIdentifier", "LabelDiscovery"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ state: Literal["review", "saved", "ignored"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[DiscoveryOperation, AsyncV4PagePaginationArray[DiscoveryOperation]]:
"""
Retrieve the most up to date view of discovered operations
@@ -367,7 +367,7 @@ async def bulk_edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationBulkEditResponse:
"""
Update the `state` on one or more discovered operations
@@ -403,13 +403,13 @@ async def edit(
operation_id: str,
*,
zone_id: str,
- state: Literal["review", "ignored"] | NotGiven = NOT_GIVEN,
+ state: Literal["review", "ignored"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationEditResponse:
"""
Update the `state` on a discovered operation
diff --git a/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py b/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py
index 828ebad4865..1434470cfad 100644
--- a/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py
+++ b/src/cloudflare/resources/api_gateway/expression_template/fallthrough.py
@@ -2,11 +2,11 @@
from __future__ import annotations
-from typing import List, Type, cast
+from typing import Type, cast
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, SequenceNotStr, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -48,13 +48,13 @@ def create(
self,
*,
zone_id: str,
- hosts: List[str],
+ hosts: SequenceNotStr[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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> FallthroughCreateResponse:
"""
Generate fallthrough WAF expression template from a set of API hosts
@@ -112,13 +112,13 @@ async def create(
self,
*,
zone_id: str,
- hosts: List[str],
+ hosts: SequenceNotStr[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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> FallthroughCreateResponse:
"""
Generate fallthrough WAF expression template from a set of API hosts
diff --git a/src/cloudflare/resources/api_gateway/operations/operations.py b/src/cloudflare/resources/api_gateway/operations/operations.py
index 5e168e8238f..1a6038c3688 100644
--- a/src/cloudflare/resources/api_gateway/operations/operations.py
+++ b/src/cloudflare/resources/api_gateway/operations/operations.py
@@ -7,7 +7,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -80,7 +80,7 @@ def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationCreateResponse:
"""Add one operation to a zone.
@@ -136,20 +136,20 @@ def list(
self,
*,
zone_id: str,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- endpoint: str | NotGiven = NOT_GIVEN,
- feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN,
- host: List[str] | NotGiven = NOT_GIVEN,
- method: List[str] | NotGiven = NOT_GIVEN,
- order: Literal["method", "host", "endpoint", "thresholds.$key"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ endpoint: str | Omit = omit,
+ feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | Omit = omit,
+ host: SequenceNotStr[str] | Omit = omit,
+ method: SequenceNotStr[str] | Omit = omit,
+ order: Literal["method", "host", "endpoint", "thresholds.$key"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[OperationListResponse]:
"""
Retrieve information about all operations on a zone
@@ -221,7 +221,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationDeleteResponse:
"""
Delete an operation
@@ -261,7 +261,7 @@ def bulk_create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncSinglePage[OperationBulkCreateResponse]:
"""Add one or more operations to a zone.
@@ -304,7 +304,7 @@ def bulk_delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationBulkDeleteResponse:
"""
Delete multiple operations
@@ -335,13 +335,13 @@ def get(
operation_id: str,
*,
zone_id: str,
- feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN,
+ feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationGetResponse:
"""
Retrieve information about an operation
@@ -417,7 +417,7 @@ async def create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationCreateResponse:
"""Add one operation to a zone.
@@ -473,20 +473,20 @@ def list(
self,
*,
zone_id: str,
- direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
- endpoint: str | NotGiven = NOT_GIVEN,
- feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN,
- host: List[str] | NotGiven = NOT_GIVEN,
- method: List[str] | NotGiven = NOT_GIVEN,
- order: Literal["method", "host", "endpoint", "thresholds.$key"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
+ direction: Literal["asc", "desc"] | Omit = omit,
+ endpoint: str | Omit = omit,
+ feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | Omit = omit,
+ host: SequenceNotStr[str] | Omit = omit,
+ method: SequenceNotStr[str] | Omit = omit,
+ order: Literal["method", "host", "endpoint", "thresholds.$key"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[OperationListResponse, AsyncV4PagePaginationArray[OperationListResponse]]:
"""
Retrieve information about all operations on a zone
@@ -558,7 +558,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationDeleteResponse:
"""
Delete an operation
@@ -598,7 +598,7 @@ def bulk_create(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[OperationBulkCreateResponse, AsyncSinglePage[OperationBulkCreateResponse]]:
"""Add one or more operations to a zone.
@@ -641,7 +641,7 @@ async def bulk_delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationBulkDeleteResponse:
"""
Delete multiple operations
@@ -672,13 +672,13 @@ async def get(
operation_id: str,
*,
zone_id: str,
- feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN,
+ feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> OperationGetResponse:
"""
Retrieve information about an operation
diff --git a/src/cloudflare/resources/api_gateway/operations/schema_validation.py b/src/cloudflare/resources/api_gateway/operations/schema_validation.py
index 39718458f87..5b526d920a8 100644
--- a/src/cloudflare/resources/api_gateway/operations/schema_validation.py
+++ b/src/cloudflare/resources/api_gateway/operations/schema_validation.py
@@ -2,12 +2,13 @@
from __future__ import annotations
+import typing_extensions
from typing import Type, Optional, cast
from typing_extensions import Literal
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -52,18 +53,21 @@ def with_streaming_response(self) -> SchemaValidationResourceWithStreamingRespon
"""
return SchemaValidationResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def update(
self,
operation_id: str,
*,
zone_id: str,
- mitigation_action: Optional[Literal["log", "block", "none"]] | NotGiven = NOT_GIVEN,
+ mitigation_action: Optional[Literal["log", "block", "none"]] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SchemaValidationUpdateResponse:
"""
Updates operation-level schema validation settings on the zone
@@ -105,6 +109,9 @@ def update(
cast_to=SchemaValidationUpdateResponse,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def edit(
self,
*,
@@ -115,7 +122,7 @@ def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SettingsMultipleRequest:
"""
Updates multiple operation-level schema validation settings on the zone
@@ -146,6 +153,9 @@ def edit(
cast_to=cast(Type[SettingsMultipleRequest], ResultWrapper[SettingsMultipleRequest]),
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def get(
self,
operation_id: str,
@@ -156,7 +166,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SchemaValidationGetResponse:
"""
Retrieves operation-level schema validation settings on the zone
@@ -207,18 +217,21 @@ def with_streaming_response(self) -> AsyncSchemaValidationResourceWithStreamingR
"""
return AsyncSchemaValidationResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def update(
self,
operation_id: str,
*,
zone_id: str,
- mitigation_action: Optional[Literal["log", "block", "none"]] | NotGiven = NOT_GIVEN,
+ mitigation_action: Optional[Literal["log", "block", "none"]] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SchemaValidationUpdateResponse:
"""
Updates operation-level schema validation settings on the zone
@@ -260,6 +273,9 @@ async def update(
cast_to=SchemaValidationUpdateResponse,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def edit(
self,
*,
@@ -270,7 +286,7 @@ async def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SettingsMultipleRequest:
"""
Updates multiple operation-level schema validation settings on the zone
@@ -303,6 +319,9 @@ async def edit(
cast_to=cast(Type[SettingsMultipleRequest], ResultWrapper[SettingsMultipleRequest]),
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def get(
self,
operation_id: str,
@@ -313,7 +332,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SchemaValidationGetResponse:
"""
Retrieves operation-level schema validation settings on the zone
@@ -348,14 +367,20 @@ class SchemaValidationResourceWithRawResponse:
def __init__(self, schema_validation: SchemaValidationResource) -> None:
self._schema_validation = schema_validation
- self.update = to_raw_response_wrapper(
- schema_validation.update,
+ self.update = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ schema_validation.update, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = to_raw_response_wrapper(
- schema_validation.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ schema_validation.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = to_raw_response_wrapper(
- schema_validation.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ schema_validation.get, # pyright: ignore[reportDeprecated],
+ )
)
@@ -363,14 +388,20 @@ class AsyncSchemaValidationResourceWithRawResponse:
def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None:
self._schema_validation = schema_validation
- self.update = async_to_raw_response_wrapper(
- schema_validation.update,
+ self.update = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ schema_validation.update, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = async_to_raw_response_wrapper(
- schema_validation.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ schema_validation.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = async_to_raw_response_wrapper(
- schema_validation.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ schema_validation.get, # pyright: ignore[reportDeprecated],
+ )
)
@@ -378,14 +409,20 @@ class SchemaValidationResourceWithStreamingResponse:
def __init__(self, schema_validation: SchemaValidationResource) -> None:
self._schema_validation = schema_validation
- self.update = to_streamed_response_wrapper(
- schema_validation.update,
+ self.update = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ schema_validation.update, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = to_streamed_response_wrapper(
- schema_validation.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ schema_validation.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = to_streamed_response_wrapper(
- schema_validation.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ schema_validation.get, # pyright: ignore[reportDeprecated],
+ )
)
@@ -393,12 +430,18 @@ class AsyncSchemaValidationResourceWithStreamingResponse:
def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None:
self._schema_validation = schema_validation
- self.update = async_to_streamed_response_wrapper(
- schema_validation.update,
+ self.update = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ schema_validation.update, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = async_to_streamed_response_wrapper(
- schema_validation.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ schema_validation.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = async_to_streamed_response_wrapper(
- schema_validation.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ schema_validation.get, # pyright: ignore[reportDeprecated],
+ )
)
diff --git a/src/cloudflare/resources/api_gateway/schemas.py b/src/cloudflare/resources/api_gateway/schemas.py
index 61db8233e2d..2559e6e21c2 100644
--- a/src/cloudflare/resources/api_gateway/schemas.py
+++ b/src/cloudflare/resources/api_gateway/schemas.py
@@ -7,7 +7,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -49,14 +49,14 @@ def list(
self,
*,
zone_id: str,
- feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN,
- host: List[str] | NotGiven = NOT_GIVEN,
+ feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | Omit = omit,
+ host: SequenceNotStr[str] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SchemaListResponse:
"""
Retrieve operations and features as OpenAPI schemas
@@ -124,14 +124,14 @@ async def list(
self,
*,
zone_id: str,
- feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN,
- host: List[str] | NotGiven = NOT_GIVEN,
+ feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | Omit = omit,
+ host: SequenceNotStr[str] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SchemaListResponse:
"""
Retrieve operations and features as OpenAPI schemas
diff --git a/src/cloudflare/resources/api_gateway/settings/schema_validation.py b/src/cloudflare/resources/api_gateway/settings/schema_validation.py
index 37610d80629..edc6f969c00 100644
--- a/src/cloudflare/resources/api_gateway/settings/schema_validation.py
+++ b/src/cloudflare/resources/api_gateway/settings/schema_validation.py
@@ -2,12 +2,13 @@
from __future__ import annotations
+import typing_extensions
from typing import Optional
from typing_extensions import Literal
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform, async_maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -44,18 +45,21 @@ def with_streaming_response(self) -> SchemaValidationResourceWithStreamingRespon
"""
return SchemaValidationResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def update(
self,
*,
zone_id: str,
validation_default_mitigation_action: Literal["none", "log", "block"],
- validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | NotGiven = NOT_GIVEN,
+ validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Settings:
"""
Updates zone level schema validation settings on the zone
@@ -106,18 +110,21 @@ def update(
cast_to=Settings,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def edit(
self,
*,
zone_id: str,
- validation_default_mitigation_action: Optional[Literal["none", "log", "block"]] | NotGiven = NOT_GIVEN,
- validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | NotGiven = NOT_GIVEN,
+ validation_default_mitigation_action: Optional[Literal["none", "log", "block"]] | Omit = omit,
+ validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Settings:
"""
Updates zone level schema validation settings on the zone
@@ -169,6 +176,9 @@ def edit(
cast_to=Settings,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def get(
self,
*,
@@ -178,7 +188,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Settings:
"""
Retrieves zone level schema validation settings currently set on the zone
@@ -225,18 +235,21 @@ def with_streaming_response(self) -> AsyncSchemaValidationResourceWithStreamingR
"""
return AsyncSchemaValidationResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def update(
self,
*,
zone_id: str,
validation_default_mitigation_action: Literal["none", "log", "block"],
- validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | NotGiven = NOT_GIVEN,
+ validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Settings:
"""
Updates zone level schema validation settings on the zone
@@ -287,18 +300,21 @@ async def update(
cast_to=Settings,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def edit(
self,
*,
zone_id: str,
- validation_default_mitigation_action: Optional[Literal["none", "log", "block"]] | NotGiven = NOT_GIVEN,
- validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | NotGiven = NOT_GIVEN,
+ validation_default_mitigation_action: Optional[Literal["none", "log", "block"]] | Omit = omit,
+ validation_override_mitigation_action: Optional[Literal["none", "disable_override"]] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Settings:
"""
Updates zone level schema validation settings on the zone
@@ -350,6 +366,9 @@ async def edit(
cast_to=Settings,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def get(
self,
*,
@@ -359,7 +378,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Settings:
"""
Retrieves zone level schema validation settings currently set on the zone
@@ -390,14 +409,20 @@ class SchemaValidationResourceWithRawResponse:
def __init__(self, schema_validation: SchemaValidationResource) -> None:
self._schema_validation = schema_validation
- self.update = to_raw_response_wrapper(
- schema_validation.update,
+ self.update = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ schema_validation.update, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = to_raw_response_wrapper(
- schema_validation.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ schema_validation.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = to_raw_response_wrapper(
- schema_validation.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ schema_validation.get, # pyright: ignore[reportDeprecated],
+ )
)
@@ -405,14 +430,20 @@ class AsyncSchemaValidationResourceWithRawResponse:
def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None:
self._schema_validation = schema_validation
- self.update = async_to_raw_response_wrapper(
- schema_validation.update,
+ self.update = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ schema_validation.update, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = async_to_raw_response_wrapper(
- schema_validation.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ schema_validation.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = async_to_raw_response_wrapper(
- schema_validation.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ schema_validation.get, # pyright: ignore[reportDeprecated],
+ )
)
@@ -420,14 +451,20 @@ class SchemaValidationResourceWithStreamingResponse:
def __init__(self, schema_validation: SchemaValidationResource) -> None:
self._schema_validation = schema_validation
- self.update = to_streamed_response_wrapper(
- schema_validation.update,
+ self.update = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ schema_validation.update, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = to_streamed_response_wrapper(
- schema_validation.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ schema_validation.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = to_streamed_response_wrapper(
- schema_validation.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ schema_validation.get, # pyright: ignore[reportDeprecated],
+ )
)
@@ -435,12 +472,18 @@ class AsyncSchemaValidationResourceWithStreamingResponse:
def __init__(self, schema_validation: AsyncSchemaValidationResource) -> None:
self._schema_validation = schema_validation
- self.update = async_to_streamed_response_wrapper(
- schema_validation.update,
+ self.update = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ schema_validation.update, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = async_to_streamed_response_wrapper(
- schema_validation.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ schema_validation.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = async_to_streamed_response_wrapper(
- schema_validation.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ schema_validation.get, # pyright: ignore[reportDeprecated],
+ )
)
diff --git a/src/cloudflare/resources/api_gateway/user_schemas/hosts.py b/src/cloudflare/resources/api_gateway/user_schemas/hosts.py
index eba45a77d93..01861b64473 100644
--- a/src/cloudflare/resources/api_gateway/user_schemas/hosts.py
+++ b/src/cloudflare/resources/api_gateway/user_schemas/hosts.py
@@ -2,9 +2,11 @@
from __future__ import annotations
+import typing_extensions
+
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ...._utils import maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -42,18 +44,21 @@ def with_streaming_response(self) -> HostsResourceWithStreamingResponse:
"""
return HostsResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def list(
self,
*,
zone_id: str,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[HostListResponse]:
"""
Retrieve schema hosts in a zone
@@ -115,18 +120,21 @@ def with_streaming_response(self) -> AsyncHostsResourceWithStreamingResponse:
"""
return AsyncHostsResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def list(
self,
*,
zone_id: str,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[HostListResponse, AsyncV4PagePaginationArray[HostListResponse]]:
"""
Retrieve schema hosts in a zone
@@ -172,8 +180,10 @@ class HostsResourceWithRawResponse:
def __init__(self, hosts: HostsResource) -> None:
self._hosts = hosts
- self.list = to_raw_response_wrapper(
- hosts.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ hosts.list, # pyright: ignore[reportDeprecated],
+ )
)
@@ -181,8 +191,10 @@ class AsyncHostsResourceWithRawResponse:
def __init__(self, hosts: AsyncHostsResource) -> None:
self._hosts = hosts
- self.list = async_to_raw_response_wrapper(
- hosts.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ hosts.list, # pyright: ignore[reportDeprecated],
+ )
)
@@ -190,8 +202,10 @@ class HostsResourceWithStreamingResponse:
def __init__(self, hosts: HostsResource) -> None:
self._hosts = hosts
- self.list = to_streamed_response_wrapper(
- hosts.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ hosts.list, # pyright: ignore[reportDeprecated],
+ )
)
@@ -199,6 +213,8 @@ class AsyncHostsResourceWithStreamingResponse:
def __init__(self, hosts: AsyncHostsResource) -> None:
self._hosts = hosts
- self.list = async_to_streamed_response_wrapper(
- hosts.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ hosts.list, # pyright: ignore[reportDeprecated],
+ )
)
diff --git a/src/cloudflare/resources/api_gateway/user_schemas/operations.py b/src/cloudflare/resources/api_gateway/user_schemas/operations.py
index a75cd28dbfb..d5a04f5f875 100644
--- a/src/cloudflare/resources/api_gateway/user_schemas/operations.py
+++ b/src/cloudflare/resources/api_gateway/user_schemas/operations.py
@@ -2,12 +2,13 @@
from __future__ import annotations
+import typing_extensions
from typing import Any, List, cast
from typing_extensions import Literal
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
from ...._utils import maybe_transform
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
@@ -45,24 +46,27 @@ def with_streaming_response(self) -> OperationsResourceWithStreamingResponse:
"""
return OperationsResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def list(
self,
schema_id: str,
*,
zone_id: str,
- endpoint: str | NotGiven = NOT_GIVEN,
- feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN,
- host: List[str] | NotGiven = NOT_GIVEN,
- method: List[str] | NotGiven = NOT_GIVEN,
- operation_status: Literal["new", "existing"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
+ endpoint: str | Omit = omit,
+ feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | Omit = omit,
+ host: SequenceNotStr[str] | Omit = omit,
+ method: SequenceNotStr[str] | Omit = omit,
+ operation_status: Literal["new", "existing"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[OperationListResponse]:
"""Retrieves all operations from the schema.
@@ -148,24 +152,27 @@ def with_streaming_response(self) -> AsyncOperationsResourceWithStreamingRespons
"""
return AsyncOperationsResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def list(
self,
schema_id: str,
*,
zone_id: str,
- endpoint: str | NotGiven = NOT_GIVEN,
- feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | NotGiven = NOT_GIVEN,
- host: List[str] | NotGiven = NOT_GIVEN,
- method: List[str] | NotGiven = NOT_GIVEN,
- operation_status: Literal["new", "existing"] | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
+ endpoint: str | Omit = omit,
+ feature: List[Literal["thresholds", "parameter_schemas", "schema_info"]] | Omit = omit,
+ host: SequenceNotStr[str] | Omit = omit,
+ method: SequenceNotStr[str] | Omit = omit,
+ operation_status: Literal["new", "existing"] | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[OperationListResponse, AsyncV4PagePaginationArray[OperationListResponse]]:
"""Retrieves all operations from the schema.
@@ -235,8 +242,10 @@ class OperationsResourceWithRawResponse:
def __init__(self, operations: OperationsResource) -> None:
self._operations = operations
- self.list = to_raw_response_wrapper(
- operations.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ operations.list, # pyright: ignore[reportDeprecated],
+ )
)
@@ -244,8 +253,10 @@ class AsyncOperationsResourceWithRawResponse:
def __init__(self, operations: AsyncOperationsResource) -> None:
self._operations = operations
- self.list = async_to_raw_response_wrapper(
- operations.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ operations.list, # pyright: ignore[reportDeprecated],
+ )
)
@@ -253,8 +264,10 @@ class OperationsResourceWithStreamingResponse:
def __init__(self, operations: OperationsResource) -> None:
self._operations = operations
- self.list = to_streamed_response_wrapper(
- operations.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ operations.list, # pyright: ignore[reportDeprecated],
+ )
)
@@ -262,6 +275,8 @@ class AsyncOperationsResourceWithStreamingResponse:
def __init__(self, operations: AsyncOperationsResource) -> None:
self._operations = operations
- self.list = async_to_streamed_response_wrapper(
- operations.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ operations.list, # pyright: ignore[reportDeprecated],
+ )
)
diff --git a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py
index 3c2921267ff..e7d9626a705 100644
--- a/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py
+++ b/src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+import typing_extensions
from typing import Type, Mapping, cast
from typing_extensions import Literal
@@ -15,7 +16,7 @@
HostsResourceWithStreamingResponse,
AsyncHostsResourceWithStreamingResponse,
)
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
+from ...._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given
from ...._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
from ...._compat import cached_property
from .operations import (
@@ -42,8 +43,8 @@
user_schema_list_params,
user_schema_create_params,
)
-from ....types.api_gateway.public_schema import PublicSchema
-from ....types.api_gateway.schema_upload import SchemaUpload
+from ....types.api_gateway.old_public_schema import OldPublicSchema
+from ....types.api_gateway.user_schema_create_response import UserSchemaCreateResponse
from ....types.api_gateway.user_schema_delete_response import UserSchemaDeleteResponse
__all__ = ["UserSchemasResource", "AsyncUserSchemasResource"]
@@ -77,21 +78,24 @@ def with_streaming_response(self) -> UserSchemasResourceWithStreamingResponse:
"""
return UserSchemasResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def create(
self,
*,
zone_id: str,
file: FileTypes,
kind: Literal["openapi_v3"],
- name: str | NotGiven = NOT_GIVEN,
- validation_enabled: Literal["true", "false"] | NotGiven = NOT_GIVEN,
+ name: str | Omit = omit,
+ validation_enabled: Literal["true", "false"] | Omit = omit,
# 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,
- ) -> SchemaUpload:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> UserSchemaCreateResponse:
"""
Upload a schema to a zone
@@ -138,26 +142,29 @@ def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[SchemaUpload]._unwrapper,
+ post_parser=ResultWrapper[UserSchemaCreateResponse]._unwrapper,
),
- cast_to=cast(Type[SchemaUpload], ResultWrapper[SchemaUpload]),
+ cast_to=cast(Type[UserSchemaCreateResponse], ResultWrapper[UserSchemaCreateResponse]),
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def list(
self,
*,
zone_id: str,
- omit_source: bool | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- validation_enabled: bool | NotGiven = NOT_GIVEN,
+ omit_source: bool | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ validation_enabled: bool | Omit = omit,
# 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,
- ) -> SyncV4PagePaginationArray[PublicSchema]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> SyncV4PagePaginationArray[OldPublicSchema]:
"""
Retrieve information about all schemas on a zone
@@ -184,7 +191,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._get_api_list(
f"/zones/{zone_id}/api_gateway/user_schemas",
- page=SyncV4PagePaginationArray[PublicSchema],
+ page=SyncV4PagePaginationArray[OldPublicSchema],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -200,9 +207,12 @@ def list(
user_schema_list_params.UserSchemaListParams,
),
),
- model=PublicSchema,
+ model=OldPublicSchema,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def delete(
self,
schema_id: str,
@@ -213,7 +223,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> UserSchemaDeleteResponse:
"""
Delete a schema
@@ -241,19 +251,22 @@ def delete(
cast_to=UserSchemaDeleteResponse,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def edit(
self,
schema_id: str,
*,
zone_id: str,
- validation_enabled: Literal[True] | NotGiven = NOT_GIVEN,
+ validation_enabled: Literal[True] | Omit = omit,
# 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,
- ) -> PublicSchema:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> OldPublicSchema:
"""
Enable validation for a schema
@@ -284,24 +297,27 @@ def edit(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[PublicSchema]._unwrapper,
+ post_parser=ResultWrapper[OldPublicSchema]._unwrapper,
),
- cast_to=cast(Type[PublicSchema], ResultWrapper[PublicSchema]),
+ cast_to=cast(Type[OldPublicSchema], ResultWrapper[OldPublicSchema]),
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def get(
self,
schema_id: str,
*,
zone_id: str,
- omit_source: bool | NotGiven = NOT_GIVEN,
+ omit_source: bool | Omit = omit,
# 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,
- ) -> PublicSchema:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> OldPublicSchema:
"""
Retrieve information about a specific schema on a zone
@@ -330,9 +346,9 @@ def get(
extra_body=extra_body,
timeout=timeout,
query=maybe_transform({"omit_source": omit_source}, user_schema_get_params.UserSchemaGetParams),
- post_parser=ResultWrapper[PublicSchema]._unwrapper,
+ post_parser=ResultWrapper[OldPublicSchema]._unwrapper,
),
- cast_to=cast(Type[PublicSchema], ResultWrapper[PublicSchema]),
+ cast_to=cast(Type[OldPublicSchema], ResultWrapper[OldPublicSchema]),
)
@@ -364,21 +380,24 @@ def with_streaming_response(self) -> AsyncUserSchemasResourceWithStreamingRespon
"""
return AsyncUserSchemasResourceWithStreamingResponse(self)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def create(
self,
*,
zone_id: str,
file: FileTypes,
kind: Literal["openapi_v3"],
- name: str | NotGiven = NOT_GIVEN,
- validation_enabled: Literal["true", "false"] | NotGiven = NOT_GIVEN,
+ name: str | Omit = omit,
+ validation_enabled: Literal["true", "false"] | Omit = omit,
# 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,
- ) -> SchemaUpload:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> UserSchemaCreateResponse:
"""
Upload a schema to a zone
@@ -425,26 +444,29 @@ async def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[SchemaUpload]._unwrapper,
+ post_parser=ResultWrapper[UserSchemaCreateResponse]._unwrapper,
),
- cast_to=cast(Type[SchemaUpload], ResultWrapper[SchemaUpload]),
+ cast_to=cast(Type[UserSchemaCreateResponse], ResultWrapper[UserSchemaCreateResponse]),
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
def list(
self,
*,
zone_id: str,
- omit_source: bool | NotGiven = NOT_GIVEN,
- page: int | NotGiven = NOT_GIVEN,
- per_page: int | NotGiven = NOT_GIVEN,
- validation_enabled: bool | NotGiven = NOT_GIVEN,
+ omit_source: bool | Omit = omit,
+ page: int | Omit = omit,
+ per_page: int | Omit = omit,
+ validation_enabled: bool | Omit = omit,
# 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[PublicSchema, AsyncV4PagePaginationArray[PublicSchema]]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> AsyncPaginator[OldPublicSchema, AsyncV4PagePaginationArray[OldPublicSchema]]:
"""
Retrieve information about all schemas on a zone
@@ -471,7 +493,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._get_api_list(
f"/zones/{zone_id}/api_gateway/user_schemas",
- page=AsyncV4PagePaginationArray[PublicSchema],
+ page=AsyncV4PagePaginationArray[OldPublicSchema],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -487,9 +509,12 @@ def list(
user_schema_list_params.UserSchemaListParams,
),
),
- model=PublicSchema,
+ model=OldPublicSchema,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def delete(
self,
schema_id: str,
@@ -500,7 +525,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> UserSchemaDeleteResponse:
"""
Delete a schema
@@ -528,19 +553,22 @@ async def delete(
cast_to=UserSchemaDeleteResponse,
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def edit(
self,
schema_id: str,
*,
zone_id: str,
- validation_enabled: Literal[True] | NotGiven = NOT_GIVEN,
+ validation_enabled: Literal[True] | Omit = omit,
# 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,
- ) -> PublicSchema:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> OldPublicSchema:
"""
Enable validation for a schema
@@ -571,24 +599,27 @@ async def edit(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[PublicSchema]._unwrapper,
+ post_parser=ResultWrapper[OldPublicSchema]._unwrapper,
),
- cast_to=cast(Type[PublicSchema], ResultWrapper[PublicSchema]),
+ cast_to=cast(Type[OldPublicSchema], ResultWrapper[OldPublicSchema]),
)
+ @typing_extensions.deprecated(
+ "Use [Schema Validation API](https://developers.cloudflare.com/api/resources/schema_validation/) instead."
+ )
async def get(
self,
schema_id: str,
*,
zone_id: str,
- omit_source: bool | NotGiven = NOT_GIVEN,
+ omit_source: bool | Omit = omit,
# 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,
- ) -> PublicSchema:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> OldPublicSchema:
"""
Retrieve information about a specific schema on a zone
@@ -619,9 +650,9 @@ async def get(
query=await async_maybe_transform(
{"omit_source": omit_source}, user_schema_get_params.UserSchemaGetParams
),
- post_parser=ResultWrapper[PublicSchema]._unwrapper,
+ post_parser=ResultWrapper[OldPublicSchema]._unwrapper,
),
- cast_to=cast(Type[PublicSchema], ResultWrapper[PublicSchema]),
+ cast_to=cast(Type[OldPublicSchema], ResultWrapper[OldPublicSchema]),
)
@@ -629,20 +660,30 @@ class UserSchemasResourceWithRawResponse:
def __init__(self, user_schemas: UserSchemasResource) -> None:
self._user_schemas = user_schemas
- self.create = to_raw_response_wrapper(
- user_schemas.create,
+ self.create = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ user_schemas.create, # pyright: ignore[reportDeprecated],
+ )
)
- self.list = to_raw_response_wrapper(
- user_schemas.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ user_schemas.list, # pyright: ignore[reportDeprecated],
+ )
)
- self.delete = to_raw_response_wrapper(
- user_schemas.delete,
+ self.delete = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ user_schemas.delete, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = to_raw_response_wrapper(
- user_schemas.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ user_schemas.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = to_raw_response_wrapper(
- user_schemas.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ to_raw_response_wrapper(
+ user_schemas.get, # pyright: ignore[reportDeprecated],
+ )
)
@cached_property
@@ -658,20 +699,30 @@ class AsyncUserSchemasResourceWithRawResponse:
def __init__(self, user_schemas: AsyncUserSchemasResource) -> None:
self._user_schemas = user_schemas
- self.create = async_to_raw_response_wrapper(
- user_schemas.create,
+ self.create = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ user_schemas.create, # pyright: ignore[reportDeprecated],
+ )
)
- self.list = async_to_raw_response_wrapper(
- user_schemas.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ user_schemas.list, # pyright: ignore[reportDeprecated],
+ )
)
- self.delete = async_to_raw_response_wrapper(
- user_schemas.delete,
+ self.delete = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ user_schemas.delete, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = async_to_raw_response_wrapper(
- user_schemas.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ user_schemas.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = async_to_raw_response_wrapper(
- user_schemas.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ async_to_raw_response_wrapper(
+ user_schemas.get, # pyright: ignore[reportDeprecated],
+ )
)
@cached_property
@@ -687,20 +738,30 @@ class UserSchemasResourceWithStreamingResponse:
def __init__(self, user_schemas: UserSchemasResource) -> None:
self._user_schemas = user_schemas
- self.create = to_streamed_response_wrapper(
- user_schemas.create,
+ self.create = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ user_schemas.create, # pyright: ignore[reportDeprecated],
+ )
)
- self.list = to_streamed_response_wrapper(
- user_schemas.list,
+ self.list = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ user_schemas.list, # pyright: ignore[reportDeprecated],
+ )
)
- self.delete = to_streamed_response_wrapper(
- user_schemas.delete,
+ self.delete = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ user_schemas.delete, # pyright: ignore[reportDeprecated],
+ )
)
- self.edit = to_streamed_response_wrapper(
- user_schemas.edit,
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ user_schemas.edit, # pyright: ignore[reportDeprecated],
+ )
)
- self.get = to_streamed_response_wrapper(
- user_schemas.get,
+ self.get = ( # pyright: ignore[reportDeprecated]
+ to_streamed_response_wrapper(
+ user_schemas.get, # pyright: ignore[reportDeprecated],
+ )
)
@cached_property
@@ -716,20 +777,30 @@ class AsyncUserSchemasResourceWithStreamingResponse:
def __init__(self, user_schemas: AsyncUserSchemasResource) -> None:
self._user_schemas = user_schemas
- self.create = async_to_streamed_response_wrapper(
- user_schemas.create,
- )
- self.list = async_to_streamed_response_wrapper(
- user_schemas.list,
- )
- self.delete = async_to_streamed_response_wrapper(
- user_schemas.delete,
- )
- self.edit = async_to_streamed_response_wrapper(
- user_schemas.edit,
- )
- self.get = async_to_streamed_response_wrapper(
- user_schemas.get,
+ self.create = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ user_schemas.create, # pyright: ignore[reportDeprecated],
+ )
+ )
+ self.list = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ user_schemas.list, # pyright: ignore[reportDeprecated],
+ )
+ )
+ self.delete = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ user_schemas.delete, # pyright: ignore[reportDeprecated],
+ )
+ )
+ self.edit = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ user_schemas.edit, # pyright: ignore[reportDeprecated],
+ )
+ )
+ self.get = ( # pyright: ignore[reportDeprecated]
+ async_to_streamed_response_wrapper(
+ user_schemas.get, # pyright: ignore[reportDeprecated],
+ )
)
@cached_property
diff --git a/src/cloudflare/resources/argo/smart_routing.py b/src/cloudflare/resources/argo/smart_routing.py
index 28c30e54c30..d45d9be9c4d 100644
--- a/src/cloudflare/resources/argo/smart_routing.py
+++ b/src/cloudflare/resources/argo/smart_routing.py
@@ -2,12 +2,12 @@
from __future__ import annotations
-from typing import Any, cast
+from typing import Type, cast
from typing_extensions import Literal
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Query, Headers, NotGiven, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -56,15 +56,15 @@ def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SmartRoutingEditResponse:
"""
- Updates enablement of Argo Smart Routing.
+ Configures the value of the Argo Smart Routing enablement setting.
Args:
- zone_id: Identifier
+ zone_id: Specifies the zone associated with the API call.
- value: Enables Argo Smart Routing.
+ value: Specifies the enablement value of Argo Smart Routing.
extra_headers: Send extra headers
@@ -76,22 +76,17 @@ def edit(
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
- return cast(
- SmartRoutingEditResponse,
- self._patch(
- f"/zones/{zone_id}/argo/smart_routing",
- body=maybe_transform({"value": value}, smart_routing_edit_params.SmartRoutingEditParams),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[SmartRoutingEditResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[SmartRoutingEditResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._patch(
+ f"/zones/{zone_id}/argo/smart_routing",
+ body=maybe_transform({"value": value}, smart_routing_edit_params.SmartRoutingEditParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[SmartRoutingEditResponse]._unwrapper,
),
+ cast_to=cast(Type[SmartRoutingEditResponse], ResultWrapper[SmartRoutingEditResponse]),
)
def get(
@@ -103,13 +98,13 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SmartRoutingGetResponse:
"""
- Get Argo Smart Routing setting
+ Retrieves the value of Argo Smart Routing enablement setting.
Args:
- zone_id: Identifier
+ zone_id: Specifies the zone associated with the API call.
extra_headers: Send extra headers
@@ -121,21 +116,16 @@ def get(
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
- return cast(
- SmartRoutingGetResponse,
- self._get(
- f"/zones/{zone_id}/argo/smart_routing",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[SmartRoutingGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[SmartRoutingGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._get(
+ f"/zones/{zone_id}/argo/smart_routing",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[SmartRoutingGetResponse]._unwrapper,
),
+ cast_to=cast(Type[SmartRoutingGetResponse], ResultWrapper[SmartRoutingGetResponse]),
)
@@ -169,15 +159,15 @@ async def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SmartRoutingEditResponse:
"""
- Updates enablement of Argo Smart Routing.
+ Configures the value of the Argo Smart Routing enablement setting.
Args:
- zone_id: Identifier
+ zone_id: Specifies the zone associated with the API call.
- value: Enables Argo Smart Routing.
+ value: Specifies the enablement value of Argo Smart Routing.
extra_headers: Send extra headers
@@ -189,22 +179,17 @@ async def edit(
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
- return cast(
- SmartRoutingEditResponse,
- await self._patch(
- f"/zones/{zone_id}/argo/smart_routing",
- body=await async_maybe_transform({"value": value}, smart_routing_edit_params.SmartRoutingEditParams),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[SmartRoutingEditResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[SmartRoutingEditResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._patch(
+ f"/zones/{zone_id}/argo/smart_routing",
+ body=await async_maybe_transform({"value": value}, smart_routing_edit_params.SmartRoutingEditParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[SmartRoutingEditResponse]._unwrapper,
),
+ cast_to=cast(Type[SmartRoutingEditResponse], ResultWrapper[SmartRoutingEditResponse]),
)
async def get(
@@ -216,13 +201,13 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SmartRoutingGetResponse:
"""
- Get Argo Smart Routing setting
+ Retrieves the value of Argo Smart Routing enablement setting.
Args:
- zone_id: Identifier
+ zone_id: Specifies the zone associated with the API call.
extra_headers: Send extra headers
@@ -234,21 +219,16 @@ async def get(
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
- return cast(
- SmartRoutingGetResponse,
- await self._get(
- f"/zones/{zone_id}/argo/smart_routing",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[SmartRoutingGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[SmartRoutingGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._get(
+ f"/zones/{zone_id}/argo/smart_routing",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[SmartRoutingGetResponse]._unwrapper,
),
+ cast_to=cast(Type[SmartRoutingGetResponse], ResultWrapper[SmartRoutingGetResponse]),
)
diff --git a/src/cloudflare/resources/argo/tiered_caching.py b/src/cloudflare/resources/argo/tiered_caching.py
index 5d512f70a6a..9662940b73c 100644
--- a/src/cloudflare/resources/argo/tiered_caching.py
+++ b/src/cloudflare/resources/argo/tiered_caching.py
@@ -7,7 +7,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Query, Headers, NotGiven, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -56,7 +56,7 @@ def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TieredCachingEditResponse]:
"""
Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of
@@ -72,7 +72,7 @@ def edit(
resources.
Args:
- zone_id: Identifier
+ zone_id: Identifier.
value: Enables Tiered Caching.
@@ -108,7 +108,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TieredCachingGetResponse]:
"""
Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of
@@ -124,7 +124,7 @@ def get(
resources.
Args:
- zone_id: Identifier
+ zone_id: Identifier.
extra_headers: Send extra headers
@@ -179,7 +179,7 @@ async def edit(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TieredCachingEditResponse]:
"""
Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of
@@ -195,7 +195,7 @@ async def edit(
resources.
Args:
- zone_id: Identifier
+ zone_id: Identifier.
value: Enables Tiered Caching.
@@ -231,7 +231,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[TieredCachingGetResponse]:
"""
Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of
@@ -247,7 +247,7 @@ async def get(
resources.
Args:
- zone_id: Identifier
+ zone_id: Identifier.
extra_headers: Send extra headers
diff --git a/src/cloudflare/resources/audit_logs.py b/src/cloudflare/resources/audit_logs.py
index bcb31f75e13..1a682f5ac0e 100644
--- a/src/cloudflare/resources/audit_logs.py
+++ b/src/cloudflare/resources/audit_logs.py
@@ -8,7 +8,7 @@
import httpx
-from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from .._utils import maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -50,23 +50,23 @@ def list(
self,
*,
account_id: str,
- id: str | NotGiven = NOT_GIVEN,
- action: audit_log_list_params.Action | NotGiven = NOT_GIVEN,
- actor: audit_log_list_params.Actor | NotGiven = NOT_GIVEN,
- before: Union[Union[str, date], Union[str, datetime]] | NotGiven = NOT_GIVEN,
- direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN,
- export: bool | NotGiven = NOT_GIVEN,
- hide_user_logs: bool | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
- since: Union[Union[str, date], Union[str, datetime]] | NotGiven = NOT_GIVEN,
- zone: audit_log_list_params.Zone | NotGiven = NOT_GIVEN,
+ id: str | Omit = omit,
+ action: audit_log_list_params.Action | Omit = omit,
+ actor: audit_log_list_params.Actor | Omit = omit,
+ before: Union[Union[str, date], Union[str, datetime]] | Omit = omit,
+ direction: Literal["desc", "asc"] | Omit = omit,
+ export: bool | Omit = omit,
+ hide_user_logs: bool | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
+ since: Union[Union[str, date], Union[str, datetime]] | Omit = omit,
+ zone: audit_log_list_params.Zone | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> SyncV4PagePaginationArray[AuditLog]:
"""Gets a list of audit logs for an account.
@@ -157,23 +157,23 @@ def list(
self,
*,
account_id: str,
- id: str | NotGiven = NOT_GIVEN,
- action: audit_log_list_params.Action | NotGiven = NOT_GIVEN,
- actor: audit_log_list_params.Actor | NotGiven = NOT_GIVEN,
- before: Union[Union[str, date], Union[str, datetime]] | NotGiven = NOT_GIVEN,
- direction: Literal["desc", "asc"] | NotGiven = NOT_GIVEN,
- export: bool | NotGiven = NOT_GIVEN,
- hide_user_logs: bool | NotGiven = NOT_GIVEN,
- page: float | NotGiven = NOT_GIVEN,
- per_page: float | NotGiven = NOT_GIVEN,
- since: Union[Union[str, date], Union[str, datetime]] | NotGiven = NOT_GIVEN,
- zone: audit_log_list_params.Zone | NotGiven = NOT_GIVEN,
+ id: str | Omit = omit,
+ action: audit_log_list_params.Action | Omit = omit,
+ actor: audit_log_list_params.Actor | Omit = omit,
+ before: Union[Union[str, date], Union[str, datetime]] | Omit = omit,
+ direction: Literal["desc", "asc"] | Omit = omit,
+ export: bool | Omit = omit,
+ hide_user_logs: bool | Omit = omit,
+ page: float | Omit = omit,
+ per_page: float | Omit = omit,
+ since: Union[Union[str, date], Union[str, datetime]] | Omit = omit,
+ zone: audit_log_list_params.Zone | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> AsyncPaginator[AuditLog, AsyncV4PagePaginationArray[AuditLog]]:
"""Gets a list of audit logs for an account.
diff --git a/src/cloudflare/resources/billing/profiles.py b/src/cloudflare/resources/billing/profiles.py
index 16e7235a279..f3272600105 100644
--- a/src/cloudflare/resources/billing/profiles.py
+++ b/src/cloudflare/resources/billing/profiles.py
@@ -7,7 +7,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Query, Headers, NotGiven, not_given
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -53,7 +53,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ProfileGetResponse:
"""
Gets the current billing profile for the account.
@@ -114,7 +114,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> ProfileGetResponse:
"""
Gets the current billing profile for the account.
@@ -151,7 +151,7 @@ def __init__(self, profiles: ProfilesResource) -> None:
self.get = ( # pyright: ignore[reportDeprecated]
to_raw_response_wrapper(
- profiles.get # pyright: ignore[reportDeprecated],
+ profiles.get, # pyright: ignore[reportDeprecated],
)
)
@@ -162,7 +162,7 @@ def __init__(self, profiles: AsyncProfilesResource) -> None:
self.get = ( # pyright: ignore[reportDeprecated]
async_to_raw_response_wrapper(
- profiles.get # pyright: ignore[reportDeprecated],
+ profiles.get, # pyright: ignore[reportDeprecated],
)
)
@@ -173,7 +173,7 @@ def __init__(self, profiles: ProfilesResource) -> None:
self.get = ( # pyright: ignore[reportDeprecated]
to_streamed_response_wrapper(
- profiles.get # pyright: ignore[reportDeprecated],
+ profiles.get, # pyright: ignore[reportDeprecated],
)
)
@@ -184,6 +184,6 @@ def __init__(self, profiles: AsyncProfilesResource) -> None:
self.get = ( # pyright: ignore[reportDeprecated]
async_to_streamed_response_wrapper(
- profiles.get # pyright: ignore[reportDeprecated],
+ profiles.get, # pyright: ignore[reportDeprecated],
)
)
diff --git a/src/cloudflare/resources/bot_management.py b/src/cloudflare/resources/bot_management.py
index f3a541ea1f7..07b76763411 100644
--- a/src/cloudflare/resources/bot_management.py
+++ b/src/cloudflare/resources/bot_management.py
@@ -7,7 +7,7 @@
import httpx
-from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from .._utils import required_args, maybe_transform, async_maybe_transform
from .._compat import cached_property
from .._resource import SyncAPIResource, AsyncAPIResource
@@ -51,16 +51,18 @@ def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- fight_mode: bool | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ fight_mode: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
"""
Updates the Bot Management configuration for a zone.
@@ -128,7 +130,10 @@ def update(
Args:
zone_id: Identifier.
- ai_bots_protection: Enable rule to block AI Scrapers and Crawlers.
+ ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. Please note the value
+ `only_on_ad_pages` is currently not available for Enterprise customers.
+
+ cf_robots_variant: Specifies the Robots Access Control License variant to use.
crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze.
@@ -137,6 +142,9 @@ def update(
fight_mode: Whether to enable Bot Fight Mode.
+ is_robots_txt_managed: Enable cloudflare managed robots.txt. If an existing robots.txt is detected,
+ then managed robots.txt will be prepended to the existing robots.txt.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -152,19 +160,21 @@ def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- optimize_wordpress: bool | NotGiven = NOT_GIVEN,
- sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- sbfm_static_resource_protection: bool | NotGiven = NOT_GIVEN,
- sbfm_verified_bots: Literal["allow", "block"] | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
+ optimize_wordpress: bool | Omit = omit,
+ sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ sbfm_static_resource_protection: bool | Omit = omit,
+ sbfm_verified_bots: Literal["allow", "block"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
"""
Updates the Bot Management configuration for a zone.
@@ -232,13 +242,19 @@ def update(
Args:
zone_id: Identifier.
- ai_bots_protection: Enable rule to block AI Scrapers and Crawlers.
+ ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. Please note the value
+ `only_on_ad_pages` is currently not available for Enterprise customers.
+
+ cf_robots_variant: Specifies the Robots Access Control License variant to use.
crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze.
enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management.
[Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).
+ is_robots_txt_managed: Enable cloudflare managed robots.txt. If an existing robots.txt is detected,
+ then managed robots.txt will be prepended to the existing robots.txt.
+
optimize_wordpress: Whether to optimize Super Bot Fight Mode protections for Wordpress.
sbfm_definitely_automated: Super Bot Fight Mode (SBFM) action to take on definitely automated requests.
@@ -264,20 +280,22 @@ def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- optimize_wordpress: bool | NotGiven = NOT_GIVEN,
- sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- sbfm_likely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- sbfm_static_resource_protection: bool | NotGiven = NOT_GIVEN,
- sbfm_verified_bots: Literal["allow", "block"] | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
+ optimize_wordpress: bool | Omit = omit,
+ sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ sbfm_likely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ sbfm_static_resource_protection: bool | Omit = omit,
+ sbfm_verified_bots: Literal["allow", "block"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
"""
Updates the Bot Management configuration for a zone.
@@ -345,13 +363,19 @@ def update(
Args:
zone_id: Identifier.
- ai_bots_protection: Enable rule to block AI Scrapers and Crawlers.
+ ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. Please note the value
+ `only_on_ad_pages` is currently not available for Enterprise customers.
+
+ cf_robots_variant: Specifies the Robots Access Control License variant to use.
crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze.
enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management.
[Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).
+ is_robots_txt_managed: Enable cloudflare managed robots.txt. If an existing robots.txt is detected,
+ then managed robots.txt will be prepended to the existing robots.txt.
+
optimize_wordpress: Whether to optimize Super Bot Fight Mode protections for Wordpress.
sbfm_definitely_automated: Super Bot Fight Mode (SBFM) action to take on definitely automated requests.
@@ -379,17 +403,20 @@ def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- auto_update_model: bool | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- suppress_session_score: bool | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ auto_update_model: bool | Omit = omit,
+ bm_cookie_enabled: bool | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
+ suppress_session_score: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
"""
Updates the Bot Management configuration for a zone.
@@ -457,17 +484,26 @@ def update(
Args:
zone_id: Identifier.
- ai_bots_protection: Enable rule to block AI Scrapers and Crawlers.
+ ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. Please note the value
+ `only_on_ad_pages` is currently not available for Enterprise customers.
auto_update_model: Automatically update to the newest bot detection models created by Cloudflare as
they are released.
[Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes)
+ bm_cookie_enabled: Indicates that the bot management cookie can be placed on end user devices
+ accessing the site. Defaults to true
+
+ cf_robots_variant: Specifies the Robots Access Control License variant to use.
+
crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze.
enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management.
[Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).
+ is_robots_txt_managed: Enable cloudflare managed robots.txt. If an existing robots.txt is detected,
+ then managed robots.txt will be prepended to the existing robots.txt.
+
suppress_session_score: Whether to disable tracking the highest bot score for a session in the Bot
Management cookie.
@@ -486,23 +522,26 @@ def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- fight_mode: bool | NotGiven = NOT_GIVEN,
- optimize_wordpress: bool | NotGiven = NOT_GIVEN,
- sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- sbfm_static_resource_protection: bool | NotGiven = NOT_GIVEN,
- sbfm_verified_bots: Literal["allow", "block"] | NotGiven = NOT_GIVEN,
- sbfm_likely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- auto_update_model: bool | NotGiven = NOT_GIVEN,
- suppress_session_score: bool | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ fight_mode: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
+ optimize_wordpress: bool | Omit = omit,
+ sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ sbfm_static_resource_protection: bool | Omit = omit,
+ sbfm_verified_bots: Literal["allow", "block"] | Omit = omit,
+ sbfm_likely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ auto_update_model: bool | Omit = omit,
+ bm_cookie_enabled: bool | Omit = omit,
+ suppress_session_score: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
@@ -513,15 +552,18 @@ def update(
body=maybe_transform(
{
"ai_bots_protection": ai_bots_protection,
+ "cf_robots_variant": cf_robots_variant,
"crawler_protection": crawler_protection,
"enable_js": enable_js,
"fight_mode": fight_mode,
+ "is_robots_txt_managed": is_robots_txt_managed,
"optimize_wordpress": optimize_wordpress,
"sbfm_definitely_automated": sbfm_definitely_automated,
"sbfm_static_resource_protection": sbfm_static_resource_protection,
"sbfm_verified_bots": sbfm_verified_bots,
"sbfm_likely_automated": sbfm_likely_automated,
"auto_update_model": auto_update_model,
+ "bm_cookie_enabled": bm_cookie_enabled,
"suppress_session_score": suppress_session_score,
},
bot_management_update_params.BotManagementUpdateParams,
@@ -548,7 +590,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementGetResponse]:
"""
Retrieve a zone's Bot Management Config
@@ -609,16 +651,18 @@ async def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- fight_mode: bool | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ fight_mode: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
"""
Updates the Bot Management configuration for a zone.
@@ -686,7 +730,10 @@ async def update(
Args:
zone_id: Identifier.
- ai_bots_protection: Enable rule to block AI Scrapers and Crawlers.
+ ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. Please note the value
+ `only_on_ad_pages` is currently not available for Enterprise customers.
+
+ cf_robots_variant: Specifies the Robots Access Control License variant to use.
crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze.
@@ -695,6 +742,9 @@ async def update(
fight_mode: Whether to enable Bot Fight Mode.
+ is_robots_txt_managed: Enable cloudflare managed robots.txt. If an existing robots.txt is detected,
+ then managed robots.txt will be prepended to the existing robots.txt.
+
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -710,19 +760,21 @@ async def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- optimize_wordpress: bool | NotGiven = NOT_GIVEN,
- sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- sbfm_static_resource_protection: bool | NotGiven = NOT_GIVEN,
- sbfm_verified_bots: Literal["allow", "block"] | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
+ optimize_wordpress: bool | Omit = omit,
+ sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ sbfm_static_resource_protection: bool | Omit = omit,
+ sbfm_verified_bots: Literal["allow", "block"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
"""
Updates the Bot Management configuration for a zone.
@@ -790,13 +842,19 @@ async def update(
Args:
zone_id: Identifier.
- ai_bots_protection: Enable rule to block AI Scrapers and Crawlers.
+ ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. Please note the value
+ `only_on_ad_pages` is currently not available for Enterprise customers.
+
+ cf_robots_variant: Specifies the Robots Access Control License variant to use.
crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze.
enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management.
[Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).
+ is_robots_txt_managed: Enable cloudflare managed robots.txt. If an existing robots.txt is detected,
+ then managed robots.txt will be prepended to the existing robots.txt.
+
optimize_wordpress: Whether to optimize Super Bot Fight Mode protections for Wordpress.
sbfm_definitely_automated: Super Bot Fight Mode (SBFM) action to take on definitely automated requests.
@@ -822,20 +880,22 @@ async def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- optimize_wordpress: bool | NotGiven = NOT_GIVEN,
- sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- sbfm_likely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- sbfm_static_resource_protection: bool | NotGiven = NOT_GIVEN,
- sbfm_verified_bots: Literal["allow", "block"] | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
+ optimize_wordpress: bool | Omit = omit,
+ sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ sbfm_likely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ sbfm_static_resource_protection: bool | Omit = omit,
+ sbfm_verified_bots: Literal["allow", "block"] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
"""
Updates the Bot Management configuration for a zone.
@@ -903,13 +963,19 @@ async def update(
Args:
zone_id: Identifier.
- ai_bots_protection: Enable rule to block AI Scrapers and Crawlers.
+ ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. Please note the value
+ `only_on_ad_pages` is currently not available for Enterprise customers.
+
+ cf_robots_variant: Specifies the Robots Access Control License variant to use.
crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze.
enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management.
[Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).
+ is_robots_txt_managed: Enable cloudflare managed robots.txt. If an existing robots.txt is detected,
+ then managed robots.txt will be prepended to the existing robots.txt.
+
optimize_wordpress: Whether to optimize Super Bot Fight Mode protections for Wordpress.
sbfm_definitely_automated: Super Bot Fight Mode (SBFM) action to take on definitely automated requests.
@@ -937,17 +1003,20 @@ async def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- auto_update_model: bool | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- suppress_session_score: bool | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ auto_update_model: bool | Omit = omit,
+ bm_cookie_enabled: bool | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
+ suppress_session_score: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
"""
Updates the Bot Management configuration for a zone.
@@ -1015,17 +1084,26 @@ async def update(
Args:
zone_id: Identifier.
- ai_bots_protection: Enable rule to block AI Scrapers and Crawlers.
+ ai_bots_protection: Enable rule to block AI Scrapers and Crawlers. Please note the value
+ `only_on_ad_pages` is currently not available for Enterprise customers.
auto_update_model: Automatically update to the newest bot detection models created by Cloudflare as
they are released.
[Learn more.](https://developers.cloudflare.com/bots/reference/machine-learning-models#model-versions-and-release-notes)
+ bm_cookie_enabled: Indicates that the bot management cookie can be placed on end user devices
+ accessing the site. Defaults to true
+
+ cf_robots_variant: Specifies the Robots Access Control License variant to use.
+
crawler_protection: Enable rule to punish AI Scrapers and Crawlers via a link maze.
enable_js: Use lightweight, invisible JavaScript detections to improve Bot Management.
[Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/).
+ is_robots_txt_managed: Enable cloudflare managed robots.txt. If an existing robots.txt is detected,
+ then managed robots.txt will be prepended to the existing robots.txt.
+
suppress_session_score: Whether to disable tracking the highest bot score for a session in the Bot
Management cookie.
@@ -1044,23 +1122,26 @@ async def update(
self,
*,
zone_id: str,
- ai_bots_protection: Literal["block", "disabled"] | NotGiven = NOT_GIVEN,
- crawler_protection: Literal["enabled", "disabled"] | NotGiven = NOT_GIVEN,
- enable_js: bool | NotGiven = NOT_GIVEN,
- fight_mode: bool | NotGiven = NOT_GIVEN,
- optimize_wordpress: bool | NotGiven = NOT_GIVEN,
- sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- sbfm_static_resource_protection: bool | NotGiven = NOT_GIVEN,
- sbfm_verified_bots: Literal["allow", "block"] | NotGiven = NOT_GIVEN,
- sbfm_likely_automated: Literal["allow", "block", "managed_challenge"] | NotGiven = NOT_GIVEN,
- auto_update_model: bool | NotGiven = NOT_GIVEN,
- suppress_session_score: bool | NotGiven = NOT_GIVEN,
+ ai_bots_protection: Literal["block", "disabled", "only_on_ad_pages"] | Omit = omit,
+ cf_robots_variant: Literal["off", "policy_only"] | Omit = omit,
+ crawler_protection: Literal["enabled", "disabled"] | Omit = omit,
+ enable_js: bool | Omit = omit,
+ fight_mode: bool | Omit = omit,
+ is_robots_txt_managed: bool | Omit = omit,
+ optimize_wordpress: bool | Omit = omit,
+ sbfm_definitely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ sbfm_static_resource_protection: bool | Omit = omit,
+ sbfm_verified_bots: Literal["allow", "block"] | Omit = omit,
+ sbfm_likely_automated: Literal["allow", "block", "managed_challenge"] | Omit = omit,
+ auto_update_model: bool | Omit = omit,
+ bm_cookie_enabled: bool | Omit = omit,
+ suppress_session_score: bool | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementUpdateResponse]:
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
@@ -1071,15 +1152,18 @@ async def update(
body=await async_maybe_transform(
{
"ai_bots_protection": ai_bots_protection,
+ "cf_robots_variant": cf_robots_variant,
"crawler_protection": crawler_protection,
"enable_js": enable_js,
"fight_mode": fight_mode,
+ "is_robots_txt_managed": is_robots_txt_managed,
"optimize_wordpress": optimize_wordpress,
"sbfm_definitely_automated": sbfm_definitely_automated,
"sbfm_static_resource_protection": sbfm_static_resource_protection,
"sbfm_verified_bots": sbfm_verified_bots,
"sbfm_likely_automated": sbfm_likely_automated,
"auto_update_model": auto_update_model,
+ "bm_cookie_enabled": bm_cookie_enabled,
"suppress_session_score": suppress_session_score,
},
bot_management_update_params.BotManagementUpdateParams,
@@ -1106,7 +1190,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[BotManagementGetResponse]:
"""
Retrieve a zone's Bot Management Config
diff --git a/src/cloudflare/resources/botnet_feed/asn.py b/src/cloudflare/resources/botnet_feed/asn.py
index 5fd0185a673..285845ee622 100755
--- a/src/cloudflare/resources/botnet_feed/asn.py
+++ b/src/cloudflare/resources/botnet_feed/asn.py
@@ -7,7 +7,7 @@
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
from ..._utils import maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
@@ -51,13 +51,13 @@ def day_report(
asn_id: int,
*,
account_id: str,
- date: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ date: Union[str, datetime] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ASNDayReportResponse]:
"""
Gets all the data the botnet tracking database has for a given ASN registered to
@@ -100,7 +100,7 @@ def full_report(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ASNFullReportResponse]:
"""
Gets all the data the botnet threat feed tracking database has for a given ASN
@@ -157,13 +157,13 @@ async def day_report(
asn_id: int,
*,
account_id: str,
- date: Union[str, datetime] | NotGiven = NOT_GIVEN,
+ date: Union[str, datetime] | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ASNDayReportResponse]:
"""
Gets all the data the botnet tracking database has for a given ASN registered to
@@ -206,7 +206,7 @@ async def full_report(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ASNFullReportResponse]:
"""
Gets all the data the botnet threat feed tracking database has for a given ASN
diff --git a/src/cloudflare/resources/botnet_feed/configs/asn.py b/src/cloudflare/resources/botnet_feed/configs/asn.py
index db2b4a80978..e8cf0754eb4 100755
--- a/src/cloudflare/resources/botnet_feed/configs/asn.py
+++ b/src/cloudflare/resources/botnet_feed/configs/asn.py
@@ -6,7 +6,7 @@
import httpx
-from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ...._types import Body, Query, Headers, NotGiven, not_given
from ...._compat import cached_property
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
@@ -53,7 +53,7 @@ def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ASNDeleteResponse]:
"""
Delete an ASN from botnet threat feed for a given user.
@@ -92,7 +92,7 @@ def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ASNGetResponse]:
"""
Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API.
@@ -153,7 +153,7 @@ async def delete(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ASNDeleteResponse]:
"""
Delete an ASN from botnet threat feed for a given user.
@@ -192,7 +192,7 @@ async def get(
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> Optional[ASNGetResponse]:
"""
Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API.
diff --git a/src/cloudflare/resources/brand_protection/__init__.py b/src/cloudflare/resources/brand_protection/__init__.py
new file mode 100644
index 00000000000..1660f110c9b
--- /dev/null
+++ b/src/cloudflare/resources/brand_protection/__init__.py
@@ -0,0 +1,75 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .logos import (
+ LogosResource,
+ AsyncLogosResource,
+ LogosResourceWithRawResponse,
+ AsyncLogosResourceWithRawResponse,
+ LogosResourceWithStreamingResponse,
+ AsyncLogosResourceWithStreamingResponse,
+)
+from .matches import (
+ MatchesResource,
+ AsyncMatchesResource,
+ MatchesResourceWithRawResponse,
+ AsyncMatchesResourceWithRawResponse,
+ MatchesResourceWithStreamingResponse,
+ AsyncMatchesResourceWithStreamingResponse,
+)
+from .queries import (
+ QueriesResource,
+ AsyncQueriesResource,
+ QueriesResourceWithRawResponse,
+ AsyncQueriesResourceWithRawResponse,
+ QueriesResourceWithStreamingResponse,
+ AsyncQueriesResourceWithStreamingResponse,
+)
+from .logo_matches import (
+ LogoMatchesResource,
+ AsyncLogoMatchesResource,
+ LogoMatchesResourceWithRawResponse,
+ AsyncLogoMatchesResourceWithRawResponse,
+ LogoMatchesResourceWithStreamingResponse,
+ AsyncLogoMatchesResourceWithStreamingResponse,
+)
+from .brand_protection import (
+ BrandProtectionResource,
+ AsyncBrandProtectionResource,
+ BrandProtectionResourceWithRawResponse,
+ AsyncBrandProtectionResourceWithRawResponse,
+ BrandProtectionResourceWithStreamingResponse,
+ AsyncBrandProtectionResourceWithStreamingResponse,
+)
+
+__all__ = [
+ "QueriesResource",
+ "AsyncQueriesResource",
+ "QueriesResourceWithRawResponse",
+ "AsyncQueriesResourceWithRawResponse",
+ "QueriesResourceWithStreamingResponse",
+ "AsyncQueriesResourceWithStreamingResponse",
+ "MatchesResource",
+ "AsyncMatchesResource",
+ "MatchesResourceWithRawResponse",
+ "AsyncMatchesResourceWithRawResponse",
+ "MatchesResourceWithStreamingResponse",
+ "AsyncMatchesResourceWithStreamingResponse",
+ "LogosResource",
+ "AsyncLogosResource",
+ "LogosResourceWithRawResponse",
+ "AsyncLogosResourceWithRawResponse",
+ "LogosResourceWithStreamingResponse",
+ "AsyncLogosResourceWithStreamingResponse",
+ "LogoMatchesResource",
+ "AsyncLogoMatchesResource",
+ "LogoMatchesResourceWithRawResponse",
+ "AsyncLogoMatchesResourceWithRawResponse",
+ "LogoMatchesResourceWithStreamingResponse",
+ "AsyncLogoMatchesResourceWithStreamingResponse",
+ "BrandProtectionResource",
+ "AsyncBrandProtectionResource",
+ "BrandProtectionResourceWithRawResponse",
+ "AsyncBrandProtectionResourceWithRawResponse",
+ "BrandProtectionResourceWithStreamingResponse",
+ "AsyncBrandProtectionResourceWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/brand_protection.py b/src/cloudflare/resources/brand_protection/brand_protection.py
similarity index 54%
rename from src/cloudflare/resources/brand_protection.py
rename to src/cloudflare/resources/brand_protection/brand_protection.py
index 659ee0c7e7c..efe44ec7d57 100644
--- a/src/cloudflare/resources/brand_protection.py
+++ b/src/cloudflare/resources/brand_protection/brand_protection.py
@@ -2,30 +2,74 @@
from __future__ import annotations
-from typing import List, Type, Iterable, Optional, cast
-
import httpx
-from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from .._utils import maybe_transform, async_maybe_transform
-from .._compat import cached_property
-from .._resource import SyncAPIResource, AsyncAPIResource
-from .._response import (
+from .logos import (
+ LogosResource,
+ AsyncLogosResource,
+ LogosResourceWithRawResponse,
+ AsyncLogosResourceWithRawResponse,
+ LogosResourceWithStreamingResponse,
+ AsyncLogosResourceWithStreamingResponse,
+)
+from .matches import (
+ MatchesResource,
+ AsyncMatchesResource,
+ MatchesResourceWithRawResponse,
+ AsyncMatchesResourceWithRawResponse,
+ MatchesResourceWithStreamingResponse,
+ AsyncMatchesResourceWithStreamingResponse,
+)
+from .queries import (
+ QueriesResource,
+ AsyncQueriesResource,
+ QueriesResourceWithRawResponse,
+ AsyncQueriesResourceWithRawResponse,
+ QueriesResourceWithStreamingResponse,
+ AsyncQueriesResourceWithStreamingResponse,
+)
+from ..._types import Body, Query, Headers, NotGiven, not_given
+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.brand_protection import brand_protection_submit_params, brand_protection_url_info_params
-from ..types.brand_protection.info import Info
-from ..types.brand_protection.submit import Submit
+from ...pagination import SyncSinglePage, AsyncSinglePage
+from .logo_matches import (
+ LogoMatchesResource,
+ AsyncLogoMatchesResource,
+ LogoMatchesResourceWithRawResponse,
+ AsyncLogoMatchesResourceWithRawResponse,
+ LogoMatchesResourceWithStreamingResponse,
+ AsyncLogoMatchesResourceWithStreamingResponse,
+)
+from ..._base_client import AsyncPaginator, make_request_options
+from ...types.brand_protection.brand_protection_submit_response import BrandProtectionSubmitResponse
+from ...types.brand_protection.brand_protection_url_info_response import BrandProtectionURLInfoResponse
__all__ = ["BrandProtectionResource", "AsyncBrandProtectionResource"]
class BrandProtectionResource(SyncAPIResource):
+ @cached_property
+ def queries(self) -> QueriesResource:
+ return QueriesResource(self._client)
+
+ @cached_property
+ def matches(self) -> MatchesResource:
+ return MatchesResource(self._client)
+
+ @cached_property
+ def logos(self) -> LogosResource:
+ return LogosResource(self._client)
+
+ @cached_property
+ def logo_matches(self) -> LogoMatchesResource:
+ return LogoMatchesResource(self._client)
+
@cached_property
def with_raw_response(self) -> BrandProtectionResourceWithRawResponse:
"""
@@ -49,22 +93,17 @@ def submit(
self,
*,
account_id: str,
- url: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[Submit]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> BrandProtectionSubmitResponse:
"""
- Submit suspicious URL for scanning.
+ Return new URL submissions
Args:
- account_id: Identifier.
-
- url: URL(s) to filter submissions results by.
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -77,40 +116,27 @@ def submit(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._post(
f"/accounts/{account_id}/brand-protection/submit",
- body=maybe_transform({"url": url}, brand_protection_submit_params.BrandProtectionSubmitParams),
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[Optional[Submit]]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=cast(Type[Optional[Submit]], ResultWrapper[Submit]),
+ cast_to=BrandProtectionSubmitResponse,
)
def url_info(
self,
*,
account_id: str,
- url: List[str] | NotGiven = NOT_GIVEN,
- url_id: Iterable[int] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[Info]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> SyncSinglePage[BrandProtectionURLInfoResponse]:
"""
- Gets phishing details about a URL.
+ Return submitted URLs based on ID
Args:
- account_id: Identifier.
-
- url: Submission URL(s) to filter submission results by.
-
- url_id: Submission ID(s) to filter submission results by.
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -121,27 +147,33 @@ def url_info(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- return self._get(
+ return self._get_api_list(
f"/accounts/{account_id}/brand-protection/url-info",
+ page=SyncSinglePage[BrandProtectionURLInfoResponse],
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- query=maybe_transform(
- {
- "url": url,
- "url_id": url_id,
- },
- brand_protection_url_info_params.BrandProtectionURLInfoParams,
- ),
- post_parser=ResultWrapper[Optional[Info]]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=cast(Type[Optional[Info]], ResultWrapper[Info]),
+ model=BrandProtectionURLInfoResponse,
)
class AsyncBrandProtectionResource(AsyncAPIResource):
+ @cached_property
+ def queries(self) -> AsyncQueriesResource:
+ return AsyncQueriesResource(self._client)
+
+ @cached_property
+ def matches(self) -> AsyncMatchesResource:
+ return AsyncMatchesResource(self._client)
+
+ @cached_property
+ def logos(self) -> AsyncLogosResource:
+ return AsyncLogosResource(self._client)
+
+ @cached_property
+ def logo_matches(self) -> AsyncLogoMatchesResource:
+ return AsyncLogoMatchesResource(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncBrandProtectionResourceWithRawResponse:
"""
@@ -165,22 +197,17 @@ async def submit(
self,
*,
account_id: str,
- url: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[Submit]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> BrandProtectionSubmitResponse:
"""
- Submit suspicious URL for scanning.
+ Return new URL submissions
Args:
- account_id: Identifier.
-
- url: URL(s) to filter submissions results by.
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -193,40 +220,27 @@ async def submit(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._post(
f"/accounts/{account_id}/brand-protection/submit",
- body=await async_maybe_transform({"url": url}, brand_protection_submit_params.BrandProtectionSubmitParams),
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[Optional[Submit]]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=cast(Type[Optional[Submit]], ResultWrapper[Submit]),
+ cast_to=BrandProtectionSubmitResponse,
)
- async def url_info(
+ def url_info(
self,
*,
account_id: str,
- url: List[str] | NotGiven = NOT_GIVEN,
- url_id: Iterable[int] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
- timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[Info]:
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> AsyncPaginator[BrandProtectionURLInfoResponse, AsyncSinglePage[BrandProtectionURLInfoResponse]]:
"""
- Gets phishing details about a URL.
+ Return submitted URLs based on ID
Args:
- account_id: Identifier.
-
- url: Submission URL(s) to filter submission results by.
-
- url_id: Submission ID(s) to filter submission results by.
-
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
@@ -237,23 +251,13 @@ async def url_info(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
- return await self._get(
+ return self._get_api_list(
f"/accounts/{account_id}/brand-protection/url-info",
+ page=AsyncSinglePage[BrandProtectionURLInfoResponse],
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- query=await async_maybe_transform(
- {
- "url": url,
- "url_id": url_id,
- },
- brand_protection_url_info_params.BrandProtectionURLInfoParams,
- ),
- post_parser=ResultWrapper[Optional[Info]]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- cast_to=cast(Type[Optional[Info]], ResultWrapper[Info]),
+ model=BrandProtectionURLInfoResponse,
)
@@ -268,6 +272,22 @@ def __init__(self, brand_protection: BrandProtectionResource) -> None:
brand_protection.url_info,
)
+ @cached_property
+ def queries(self) -> QueriesResourceWithRawResponse:
+ return QueriesResourceWithRawResponse(self._brand_protection.queries)
+
+ @cached_property
+ def matches(self) -> MatchesResourceWithRawResponse:
+ return MatchesResourceWithRawResponse(self._brand_protection.matches)
+
+ @cached_property
+ def logos(self) -> LogosResourceWithRawResponse:
+ return LogosResourceWithRawResponse(self._brand_protection.logos)
+
+ @cached_property
+ def logo_matches(self) -> LogoMatchesResourceWithRawResponse:
+ return LogoMatchesResourceWithRawResponse(self._brand_protection.logo_matches)
+
class AsyncBrandProtectionResourceWithRawResponse:
def __init__(self, brand_protection: AsyncBrandProtectionResource) -> None:
@@ -280,6 +300,22 @@ def __init__(self, brand_protection: AsyncBrandProtectionResource) -> None:
brand_protection.url_info,
)
+ @cached_property
+ def queries(self) -> AsyncQueriesResourceWithRawResponse:
+ return AsyncQueriesResourceWithRawResponse(self._brand_protection.queries)
+
+ @cached_property
+ def matches(self) -> AsyncMatchesResourceWithRawResponse:
+ return AsyncMatchesResourceWithRawResponse(self._brand_protection.matches)
+
+ @cached_property
+ def logos(self) -> AsyncLogosResourceWithRawResponse:
+ return AsyncLogosResourceWithRawResponse(self._brand_protection.logos)
+
+ @cached_property
+ def logo_matches(self) -> AsyncLogoMatchesResourceWithRawResponse:
+ return AsyncLogoMatchesResourceWithRawResponse(self._brand_protection.logo_matches)
+
class BrandProtectionResourceWithStreamingResponse:
def __init__(self, brand_protection: BrandProtectionResource) -> None:
@@ -292,6 +328,22 @@ def __init__(self, brand_protection: BrandProtectionResource) -> None:
brand_protection.url_info,
)
+ @cached_property
+ def queries(self) -> QueriesResourceWithStreamingResponse:
+ return QueriesResourceWithStreamingResponse(self._brand_protection.queries)
+
+ @cached_property
+ def matches(self) -> MatchesResourceWithStreamingResponse:
+ return MatchesResourceWithStreamingResponse(self._brand_protection.matches)
+
+ @cached_property
+ def logos(self) -> LogosResourceWithStreamingResponse:
+ return LogosResourceWithStreamingResponse(self._brand_protection.logos)
+
+ @cached_property
+ def logo_matches(self) -> LogoMatchesResourceWithStreamingResponse:
+ return LogoMatchesResourceWithStreamingResponse(self._brand_protection.logo_matches)
+
class AsyncBrandProtectionResourceWithStreamingResponse:
def __init__(self, brand_protection: AsyncBrandProtectionResource) -> None:
@@ -303,3 +355,19 @@ def __init__(self, brand_protection: AsyncBrandProtectionResource) -> None:
self.url_info = async_to_streamed_response_wrapper(
brand_protection.url_info,
)
+
+ @cached_property
+ def queries(self) -> AsyncQueriesResourceWithStreamingResponse:
+ return AsyncQueriesResourceWithStreamingResponse(self._brand_protection.queries)
+
+ @cached_property
+ def matches(self) -> AsyncMatchesResourceWithStreamingResponse:
+ return AsyncMatchesResourceWithStreamingResponse(self._brand_protection.matches)
+
+ @cached_property
+ def logos(self) -> AsyncLogosResourceWithStreamingResponse:
+ return AsyncLogosResourceWithStreamingResponse(self._brand_protection.logos)
+
+ @cached_property
+ def logo_matches(self) -> AsyncLogoMatchesResourceWithStreamingResponse:
+ return AsyncLogoMatchesResourceWithStreamingResponse(self._brand_protection.logo_matches)
diff --git a/src/cloudflare/resources/brand_protection/logo_matches.py b/src/cloudflare/resources/brand_protection/logo_matches.py
new file mode 100644
index 00000000000..abe100862e5
--- /dev/null
+++ b/src/cloudflare/resources/brand_protection/logo_matches.py
@@ -0,0 +1,300 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._base_client import make_request_options
+from ...types.brand_protection import logo_match_get_params, logo_match_download_params
+from ...types.brand_protection.logo_match_get_response import LogoMatchGetResponse
+from ...types.brand_protection.logo_match_download_response import LogoMatchDownloadResponse
+
+__all__ = ["LogoMatchesResource", "AsyncLogoMatchesResource"]
+
+
+class LogoMatchesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> LogoMatchesResourceWithRawResponse:
+ """
+ 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 LogoMatchesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> LogoMatchesResourceWithStreamingResponse:
+ """
+ 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 LogoMatchesResourceWithStreamingResponse(self)
+
+ def download(
+ self,
+ *,
+ account_id: str,
+ limit: str | Omit = omit,
+ logo_id: SequenceNotStr[str] | Omit = omit,
+ offset: str | Omit = omit,
+ # 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,
+ ) -> LogoMatchDownloadResponse:
+ """
+ Return matches as CSV for logo queries based on ID
+
+ Args:
+ 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(
+ f"/accounts/{account_id}/brand-protection/logo-matches/download",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "limit": limit,
+ "logo_id": logo_id,
+ "offset": offset,
+ },
+ logo_match_download_params.LogoMatchDownloadParams,
+ ),
+ ),
+ cast_to=LogoMatchDownloadResponse,
+ )
+
+ def get(
+ self,
+ *,
+ account_id: str,
+ limit: str | Omit = omit,
+ logo_id: SequenceNotStr[str] | Omit = omit,
+ offset: str | Omit = omit,
+ # 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,
+ ) -> LogoMatchGetResponse:
+ """
+ Return matches for logo queries based on ID
+
+ Args:
+ 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(
+ f"/accounts/{account_id}/brand-protection/logo-matches",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "limit": limit,
+ "logo_id": logo_id,
+ "offset": offset,
+ },
+ logo_match_get_params.LogoMatchGetParams,
+ ),
+ ),
+ cast_to=LogoMatchGetResponse,
+ )
+
+
+class AsyncLogoMatchesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncLogoMatchesResourceWithRawResponse:
+ """
+ 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 AsyncLogoMatchesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncLogoMatchesResourceWithStreamingResponse:
+ """
+ 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 AsyncLogoMatchesResourceWithStreamingResponse(self)
+
+ async def download(
+ self,
+ *,
+ account_id: str,
+ limit: str | Omit = omit,
+ logo_id: SequenceNotStr[str] | Omit = omit,
+ offset: str | Omit = omit,
+ # 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,
+ ) -> LogoMatchDownloadResponse:
+ """
+ Return matches as CSV for logo queries based on ID
+
+ Args:
+ 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 await self._get(
+ f"/accounts/{account_id}/brand-protection/logo-matches/download",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "limit": limit,
+ "logo_id": logo_id,
+ "offset": offset,
+ },
+ logo_match_download_params.LogoMatchDownloadParams,
+ ),
+ ),
+ cast_to=LogoMatchDownloadResponse,
+ )
+
+ async def get(
+ self,
+ *,
+ account_id: str,
+ limit: str | Omit = omit,
+ logo_id: SequenceNotStr[str] | Omit = omit,
+ offset: str | Omit = omit,
+ # 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,
+ ) -> LogoMatchGetResponse:
+ """
+ Return matches for logo queries based on ID
+
+ Args:
+ 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 await self._get(
+ f"/accounts/{account_id}/brand-protection/logo-matches",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "limit": limit,
+ "logo_id": logo_id,
+ "offset": offset,
+ },
+ logo_match_get_params.LogoMatchGetParams,
+ ),
+ ),
+ cast_to=LogoMatchGetResponse,
+ )
+
+
+class LogoMatchesResourceWithRawResponse:
+ def __init__(self, logo_matches: LogoMatchesResource) -> None:
+ self._logo_matches = logo_matches
+
+ self.download = to_raw_response_wrapper(
+ logo_matches.download,
+ )
+ self.get = to_raw_response_wrapper(
+ logo_matches.get,
+ )
+
+
+class AsyncLogoMatchesResourceWithRawResponse:
+ def __init__(self, logo_matches: AsyncLogoMatchesResource) -> None:
+ self._logo_matches = logo_matches
+
+ self.download = async_to_raw_response_wrapper(
+ logo_matches.download,
+ )
+ self.get = async_to_raw_response_wrapper(
+ logo_matches.get,
+ )
+
+
+class LogoMatchesResourceWithStreamingResponse:
+ def __init__(self, logo_matches: LogoMatchesResource) -> None:
+ self._logo_matches = logo_matches
+
+ self.download = to_streamed_response_wrapper(
+ logo_matches.download,
+ )
+ self.get = to_streamed_response_wrapper(
+ logo_matches.get,
+ )
+
+
+class AsyncLogoMatchesResourceWithStreamingResponse:
+ def __init__(self, logo_matches: AsyncLogoMatchesResource) -> None:
+ self._logo_matches = logo_matches
+
+ self.download = async_to_streamed_response_wrapper(
+ logo_matches.download,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ logo_matches.get,
+ )
diff --git a/src/cloudflare/resources/brand_protection/logos.py b/src/cloudflare/resources/brand_protection/logos.py
new file mode 100644
index 00000000000..fb55402f7e7
--- /dev/null
+++ b/src/cloudflare/resources/brand_protection/logos.py
@@ -0,0 +1,283 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, FileTypes, omit, not_given
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._base_client import make_request_options
+from ...types.brand_protection import logo_create_params
+from ...types.brand_protection.logo_create_response import LogoCreateResponse
+
+__all__ = ["LogosResource", "AsyncLogosResource"]
+
+
+class LogosResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> LogosResourceWithRawResponse:
+ """
+ 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 LogosResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> LogosResourceWithStreamingResponse:
+ """
+ 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 LogosResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ account_id: str,
+ match_type: str | Omit = omit,
+ tag: str | Omit = omit,
+ threshold: float | Omit = omit,
+ image: FileTypes | Omit = omit,
+ # 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,
+ ) -> LogoCreateResponse:
+ """
+ Return new saved logo queries created from image files
+
+ Args:
+ 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._post(
+ f"/accounts/{account_id}/brand-protection/logos",
+ body=maybe_transform({"image": image}, logo_create_params.LogoCreateParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "match_type": match_type,
+ "tag": tag,
+ "threshold": threshold,
+ },
+ logo_create_params.LogoCreateParams,
+ ),
+ ),
+ cast_to=LogoCreateResponse,
+ )
+
+ def delete(
+ self,
+ logo_id: str,
+ *,
+ 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,
+ ) -> None:
+ """
+ Return a success message after deleting saved logo queries by ID
+
+ Args:
+ 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 logo_id:
+ raise ValueError(f"Expected a non-empty value for `logo_id` but received {logo_id!r}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return self._delete(
+ f"/accounts/{account_id}/brand-protection/logos/{logo_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=NoneType,
+ )
+
+
+class AsyncLogosResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncLogosResourceWithRawResponse:
+ """
+ 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 AsyncLogosResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncLogosResourceWithStreamingResponse:
+ """
+ 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 AsyncLogosResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ account_id: str,
+ match_type: str | Omit = omit,
+ tag: str | Omit = omit,
+ threshold: float | Omit = omit,
+ image: FileTypes | Omit = omit,
+ # 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,
+ ) -> LogoCreateResponse:
+ """
+ Return new saved logo queries created from image files
+
+ Args:
+ 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 await self._post(
+ f"/accounts/{account_id}/brand-protection/logos",
+ body=await async_maybe_transform({"image": image}, logo_create_params.LogoCreateParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "match_type": match_type,
+ "tag": tag,
+ "threshold": threshold,
+ },
+ logo_create_params.LogoCreateParams,
+ ),
+ ),
+ cast_to=LogoCreateResponse,
+ )
+
+ async def delete(
+ self,
+ logo_id: str,
+ *,
+ 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,
+ ) -> None:
+ """
+ Return a success message after deleting saved logo queries by ID
+
+ Args:
+ 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 logo_id:
+ raise ValueError(f"Expected a non-empty value for `logo_id` but received {logo_id!r}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return await self._delete(
+ f"/accounts/{account_id}/brand-protection/logos/{logo_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=NoneType,
+ )
+
+
+class LogosResourceWithRawResponse:
+ def __init__(self, logos: LogosResource) -> None:
+ self._logos = logos
+
+ self.create = to_raw_response_wrapper(
+ logos.create,
+ )
+ self.delete = to_raw_response_wrapper(
+ logos.delete,
+ )
+
+
+class AsyncLogosResourceWithRawResponse:
+ def __init__(self, logos: AsyncLogosResource) -> None:
+ self._logos = logos
+
+ self.create = async_to_raw_response_wrapper(
+ logos.create,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ logos.delete,
+ )
+
+
+class LogosResourceWithStreamingResponse:
+ def __init__(self, logos: LogosResource) -> None:
+ self._logos = logos
+
+ self.create = to_streamed_response_wrapper(
+ logos.create,
+ )
+ self.delete = to_streamed_response_wrapper(
+ logos.delete,
+ )
+
+
+class AsyncLogosResourceWithStreamingResponse:
+ def __init__(self, logos: AsyncLogosResource) -> None:
+ self._logos = logos
+
+ self.create = async_to_streamed_response_wrapper(
+ logos.create,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ logos.delete,
+ )
diff --git a/src/cloudflare/resources/brand_protection/matches.py b/src/cloudflare/resources/brand_protection/matches.py
new file mode 100644
index 00000000000..cf18f113e32
--- /dev/null
+++ b/src/cloudflare/resources/brand_protection/matches.py
@@ -0,0 +1,308 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import httpx
+
+from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._base_client import make_request_options
+from ...types.brand_protection import match_get_params, match_download_params
+from ...types.brand_protection.match_get_response import MatchGetResponse
+from ...types.brand_protection.match_download_response import MatchDownloadResponse
+
+__all__ = ["MatchesResource", "AsyncMatchesResource"]
+
+
+class MatchesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> MatchesResourceWithRawResponse:
+ """
+ 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 MatchesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> MatchesResourceWithStreamingResponse:
+ """
+ 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 MatchesResourceWithStreamingResponse(self)
+
+ def download(
+ self,
+ *,
+ account_id: str,
+ id: str | Omit = omit,
+ include_domain_id: bool | Omit = omit,
+ limit: int | Omit = omit,
+ offset: int | Omit = omit,
+ # 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,
+ ) -> MatchDownloadResponse:
+ """
+ Return matches as CSV for string queries based on ID
+
+ Args:
+ 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(
+ f"/accounts/{account_id}/brand-protection/matches/download",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "id": id,
+ "include_domain_id": include_domain_id,
+ "limit": limit,
+ "offset": offset,
+ },
+ match_download_params.MatchDownloadParams,
+ ),
+ ),
+ cast_to=MatchDownloadResponse,
+ )
+
+ def get(
+ self,
+ *,
+ account_id: str,
+ id: str | Omit = omit,
+ include_domain_id: bool | Omit = omit,
+ limit: int | Omit = omit,
+ offset: int | Omit = omit,
+ # 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,
+ ) -> MatchGetResponse:
+ """
+ Return matches for string queries based on ID
+
+ Args:
+ 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(
+ f"/accounts/{account_id}/brand-protection/matches",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "id": id,
+ "include_domain_id": include_domain_id,
+ "limit": limit,
+ "offset": offset,
+ },
+ match_get_params.MatchGetParams,
+ ),
+ ),
+ cast_to=MatchGetResponse,
+ )
+
+
+class AsyncMatchesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncMatchesResourceWithRawResponse:
+ """
+ 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 AsyncMatchesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncMatchesResourceWithStreamingResponse:
+ """
+ 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 AsyncMatchesResourceWithStreamingResponse(self)
+
+ async def download(
+ self,
+ *,
+ account_id: str,
+ id: str | Omit = omit,
+ include_domain_id: bool | Omit = omit,
+ limit: int | Omit = omit,
+ offset: int | Omit = omit,
+ # 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,
+ ) -> MatchDownloadResponse:
+ """
+ Return matches as CSV for string queries based on ID
+
+ Args:
+ 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 await self._get(
+ f"/accounts/{account_id}/brand-protection/matches/download",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "id": id,
+ "include_domain_id": include_domain_id,
+ "limit": limit,
+ "offset": offset,
+ },
+ match_download_params.MatchDownloadParams,
+ ),
+ ),
+ cast_to=MatchDownloadResponse,
+ )
+
+ async def get(
+ self,
+ *,
+ account_id: str,
+ id: str | Omit = omit,
+ include_domain_id: bool | Omit = omit,
+ limit: int | Omit = omit,
+ offset: int | Omit = omit,
+ # 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,
+ ) -> MatchGetResponse:
+ """
+ Return matches for string queries based on ID
+
+ Args:
+ 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 await self._get(
+ f"/accounts/{account_id}/brand-protection/matches",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "id": id,
+ "include_domain_id": include_domain_id,
+ "limit": limit,
+ "offset": offset,
+ },
+ match_get_params.MatchGetParams,
+ ),
+ ),
+ cast_to=MatchGetResponse,
+ )
+
+
+class MatchesResourceWithRawResponse:
+ def __init__(self, matches: MatchesResource) -> None:
+ self._matches = matches
+
+ self.download = to_raw_response_wrapper(
+ matches.download,
+ )
+ self.get = to_raw_response_wrapper(
+ matches.get,
+ )
+
+
+class AsyncMatchesResourceWithRawResponse:
+ def __init__(self, matches: AsyncMatchesResource) -> None:
+ self._matches = matches
+
+ self.download = async_to_raw_response_wrapper(
+ matches.download,
+ )
+ self.get = async_to_raw_response_wrapper(
+ matches.get,
+ )
+
+
+class MatchesResourceWithStreamingResponse:
+ def __init__(self, matches: MatchesResource) -> None:
+ self._matches = matches
+
+ self.download = to_streamed_response_wrapper(
+ matches.download,
+ )
+ self.get = to_streamed_response_wrapper(
+ matches.get,
+ )
+
+
+class AsyncMatchesResourceWithStreamingResponse:
+ def __init__(self, matches: AsyncMatchesResource) -> None:
+ self._matches = matches
+
+ self.download = async_to_streamed_response_wrapper(
+ matches.download,
+ )
+ self.get = async_to_streamed_response_wrapper(
+ matches.get,
+ )
diff --git a/src/cloudflare/resources/brand_protection/queries.py b/src/cloudflare/resources/brand_protection/queries.py
new file mode 100644
index 00000000000..4b7ead75a1c
--- /dev/null
+++ b/src/cloudflare/resources/brand_protection/queries.py
@@ -0,0 +1,419 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict, Union, Iterable
+from datetime import datetime
+
+import httpx
+
+from ..._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
+from ..._utils import maybe_transform, async_maybe_transform
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._base_client import make_request_options
+from ...types.brand_protection import query_bulk_params, query_create_params, query_delete_params
+
+__all__ = ["QueriesResource", "AsyncQueriesResource"]
+
+
+class QueriesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> QueriesResourceWithRawResponse:
+ """
+ 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 QueriesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> QueriesResourceWithStreamingResponse:
+ """
+ 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 QueriesResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ account_id: str,
+ id: str | Omit = omit,
+ query_scan: bool | Omit = omit,
+ query_tag: str | Omit = omit,
+ max_time: Union[str, datetime, None] | Omit = omit,
+ min_time: Union[str, datetime, None] | Omit = omit,
+ body_scan: bool | Omit = omit,
+ string_matches: object | Omit = omit,
+ body_tag: str | Omit = omit,
+ # 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,
+ ) -> None:
+ """
+ Return a success message after creating new saved string queries
+
+ Args:
+ 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}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return self._post(
+ f"/accounts/{account_id}/brand-protection/queries",
+ body=maybe_transform(
+ {
+ "max_time": max_time,
+ "min_time": min_time,
+ "body_scan": body_scan,
+ "string_matches": string_matches,
+ "body_tag": body_tag,
+ },
+ query_create_params.QueryCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "id": id,
+ "query_scan": query_scan,
+ "query_tag": query_tag,
+ },
+ query_create_params.QueryCreateParams,
+ ),
+ ),
+ cast_to=NoneType,
+ )
+
+ def delete(
+ self,
+ *,
+ account_id: str,
+ id: str | Omit = omit,
+ scan: bool | Omit = omit,
+ tag: str | Omit = omit,
+ # 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,
+ ) -> None:
+ """
+ Return a success message after deleting saved string queries by ID
+
+ Args:
+ 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}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return self._delete(
+ f"/accounts/{account_id}/brand-protection/queries",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "id": id,
+ "scan": scan,
+ "tag": tag,
+ },
+ query_delete_params.QueryDeleteParams,
+ ),
+ ),
+ cast_to=NoneType,
+ )
+
+ def bulk(
+ self,
+ *,
+ account_id: str,
+ queries: Iterable[Dict[str, object]] | Omit = omit,
+ # 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,
+ ) -> None:
+ """
+ Return a success message after creating new saved string queries in bulk
+
+ Args:
+ 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}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return self._post(
+ f"/accounts/{account_id}/brand-protection/queries/bulk",
+ body=maybe_transform({"queries": queries}, query_bulk_params.QueryBulkParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=NoneType,
+ )
+
+
+class AsyncQueriesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncQueriesResourceWithRawResponse:
+ """
+ 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 AsyncQueriesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncQueriesResourceWithStreamingResponse:
+ """
+ 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 AsyncQueriesResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ account_id: str,
+ id: str | Omit = omit,
+ query_scan: bool | Omit = omit,
+ query_tag: str | Omit = omit,
+ max_time: Union[str, datetime, None] | Omit = omit,
+ min_time: Union[str, datetime, None] | Omit = omit,
+ body_scan: bool | Omit = omit,
+ string_matches: object | Omit = omit,
+ body_tag: str | Omit = omit,
+ # 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,
+ ) -> None:
+ """
+ Return a success message after creating new saved string queries
+
+ Args:
+ 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}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return await self._post(
+ f"/accounts/{account_id}/brand-protection/queries",
+ body=await async_maybe_transform(
+ {
+ "max_time": max_time,
+ "min_time": min_time,
+ "body_scan": body_scan,
+ "string_matches": string_matches,
+ "body_tag": body_tag,
+ },
+ query_create_params.QueryCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "id": id,
+ "query_scan": query_scan,
+ "query_tag": query_tag,
+ },
+ query_create_params.QueryCreateParams,
+ ),
+ ),
+ cast_to=NoneType,
+ )
+
+ async def delete(
+ self,
+ *,
+ account_id: str,
+ id: str | Omit = omit,
+ scan: bool | Omit = omit,
+ tag: str | Omit = omit,
+ # 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,
+ ) -> None:
+ """
+ Return a success message after deleting saved string queries by ID
+
+ Args:
+ 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}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return await self._delete(
+ f"/accounts/{account_id}/brand-protection/queries",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "id": id,
+ "scan": scan,
+ "tag": tag,
+ },
+ query_delete_params.QueryDeleteParams,
+ ),
+ ),
+ cast_to=NoneType,
+ )
+
+ async def bulk(
+ self,
+ *,
+ account_id: str,
+ queries: Iterable[Dict[str, object]] | Omit = omit,
+ # 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,
+ ) -> None:
+ """
+ Return a success message after creating new saved string queries in bulk
+
+ Args:
+ 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}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return await self._post(
+ f"/accounts/{account_id}/brand-protection/queries/bulk",
+ body=await async_maybe_transform({"queries": queries}, query_bulk_params.QueryBulkParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=NoneType,
+ )
+
+
+class QueriesResourceWithRawResponse:
+ def __init__(self, queries: QueriesResource) -> None:
+ self._queries = queries
+
+ self.create = to_raw_response_wrapper(
+ queries.create,
+ )
+ self.delete = to_raw_response_wrapper(
+ queries.delete,
+ )
+ self.bulk = to_raw_response_wrapper(
+ queries.bulk,
+ )
+
+
+class AsyncQueriesResourceWithRawResponse:
+ def __init__(self, queries: AsyncQueriesResource) -> None:
+ self._queries = queries
+
+ self.create = async_to_raw_response_wrapper(
+ queries.create,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ queries.delete,
+ )
+ self.bulk = async_to_raw_response_wrapper(
+ queries.bulk,
+ )
+
+
+class QueriesResourceWithStreamingResponse:
+ def __init__(self, queries: QueriesResource) -> None:
+ self._queries = queries
+
+ self.create = to_streamed_response_wrapper(
+ queries.create,
+ )
+ self.delete = to_streamed_response_wrapper(
+ queries.delete,
+ )
+ self.bulk = to_streamed_response_wrapper(
+ queries.bulk,
+ )
+
+
+class AsyncQueriesResourceWithStreamingResponse:
+ def __init__(self, queries: AsyncQueriesResource) -> None:
+ self._queries = queries
+
+ self.create = async_to_streamed_response_wrapper(
+ queries.create,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ queries.delete,
+ )
+ self.bulk = async_to_streamed_response_wrapper(
+ queries.bulk,
+ )
diff --git a/src/cloudflare/resources/browser_rendering/content.py b/src/cloudflare/resources/browser_rendering/content.py
index 6ff78d62f8b..a70abd0583b 100644
--- a/src/cloudflare/resources/browser_rendering/content.py
+++ b/src/cloudflare/resources/browser_rendering/content.py
@@ -3,12 +3,12 @@
from __future__ import annotations
from typing import Dict, List, Type, Iterable, Optional, cast
-from typing_extensions import Literal
+from typing_extensions import Literal, overload
import httpx
-from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
-from ..._utils import maybe_transform, async_maybe_transform
+from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
+from ..._utils import required_args, maybe_transform, async_maybe_transform
from ..._compat import cached_property
from ..._resource import SyncAPIResource, AsyncAPIResource
from ..._response import (
@@ -45,15 +45,17 @@ def with_streaming_response(self) -> ContentResourceWithStreamingResponse:
"""
return ContentResourceWithStreamingResponse(self)
+ @overload
def create(
self,
*,
account_id: str,
- cache_ttl: float | NotGiven = NOT_GIVEN,
- action_timeout: float | NotGiven = NOT_GIVEN,
- add_script_tag: Iterable[content_create_params.AddScriptTag] | NotGiven = NOT_GIVEN,
- add_style_tag: Iterable[content_create_params.AddStyleTag] | NotGiven = NOT_GIVEN,
- allow_request_pattern: List[str] | NotGiven = NOT_GIVEN,
+ url: str,
+ cache_ttl: float | Omit = omit,
+ action_timeout: float | Omit = omit,
+ add_script_tag: Iterable[content_create_params.Variant0AddScriptTag] | Omit = omit,
+ add_style_tag: Iterable[content_create_params.Variant0AddStyleTag] | Omit = omit,
+ allow_request_pattern: SequenceNotStr[str] | Omit = omit,
allow_resource_types: List[
Literal[
"document",
@@ -76,14 +78,13 @@ def create(
"other",
]
]
- | NotGiven = NOT_GIVEN,
- authenticate: content_create_params.Authenticate | NotGiven = NOT_GIVEN,
- best_attempt: bool | NotGiven = NOT_GIVEN,
- cookies: Iterable[content_create_params.Cookie] | NotGiven = NOT_GIVEN,
- emulate_media_type: str | NotGiven = NOT_GIVEN,
- goto_options: content_create_params.GotoOptions | NotGiven = NOT_GIVEN,
- html: str | NotGiven = NOT_GIVEN,
- reject_request_pattern: List[str] | NotGiven = NOT_GIVEN,
+ | Omit = omit,
+ authenticate: content_create_params.Variant0Authenticate | Omit = omit,
+ best_attempt: bool | Omit = omit,
+ cookies: Iterable[content_create_params.Variant0Cookie] | Omit = omit,
+ emulate_media_type: str | Omit = omit,
+ goto_options: content_create_params.Variant0GotoOptions | Omit = omit,
+ reject_request_pattern: SequenceNotStr[str] | Omit = omit,
reject_resource_types: List[
Literal[
"document",
@@ -106,20 +107,19 @@ def create(
"other",
]
]
- | NotGiven = NOT_GIVEN,
- set_extra_http_headers: Dict[str, str] | NotGiven = NOT_GIVEN,
- set_java_script_enabled: bool | NotGiven = NOT_GIVEN,
- url: str | NotGiven = NOT_GIVEN,
- user_agent: str | NotGiven = NOT_GIVEN,
- viewport: content_create_params.Viewport | NotGiven = NOT_GIVEN,
- wait_for_selector: content_create_params.WaitForSelector | NotGiven = NOT_GIVEN,
- wait_for_timeout: float | NotGiven = NOT_GIVEN,
+ | Omit = omit,
+ set_extra_http_headers: Dict[str, str] | Omit = omit,
+ set_java_script_enabled: bool | Omit = omit,
+ user_agent: str | Omit = omit,
+ viewport: content_create_params.Variant0Viewport | Omit = omit,
+ wait_for_selector: content_create_params.Variant0WaitForSelector | Omit = omit,
+ wait_for_timeout: float | Omit = omit,
# 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,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
) -> str:
"""Fetches rendered HTML content from provided URL or HTML.
@@ -129,6 +129,8 @@ def create(
Args:
account_id: Account ID.
+ url: URL to navigate to, eg. `https://example.com`.
+
cache_ttl: Cache TTL default is 5s. Set to 0 to disable.
action_timeout: The maximum duration allowed for the browser action to complete after the page
@@ -153,17 +155,146 @@ def create(
goto_options: Check [options](https://pptr.dev/api/puppeteer.gotooptions).
+ reject_request_pattern: Block undesired requests that match the provided regex patterns, eg.
+ '/^.\\**\\..(css)'.
+
+ reject_resource_types: Block undesired requests that match the provided resource types, eg. 'image' or
+ 'script'.
+
+ viewport: Check [options](https://pptr.dev/api/puppeteer.page.setviewport).
+
+ wait_for_selector: Wait for the selector to appear in page. Check
+ [options](https://pptr.dev/api/puppeteer.page.waitforselector).
+
+ wait_for_timeout: Waits for a specified timeout before continuing.
+
+ 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
+ """
+ ...
+
+ @overload
+ def create(
+ self,
+ *,
+ account_id: str,
+ html: str,
+ cache_ttl: float | Omit = omit,
+ action_timeout: float | Omit = omit,
+ add_script_tag: Iterable[content_create_params.Variant1AddScriptTag] | Omit = omit,
+ add_style_tag: Iterable[content_create_params.Variant1AddStyleTag] | Omit = omit,
+ allow_request_pattern: SequenceNotStr[str] | Omit = omit,
+ allow_resource_types: List[
+ Literal[
+ "document",
+ "stylesheet",
+ "image",
+ "media",
+ "font",
+ "script",
+ "texttrack",
+ "xhr",
+ "fetch",
+ "prefetch",
+ "eventsource",
+ "websocket",
+ "manifest",
+ "signedexchange",
+ "ping",
+ "cspviolationreport",
+ "preflight",
+ "other",
+ ]
+ ]
+ | Omit = omit,
+ authenticate: content_create_params.Variant1Authenticate | Omit = omit,
+ best_attempt: bool | Omit = omit,
+ cookies: Iterable[content_create_params.Variant1Cookie] | Omit = omit,
+ emulate_media_type: str | Omit = omit,
+ goto_options: content_create_params.Variant1GotoOptions | Omit = omit,
+ reject_request_pattern: SequenceNotStr[str] | Omit = omit,
+ reject_resource_types: List[
+ Literal[
+ "document",
+ "stylesheet",
+ "image",
+ "media",
+ "font",
+ "script",
+ "texttrack",
+ "xhr",
+ "fetch",
+ "prefetch",
+ "eventsource",
+ "websocket",
+ "manifest",
+ "signedexchange",
+ "ping",
+ "cspviolationreport",
+ "preflight",
+ "other",
+ ]
+ ]
+ | Omit = omit,
+ set_extra_http_headers: Dict[str, str] | Omit = omit,
+ set_java_script_enabled: bool | Omit = omit,
+ user_agent: str | Omit = omit,
+ viewport: content_create_params.Variant1Viewport | Omit = omit,
+ wait_for_selector: content_create_params.Variant1WaitForSelector | Omit = omit,
+ wait_for_timeout: float | Omit = omit,
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
+ # The extra values given here take precedence over values defined on the client or passed to this method.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
+ ) -> str:
+ """Fetches rendered HTML content from provided URL or HTML.
+
+ Check available options
+ like `gotoOptions` and `waitFor*` to control page load behaviour.
+
+ Args:
+ account_id: Account ID.
+
html: Set the content of the page, eg: `Hello World!!
`. Either `html` or
`url` must be set.
+ cache_ttl: Cache TTL default is 5s. Set to 0 to disable.
+
+ action_timeout: The maximum duration allowed for the browser action to complete after the page
+ has loaded (such as taking screenshots, extracting content, or generating PDFs).
+ If this time limit is exceeded, the action stops and returns a timeout error.
+
+ add_script_tag: Adds a `