diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5f0624a8c..d0b8bb94ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,11 +8,15 @@ on: - main - next +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: lint: name: lint runs-on: ubuntu-latest - + timeout-minutes: 5 steps: - uses: actions/checkout@v4 @@ -22,14 +26,34 @@ jobs: with: node-version: '18' - - name: Install dependencies - run: yarn install + - name: Bootstrap + run: ./scripts/bootstrap - name: Check types run: ./scripts/lint + + build: + name: build + runs-on: ubuntu-latest + + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Bootstrap + run: ./scripts/bootstrap + + - name: Check build + run: ./scripts/build test: name: test runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v4 @@ -47,6 +71,7 @@ jobs: examples: name: examples runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v4 @@ -59,10 +84,10 @@ jobs: run: | yarn install - - env: + - env: CLOUDFLARE_ACCOUNT_ID: f037e56e89293a057740de681ac9abbe CLOUDFLARE_EMAIL: terraform-acceptance-test@cfapi.net CLOUDFLARE_ZONE_ID: 0da42c8d2132a9ddaf714f9e7c92011 CLOUDFLARE_API_KEY: ${{ secrets.CLOUDFLARE_API_KEY }} run: | - yarn tsn ./examples/workers/ai/demo.ts + yarn tsn ./examples/ai/demo.ts diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 3008e5bc96..962bb2a13c 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -1,12 +1,19 @@ name: Release Doctor on: pull_request: + branches: + - main workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: release_doctor: name: release doctor runs-on: ubuntu-latest + timeout-minutes: 2 if: github.repository == 'cloudflare/cloudflare-typescript' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: @@ -17,3 +24,4 @@ jobs: bash ./bin/check-release-environment env: NPM_TOKEN: ${{ secrets.CLOUDFLARE_NPM_TOKEN || secrets.NPM_TOKEN }} + diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml new file mode 100644 index 0000000000..788c64e100 --- /dev/null +++ b/.github/workflows/semgrep.yml @@ -0,0 +1,19 @@ +on: + workflow_dispatch: {} + schedule: + - cron: '0 4 * * *' +name: Semgrep config +jobs: + semgrep: + name: semgrep/ci + runs-on: ubuntu-latest + env: + SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} + SEMGREP_URL: https://cloudflare.semgrep.dev + SEMGREP_APP_URL: https://cloudflare.semgrep.dev + SEMGREP_VERSION_CHECK_URL: https://cloudflare.semgrep.dev/api/check-version + container: + image: semgrep/semgrep + steps: + - uses: actions/checkout@v4 + - run: semgrep ci diff --git a/.gitignore b/.gitignore index 3eed6ddf26..d98d51a880 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ yarn-error.log codegen.log Brewfile.lock.json dist -/deno +dist-deno /*.tgz .idea/ diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3cf104e936..e6f877563b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.5.0" + ".": "4.0.0" } diff --git a/.stats.yml b/.stats.yml index 21a17687b3..e8e51bfa08 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1256 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-923d8c7667b68c786e6c026c4f4851798943c7d68ea055c0043d9253413c5847.yml +configured_endpoints: 1493 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-292d86018649794a0921751cee7162cb618358a55576fe9e18995601ad7484cc.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index bce03e7dc6..1852244cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,260 @@ # Changelog +## 4.0.0 (2025-01-14) + +Full Changelog: [v3.5.0...v4.0.0](https://github.com/cloudflare/cloudflare-typescript/compare/v3.5.0...v4.0.0) + +### ⚠ BREAKING CHANGES + +* **addressing:** reshuffle relationship in the namespace to align with the product ([#2290](https://github.com/cloudflare/cloudflare-typescript/issues/2290)) +* **r2:** rename `cf-r2-jurisdiction` to more usable `jurisdiction` parameter ([#2279](https://github.com/cloudflare/cloudflare-typescript/issues/2279)) +* **r2:** rename `cf-r2-jurisdiction` to more usable `jurisdiction` parameter ([#2278](https://github.com/cloudflare/cloudflare-typescript/issues/2278)) +* **r2:** rename `cf-r2-jurisdiction` to more usable `jurisdiction` parameter ([#2277](https://github.com/cloudflare/cloudflare-typescript/issues/2277)) +* **loa_documents:** move download subresource into parent as `get` ([#2274](https://github.com/cloudflare/cloudflare-typescript/issues/2274)) +* **addressing:** move service bindings to dedicated namespace ([#2273](https://github.com/cloudflare/cloudflare-typescript/issues/2273)) +* **ai:** move to dedicated namespace ([#2241](https://github.com/cloudflare/cloudflare-typescript/issues/2241)) +* **kv:** move analytics under existing namespace ([#2212](https://github.com/cloudflare/cloudflare-typescript/issues/2212)) +* **zone_transfers:** move under DNS namespace ([#2208](https://github.com/cloudflare/cloudflare-typescript/issues/2208)) +* **dnssec:** move under DNS namespace ([#2207](https://github.com/cloudflare/cloudflare-typescript/issues/2207)) +* **url_scanner:** swap all methods to be v2 only ([#2206](https://github.com/cloudflare/cloudflare-typescript/issues/2206)) +* **warp_connector:** move under zero trust namespace ([#2195](https://github.com/cloudflare/cloudflare-typescript/issues/2195)) +* **calls:** split turn and sfu apps ([#2099](https://github.com/cloudflare/cloudflare-typescript/issues/2099)) + +### Features + +* **addressing:** move service bindings to dedicated namespace ([#2273](https://github.com/cloudflare/cloudflare-typescript/issues/2273)) ([66e2a04](https://github.com/cloudflare/cloudflare-typescript/commit/66e2a040bff49a0397715999b1b6f9260f1da582)) +* **addressing:** reshuffle relationship in the namespace to align with the product ([#2290](https://github.com/cloudflare/cloudflare-typescript/issues/2290)) ([af68b5d](https://github.com/cloudflare/cloudflare-typescript/commit/af68b5d6c53c7505a70eaf09fef8fb5ef741b50f)) +* **ai:** add support for search endpoints and finetunes ([#2275](https://github.com/cloudflare/cloudflare-typescript/issues/2275)) ([7cbefee](https://github.com/cloudflare/cloudflare-typescript/commit/7cbefee616dedd3e84f419a3fe6c6353e5a470c9)) +* **ai:** move AI back to dedicated namespace ([#2246](https://github.com/cloudflare/cloudflare-typescript/issues/2246)) ([ef18a36](https://github.com/cloudflare/cloudflare-typescript/commit/ef18a366b445ee32e54c03be3587564632c10ac7)) +* **ai:** move to dedicated namespace ([#2241](https://github.com/cloudflare/cloudflare-typescript/issues/2241)) ([0e5231b](https://github.com/cloudflare/cloudflare-typescript/commit/0e5231b6d1c4b80970f4fc6079f3351eea4e7c67)) +* **api:** add more path mappings ([#2153](https://github.com/cloudflare/cloudflare-typescript/issues/2153)) ([f95f175](https://github.com/cloudflare/cloudflare-typescript/commit/f95f175ffcb2497b19a8492b19793eabba6a1c99)) +* **api:** Add new Aegis zone setting ([#2287](https://github.com/cloudflare/cloudflare-typescript/issues/2287)) ([fc1c802](https://github.com/cloudflare/cloudflare-typescript/commit/fc1c802de1ec0a3ff7400165b87823b2e0ce25a2)) +* **api:** Add PATCH zone hold update method ([#2240](https://github.com/cloudflare/cloudflare-typescript/issues/2240)) ([bf162ce](https://github.com/cloudflare/cloudflare-typescript/commit/bf162cec406c7d185f74af7d6ce8cface973180c)) +* **api:** api shield operations updates; rename discovery resource ([#2263](https://github.com/cloudflare/cloudflare-typescript/issues/2263)) ([6053b14](https://github.com/cloudflare/cloudflare-typescript/commit/6053b148fb85adebc899b5ad5554df20d145f271)) +* **api:** api update ([#2095](https://github.com/cloudflare/cloudflare-typescript/issues/2095)) ([8bc3925](https://github.com/cloudflare/cloudflare-typescript/commit/8bc392544ec12a3964aabb911291bf9bb0a5f33e)) +* **api:** api update ([#2096](https://github.com/cloudflare/cloudflare-typescript/issues/2096)) ([2ad4904](https://github.com/cloudflare/cloudflare-typescript/commit/2ad49043944539bcb751db428795dc0e1e5c33ab)) +* **api:** api update ([#2097](https://github.com/cloudflare/cloudflare-typescript/issues/2097)) ([7b27dc1](https://github.com/cloudflare/cloudflare-typescript/commit/7b27dc1a2928cf011b699156087f6104a89de20e)) +* **api:** api update ([#2098](https://github.com/cloudflare/cloudflare-typescript/issues/2098)) ([6c37a3e](https://github.com/cloudflare/cloudflare-typescript/commit/6c37a3e9b1f171a3fbad896235f5a2811923c72a)) +* **api:** api update ([#2102](https://github.com/cloudflare/cloudflare-typescript/issues/2102)) ([0317db2](https://github.com/cloudflare/cloudflare-typescript/commit/0317db201085ceee4e68f17b3551cd3a86367b25)) +* **api:** api update ([#2103](https://github.com/cloudflare/cloudflare-typescript/issues/2103)) ([a76563d](https://github.com/cloudflare/cloudflare-typescript/commit/a76563de2ae6f91306fae6e5fe22ae92c31c47ad)) +* **api:** api update ([#2104](https://github.com/cloudflare/cloudflare-typescript/issues/2104)) ([93ce20e](https://github.com/cloudflare/cloudflare-typescript/commit/93ce20e267c372ee3fd769abd892065015e21044)) +* **api:** api update ([#2105](https://github.com/cloudflare/cloudflare-typescript/issues/2105)) ([ad74309](https://github.com/cloudflare/cloudflare-typescript/commit/ad7430908b4bb1d61d28abeef8fdbe5b7988f523)) +* **api:** api update ([#2106](https://github.com/cloudflare/cloudflare-typescript/issues/2106)) ([2330530](https://github.com/cloudflare/cloudflare-typescript/commit/2330530af838d1e1a501676c937f78faf6265061)) +* **api:** api update ([#2108](https://github.com/cloudflare/cloudflare-typescript/issues/2108)) ([5bef56e](https://github.com/cloudflare/cloudflare-typescript/commit/5bef56e6c6d3d7c017f4c60092316446f755b478)) +* **api:** api update ([#2109](https://github.com/cloudflare/cloudflare-typescript/issues/2109)) ([04903fe](https://github.com/cloudflare/cloudflare-typescript/commit/04903fe5bc76122f3e0651c15759df9a65581f79)) +* **api:** api update ([#2111](https://github.com/cloudflare/cloudflare-typescript/issues/2111)) ([ead76b8](https://github.com/cloudflare/cloudflare-typescript/commit/ead76b842b4023a21dbae99182a581cd45063a73)) +* **api:** api update ([#2112](https://github.com/cloudflare/cloudflare-typescript/issues/2112)) ([67cd748](https://github.com/cloudflare/cloudflare-typescript/commit/67cd7482e7bb4af84417c6d619a444da434056b5)) +* **api:** api update ([#2113](https://github.com/cloudflare/cloudflare-typescript/issues/2113)) ([b1749ec](https://github.com/cloudflare/cloudflare-typescript/commit/b1749ec548855fa6714756b244062b45a0755c60)) +* **api:** api update ([#2114](https://github.com/cloudflare/cloudflare-typescript/issues/2114)) ([1fe3d47](https://github.com/cloudflare/cloudflare-typescript/commit/1fe3d47a07d878fc75805b6f99454303c0f38163)) +* **api:** api update ([#2115](https://github.com/cloudflare/cloudflare-typescript/issues/2115)) ([a0555ed](https://github.com/cloudflare/cloudflare-typescript/commit/a0555edfa67022c8a3e45d6003c2b4495cbc7dad)) +* **api:** api update ([#2119](https://github.com/cloudflare/cloudflare-typescript/issues/2119)) ([a31ec78](https://github.com/cloudflare/cloudflare-typescript/commit/a31ec788e5a2f2b253204b10da3789310dbec0eb)) +* **api:** api update ([#2120](https://github.com/cloudflare/cloudflare-typescript/issues/2120)) ([55849b2](https://github.com/cloudflare/cloudflare-typescript/commit/55849b2667173ad22825cba28fa9bb3f74a261d0)) +* **api:** api update ([#2121](https://github.com/cloudflare/cloudflare-typescript/issues/2121)) ([c34e30a](https://github.com/cloudflare/cloudflare-typescript/commit/c34e30a31c4414ae5bfb9e9eee49b4326f439477)) +* **api:** api update ([#2123](https://github.com/cloudflare/cloudflare-typescript/issues/2123)) ([9911931](https://github.com/cloudflare/cloudflare-typescript/commit/9911931cf80c8a5c75ff84f83c12188e7f41e70d)) +* **api:** api update ([#2124](https://github.com/cloudflare/cloudflare-typescript/issues/2124)) ([025572d](https://github.com/cloudflare/cloudflare-typescript/commit/025572dae0a7206b2032c01f9bcd259d925ad961)) +* **api:** api update ([#2125](https://github.com/cloudflare/cloudflare-typescript/issues/2125)) ([b126dd9](https://github.com/cloudflare/cloudflare-typescript/commit/b126dd9c3cdbbe94066f7591370aefa3b2d67e44)) +* **api:** api update ([#2126](https://github.com/cloudflare/cloudflare-typescript/issues/2126)) ([93b93d8](https://github.com/cloudflare/cloudflare-typescript/commit/93b93d87d5a11301a9ce16a06cded6b6c42d0d80)) +* **api:** api update ([#2127](https://github.com/cloudflare/cloudflare-typescript/issues/2127)) ([c5ec717](https://github.com/cloudflare/cloudflare-typescript/commit/c5ec71794dcd90fb56470e355da2f7b20ab252cd)) +* **api:** api update ([#2128](https://github.com/cloudflare/cloudflare-typescript/issues/2128)) ([62b07b5](https://github.com/cloudflare/cloudflare-typescript/commit/62b07b5289c1a9d14174297435c6fcb1c8a375c7)) +* **api:** api update ([#2129](https://github.com/cloudflare/cloudflare-typescript/issues/2129)) ([7f1d762](https://github.com/cloudflare/cloudflare-typescript/commit/7f1d76242102bdceb4e3f7036d9b9439a79a27ee)) +* **api:** api update ([#2137](https://github.com/cloudflare/cloudflare-typescript/issues/2137)) ([a24a64d](https://github.com/cloudflare/cloudflare-typescript/commit/a24a64d25ec71027b6534d50d64ec611b7212f30)) +* **api:** api update ([#2138](https://github.com/cloudflare/cloudflare-typescript/issues/2138)) ([caa573c](https://github.com/cloudflare/cloudflare-typescript/commit/caa573cd76416f43307ab0755badc0bac1f00344)) +* **api:** api update ([#2139](https://github.com/cloudflare/cloudflare-typescript/issues/2139)) ([07e6bab](https://github.com/cloudflare/cloudflare-typescript/commit/07e6bab18d2df7de22ca8f3de79ef28c56e9b91b)) +* **api:** api update ([#2140](https://github.com/cloudflare/cloudflare-typescript/issues/2140)) ([1db4f06](https://github.com/cloudflare/cloudflare-typescript/commit/1db4f06d6ad838b8a915293c97f3a24971dc1c32)) +* **api:** api update ([#2141](https://github.com/cloudflare/cloudflare-typescript/issues/2141)) ([1ecdef9](https://github.com/cloudflare/cloudflare-typescript/commit/1ecdef9eda66fa5070513a8e30442879752b94fc)) +* **api:** api update ([#2144](https://github.com/cloudflare/cloudflare-typescript/issues/2144)) ([a7d7b34](https://github.com/cloudflare/cloudflare-typescript/commit/a7d7b343874d9e3f7c122c2866a746f5fc1baee7)) +* **api:** api update ([#2145](https://github.com/cloudflare/cloudflare-typescript/issues/2145)) ([d1f8295](https://github.com/cloudflare/cloudflare-typescript/commit/d1f8295950ff5ba92e54d727d3cc5f691f0ebec0)) +* **api:** api update ([#2146](https://github.com/cloudflare/cloudflare-typescript/issues/2146)) ([d5ed817](https://github.com/cloudflare/cloudflare-typescript/commit/d5ed817382a6cc0a6378af3c96fdac3deefc0df1)) +* **api:** api update ([#2147](https://github.com/cloudflare/cloudflare-typescript/issues/2147)) ([f100cae](https://github.com/cloudflare/cloudflare-typescript/commit/f100cae808c594f9b8d8dcf7b519bbed7c346d64)) +* **api:** api update ([#2148](https://github.com/cloudflare/cloudflare-typescript/issues/2148)) ([9fe68a6](https://github.com/cloudflare/cloudflare-typescript/commit/9fe68a6d9052a5813bc4a7691d41d7bf4a4dddc3)) +* **api:** api update ([#2149](https://github.com/cloudflare/cloudflare-typescript/issues/2149)) ([5e25c9c](https://github.com/cloudflare/cloudflare-typescript/commit/5e25c9c0287d54c3e10cbd5c5b2390bf59adfced)) +* **api:** api update ([#2150](https://github.com/cloudflare/cloudflare-typescript/issues/2150)) ([21e5e4e](https://github.com/cloudflare/cloudflare-typescript/commit/21e5e4e67390ac197d707d9a3efa1d4598babf10)) +* **api:** api update ([#2151](https://github.com/cloudflare/cloudflare-typescript/issues/2151)) ([9d4ff30](https://github.com/cloudflare/cloudflare-typescript/commit/9d4ff30b0e92a80e81a6b6c6fa84a6567614878b)) +* **api:** api update ([#2152](https://github.com/cloudflare/cloudflare-typescript/issues/2152)) ([0075dd0](https://github.com/cloudflare/cloudflare-typescript/commit/0075dd01853dcc8bc278de4057ba3ffdd2d4d5f5)) +* **api:** api update ([#2157](https://github.com/cloudflare/cloudflare-typescript/issues/2157)) ([3489fce](https://github.com/cloudflare/cloudflare-typescript/commit/3489fce6c48a09a711bc08b3312d6aaa2a422c68)) +* **api:** api update ([#2158](https://github.com/cloudflare/cloudflare-typescript/issues/2158)) ([47c824c](https://github.com/cloudflare/cloudflare-typescript/commit/47c824cc196036b5c63e0bf4baef2b4076c7714e)) +* **api:** api update ([#2160](https://github.com/cloudflare/cloudflare-typescript/issues/2160)) ([1eff626](https://github.com/cloudflare/cloudflare-typescript/commit/1eff626c981e9a70ebeb94590bb8033ec1dbc566)) +* **api:** api update ([#2163](https://github.com/cloudflare/cloudflare-typescript/issues/2163)) ([bae2265](https://github.com/cloudflare/cloudflare-typescript/commit/bae226583ac0dce0422e6d1484b1080b646c3032)) +* **api:** api update ([#2179](https://github.com/cloudflare/cloudflare-typescript/issues/2179)) ([964ff22](https://github.com/cloudflare/cloudflare-typescript/commit/964ff223fd10fe6ea8c2be608de997bb27a7e903)) +* **api:** api update ([#2180](https://github.com/cloudflare/cloudflare-typescript/issues/2180)) ([6c95adf](https://github.com/cloudflare/cloudflare-typescript/commit/6c95adfbbc2ad0d3563294bebb5fa43816e71c49)) +* **api:** api update ([#2181](https://github.com/cloudflare/cloudflare-typescript/issues/2181)) ([56305fb](https://github.com/cloudflare/cloudflare-typescript/commit/56305fb2175d8bc4cf7c6304cf73acd1a26f57c3)) +* **api:** api update ([#2182](https://github.com/cloudflare/cloudflare-typescript/issues/2182)) ([15378ee](https://github.com/cloudflare/cloudflare-typescript/commit/15378ee10b70ad01db5e38dd420a6cde3febda04)) +* **api:** api update ([#2183](https://github.com/cloudflare/cloudflare-typescript/issues/2183)) ([0e498f7](https://github.com/cloudflare/cloudflare-typescript/commit/0e498f7163d4869553e4450e06a2de3896ed5abf)) +* **api:** api update ([#2184](https://github.com/cloudflare/cloudflare-typescript/issues/2184)) ([d01a09e](https://github.com/cloudflare/cloudflare-typescript/commit/d01a09e71a91df3ea12a27ce78ca7da266b2990c)) +* **api:** api update ([#2185](https://github.com/cloudflare/cloudflare-typescript/issues/2185)) ([5c1b4a0](https://github.com/cloudflare/cloudflare-typescript/commit/5c1b4a0b3e476620aa24d09a1bc5ce2732014554)) +* **api:** api update ([#2187](https://github.com/cloudflare/cloudflare-typescript/issues/2187)) ([3bbb4be](https://github.com/cloudflare/cloudflare-typescript/commit/3bbb4bebdd8e7ceae9f7cc785de442e4c7556328)) +* **api:** api update ([#2188](https://github.com/cloudflare/cloudflare-typescript/issues/2188)) ([ce27401](https://github.com/cloudflare/cloudflare-typescript/commit/ce27401acf3ade16bf02582c5cb289e06606b838)) +* **api:** api update ([#2191](https://github.com/cloudflare/cloudflare-typescript/issues/2191)) ([7530379](https://github.com/cloudflare/cloudflare-typescript/commit/7530379d6e97dc309971ac859e129b1867b61922)) +* **api:** api update ([#2192](https://github.com/cloudflare/cloudflare-typescript/issues/2192)) ([92cf869](https://github.com/cloudflare/cloudflare-typescript/commit/92cf869b2df4cd13a86db7a471b9760352053839)) +* **api:** api update ([#2193](https://github.com/cloudflare/cloudflare-typescript/issues/2193)) ([c5e0d4d](https://github.com/cloudflare/cloudflare-typescript/commit/c5e0d4d1b62e53dc3ab07c979a7bd70968a2e34d)) +* **api:** api update ([#2194](https://github.com/cloudflare/cloudflare-typescript/issues/2194)) ([84d580a](https://github.com/cloudflare/cloudflare-typescript/commit/84d580ae686bf18f30691462452831f042557d74)) +* **api:** api update ([#2197](https://github.com/cloudflare/cloudflare-typescript/issues/2197)) ([139259d](https://github.com/cloudflare/cloudflare-typescript/commit/139259d0a16fe4a2220b0729b2e21d409b47bbd3)) +* **api:** api update ([#2198](https://github.com/cloudflare/cloudflare-typescript/issues/2198)) ([8c26eb4](https://github.com/cloudflare/cloudflare-typescript/commit/8c26eb46e73c0cc2d8e5961883a4e426ac1df78b)) +* **api:** api update ([#2203](https://github.com/cloudflare/cloudflare-typescript/issues/2203)) ([03b1587](https://github.com/cloudflare/cloudflare-typescript/commit/03b158733008ae76996b55e99f7f2ab8bf410e56)) +* **api:** api update ([#2210](https://github.com/cloudflare/cloudflare-typescript/issues/2210)) ([cb517eb](https://github.com/cloudflare/cloudflare-typescript/commit/cb517eb320764fa65f71abe38c4d3fb045bf9cad)) +* **api:** api update ([#2211](https://github.com/cloudflare/cloudflare-typescript/issues/2211)) ([0e7c5d2](https://github.com/cloudflare/cloudflare-typescript/commit/0e7c5d2c4f18179ce18b9ef73e98ac36d173ab71)) +* **api:** api update ([#2214](https://github.com/cloudflare/cloudflare-typescript/issues/2214)) ([6cd6861](https://github.com/cloudflare/cloudflare-typescript/commit/6cd6861c8313bfd9d9ce8a54b8255c3f08ad414a)) +* **api:** api update ([#2215](https://github.com/cloudflare/cloudflare-typescript/issues/2215)) ([e5b8bff](https://github.com/cloudflare/cloudflare-typescript/commit/e5b8bffcc4a641555ba2731aeb6be43caca0f22e)) +* **api:** api update ([#2216](https://github.com/cloudflare/cloudflare-typescript/issues/2216)) ([72247d2](https://github.com/cloudflare/cloudflare-typescript/commit/72247d2032c9213ae1baa4df0c2d51c45a40d4d1)) +* **api:** api update ([#2217](https://github.com/cloudflare/cloudflare-typescript/issues/2217)) ([d0a4299](https://github.com/cloudflare/cloudflare-typescript/commit/d0a4299ff2576c993804224aa2db982fc71f24ae)) +* **api:** api update ([#2219](https://github.com/cloudflare/cloudflare-typescript/issues/2219)) ([c75fe51](https://github.com/cloudflare/cloudflare-typescript/commit/c75fe5193072817c1b992ffff846999042ef28d9)) +* **api:** api update ([#2238](https://github.com/cloudflare/cloudflare-typescript/issues/2238)) ([a12b08c](https://github.com/cloudflare/cloudflare-typescript/commit/a12b08c44e7316bb9f424d5736979b571788662b)) +* **api:** api update ([#2243](https://github.com/cloudflare/cloudflare-typescript/issues/2243)) ([1ec784d](https://github.com/cloudflare/cloudflare-typescript/commit/1ec784d0293eca30081031dc1008f170d56b8b5a)) +* **api:** api update ([#2245](https://github.com/cloudflare/cloudflare-typescript/issues/2245)) ([ff355fa](https://github.com/cloudflare/cloudflare-typescript/commit/ff355fac8924e3927f3632516441c9cda1e544f8)) +* **api:** api update ([#2252](https://github.com/cloudflare/cloudflare-typescript/issues/2252)) ([2305a6e](https://github.com/cloudflare/cloudflare-typescript/commit/2305a6e24ccca1650ca7433c2642527c9a2f54a0)) +* **api:** api update ([#2253](https://github.com/cloudflare/cloudflare-typescript/issues/2253)) ([b470fa2](https://github.com/cloudflare/cloudflare-typescript/commit/b470fa29e4e102d6e57028171ca6b707d846922e)) +* **api:** api update ([#2254](https://github.com/cloudflare/cloudflare-typescript/issues/2254)) ([3048fd7](https://github.com/cloudflare/cloudflare-typescript/commit/3048fd7ac1a9219e5b62862ea4b36f0558af06d9)) +* **api:** api update ([#2255](https://github.com/cloudflare/cloudflare-typescript/issues/2255)) ([4813cce](https://github.com/cloudflare/cloudflare-typescript/commit/4813cce96c07068691badb5d2a5f15a8cf651332)) +* **api:** api update ([#2257](https://github.com/cloudflare/cloudflare-typescript/issues/2257)) ([90aa09d](https://github.com/cloudflare/cloudflare-typescript/commit/90aa09d8703eebb78f2eb65d9304d4dd177d335e)) +* **api:** api update ([#2258](https://github.com/cloudflare/cloudflare-typescript/issues/2258)) ([e7769f2](https://github.com/cloudflare/cloudflare-typescript/commit/e7769f2781c43005295a6293145e93bd4ef5cac2)) +* **api:** api update ([#2259](https://github.com/cloudflare/cloudflare-typescript/issues/2259)) ([bfbfdcf](https://github.com/cloudflare/cloudflare-typescript/commit/bfbfdcf70374fe0a233374b4b29ce58daf5b14e3)) +* **api:** api update ([#2260](https://github.com/cloudflare/cloudflare-typescript/issues/2260)) ([c0259cd](https://github.com/cloudflare/cloudflare-typescript/commit/c0259cd2854820058c9d202a90aa08cc763e9a48)) +* **api:** api update ([#2261](https://github.com/cloudflare/cloudflare-typescript/issues/2261)) ([d7bf349](https://github.com/cloudflare/cloudflare-typescript/commit/d7bf3490e1180ea242cb36899fdee19192de6e39)) +* **api:** api update ([#2264](https://github.com/cloudflare/cloudflare-typescript/issues/2264)) ([c30593b](https://github.com/cloudflare/cloudflare-typescript/commit/c30593b469751e4d7cf27c019ee1ebeedbac7059)) +* **api:** api update ([#2266](https://github.com/cloudflare/cloudflare-typescript/issues/2266)) ([1ca4274](https://github.com/cloudflare/cloudflare-typescript/commit/1ca42744548d6ce861f66152b06178ba2cbfc3f3)) +* **api:** api update ([#2269](https://github.com/cloudflare/cloudflare-typescript/issues/2269)) ([332891a](https://github.com/cloudflare/cloudflare-typescript/commit/332891a45ebc62091984ab4cd2c79ded6b27e85a)) +* **api:** api update ([#2282](https://github.com/cloudflare/cloudflare-typescript/issues/2282)) ([6c77547](https://github.com/cloudflare/cloudflare-typescript/commit/6c77547806cefd6469b59c5149ddbb810ffd3aed)) +* **api:** api update ([#2284](https://github.com/cloudflare/cloudflare-typescript/issues/2284)) ([f0140e7](https://github.com/cloudflare/cloudflare-typescript/commit/f0140e736ceb0c63fe5ff2c37d34138f87666891)) +* **api:** api update ([#2285](https://github.com/cloudflare/cloudflare-typescript/issues/2285)) ([2b0e272](https://github.com/cloudflare/cloudflare-typescript/commit/2b0e272686388172733ff21c88aabed55a72d731)) +* **api:** api update ([#2286](https://github.com/cloudflare/cloudflare-typescript/issues/2286)) ([a7c30c4](https://github.com/cloudflare/cloudflare-typescript/commit/a7c30c478eeb8d26242fe930c47f1c6e95da72a1)) +* **api:** api update ([#2288](https://github.com/cloudflare/cloudflare-typescript/issues/2288)) ([cc2ec85](https://github.com/cloudflare/cloudflare-typescript/commit/cc2ec8535ead18c8c3204aa8bcbdfafa21ad0c06)) +* **api:** api update ([#2305](https://github.com/cloudflare/cloudflare-typescript/issues/2305)) ([b3cf0be](https://github.com/cloudflare/cloudflare-typescript/commit/b3cf0be70d65dca419c7eac91cb21b610833b3a1)) +* **api:** api update ([#2306](https://github.com/cloudflare/cloudflare-typescript/issues/2306)) ([5d3f037](https://github.com/cloudflare/cloudflare-typescript/commit/5d3f0374ca025eb4a11f97402651e446473d3bca)) +* **api:** api update ([#2308](https://github.com/cloudflare/cloudflare-typescript/issues/2308)) ([a796481](https://github.com/cloudflare/cloudflare-typescript/commit/a79648149403d0b4f3527cc2e2b58f3873de49ae)) +* **api:** api update ([#2309](https://github.com/cloudflare/cloudflare-typescript/issues/2309)) ([87ce3eb](https://github.com/cloudflare/cloudflare-typescript/commit/87ce3eb166f902ae2b32663394c4bef0ffe9f0a5)) +* **api:** api update ([#2311](https://github.com/cloudflare/cloudflare-typescript/issues/2311)) ([3e6e73e](https://github.com/cloudflare/cloudflare-typescript/commit/3e6e73e4dbc9181153bb3acaea713fa5d39d6c5e)) +* **api:** api update ([#2320](https://github.com/cloudflare/cloudflare-typescript/issues/2320)) ([d23ab1a](https://github.com/cloudflare/cloudflare-typescript/commit/d23ab1a63d4010fb68f332206e5a368daf576026)) +* **api:** api update ([#2321](https://github.com/cloudflare/cloudflare-typescript/issues/2321)) ([59ce70c](https://github.com/cloudflare/cloudflare-typescript/commit/59ce70c8decd17a0cca5a0d6081a87249fd03e59)) +* **api:** api update ([#2322](https://github.com/cloudflare/cloudflare-typescript/issues/2322)) ([a77ee98](https://github.com/cloudflare/cloudflare-typescript/commit/a77ee98ddff97de44cfc703737b01c286d634461)) +* **api:** api update ([#2323](https://github.com/cloudflare/cloudflare-typescript/issues/2323)) ([a783c38](https://github.com/cloudflare/cloudflare-typescript/commit/a783c3828b925e070882690dcaf4673b3eaf359c)) +* **api:** api update ([#2324](https://github.com/cloudflare/cloudflare-typescript/issues/2324)) ([8857c9f](https://github.com/cloudflare/cloudflare-typescript/commit/8857c9fd12feca3607dc3960245103a63ae6640f)) +* **api:** api update ([#2326](https://github.com/cloudflare/cloudflare-typescript/issues/2326)) ([a5bb664](https://github.com/cloudflare/cloudflare-typescript/commit/a5bb6643cc2b382d7b175478517b6337f0cb1b48)) +* **api:** clean up indirect models ([#2134](https://github.com/cloudflare/cloudflare-typescript/issues/2134)) ([8ddd7ce](https://github.com/cloudflare/cloudflare-typescript/commit/8ddd7ce75e5d6252fda2e2c86b0614927d706fb8)) +* **api:** clean up missing model references ([#2117](https://github.com/cloudflare/cloudflare-typescript/issues/2117)) ([4db7324](https://github.com/cloudflare/cloudflare-typescript/commit/4db73243e1f783b4abc54a103e916de8d9a7b390)) +* **api:** clean up missing models ([#2155](https://github.com/cloudflare/cloudflare-typescript/issues/2155)) ([0cc346f](https://github.com/cloudflare/cloudflare-typescript/commit/0cc346f90903b1613fa09a586e4c7125105cf841)) +* **api:** fix internal URL mappings ([#2239](https://github.com/cloudflare/cloudflare-typescript/issues/2239)) ([35935d1](https://github.com/cloudflare/cloudflare-typescript/commit/35935d11e59f9c9b83e99d2af976c19ac7f1ee83)) +* **api:** initialism for SFU ([#2100](https://github.com/cloudflare/cloudflare-typescript/issues/2100)) ([7546361](https://github.com/cloudflare/cloudflare-typescript/commit/7546361a1c119f18045bf9e93fa660e7f04b0047)) +* **api:** introduce bulk operation methods ([#2154](https://github.com/cloudflare/cloudflare-typescript/issues/2154)) ([880277c](https://github.com/cloudflare/cloudflare-typescript/commit/880277cd4920ea3fa186878cb81ae3ca4861f6d7)) +* **api:** manual updates ([#2130](https://github.com/cloudflare/cloudflare-typescript/issues/2130)) ([b868967](https://github.com/cloudflare/cloudflare-typescript/commit/b868967f3304ce1bf23dcae9cbde4b916de005a0)) +* **api:** manual updates ([#2142](https://github.com/cloudflare/cloudflare-typescript/issues/2142)) ([04083fd](https://github.com/cloudflare/cloudflare-typescript/commit/04083fd5fc56a899f048f15ba53fc21980d1e648)) +* **api:** manual updates ([#2177](https://github.com/cloudflare/cloudflare-typescript/issues/2177)) ([cddc5fd](https://github.com/cloudflare/cloudflare-typescript/commit/cddc5fd8e12a7ead25665f415d3e250bf2ea36f9)) +* **api:** manual updates ([#2190](https://github.com/cloudflare/cloudflare-typescript/issues/2190)) ([491ae64](https://github.com/cloudflare/cloudflare-typescript/commit/491ae64bd5a67301926605b8383f7f19607c765a)) +* **api:** manual updates ([#2202](https://github.com/cloudflare/cloudflare-typescript/issues/2202)) ([07c7c62](https://github.com/cloudflare/cloudflare-typescript/commit/07c7c62d576cb592fb4d5a072310642c03feb31d)) +* **api:** manual updates ([#2226](https://github.com/cloudflare/cloudflare-typescript/issues/2226)) ([2fed205](https://github.com/cloudflare/cloudflare-typescript/commit/2fed205d3ddd5392195bc7d9030af58d55d58abf)) +* **api:** manual updates ([#2262](https://github.com/cloudflare/cloudflare-typescript/issues/2262)) ([3718325](https://github.com/cloudflare/cloudflare-typescript/commit/3718325dc6926a3944fa5644c005b850f49848db)) +* **api:** manual updates ([#2271](https://github.com/cloudflare/cloudflare-typescript/issues/2271)) ([072f2da](https://github.com/cloudflare/cloudflare-typescript/commit/072f2da9c91a51658253f71f1ad87a8b1f3d23f8)) +* **api:** manual updates ([#2272](https://github.com/cloudflare/cloudflare-typescript/issues/2272)) ([a984ead](https://github.com/cloudflare/cloudflare-typescript/commit/a984eada87599d74766c8830dd3b085e5923a017)) +* **api:** manual updates ([#2281](https://github.com/cloudflare/cloudflare-typescript/issues/2281)) ([05e1ed4](https://github.com/cloudflare/cloudflare-typescript/commit/05e1ed470ecab9a2c169c47b7a926a8ab34e0d87)) +* **api:** manual updates ([#2293](https://github.com/cloudflare/cloudflare-typescript/issues/2293)) ([d44d2bc](https://github.com/cloudflare/cloudflare-typescript/commit/d44d2bc59f9ad952c687cc150dbe7379df99f3d3)) +* **api:** manual updates ([#2294](https://github.com/cloudflare/cloudflare-typescript/issues/2294)) ([3768767](https://github.com/cloudflare/cloudflare-typescript/commit/3768767bd0fb6273893ef1252ee3bb384accabe2)) +* **api:** manual updates ([#2295](https://github.com/cloudflare/cloudflare-typescript/issues/2295)) ([5517452](https://github.com/cloudflare/cloudflare-typescript/commit/55174522e643415b8fe9ed0a2ce6bacf1579ce3f)) +* **api:** manual updates ([#2313](https://github.com/cloudflare/cloudflare-typescript/issues/2313)) ([ac6814a](https://github.com/cloudflare/cloudflare-typescript/commit/ac6814a8a50960857bad491c423497fe432eaa61)) +* **api:** manual updates ([#2316](https://github.com/cloudflare/cloudflare-typescript/issues/2316)) ([5e653ff](https://github.com/cloudflare/cloudflare-typescript/commit/5e653ffe3c311c3e9a417f4f1f20f619bb422a9e)) +* **api:** map in new endpoints for account owned tokens, dns setting views and worker assets ([#2122](https://github.com/cloudflare/cloudflare-typescript/issues/2122)) ([601da6b](https://github.com/cloudflare/cloudflare-typescript/commit/601da6bbc9a16bccab441cdf5bf21460bbb26725)) +* **api:** map more endpoints ([#2256](https://github.com/cloudflare/cloudflare-typescript/issues/2256)) ([fde51c5](https://github.com/cloudflare/cloudflare-typescript/commit/fde51c5dab6563eeaf5bb2f988310c7ea2e5856e)) +* **api:** mark JSON as initialism ([#2292](https://github.com/cloudflare/cloudflare-typescript/issues/2292)) ([047e98f](https://github.com/cloudflare/cloudflare-typescript/commit/047e98f294f852d3d7a8e2133933b781c4e8633f)) +* **api:** remap models for magic visibility ([#2107](https://github.com/cloudflare/cloudflare-typescript/issues/2107)) ([7bf017e](https://github.com/cloudflare/cloudflare-typescript/commit/7bf017eeff6651c6be0445e42dfdd2c9a6cf7cd8)) +* **api:** remove unneeded DNS transforms ([#2304](https://github.com/cloudflare/cloudflare-typescript/issues/2304)) ([63a6fc3](https://github.com/cloudflare/cloudflare-typescript/commit/63a6fc38de3cde0dbd0aaea255b0e1f972aed1aa)) +* **api:** skip authorization failures in prism ([#2291](https://github.com/cloudflare/cloudflare-typescript/issues/2291)) ([0ba9745](https://github.com/cloudflare/cloudflare-typescript/commit/0ba97458dfe3b25b34627cab3f3f7aa3cde9fedd)) +* **api:** update api shield operation endpoint ([#2312](https://github.com/cloudflare/cloudflare-typescript/issues/2312)) ([f0c04b8](https://github.com/cloudflare/cloudflare-typescript/commit/f0c04b8c57c875a7a900bf2d5737c0f71b2e7bc6)) +* **api:** Update verb on PATCH zone hold method ([#2244](https://github.com/cloudflare/cloudflare-typescript/issues/2244)) ([11b2590](https://github.com/cloudflare/cloudflare-typescript/commit/11b25905a2bbfdfe7069f9db2295860ad335a095)) +* **api:** update via SDK Studio ([#2161](https://github.com/cloudflare/cloudflare-typescript/issues/2161)) ([194d70d](https://github.com/cloudflare/cloudflare-typescript/commit/194d70d939d4504ec28865c5b61139abdac965a9)) +* **api:** update via SDK Studio ([#2162](https://github.com/cloudflare/cloudflare-typescript/issues/2162)) ([ea7acdc](https://github.com/cloudflare/cloudflare-typescript/commit/ea7acdcdb72dbe4169cb3aae3c9447b4042ac9fd)) +* **api:** update via SDK Studio ([#2164](https://github.com/cloudflare/cloudflare-typescript/issues/2164)) ([87066cf](https://github.com/cloudflare/cloudflare-typescript/commit/87066cf7033708d40f407505ae03235f2ee33b66)) +* **api:** update via SDK Studio ([#2166](https://github.com/cloudflare/cloudflare-typescript/issues/2166)) ([060eef8](https://github.com/cloudflare/cloudflare-typescript/commit/060eef8e533bf6ca7a944dab688d4bfbcf80af59)) +* **api:** update via SDK Studio ([#2167](https://github.com/cloudflare/cloudflare-typescript/issues/2167)) ([1d10dd4](https://github.com/cloudflare/cloudflare-typescript/commit/1d10dd477808aeca6b16ca32c812b5e3b85ff091)) +* **api:** update via SDK Studio ([#2170](https://github.com/cloudflare/cloudflare-typescript/issues/2170)) ([587eda7](https://github.com/cloudflare/cloudflare-typescript/commit/587eda705ee1190b14f0fb45882b1c4c6ecb2bac)) +* **api:** update via SDK Studio ([#2171](https://github.com/cloudflare/cloudflare-typescript/issues/2171)) ([32f9736](https://github.com/cloudflare/cloudflare-typescript/commit/32f9736924ee257bcc49bd6cc6c263392df405fe)) +* **api:** update via SDK Studio ([#2172](https://github.com/cloudflare/cloudflare-typescript/issues/2172)) ([fdccf87](https://github.com/cloudflare/cloudflare-typescript/commit/fdccf87a2dbb165c13727eb5a3e3166f7b18b704)) +* **api:** update via SDK Studio ([#2173](https://github.com/cloudflare/cloudflare-typescript/issues/2173)) ([899c979](https://github.com/cloudflare/cloudflare-typescript/commit/899c9797bf4ba1abddeaee1ad8f531cce7396ff9)) +* **api:** update via SDK Studio ([#2174](https://github.com/cloudflare/cloudflare-typescript/issues/2174)) ([c706071](https://github.com/cloudflare/cloudflare-typescript/commit/c706071aacec8840f7d026c2587cdceeeec5ab4d)) +* **api:** update via SDK Studio ([#2175](https://github.com/cloudflare/cloudflare-typescript/issues/2175)) ([7abc050](https://github.com/cloudflare/cloudflare-typescript/commit/7abc050701d3ec3241fa3775d860eabda87a7382)) +* **api:** update via SDK Studio ([#2176](https://github.com/cloudflare/cloudflare-typescript/issues/2176)) ([02e148a](https://github.com/cloudflare/cloudflare-typescript/commit/02e148af83bd709a0a5dfc41fa5feaa2aad1b732)) +* **calls:** split turn and sfu apps ([#2099](https://github.com/cloudflare/cloudflare-typescript/issues/2099)) ([ea46545](https://github.com/cloudflare/cloudflare-typescript/commit/ea46545b00fa7597c899087bbca6b8afeff61a7c)) +* **cloud_connector:** define body param name ([#2283](https://github.com/cloudflare/cloudflare-typescript/issues/2283)) ([e9b85b4](https://github.com/cloudflare/cloudflare-typescript/commit/e9b85b406e2a32af0f62db5be7f0996d6effb036)) +* **content_scanning:** introduce support ([#2225](https://github.com/cloudflare/cloudflare-typescript/issues/2225)) ([80dcb52](https://github.com/cloudflare/cloudflare-typescript/commit/80dcb52d023047023ec0b7810453353965e6dbc4)) +* **dex:** add commands support ([#2220](https://github.com/cloudflare/cloudflare-typescript/issues/2220)) ([e1ca1f5](https://github.com/cloudflare/cloudflare-typescript/commit/e1ca1f506d79a7d4860f3b97125fd00aea412746)) +* **dlp:** disable problematic test ([#2232](https://github.com/cloudflare/cloudflare-typescript/issues/2232)) ([f37ca9c](https://github.com/cloudflare/cloudflare-typescript/commit/f37ca9c23f6ad10dbb2c5891680bfc4c8f53a6b7)) +* **dlp:** skip tests for `entries` update due to HTTP 422 in prism ([#2297](https://github.com/cloudflare/cloudflare-typescript/issues/2297)) ([31e81a3](https://github.com/cloudflare/cloudflare-typescript/commit/31e81a34fc5c75094699fde533fefec58555e31c)) +* **dns_firewall:** break out into standalone package ([#2209](https://github.com/cloudflare/cloudflare-typescript/issues/2209)) ([d543759](https://github.com/cloudflare/cloudflare-typescript/commit/d543759ffe695498465c595b27beeb04e3698d66)) +* **dns:** add models for batch operations and response ([#2303](https://github.com/cloudflare/cloudflare-typescript/issues/2303)) ([b583557](https://github.com/cloudflare/cloudflare-typescript/commit/b583557434bd1a500be249e2d4d893d893818e7f)) +* **dns:** fix model oneOf ([#2247](https://github.com/cloudflare/cloudflare-typescript/issues/2247)) ([2fb0edc](https://github.com/cloudflare/cloudflare-typescript/commit/2fb0edcba17d380229b0ab2a13a5be8ddea91ed5)) +* **dns:** remove `delta` model ([#2213](https://github.com/cloudflare/cloudflare-typescript/issues/2213)) ([3459c10](https://github.com/cloudflare/cloudflare-typescript/commit/3459c10a594f7fae966f5513bcc1f0adb80285ba)) +* **dnssec:** move under DNS namespace ([#2207](https://github.com/cloudflare/cloudflare-typescript/issues/2207)) ([465de38](https://github.com/cloudflare/cloudflare-typescript/commit/465de38877cfc843ee5922a87cb2e430486544d1)) +* **fleet_status:** update path placeholders to match conventions ([#2132](https://github.com/cloudflare/cloudflare-typescript/issues/2132)) ([d91a8cf](https://github.com/cloudflare/cloudflare-typescript/commit/d91a8cf6c4f4381aacb6ef96f716596aad836fb1)) +* generate more types that are used as request bodies ([#2236](https://github.com/cloudflare/cloudflare-typescript/issues/2236)) ([2ec75e4](https://github.com/cloudflare/cloudflare-typescript/commit/2ec75e441791064d5afcb11d122fdbebcf02ab60)) +* **iam:** fix model mappings ([#2133](https://github.com/cloudflare/cloudflare-typescript/issues/2133)) ([6f6e51b](https://github.com/cloudflare/cloudflare-typescript/commit/6f6e51b9ccec4ffebadcf684d595de9676e20363)) +* **infrastructure_targets:** add bulk endpoints ([#2218](https://github.com/cloudflare/cloudflare-typescript/issues/2218)) ([df4531d](https://github.com/cloudflare/cloudflare-typescript/commit/df4531d7c0570b37970a595fe70464af7bd8f2e7)) +* **internal:** make git install file structure match npm ([#2199](https://github.com/cloudflare/cloudflare-typescript/issues/2199)) ([0436f37](https://github.com/cloudflare/cloudflare-typescript/commit/0436f37c1a26d3270f685def62222bf9ddb6c6c0)) +* **internal:** update path placeholders ([#2200](https://github.com/cloudflare/cloudflare-typescript/issues/2200)) ([9b8c031](https://github.com/cloudflare/cloudflare-typescript/commit/9b8c031d063c476b7270a834942809d89267d821)) +* **kv:** move analytics under existing namespace ([#2212](https://github.com/cloudflare/cloudflare-typescript/issues/2212)) ([f25f70f](https://github.com/cloudflare/cloudflare-typescript/commit/f25f70f5055b8f2e5cd5f74ebe7e253ec518f5fc)) +* **leaked_credential_check:** add terraform resource ([#2204](https://github.com/cloudflare/cloudflare-typescript/issues/2204)) ([938073f](https://github.com/cloudflare/cloudflare-typescript/commit/938073f61554a9660138aff74b3dda7d26b20f06)) +* **list_item:** remove duplicated `anyOf` properties from component ([#2307](https://github.com/cloudflare/cloudflare-typescript/issues/2307)) ([0d902e0](https://github.com/cloudflare/cloudflare-typescript/commit/0d902e04f00672f709f40a1c63e7be957edb4623)) +* **loa_documents:** move download subresource into parent as `get` ([#2274](https://github.com/cloudflare/cloudflare-typescript/issues/2274)) ([8e808ee](https://github.com/cloudflare/cloudflare-typescript/commit/8e808eeba654bb0c3322a9361d49f2d5bc29b51e)) +* **origin_post_quantum_encryption:** swap PUT for PATCH operation ([#2289](https://github.com/cloudflare/cloudflare-typescript/issues/2289)) ([f870d7b](https://github.com/cloudflare/cloudflare-typescript/commit/f870d7b058ac3c5ce114bfb246a61ced4fd422de)) +* **pagerules:** rename namespace to page_rules ([#2237](https://github.com/cloudflare/cloudflare-typescript/issues/2237)) ([7d758f7](https://github.com/cloudflare/cloudflare-typescript/commit/7d758f72c9bee1bd020bc098c4f85c0335cf904d)) +* **r2_bucket:** add `cors` support ([#2178](https://github.com/cloudflare/cloudflare-typescript/issues/2178)) ([803fd0e](https://github.com/cloudflare/cloudflare-typescript/commit/803fd0e3db891b19e5afc3d6cb132c34d16d62e0)) +* **r2:** rename `cf-r2-jurisdiction` to more usable `jurisdiction` parameter ([#2277](https://github.com/cloudflare/cloudflare-typescript/issues/2277)) ([0d6423b](https://github.com/cloudflare/cloudflare-typescript/commit/0d6423b4f8e7ac1306ef3895e579acf70d1b8126)) +* **r2:** rename `cf-r2-jurisdiction` to more usable `jurisdiction` parameter ([#2278](https://github.com/cloudflare/cloudflare-typescript/issues/2278)) ([ba52017](https://github.com/cloudflare/cloudflare-typescript/commit/ba52017ae3c3af940092adea1f0bb145b8f8f7cd)) +* **r2:** rename `cf-r2-jurisdiction` to more usable `jurisdiction` parameter ([#2279](https://github.com/cloudflare/cloudflare-typescript/issues/2279)) ([5aae807](https://github.com/cloudflare/cloudflare-typescript/commit/5aae8071a1e82d1b1dd27e34b58d47044f518f5e)) +* **tokens:** move condition and policy to shared models ([#2136](https://github.com/cloudflare/cloudflare-typescript/issues/2136)) ([db8c1ce](https://github.com/cloudflare/cloudflare-typescript/commit/db8c1cebd6d61253f32ffca62915f8f3c7fac6bc)) +* **tokens:** move token value model to shared ([#2135](https://github.com/cloudflare/cloudflare-typescript/issues/2135)) ([e5755e4](https://github.com/cloudflare/cloudflare-typescript/commit/e5755e4ecc5faf4bce9116a1c75ee499234a4526)) +* **url_scanner:** swap all methods to be v2 only ([#2206](https://github.com/cloudflare/cloudflare-typescript/issues/2206)) ([cfd4df6](https://github.com/cloudflare/cloudflare-typescript/commit/cfd4df6188914f7a32415d050412af9602642fc4)) +* **urlscanner:** swap to v2 create ([#2201](https://github.com/cloudflare/cloudflare-typescript/issues/2201)) ([311951a](https://github.com/cloudflare/cloudflare-typescript/commit/311951abc60b978de69c78c9b746574ae35b1d30)) +* **warp_connector:** move under zero trust namespace ([#2195](https://github.com/cloudflare/cloudflare-typescript/issues/2195)) ([6df8c3b](https://github.com/cloudflare/cloudflare-typescript/commit/6df8c3ba7c2dc562cf73dcca5203164212760b5c)) +* **workers:** add routes support ([#2248](https://github.com/cloudflare/cloudflare-typescript/issues/2248)) ([0ed4e90](https://github.com/cloudflare/cloudflare-typescript/commit/0ed4e9061479e0980f46d123b6f3dd5f7757b6ac)) +* **zero_trust_device_certificates:** update path placeholders ([#2186](https://github.com/cloudflare/cloudflare-typescript/issues/2186)) ([da2f852](https://github.com/cloudflare/cloudflare-typescript/commit/da2f85275f933bf4fce5b0282cd22db4e66fcef2)) +* **zero_trust_device_default_profile_certificates:** define as `upsert` operation ([#2131](https://github.com/cloudflare/cloudflare-typescript/issues/2131)) ([be41552](https://github.com/cloudflare/cloudflare-typescript/commit/be415526caa043d8edf932412c5e18e27851c603)) +* **zero_trust_device:** reshuffle structure to allow use of custom and default ([#2116](https://github.com/cloudflare/cloudflare-typescript/issues/2116)) ([715ae0b](https://github.com/cloudflare/cloudflare-typescript/commit/715ae0b1f8351f345814c49b719be2ce85393d89)) +* **zero_trust_local_domain_fallback:** define body param for updates ([#2101](https://github.com/cloudflare/cloudflare-typescript/issues/2101)) ([1e1f783](https://github.com/cloudflare/cloudflare-typescript/commit/1e1f78349b3e399640f80bb61337566c4134292d)) +* **zero_trust_organization:** swap to upsert for creation ([#2165](https://github.com/cloudflare/cloudflare-typescript/issues/2165)) ([faffcaf](https://github.com/cloudflare/cloudflare-typescript/commit/faffcaf4913df11b22ab1d23e1298648a98c4dad)) +* **zone_settings:** update `origin_max_http_version` model ([#2280](https://github.com/cloudflare/cloudflare-typescript/issues/2280)) ([f781ef8](https://github.com/cloudflare/cloudflare-typescript/commit/f781ef88ec430519ea22258f7f965647c081c5fd)) +* **zone_setting:** update origin_max_http_version model definition ([#2276](https://github.com/cloudflare/cloudflare-typescript/issues/2276)) ([e8ececd](https://github.com/cloudflare/cloudflare-typescript/commit/e8ececd645906808a1a718b77094e004060b1cfd)) +* **zone_transfers:** move under DNS namespace ([#2208](https://github.com/cloudflare/cloudflare-typescript/issues/2208)) ([4a11c28](https://github.com/cloudflare/cloudflare-typescript/commit/4a11c28d1619d5a650f6f0b1790df3efec88bf80)) + + +### Bug Fixes + +* **api:** better support union schemas with common properties ([#2314](https://github.com/cloudflare/cloudflare-typescript/issues/2314)) ([2208ea4](https://github.com/cloudflare/cloudflare-typescript/commit/2208ea4983dd01dc8a0948e6a4b1faf335d20061)) +* **client:** normalize method ([#2265](https://github.com/cloudflare/cloudflare-typescript/issues/2265)) ([9cc7114](https://github.com/cloudflare/cloudflare-typescript/commit/9cc7114698755948ba6b6a3379497e68a0684ef7)) +* **client:** reexport resource as value ([#2318](https://github.com/cloudflare/cloudflare-typescript/issues/2318)) ([97cdae4](https://github.com/cloudflare/cloudflare-typescript/commit/97cdae45814da933279f45ca93197b5061ca09e6)) +* **internal:** add cleaner handling of DNS unions ([#2242](https://github.com/cloudflare/cloudflare-typescript/issues/2242)) ([2053a15](https://github.com/cloudflare/cloudflare-typescript/commit/2053a1546ccf0c5f32e7c6dea0057d4a6facfe0e)) +* send correct Accept header for certain endpoints ([#2317](https://github.com/cloudflare/cloudflare-typescript/issues/2317)) ([d64c9bc](https://github.com/cloudflare/cloudflare-typescript/commit/d64c9bc41434343b62338fea539d2dfefeceeac1)) +* **urlscanner:** fix invalid schema definition for plain text ([#2227](https://github.com/cloudflare/cloudflare-typescript/issues/2227)) ([1adb0c4](https://github.com/cloudflare/cloudflare-typescript/commit/1adb0c45137264a7d9d41311ed164a9fc503fc1f)) +* **waiting_room_rules:** define `body_param_name` for bulk rules endpoint ([#2118](https://github.com/cloudflare/cloudflare-typescript/issues/2118)) ([01dc8b3](https://github.com/cloudflare/cloudflare-typescript/commit/01dc8b31cb9ce1c3625d57248e619b5860afaaa6)) + + +### Chores + +* add missing files back ([6426588](https://github.com/cloudflare/cloudflare-typescript/commit/64265880b79c7b6f2f90de0ba53f23dd5af0443f)) +* **internal:** bump cross-spawn to v7.0.6 ([#2233](https://github.com/cloudflare/cloudflare-typescript/issues/2233)) ([4387d91](https://github.com/cloudflare/cloudflare-typescript/commit/4387d9186de629f34950782693abae1071567cd4)) +* **internal:** codegen related update ([#2168](https://github.com/cloudflare/cloudflare-typescript/issues/2168)) ([6cb6868](https://github.com/cloudflare/cloudflare-typescript/commit/6cb6868e307e80fa0ce699b79b034dcbf2696e86)) +* **internal:** codegen related update ([#2169](https://github.com/cloudflare/cloudflare-typescript/issues/2169)) ([062b84d](https://github.com/cloudflare/cloudflare-typescript/commit/062b84d5720cf2ffe17d4b093b986d9cd31e74a3)) +* **internal:** codegen related update ([#2205](https://github.com/cloudflare/cloudflare-typescript/issues/2205)) ([0e85698](https://github.com/cloudflare/cloudflare-typescript/commit/0e856980f8d0bc245243d581d224c836e7b143b5)) +* **internal:** codegen related update ([#2224](https://github.com/cloudflare/cloudflare-typescript/issues/2224)) ([1532bb6](https://github.com/cloudflare/cloudflare-typescript/commit/1532bb64c5d6b95053344f628b5ca08f93ad21bc)) +* **internal:** codegen related update ([#2250](https://github.com/cloudflare/cloudflare-typescript/issues/2250)) ([5493317](https://github.com/cloudflare/cloudflare-typescript/commit/549331726b303188361ed82105dd5df08cc0949d)) +* **internal:** codegen related update ([#2270](https://github.com/cloudflare/cloudflare-typescript/issues/2270)) ([e528947](https://github.com/cloudflare/cloudflare-typescript/commit/e5289472e15f4b0d4ba84fdc40755cb48009b19c)) +* **internal:** codegen related update ([#2301](https://github.com/cloudflare/cloudflare-typescript/issues/2301)) ([aa69ad7](https://github.com/cloudflare/cloudflare-typescript/commit/aa69ad74831fd279a79b4f796da85821ab350368)) +* **internal:** codegen related update ([#2315](https://github.com/cloudflare/cloudflare-typescript/issues/2315)) ([4389861](https://github.com/cloudflare/cloudflare-typescript/commit/438986147fd9574b68af581f638340e6d8f1f746)) +* **internal:** codegen related update ([#2325](https://github.com/cloudflare/cloudflare-typescript/issues/2325)) ([086577c](https://github.com/cloudflare/cloudflare-typescript/commit/086577c84b20ae60a53c9ac2814894de0ab57803)) +* **internal:** fix some typos ([#2251](https://github.com/cloudflare/cloudflare-typescript/issues/2251)) ([6ad407c](https://github.com/cloudflare/cloudflare-typescript/commit/6ad407ccc6b8f8041ee98621673e4d9b59283ca4)) +* **internal:** remove unnecessary getRequestClient function ([#2223](https://github.com/cloudflare/cloudflare-typescript/issues/2223)) ([1242e4c](https://github.com/cloudflare/cloudflare-typescript/commit/1242e4cb37449e30d06b54123a63244e424cf3bf)) +* **internal:** skip broken tests ([#2310](https://github.com/cloudflare/cloudflare-typescript/issues/2310)) ([2ed931e](https://github.com/cloudflare/cloudflare-typescript/commit/2ed931ed51f82c8227338a23cb85cd5d725e7d91)) +* **internal:** skip some tests ([#2327](https://github.com/cloudflare/cloudflare-typescript/issues/2327)) ([03ef5f0](https://github.com/cloudflare/cloudflare-typescript/commit/03ef5f0b13041760da3c7ff7044acb75b74ae31b)) +* **internal:** update isAbsoluteURL ([#2235](https://github.com/cloudflare/cloudflare-typescript/issues/2235)) ([bc092f6](https://github.com/cloudflare/cloudflare-typescript/commit/bc092f6dc091906eccefbeb2b4af4d278cbf876e)) +* rebuild project due to codegen change ([#2143](https://github.com/cloudflare/cloudflare-typescript/issues/2143)) ([12bd9ea](https://github.com/cloudflare/cloudflare-typescript/commit/12bd9ea9886d2235847c485de7581c7ee5854440)) +* remove redundant word in comment ([#2159](https://github.com/cloudflare/cloudflare-typescript/issues/2159)) ([eaf523c](https://github.com/cloudflare/cloudflare-typescript/commit/eaf523cdabbec65ed63575c1ac3e085ceb1aae8a)) +* **types:** nicer error class types + jsdocs ([#2234](https://github.com/cloudflare/cloudflare-typescript/issues/2234)) ([8b68374](https://github.com/cloudflare/cloudflare-typescript/commit/8b68374ef2c5186764f466a3aaeffebdecd696bd)) +* **types:** use `declare namespace` ([#2296](https://github.com/cloudflare/cloudflare-typescript/issues/2296)) ([6930665](https://github.com/cloudflare/cloudflare-typescript/commit/69306654bdadb7395268724e59ce88633d89cd6a)) +* updates ([#2231](https://github.com/cloudflare/cloudflare-typescript/issues/2231)) ([4b363c1](https://github.com/cloudflare/cloudflare-typescript/commit/4b363c17715836ed4dda3c5904cd1eae64754943)) +* updates ([#2319](https://github.com/cloudflare/cloudflare-typescript/issues/2319)) ([bbc7f09](https://github.com/cloudflare/cloudflare-typescript/commit/bbc7f098e6a9535c019b77ec0618eb10f780a4b8)) + + +### Documentation + +* minor formatting changes ([#2268](https://github.com/cloudflare/cloudflare-typescript/issues/2268)) ([f9819f3](https://github.com/cloudflare/cloudflare-typescript/commit/f9819f35de3841a7e9c34e87537eefc4c09acaad)) +* remove suggestion to use `npm` call out ([#2156](https://github.com/cloudflare/cloudflare-typescript/issues/2156)) ([a0db5f3](https://github.com/cloudflare/cloudflare-typescript/commit/a0db5f371e26995b66a3cabe82117bcdd2dbaf0f)) + ## 3.5.0 (2024-07-16) Full Changelog: [v3.4.0...v3.5.0](https://github.com/cloudflare/cloudflare-typescript/compare/v3.4.0...v3.5.0) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 850d6ceaaf..1cdd45f8d6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,38 +1,38 @@ ## Setting up the environment -This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable). +This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install). Other package managers may work but are not officially supported for development. To set up the repository, run: -```bash -yarn -yarn build +```sh +$ yarn +$ yarn build ``` This will install all the required dependencies and build output files to `dist/`. ## Modifying/Adding code -Most of the SDK is generated code, and any modified code will be overridden on the next generation. The -`src/lib/` and `examples/` directories are exceptions and will never be overridden. +Most of the SDK is generated code. Modifications to code will be persisted between generations, but may +result in merge conflicts between manual patches and changes from the generator. The generator will never +modify the contents of the `src/lib/` and `examples/` directories. ## Adding and running examples -All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or -added to. +All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. -```bash +```ts // add an example to examples/.ts #!/usr/bin/env -S npm run tsn -T … ``` -``` -chmod +x examples/.ts +```sh +$ chmod +x examples/.ts # run the example against your api -yarn tsn -T examples/.ts +$ yarn tsn -T examples/.ts ``` ## Using the repository from source @@ -41,38 +41,38 @@ If you’d like to use the repository from source, you can either install from g To install via git: -```bash -npm install git+ssh://git@github.com:cloudflare/cloudflare-typescript.git +```sh +$ npm install git+ssh://git@github.com:cloudflare/cloudflare-typescript.git ``` Alternatively, to link a local copy of the repo: -```bash +```sh # Clone -git clone https://www.github.com/cloudflare/cloudflare-typescript -cd cloudflare-typescript +$ git clone https://www.github.com/cloudflare/cloudflare-typescript +$ cd cloudflare-typescript # With yarn -yarn link -cd ../my-package -yarn link cloudflare +$ yarn link +$ cd ../my-package +$ yarn link cloudflare # With pnpm -pnpm link --global -cd ../my-package -pnpm link -—global cloudflare +$ pnpm link --global +$ cd ../my-package +$ pnpm link -—global cloudflare ``` ## Running tests Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. -```bash -npx prism mock path/to/your/openapi.yml +```sh +$ npx prism mock path/to/your/openapi.yml ``` -```bash -yarn run test +```sh +$ yarn run test ``` ## Linting and formatting @@ -82,14 +82,14 @@ This repository uses [prettier](https://www.npmjs.com/package/prettier) and To lint: -```bash -yarn lint +```sh +$ yarn lint ``` To format and fix all lint issues automatically: -```bash -yarn fix +```sh +$ yarn fix ``` ## Publishing and releases diff --git a/LICENSE b/LICENSE index 827fca03dd..f303cce4b5 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright 2024 Cloudflare + Copyright 2025 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 fe79de5f9b..0bae1d8d3e 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,13 @@ The full API of this library can be found in [api.md](api.md). ```js import Cloudflare from 'cloudflare'; -const cloudflare = new Cloudflare({ +const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); async function main() { - const zone = await cloudflare.zones.create({ + const zone = await client.zones.create({ account: { id: '023e105f4ecef8ad9ca31a8372d0c353' }, name: 'example.com', type: 'full', @@ -46,7 +46,7 @@ This library includes TypeScript definitions for all request params and response ```ts import Cloudflare from 'cloudflare'; -const cloudflare = new Cloudflare({ +const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); @@ -57,7 +57,7 @@ async function main() { name: 'example.com', type: 'full', }; - const zone: Cloudflare.Zone = await cloudflare.zones.create(params); + const zone: Cloudflare.Zone = await client.zones.create(params); } main(); @@ -74,17 +74,15 @@ a subclass of `APIError` will be thrown: ```ts async function main() { - const zone = await cloudflare.zones - .get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }) - .catch(async (err) => { - if (err instanceof Cloudflare.APIError) { - console.log(err.status); // 400 - console.log(err.name); // BadRequestError - console.log(err.headers); // {server: 'nginx', ...} - } else { - throw err; - } - }); + const zone = await client.zones.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }).catch(async (err) => { + if (err instanceof Cloudflare.APIError) { + console.log(err.status); // 400 + console.log(err.name); // BadRequestError + console.log(err.headers); // {server: 'nginx', ...} + } else { + throw err; + } + }); } main(); @@ -114,12 +112,12 @@ You can use the `maxRetries` option to configure or disable this: ```js // Configure the default for all requests: -const cloudflare = new Cloudflare({ +const client = new Cloudflare({ maxRetries: 0, // default is 2 }); // Or, configure per-request: -await cloudflare.zones.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, { +await client.zones.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, { maxRetries: 5, }); ``` @@ -131,12 +129,12 @@ Requests time out after 1 minute by default. You can configure this with a `time ```ts // Configure the default for all requests: -const cloudflare = new Cloudflare({ +const client = new Cloudflare({ timeout: 20 * 1000, // 20 seconds (default is 1 minute) }); // Override per-request: -await cloudflare.zones.edit({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, { +await client.zones.edit({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, { timeout: 5 * 1000, }); ``` @@ -148,30 +146,30 @@ Note that requests which time out will be [retried twice by default](#retries). ## Auto-pagination List methods in the Cloudflare API are paginated. -You can use `for await … of` syntax to iterate through items across all pages: +You can use the `for await … of` syntax to iterate through items across all pages: ```ts async function fetchAllAccounts(params) { const allAccounts = []; // Automatically fetches more pages as needed. - for await (const accountListResponse of cloudflare.accounts.list()) { - allAccounts.push(accountListResponse); + for await (const account of client.accounts.list()) { + allAccounts.push(account); } return allAccounts; } ``` -Alternatively, you can make request a single page at a time: +Alternatively, you can request a single page at a time: ```ts -let page = await cloudflare.accounts.list(); -for (const accountListResponse of page.result) { - console.log(accountListResponse); +let page = await client.accounts.list(); +for (const account of page.result) { + console.log(account); } // Convenience methods are provided for manually paginating: while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); // ... } ``` @@ -186,15 +184,15 @@ You can also use the `.withResponse()` method to get the raw `Response` along wi ```ts -const cloudflare = new Cloudflare(); +const client = new Cloudflare(); -const response = await cloudflare.zones +const response = await client.zones .create({ account: { id: '023e105f4ecef8ad9ca31a8372d0c353' }, name: 'example.com', type: 'full' }) .asResponse(); console.log(response.headers.get('X-My-Header')); console.log(response.statusText); // access the underlying Response object -const { data: zone, response: raw } = await cloudflare.zones +const { data: zone, response: raw } = await client.zones .create({ account: { id: '023e105f4ecef8ad9ca31a8372d0c353' }, name: 'example.com', type: 'full' }) .withResponse(); console.log(raw.headers.get('X-My-Header')); @@ -297,12 +295,12 @@ import http from 'http'; import { HttpsProxyAgent } from 'https-proxy-agent'; // Configure the default for all requests: -const cloudflare = new Cloudflare({ +const client = new Cloudflare({ httpAgent: new HttpsProxyAgent(process.env.PROXY_URL), }); // Override per-request: -await cloudflare.zones.delete( +await client.zones.delete( { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, { httpAgent: new http.Agent({ keepAlive: false }), @@ -315,12 +313,8 @@ await cloudflare.zones.delete( This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions: 1. Changes that only affect static types, without breaking runtime behavior. -2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_. -3. Changes that we do not expect to impact the vast majority of users in practice. - -We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience. - -We are keen for your feedback; please open an [issue](https://www.github.com/cloudflare/cloudflare-typescript/issues) with questions, bugs, or suggestions. +1. Changes to library internals which are technically public but not intended or documented for external use. +1. Changes that we do not expect to impact the vast majority of users in practice. ## Requirements @@ -330,7 +324,7 @@ The following runtimes are supported: - Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more) - Node.js 18 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions. -- Deno v1.28.0 or higher, using `import Cloudflare from "npm:cloudflare"`. +- Deno v1.28.0 or higher. - Bun 1.0 or later. - Cloudflare Workers. - Vercel Edge Runtime. @@ -340,3 +334,7 @@ The following runtimes are supported: Note that React Native is not supported at this time. If you are interested in other runtime environments, please open or upvote an issue on GitHub. + +## Contributing + +See [the contributing documentation](./CONTRIBUTING.md). diff --git a/SECURITY.md b/SECURITY.md index 8cd70e5e93..0735c89299 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,27 +1,3 @@ -# Security Policy +# Reporting Security Vulnerabilities -## Reporting Security Issues - -This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. - -To report a security issue, please contact the Stainless team at security@stainlessapi.com. - -## Responsible Disclosure - -We appreciate the efforts of security researchers and individuals who help us maintain the security of -SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible -disclosure practices by allowing us a reasonable amount of time to investigate and address the issue -before making any information public. - -## Reporting Non-SDK Related Security Issues - -If you encounter security issues that are not directly related to SDKs but pertain to the services -or products provided by Cloudflare please follow the respective company's security reporting guidelines. - -### Cloudflare Terms and Policies - -Please contact api@cloudflare.com for any questions or concerns regarding security of our services. - ---- - -Thank you for helping us keep the SDKs and systems they interact with secure. +Please see [this page](https://www.cloudflare.com/.well-known/security.txt) for information on how to report a vulnerability to Cloudflare. Thanks! diff --git a/api.md b/api.md index 3ae4322470..16c090c144 100644 --- a/api.md +++ b/api.md @@ -14,72 +14,130 @@ Types: - PaginationInfo - Permission - PermissionGrant +- RatePlan - ResponseInfo - Result - Role - SortDirection +- Subscription +- SubscriptionComponent +- SubscriptionZone +- Token +- TokenConditionCIDRList +- TokenPolicy +- TokenValue # Accounts Types: - Account -- AccountUpdateResponse -- AccountListResponse -- AccountGetResponse +- AccountDeleteResponse Methods: -- client.accounts.update({ ...params }) -> AccountUpdateResponse -- client.accounts.list({ ...params }) -> AccountListResponsesV4PagePaginationArray -- client.accounts.get({ ...params }) -> AccountGetResponse +- client.accounts.create({ ...params }) -> Account +- client.accounts.update({ ...params }) -> Account +- client.accounts.list({ ...params }) -> AccountsV4PagePaginationArray +- client.accounts.delete({ ...params }) -> AccountDeleteResponse | null +- client.accounts.get({ ...params }) -> Account ## Members Types: - Status -- UserWithInviteCode -- MemberCreateResponse -- MemberUpdateResponse -- MemberListResponse - MemberDeleteResponse -- MemberGetResponse Methods: -- client.accounts.members.create({ ...params }) -> MemberCreateResponse -- client.accounts.members.update(memberId, { ...params }) -> MemberUpdateResponse -- client.accounts.members.list({ ...params }) -> MemberListResponsesV4PagePaginationArray +- client.accounts.members.create({ ...params }) -> Member +- client.accounts.members.update(memberId, { ...params }) -> Member +- client.accounts.members.list({ ...params }) -> MembersV4PagePaginationArray - client.accounts.members.delete(memberId, { ...params }) -> MemberDeleteResponse | null -- client.accounts.members.get(memberId, { ...params }) -> MemberGetResponse +- client.accounts.members.get(memberId, { ...params }) -> Member ## Roles +Methods: + +- client.accounts.roles.list({ ...params }) -> RolesSinglePage +- client.accounts.roles.get(roleId, { ...params }) -> Role + +## Subscriptions + Types: -- RoleGetResponse +- SubscriptionCreateResponse +- SubscriptionUpdateResponse +- SubscriptionDeleteResponse +- SubscriptionGetResponse Methods: -- client.accounts.roles.list({ ...params }) -> RolesSinglePage -- client.accounts.roles.get(roleId, { ...params }) -> RoleGetResponse +- client.accounts.subscriptions.create({ ...params }) -> SubscriptionCreateResponse +- client.accounts.subscriptions.update(subscriptionIdentifier, { ...params }) -> SubscriptionUpdateResponse +- client.accounts.subscriptions.delete(subscriptionIdentifier, { ...params }) -> SubscriptionDeleteResponse +- client.accounts.subscriptions.get({ ...params }) -> SubscriptionGetResponse | null + +## Tokens + +Types: + +- TokenCreateResponse +- TokenDeleteResponse +- TokenVerifyResponse + +Methods: + +- client.accounts.tokens.create({ ...params }) -> TokenCreateResponse +- client.accounts.tokens.update(tokenId, { ...params }) -> Token +- client.accounts.tokens.list({ ...params }) -> TokensV4PagePaginationArray +- client.accounts.tokens.delete(tokenId, { ...params }) -> TokenDeleteResponse | null +- client.accounts.tokens.get(tokenId, { ...params }) -> Token +- client.accounts.tokens.verify({ ...params }) -> TokenVerifyResponse + +### PermissionGroups + +Types: + +- PermissionGroupListResponse + +Methods: + +- client.accounts.tokens.permissionGroups.list({ ...params }) -> PermissionGroupListResponsesSinglePage + +### Value + +Methods: + +- client.accounts.tokens.value.update(tokenId, { ...params }) -> TokenValue + +## Logs + +### Audit + +Types: + +- AuditListResponse + +Methods: + +- client.accounts.logs.audit.list({ ...params }) -> AuditListResponsesCursorLimitPagination # OriginCACertificates Types: - OriginCACertificate -- OriginCACertificateCreateResponse - OriginCACertificateDeleteResponse -- OriginCACertificateGetResponse Methods: -- client.originCACertificates.create({ ...params }) -> OriginCACertificateCreateResponse +- client.originCACertificates.create({ ...params }) -> OriginCACertificate - client.originCACertificates.list({ ...params }) -> OriginCACertificatesSinglePage - client.originCACertificates.delete(certificateId) -> OriginCACertificateDeleteResponse -- client.originCACertificates.get(certificateId) -> OriginCACertificateGetResponse +- client.originCACertificates.get(certificateId) -> OriginCACertificate # IPs @@ -154,14 +212,12 @@ Methods: Types: - Invite -- InviteEditResponse -- InviteGetResponse Methods: - client.user.invites.list() -> InvitesSinglePage -- client.user.invites.edit(inviteId, { ...params }) -> InviteEditResponse -- client.user.invites.get(inviteId) -> InviteGetResponse +- client.user.invites.edit(inviteId, { ...params }) -> Invite +- client.user.invites.get(inviteId) -> Invite ## Organizations @@ -181,43 +237,31 @@ Methods: Types: -- RatePlan -- Subscription -- SubscriptionComponent -- SubscriptionZone - SubscriptionUpdateResponse - SubscriptionDeleteResponse -- SubscriptionEditResponse - SubscriptionGetResponse Methods: - client.user.subscriptions.update(identifier, { ...params }) -> SubscriptionUpdateResponse - client.user.subscriptions.delete(identifier) -> SubscriptionDeleteResponse -- client.user.subscriptions.edit(identifier, { ...params }) -> SubscriptionEditResponse - client.user.subscriptions.get() -> SubscriptionGetResponse | null ## Tokens Types: -- CIDRList -- Policy -- Token - TokenCreateResponse -- TokenUpdateResponse -- TokenListResponse - TokenDeleteResponse -- TokenGetResponse - TokenVerifyResponse Methods: - client.user.tokens.create({ ...params }) -> TokenCreateResponse -- client.user.tokens.update(tokenId, { ...params }) -> TokenUpdateResponse -- client.user.tokens.list({ ...params }) -> TokenListResponsesV4PagePaginationArray +- client.user.tokens.update(tokenId, { ...params }) -> Token +- client.user.tokens.list({ ...params }) -> TokensV4PagePaginationArray - client.user.tokens.delete(tokenId) -> TokenDeleteResponse | null -- client.user.tokens.get(tokenId) -> TokenGetResponse +- client.user.tokens.get(tokenId) -> Token - client.user.tokens.verify() -> TokenVerifyResponse ### PermissionGroups @@ -232,13 +276,9 @@ Methods: ### Value -Types: - -- Value - Methods: -- client.user.tokens.value.update(tokenId, { ...params }) -> Value +- client.user.tokens.value.update(tokenId, { ...params }) -> TokenValue # Zones @@ -271,6 +311,7 @@ Methods: Types: - AdvancedDDoS +- Aegis - AlwaysOnline - AlwaysUseHTTPS - AutomaticHTTPSRewrites @@ -293,9 +334,7 @@ Types: - IPGeolocation - IPV6 - MinTLSVersion -- Minify - Mirage -- MobileRedirect - NEL - OpportunisticEncryption - OpportunisticOnion @@ -338,8 +377,8 @@ Types: Methods: -- client.zones.customNameservers.update({ ...params }) -> CustomNameserverUpdateResponse | null -- client.zones.customNameservers.get({ ...params }) -> CustomNameserverGetResponse | null +- client.zones.customNameservers.update({ ...params }) -> CustomNameserverUpdateResponse +- client.zones.customNameservers.get({ ...params }) -> CustomNameserverGetResponse ## Holds @@ -351,6 +390,7 @@ Methods: - client.zones.holds.create({ ...params }) -> ZoneHold - client.zones.holds.delete({ ...params }) -> ZoneHold +- client.zones.holds.edit({ ...params }) -> ZoneHold - client.zones.holds.get({ ...params }) -> ZoneHold ## Subscriptions @@ -358,14 +398,36 @@ Methods: Types: - SubscriptionCreateResponse +- SubscriptionUpdateResponse - SubscriptionGetResponse Methods: - client.zones.subscriptions.create(identifier, { ...params }) -> SubscriptionCreateResponse -- client.zones.subscriptions.list(accountIdentifier) -> SubscriptionsSinglePage +- client.zones.subscriptions.update(identifier, { ...params }) -> SubscriptionUpdateResponse - client.zones.subscriptions.get(identifier) -> SubscriptionGetResponse +## Plans + +Types: + +- AvailableRatePlan + +Methods: + +- client.zones.plans.list({ ...params }) -> AvailableRatePlansSinglePage +- client.zones.plans.get(planIdentifier, { ...params }) -> AvailableRatePlan + +## RatePlans + +Types: + +- RatePlanGetResponse + +Methods: + +- client.zones.ratePlans.get({ ...params }) -> RatePlanGetResponse | null + # LoadBalancers Types: @@ -432,7 +494,7 @@ Types: Methods: -- client.loadBalancers.monitors.references.get(monitorId, { ...params }) -> ReferenceGetResponse | null +- client.loadBalancers.monitors.references.get(monitorId, { ...params }) -> ReferenceGetResponse ## Pools @@ -440,6 +502,7 @@ Types: - Pool - PoolDeleteResponse +- PoolBulkEditResponse Methods: @@ -447,6 +510,7 @@ Methods: - client.loadBalancers.pools.update(poolId, { ...params }) -> Pool - client.loadBalancers.pools.list({ ...params }) -> PoolsSinglePage - client.loadBalancers.pools.delete(poolId, { ...params }) -> PoolDeleteResponse +- client.loadBalancers.pools.bulkEdit({ ...params }) -> PoolBulkEditResponse - client.loadBalancers.pools.edit(poolId, { ...params }) -> Pool - client.loadBalancers.pools.get(poolId, { ...params }) -> Pool @@ -470,7 +534,7 @@ Types: Methods: -- client.loadBalancers.pools.references.get(poolId, { ...params }) -> ReferenceGetResponse | null +- client.loadBalancers.pools.references.get(poolId, { ...params }) -> ReferenceGetResponse ## Previews @@ -502,7 +566,7 @@ Types: Methods: -- client.loadBalancers.searches.get({ ...params }) -> SearchGetResponse | null +- client.loadBalancers.searches.get({ ...params }) -> SearchGetResponse # Cache @@ -552,13 +616,13 @@ Methods: Types: - CacheVariant -- CacheVariantIdentifier +- VariantDeleteResponse - VariantEditResponse - VariantGetResponse Methods: -- client.cache.variants.delete({ ...params }) -> CacheVariant +- client.cache.variants.delete({ ...params }) -> VariantDeleteResponse - client.cache.variants.edit({ ...params }) -> VariantEditResponse - client.cache.variants.get({ ...params }) -> VariantGetResponse @@ -595,6 +659,7 @@ Types: - RequestValidity - Status - ValidationMethod +- CertificatePackCreateResponse - CertificatePackListResponse - CertificatePackDeleteResponse - CertificatePackEditResponse @@ -602,21 +667,12 @@ Types: Methods: +- client.ssl.certificatePacks.create({ ...params }) -> CertificatePackCreateResponse - client.ssl.certificatePacks.list({ ...params }) -> CertificatePackListResponsesSinglePage - client.ssl.certificatePacks.delete(certificatePackId, { ...params }) -> CertificatePackDeleteResponse - client.ssl.certificatePacks.edit(certificatePackId, { ...params }) -> CertificatePackEditResponse - client.ssl.certificatePacks.get(certificatePackId, { ...params }) -> CertificatePackGetResponse -### Order - -Types: - -- OrderCreateResponse - -Methods: - -- client.ssl.certificatePacks.order.create({ ...params }) -> OrderCreateResponse - ### Quota Types: @@ -663,23 +719,6 @@ Methods: - client.ssl.verification.edit(certificatePackId, { ...params }) -> VerificationEditResponse - client.ssl.verification.get({ ...params }) -> VerificationGetResponse -# Subscriptions - -Types: - -- SubscriptionCreateResponse -- SubscriptionUpdateResponse -- SubscriptionDeleteResponse -- SubscriptionGetResponse - -Methods: - -- client.subscriptions.create(identifier, { ...params }) -> SubscriptionCreateResponse -- client.subscriptions.update(accountIdentifier, subscriptionIdentifier, { ...params }) -> SubscriptionUpdateResponse -- client.subscriptions.list(accountIdentifier) -> SubscriptionsSinglePage -- client.subscriptions.delete(accountIdentifier, subscriptionIdentifier) -> SubscriptionDeleteResponse -- client.subscriptions.get(identifier) -> SubscriptionGetResponse - # ACM ## TotalTLS @@ -721,28 +760,6 @@ Methods: - client.argo.tieredCaching.edit({ ...params }) -> TieredCachingEditResponse - client.argo.tieredCaching.get({ ...params }) -> TieredCachingGetResponse -# Plans - -Types: - -- AvailableRatePlan - -Methods: - -- client.plans.list(zoneIdentifier) -> AvailableRatePlansSinglePage -- client.plans.get(zoneIdentifier, planIdentifier) -> AvailableRatePlan - -# RatePlans - -Types: - -- RatePlan -- RatePlanGetResponse - -Methods: - -- client.ratePlans.get(zoneIdentifier) -> RatePlanGetResponse | null - # CertificateAuthorities ## HostnameAssociations @@ -780,18 +797,15 @@ Types: - CustomCertificate - GeoRestrictions - Status -- CustomCertificateCreateResponse - CustomCertificateDeleteResponse -- CustomCertificateEditResponse -- CustomCertificateGetResponse Methods: -- client.customCertificates.create({ ...params }) -> CustomCertificateCreateResponse +- client.customCertificates.create({ ...params }) -> CustomCertificate - client.customCertificates.list({ ...params }) -> CustomCertificatesV4PagePaginationArray - client.customCertificates.delete(customCertificateId, { ...params }) -> CustomCertificateDeleteResponse -- client.customCertificates.edit(customCertificateId, { ...params }) -> CustomCertificateEditResponse -- client.customCertificates.get(customCertificateId, { ...params }) -> CustomCertificateGetResponse +- client.customCertificates.edit(customCertificateId, { ...params }) -> CustomCertificate +- client.customCertificates.get(customCertificateId, { ...params }) -> CustomCertificate ## Prioritize @@ -801,7 +815,7 @@ Types: Methods: -- client.customCertificates.prioritize.update({ ...params }) -> PrioritizeUpdateResponse | null +- client.customCertificates.prioritize.update({ ...params }) -> PrioritizeUpdateResponse # CustomHostnames @@ -851,9 +865,56 @@ Types: Methods: - client.customNameservers.create({ ...params }) -> CustomNameserver -- client.customNameservers.delete(customNSId, { ...params }) -> CustomNameserverDeleteResponse | null -- client.customNameservers.availabilty({ ...params }) -> CustomNameserverAvailabiltyResponse | null -- client.customNameservers.get({ ...params }) -> CustomNameserverGetResponse | null +- client.customNameservers.delete(customNSId, { ...params }) -> CustomNameserverDeleteResponse +- client.customNameservers.availabilty({ ...params }) -> CustomNameserverAvailabiltyResponse +- client.customNameservers.get({ ...params }) -> CustomNameserverGetResponse + +# DNSFirewall + +Types: + +- AttackMitigation +- FirewallIPs +- UpstreamIPs +- DNSFirewallCreateResponse +- DNSFirewallListResponse +- DNSFirewallDeleteResponse +- DNSFirewallEditResponse +- DNSFirewallGetResponse + +Methods: + +- client.dnsFirewall.create({ ...params }) -> DNSFirewallCreateResponse +- client.dnsFirewall.list({ ...params }) -> DNSFirewallListResponsesV4PagePaginationArray +- client.dnsFirewall.delete(dnsFirewallId, { ...params }) -> DNSFirewallDeleteResponse +- client.dnsFirewall.edit(dnsFirewallId, { ...params }) -> DNSFirewallEditResponse +- client.dnsFirewall.get(dnsFirewallId, { ...params }) -> DNSFirewallGetResponse + +## Analytics + +### Reports + +Methods: + +- client.dnsFirewall.analytics.reports.get(dnsFirewallId, { ...params }) -> Report + +#### Bytimes + +Methods: + +- client.dnsFirewall.analytics.reports.bytimes.get(dnsFirewallId, { ...params }) -> ByTime + +## ReverseDNS + +Types: + +- ReverseDNSEditResponse +- ReverseDNSGetResponse + +Methods: + +- client.dnsFirewall.reverseDNS.edit(dnsFirewallId, { ...params }) -> ReverseDNSEditResponse +- client.dnsFirewall.reverseDNS.get(dnsFirewallId, { ...params }) -> ReverseDNSGetResponse # DNS @@ -862,12 +923,27 @@ Types: - DNSAnalyticsNominalMetric - DNSAnalyticsQuery +## DNSSEC + +Types: + +- DNSSEC +- DNSSECDeleteResponse + +Methods: + +- client.dns.dnssec.delete({ ...params }) -> DNSSECDeleteResponse +- client.dns.dnssec.edit({ ...params }) -> DNSSEC +- client.dns.dnssec.get({ ...params }) -> DNSSEC + ## Records Types: - ARecord - AAAARecord +- BatchPatch +- BatchPut - CAARecord - CERTRecord - CNAMERecord @@ -880,8 +956,7 @@ Types: - NSRecord - PTRRecord - Record -- RecordMetadata -- RecordProcessTiming +- RecordResponse - RecordTags - SMIMEARecord - SRVRecord @@ -892,19 +967,21 @@ Types: - TXTRecord - URIRecord - RecordDeleteResponse +- RecordBatchResponse - RecordExportResponse - RecordImportResponse - RecordScanResponse Methods: -- client.dns.records.create({ ...params }) -> Record -- client.dns.records.update(dnsRecordId, { ...params }) -> Record -- client.dns.records.list({ ...params }) -> RecordsV4PagePaginationArray +- client.dns.records.create({ ...params }) -> RecordResponse +- client.dns.records.update(dnsRecordId, { ...params }) -> RecordResponse +- client.dns.records.list({ ...params }) -> RecordResponsesV4PagePaginationArray - client.dns.records.delete(dnsRecordId, { ...params }) -> RecordDeleteResponse -- client.dns.records.edit(dnsRecordId, { ...params }) -> Record +- client.dns.records.batch({ ...params }) -> RecordBatchResponse +- client.dns.records.edit(dnsRecordId, { ...params }) -> RecordResponse - client.dns.records.export({ ...params }) -> string -- client.dns.records.get(dnsRecordId, { ...params }) -> Record +- client.dns.records.get(dnsRecordId, { ...params }) -> RecordResponse - client.dns.records.import({ ...params }) -> RecordImportResponse - client.dns.records.scan({ ...params }) -> RecordScanResponse @@ -912,15 +989,32 @@ Methods: Types: -- DNSSetting -- Nameserver -- SettingEditResponse -- SettingGetResponse +- DNSSetting +- SettingEditResponse +- SettingGetResponse + +Methods: + +- client.dns.settings.edit({ ...params }) -> SettingEditResponse +- client.dns.settings.get({ ...params }) -> SettingGetResponse + +### Views + +Types: + +- ViewCreateResponse +- ViewListResponse +- ViewDeleteResponse +- ViewEditResponse +- ViewGetResponse Methods: -- client.dns.settings.edit({ ...params }) -> SettingEditResponse -- client.dns.settings.get({ ...params }) -> SettingGetResponse +- client.dns.settings.views.create({ ...params }) -> ViewCreateResponse +- client.dns.settings.views.list({ ...params }) -> ViewListResponsesV4PagePaginationArray +- client.dns.settings.views.delete(viewId, { ...params }) -> ViewDeleteResponse +- client.dns.settings.views.edit(viewId, { ...params }) -> ViewEditResponse +- client.dns.settings.views.get(viewId, { ...params }) -> ViewGetResponse ## Analytics @@ -944,54 +1038,299 @@ Methods: - client.dns.analytics.reports.bytimes.get({ ...params }) -> ByTime -## Firewall +## ZoneTransfers + +### ForceAXFR Types: -- AttackMitigation -- Firewall -- FirewallIPs -- UpstreamIPs -- FirewallDeleteResponse +- ForceAXFR Methods: -- client.dns.firewall.create({ ...params }) -> Firewall -- client.dns.firewall.list({ ...params }) -> FirewallsV4PagePaginationArray -- client.dns.firewall.delete(dnsFirewallId, { ...params }) -> FirewallDeleteResponse -- client.dns.firewall.edit(dnsFirewallId, { ...params }) -> Firewall -- client.dns.firewall.get(dnsFirewallId, { ...params }) -> Firewall +- client.dns.zoneTransfers.forceAXFR.create({ ...params }) -> ForceAXFR -### Analytics +### Incoming + +Types: + +- Incoming +- IncomingCreateResponse +- IncomingUpdateResponse +- IncomingDeleteResponse +- IncomingGetResponse + +Methods: + +- client.dns.zoneTransfers.incoming.create({ ...params }) -> IncomingCreateResponse +- client.dns.zoneTransfers.incoming.update({ ...params }) -> IncomingUpdateResponse +- client.dns.zoneTransfers.incoming.delete({ ...params }) -> IncomingDeleteResponse +- client.dns.zoneTransfers.incoming.get({ ...params }) -> IncomingGetResponse + +### Outgoing + +Types: + +- DisableTransfer +- EnableTransfer +- Outgoing +- OutgoingStatus +- OutgoingCreateResponse +- OutgoingUpdateResponse +- OutgoingDeleteResponse +- OutgoingForceNotifyResponse +- OutgoingGetResponse + +Methods: + +- client.dns.zoneTransfers.outgoing.create({ ...params }) -> OutgoingCreateResponse +- client.dns.zoneTransfers.outgoing.update({ ...params }) -> OutgoingUpdateResponse +- client.dns.zoneTransfers.outgoing.delete({ ...params }) -> OutgoingDeleteResponse +- client.dns.zoneTransfers.outgoing.disable({ ...params }) -> DisableTransfer +- client.dns.zoneTransfers.outgoing.enable({ ...params }) -> EnableTransfer +- client.dns.zoneTransfers.outgoing.forceNotify({ ...params }) -> OutgoingForceNotifyResponse +- client.dns.zoneTransfers.outgoing.get({ ...params }) -> OutgoingGetResponse + +#### Status + +Methods: + +- client.dns.zoneTransfers.outgoing.status.get({ ...params }) -> EnableTransfer + +### ACLs + +Types: + +- ACL +- ACLDeleteResponse + +Methods: + +- client.dns.zoneTransfers.acls.create({ ...params }) -> ACL +- client.dns.zoneTransfers.acls.update(aclId, { ...params }) -> ACL +- client.dns.zoneTransfers.acls.list({ ...params }) -> ACLsSinglePage +- client.dns.zoneTransfers.acls.delete(aclId, { ...params }) -> ACLDeleteResponse +- client.dns.zoneTransfers.acls.get(aclId, { ...params }) -> ACL + +### Peers + +Types: + +- Peer +- PeerDeleteResponse + +Methods: + +- client.dns.zoneTransfers.peers.create({ ...params }) -> Peer +- client.dns.zoneTransfers.peers.update(peerId, { ...params }) -> Peer +- client.dns.zoneTransfers.peers.list({ ...params }) -> PeersSinglePage +- client.dns.zoneTransfers.peers.delete(peerId, { ...params }) -> PeerDeleteResponse +- client.dns.zoneTransfers.peers.get(peerId, { ...params }) -> Peer + +### TSIGs + +Types: + +- TSIG +- TSIGDeleteResponse + +Methods: + +- client.dns.zoneTransfers.tsigs.create({ ...params }) -> TSIG +- client.dns.zoneTransfers.tsigs.update(tsigId, { ...params }) -> TSIG +- client.dns.zoneTransfers.tsigs.list({ ...params }) -> TSIGsSinglePage +- client.dns.zoneTransfers.tsigs.delete(tsigId, { ...params }) -> TSIGDeleteResponse +- client.dns.zoneTransfers.tsigs.get(tsigId, { ...params }) -> TSIG + +# EmailSecurity + +## Investigate + +Types: + +- InvestigateListResponse +- InvestigateGetResponse + +Methods: + +- client.emailSecurity.investigate.list({ ...params }) -> InvestigateListResponsesV4PagePaginationArray +- client.emailSecurity.investigate.get(postfixId, { ...params }) -> InvestigateGetResponse + +### Detections + +Types: + +- DetectionGetResponse + +Methods: + +- client.emailSecurity.investigate.detections.get(postfixId, { ...params }) -> DetectionGetResponse + +### Preview + +Types: + +- PreviewCreateResponse +- PreviewGetResponse + +Methods: + +- client.emailSecurity.investigate.preview.create({ ...params }) -> PreviewCreateResponse +- client.emailSecurity.investigate.preview.get(postfixId, { ...params }) -> PreviewGetResponse + +### Raw + +Types: + +- RawGetResponse + +Methods: + +- client.emailSecurity.investigate.raw.get(postfixId, { ...params }) -> RawGetResponse + +### Trace + +Types: + +- TraceGetResponse + +Methods: + +- client.emailSecurity.investigate.trace.get(postfixId, { ...params }) -> TraceGetResponse + +### Move + +Types: + +- MoveCreateResponse +- MoveBulkResponse + +Methods: + +- client.emailSecurity.investigate.move.create(postfixId, { ...params }) -> MoveCreateResponse +- client.emailSecurity.investigate.move.bulk({ ...params }) -> MoveBulkResponse + +### Reclassify + +Types: + +- ReclassifyCreateResponse + +Methods: + +- client.emailSecurity.investigate.reclassify.create(postfixId, { ...params }) -> ReclassifyCreateResponse + +### Release + +Types: + +- ReleaseBulkResponse + +Methods: + +- client.emailSecurity.investigate.release.bulk([ ...body ]) -> ReleaseBulkResponse + +## Settings + +### AllowPolicies + +Types: + +- AllowPolicyCreateResponse +- AllowPolicyListResponse +- AllowPolicyDeleteResponse +- AllowPolicyEditResponse +- AllowPolicyGetResponse + +Methods: + +- client.emailSecurity.settings.allowPolicies.create({ ...params }) -> AllowPolicyCreateResponse +- client.emailSecurity.settings.allowPolicies.list({ ...params }) -> AllowPolicyListResponsesV4PagePaginationArray +- client.emailSecurity.settings.allowPolicies.delete(policyId, { ...params }) -> AllowPolicyDeleteResponse +- client.emailSecurity.settings.allowPolicies.edit(policyId, { ...params }) -> AllowPolicyEditResponse +- client.emailSecurity.settings.allowPolicies.get(policyId, { ...params }) -> AllowPolicyGetResponse + +### BlockSenders + +Types: + +- BlockSenderCreateResponse +- BlockSenderListResponse +- BlockSenderDeleteResponse +- BlockSenderEditResponse +- BlockSenderGetResponse + +Methods: + +- client.emailSecurity.settings.blockSenders.create({ ...params }) -> BlockSenderCreateResponse +- client.emailSecurity.settings.blockSenders.list({ ...params }) -> BlockSenderListResponsesV4PagePaginationArray +- client.emailSecurity.settings.blockSenders.delete(patternId, { ...params }) -> BlockSenderDeleteResponse +- client.emailSecurity.settings.blockSenders.edit(patternId, { ...params }) -> BlockSenderEditResponse +- client.emailSecurity.settings.blockSenders.get(patternId, { ...params }) -> BlockSenderGetResponse + +### Domains Types: -- Delta +- DomainListResponse +- DomainDeleteResponse +- DomainBulkDeleteResponse +- DomainEditResponse +- DomainGetResponse -#### Reports +Methods: + +- client.emailSecurity.settings.domains.list({ ...params }) -> DomainListResponsesV4PagePaginationArray +- client.emailSecurity.settings.domains.delete(domainId, { ...params }) -> DomainDeleteResponse +- client.emailSecurity.settings.domains.bulkDelete({ ...params }) -> DomainBulkDeleteResponse +- client.emailSecurity.settings.domains.edit(domainId, { ...params }) -> DomainEditResponse +- client.emailSecurity.settings.domains.get(domainId, { ...params }) -> DomainGetResponse + +### ImpersonationRegistry + +Types: + +- ImpersonationRegistryCreateResponse +- ImpersonationRegistryListResponse +- ImpersonationRegistryDeleteResponse +- ImpersonationRegistryEditResponse +- ImpersonationRegistryGetResponse Methods: -- client.dns.firewall.analytics.reports.get(dnsFirewallId, { ...params }) -> Report +- client.emailSecurity.settings.impersonationRegistry.create({ ...params }) -> ImpersonationRegistryCreateResponse +- client.emailSecurity.settings.impersonationRegistry.list({ ...params }) -> ImpersonationRegistryListResponsesV4PagePaginationArray +- client.emailSecurity.settings.impersonationRegistry.delete(displayNameId, { ...params }) -> ImpersonationRegistryDeleteResponse +- client.emailSecurity.settings.impersonationRegistry.edit(displayNameId, { ...params }) -> ImpersonationRegistryEditResponse +- client.emailSecurity.settings.impersonationRegistry.get(displayNameId, { ...params }) -> ImpersonationRegistryGetResponse + +### TrustedDomains -##### Bytimes +Types: + +- TrustedDomainCreateResponse +- TrustedDomainListResponse +- TrustedDomainDeleteResponse +- TrustedDomainEditResponse +- TrustedDomainGetResponse Methods: -- client.dns.firewall.analytics.reports.bytimes.get(dnsFirewallId, { ...params }) -> ByTime +- client.emailSecurity.settings.trustedDomains.create({ ...params }) -> TrustedDomainCreateResponse +- client.emailSecurity.settings.trustedDomains.list({ ...params }) -> TrustedDomainListResponsesV4PagePaginationArray +- client.emailSecurity.settings.trustedDomains.delete(trustedDomainId, { ...params }) -> TrustedDomainDeleteResponse +- client.emailSecurity.settings.trustedDomains.edit(trustedDomainId, { ...params }) -> TrustedDomainEditResponse +- client.emailSecurity.settings.trustedDomains.get(trustedDomainId, { ...params }) -> TrustedDomainGetResponse -# DNSSEC +## Submissions Types: -- DNSSEC -- DNSSECDeleteResponse +- SubmissionListResponse Methods: -- client.dnssec.delete({ ...params }) -> DNSSECDeleteResponse -- client.dnssec.edit({ ...params }) -> DNSSEC -- client.dnssec.get({ ...params }) -> DNSSEC +- client.emailSecurity.submissions.list({ ...params }) -> SubmissionListResponsesV4PagePaginationArray # EmailRouting @@ -1001,20 +1340,24 @@ Types: Methods: -- client.emailRouting.disable(zoneIdentifier, { ...params }) -> Settings -- client.emailRouting.enable(zoneIdentifier, { ...params }) -> Settings -- client.emailRouting.get(zoneIdentifier) -> Settings +- client.emailRouting.disable({ ...params }) -> Settings +- client.emailRouting.enable({ ...params }) -> Settings +- client.emailRouting.get({ ...params }) -> Settings ## DNS Types: - DNSRecord +- DNSDeleteResponse - DNSGetResponse Methods: -- client.emailRouting.dns.get(zoneIdentifier) -> DNSGetResponse | null +- client.emailRouting.dns.create({ ...params }) -> Settings +- client.emailRouting.dns.delete({ ...params }) -> DNSDeleteResponse +- client.emailRouting.dns.edit({ ...params }) -> Settings +- client.emailRouting.dns.get({ ...params }) -> DNSGetResponse ## Rules @@ -1026,11 +1369,11 @@ Types: Methods: -- client.emailRouting.rules.create(zoneIdentifier, { ...params }) -> EmailRoutingRule -- client.emailRouting.rules.update(zoneIdentifier, ruleIdentifier, { ...params }) -> EmailRoutingRule -- client.emailRouting.rules.list(zoneIdentifier, { ...params }) -> EmailRoutingRulesV4PagePaginationArray -- client.emailRouting.rules.delete(zoneIdentifier, ruleIdentifier) -> EmailRoutingRule -- client.emailRouting.rules.get(zoneIdentifier, ruleIdentifier) -> EmailRoutingRule +- client.emailRouting.rules.create({ ...params }) -> EmailRoutingRule +- client.emailRouting.rules.update(ruleIdentifier, { ...params }) -> EmailRoutingRule +- client.emailRouting.rules.list({ ...params }) -> EmailRoutingRulesV4PagePaginationArray +- client.emailRouting.rules.delete(ruleIdentifier, { ...params }) -> EmailRoutingRule +- client.emailRouting.rules.get(ruleIdentifier, { ...params }) -> EmailRoutingRule ### CatchAlls @@ -1043,8 +1386,8 @@ Types: Methods: -- client.emailRouting.rules.catchAlls.update(zoneIdentifier, { ...params }) -> CatchAllUpdateResponse -- client.emailRouting.rules.catchAlls.get(zoneIdentifier) -> CatchAllGetResponse +- client.emailRouting.rules.catchAlls.update({ ...params }) -> CatchAllUpdateResponse +- client.emailRouting.rules.catchAlls.get({ ...params }) -> CatchAllGetResponse ## Addresses @@ -1054,10 +1397,10 @@ Types: Methods: -- client.emailRouting.addresses.create(accountIdentifier, { ...params }) -> Address -- client.emailRouting.addresses.list(accountIdentifier, { ...params }) -> AddressesV4PagePaginationArray -- client.emailRouting.addresses.delete(accountIdentifier, destinationAddressIdentifier) -> Address -- client.emailRouting.addresses.get(accountIdentifier, destinationAddressIdentifier) -> Address +- client.emailRouting.addresses.create({ ...params }) -> Address +- client.emailRouting.addresses.list({ ...params }) -> AddressesV4PagePaginationArray +- client.emailRouting.addresses.delete(destinationAddressIdentifier, { ...params }) -> Address +- client.emailRouting.addresses.get(destinationAddressIdentifier, { ...params }) -> Address # Filters @@ -1065,14 +1408,18 @@ Types: - FirewallFilter - FilterCreateResponse +- FilterBulkDeleteResponse +- FilterBulkUpdateResponse Methods: -- client.filters.create(zoneIdentifier, { ...params }) -> FilterCreateResponse | null -- client.filters.update(zoneIdentifier, id, { ...params }) -> FirewallFilter -- client.filters.list(zoneIdentifier, { ...params }) -> FirewallFiltersV4PagePaginationArray -- client.filters.delete(zoneIdentifier, id) -> FirewallFilter -- client.filters.get(zoneIdentifier, id) -> FirewallFilter +- client.filters.create({ ...params }) -> FilterCreateResponse | null +- client.filters.update(filterId, { ...params }) -> FirewallFilter +- client.filters.list({ ...params }) -> FirewallFiltersV4PagePaginationArray +- client.filters.delete(filterId, { ...params }) -> FirewallFilter +- client.filters.bulkDelete({ ...params }) -> FilterBulkDeleteResponse | null +- client.filters.bulkUpdate({ ...params }) -> FilterBulkUpdateResponse | null +- client.filters.get(filterId, { ...params }) -> FirewallFilter # Firewall @@ -1089,30 +1436,36 @@ Types: Methods: -- client.firewall.lockdowns.create(zoneIdentifier, { ...params }) -> Lockdown -- client.firewall.lockdowns.update(zoneIdentifier, id, { ...params }) -> Lockdown -- client.firewall.lockdowns.list(zoneIdentifier, { ...params }) -> LockdownsV4PagePaginationArray -- client.firewall.lockdowns.delete(zoneIdentifier, id) -> LockdownDeleteResponse -- client.firewall.lockdowns.get(zoneIdentifier, id) -> Lockdown +- client.firewall.lockdowns.create({ ...params }) -> Lockdown +- client.firewall.lockdowns.update(lockDownsId, { ...params }) -> Lockdown +- client.firewall.lockdowns.list({ ...params }) -> LockdownsV4PagePaginationArray +- client.firewall.lockdowns.delete(lockDownsId, { ...params }) -> LockdownDeleteResponse +- client.firewall.lockdowns.get(lockDownsId, { ...params }) -> Lockdown ## Rules Types: +- DeletedFilter - FirewallRule - Product -- DeletedFilter - RuleCreateResponse +- RuleBulkDeleteResponse +- RuleBulkEditResponse +- RuleBulkUpdateResponse - RuleEditResponse Methods: -- client.firewall.rules.create(zoneIdentifier, { ...params }) -> RuleCreateResponse | null -- client.firewall.rules.update(zoneIdentifier, id, { ...params }) -> FirewallRule -- client.firewall.rules.list(zoneIdentifier, { ...params }) -> FirewallRulesV4PagePaginationArray -- client.firewall.rules.delete(zoneIdentifier, id) -> FirewallRule -- client.firewall.rules.edit(zoneIdentifier, id, { ...params }) -> RuleEditResponse | null -- client.firewall.rules.get(zoneIdentifier, { ...params }) -> FirewallRule +- client.firewall.rules.create({ ...params }) -> RuleCreateResponse | null +- client.firewall.rules.update(ruleId, { ...params }) -> FirewallRule +- client.firewall.rules.list({ ...params }) -> FirewallRulesV4PagePaginationArray +- client.firewall.rules.delete(ruleId, { ...params }) -> FirewallRule +- client.firewall.rules.bulkDelete({ ...params }) -> RuleBulkDeleteResponse | null +- client.firewall.rules.bulkEdit({ ...params }) -> RuleBulkEditResponse | null +- client.firewall.rules.bulkUpdate({ ...params }) -> RuleBulkUpdateResponse | null +- client.firewall.rules.edit(ruleId, { ...params }) -> RuleEditResponse | null +- client.firewall.rules.get(ruleId, { ...params }) -> FirewallRule ## AccessRules @@ -1133,9 +1486,9 @@ Methods: - client.firewall.accessRules.create({ ...params }) -> AccessRuleCreateResponse - client.firewall.accessRules.list({ ...params }) -> AccessRuleListResponsesV4PagePaginationArray -- client.firewall.accessRules.delete(identifier, { ...params }) -> AccessRuleDeleteResponse | null -- client.firewall.accessRules.edit(identifier, { ...params }) -> AccessRuleEditResponse -- client.firewall.accessRules.get(identifier, { ...params }) -> AccessRuleGetResponse +- client.firewall.accessRules.delete(ruleId, { ...params }) -> AccessRuleDeleteResponse | null +- client.firewall.accessRules.edit(ruleId, { ...params }) -> AccessRuleEditResponse +- client.firewall.accessRules.get(ruleId, { ...params }) -> AccessRuleGetResponse ## UARules @@ -1149,11 +1502,11 @@ Types: Methods: -- client.firewall.uaRules.create(zoneIdentifier, { ...params }) -> UARuleCreateResponse -- client.firewall.uaRules.update(zoneIdentifier, id, { ...params }) -> UARuleUpdateResponse -- client.firewall.uaRules.list(zoneIdentifier, { ...params }) -> UARuleListResponsesV4PagePaginationArray -- client.firewall.uaRules.delete(zoneIdentifier, id) -> UARuleDeleteResponse -- client.firewall.uaRules.get(zoneIdentifier, id) -> UARuleGetResponse +- client.firewall.uaRules.create({ ...params }) -> UARuleCreateResponse +- client.firewall.uaRules.update(uaRuleId, { ...params }) -> UARuleUpdateResponse +- client.firewall.uaRules.list({ ...params }) -> UARuleListResponsesV4PagePaginationArray +- client.firewall.uaRules.delete(uaRuleId, { ...params }) -> UARuleDeleteResponse +- client.firewall.uaRules.get(uaRuleId, { ...params }) -> UARuleGetResponse ## WAF @@ -1169,11 +1522,11 @@ Types: Methods: -- client.firewall.waf.overrides.create(zoneIdentifier, { ...params }) -> Override -- client.firewall.waf.overrides.update(zoneIdentifier, id, { ...params }) -> Override -- client.firewall.waf.overrides.list(zoneIdentifier, { ...params }) -> OverridesV4PagePaginationArray -- client.firewall.waf.overrides.delete(zoneIdentifier, id) -> OverrideDeleteResponse -- client.firewall.waf.overrides.get(zoneIdentifier, id) -> Override +- client.firewall.waf.overrides.create({ ...params }) -> Override +- client.firewall.waf.overrides.update(overridesId, { ...params }) -> Override +- client.firewall.waf.overrides.list({ ...params }) -> OverridesV4PagePaginationArray +- client.firewall.waf.overrides.delete(overridesId, { ...params }) -> OverrideDeleteResponse +- client.firewall.waf.overrides.get(overridesId, { ...params }) -> Override ### Packages @@ -1184,8 +1537,8 @@ Types: Methods: -- client.firewall.waf.packages.list(zoneIdentifier, { ...params }) -> PackageListResponsesV4PagePaginationArray -- client.firewall.waf.packages.get(zoneIdentifier, identifier) -> PackageGetResponse +- client.firewall.waf.packages.list({ ...params }) -> PackageListResponsesV4PagePaginationArray +- client.firewall.waf.packages.get(packageId, { ...params }) -> PackageGetResponse #### Groups @@ -1232,7 +1585,7 @@ Methods: - client.healthchecks.create({ ...params }) -> Healthcheck - client.healthchecks.update(healthcheckId, { ...params }) -> Healthcheck -- client.healthchecks.list({ ...params }) -> HealthchecksSinglePage +- client.healthchecks.list({ ...params }) -> HealthchecksV4PagePaginationArray - client.healthchecks.delete(healthcheckId, { ...params }) -> HealthcheckDeleteResponse - client.healthchecks.edit(healthcheckId, { ...params }) -> Healthcheck - client.healthchecks.get(healthcheckId, { ...params }) -> Healthcheck @@ -1314,7 +1667,7 @@ Methods: - client.logpush.jobs.create({ ...params }) -> LogpushJob | null - client.logpush.jobs.update(jobId, { ...params }) -> LogpushJob | null - client.logpush.jobs.list({ ...params }) -> LogpushJobsSinglePage -- client.logpush.jobs.delete(jobId, { ...params }) -> JobDeleteResponse | null +- client.logpush.jobs.delete(jobId, { ...params }) -> JobDeleteResponse - client.logpush.jobs.get(jobId, { ...params }) -> LogpushJob | null ## Ownership @@ -1354,8 +1707,8 @@ Types: Methods: -- client.logs.control.retention.create(zoneIdentifier, { ...params }) -> RetentionCreateResponse -- client.logs.control.retention.get(zoneIdentifier) -> RetentionGetResponse +- client.logs.control.retention.create({ ...params }) -> RetentionCreateResponse | null +- client.logs.control.retention.get({ ...params }) -> RetentionGetResponse | null ### Cmb @@ -1380,7 +1733,7 @@ Types: Methods: -- client.logs.RayID.get(zoneIdentifier, rayIdentifier, { ...params }) -> RayIDGetResponse +- client.logs.RayID.get(RayID, { ...params }) -> RayIDGetResponse ## Received @@ -1390,7 +1743,7 @@ Types: Methods: -- client.logs.received.get(zoneIdentifier, { ...params }) -> ReceivedGetResponse +- client.logs.received.get({ ...params }) -> ReceivedGetResponse ### Fields @@ -1400,7 +1753,7 @@ Types: Methods: -- client.logs.received.fields.get(zoneIdentifier) -> FieldGetResponse +- client.logs.received.fields.get({ ...params }) -> FieldGetResponse # OriginTLSClientAuth @@ -1408,13 +1761,14 @@ Types: - ZoneAuthenticatedOriginPull - OriginTLSClientAuthCreateResponse +- OriginTLSClientAuthListResponse - OriginTLSClientAuthDeleteResponse - OriginTLSClientAuthGetResponse Methods: - client.originTLSClientAuth.create({ ...params }) -> OriginTLSClientAuthCreateResponse -- client.originTLSClientAuth.list({ ...params }) -> ZoneAuthenticatedOriginPullsSinglePage +- client.originTLSClientAuth.list({ ...params }) -> OriginTLSClientAuthListResponsesSinglePage - client.originTLSClientAuth.delete(certificateId, { ...params }) -> OriginTLSClientAuthDeleteResponse - client.originTLSClientAuth.get(certificateId, { ...params }) -> OriginTLSClientAuthGetResponse @@ -1427,7 +1781,7 @@ Types: Methods: -- client.originTLSClientAuth.hostnames.update({ ...params }) -> HostnameUpdateResponse | null +- client.originTLSClientAuth.hostnames.update({ ...params }) -> HostnameUpdateResponse - client.originTLSClientAuth.hostnames.get(hostname, { ...params }) -> AuthenticatedOriginPull ### Certificates @@ -1436,13 +1790,14 @@ Types: - Certificate - CertificateCreateResponse +- CertificateListResponse - CertificateDeleteResponse - CertificateGetResponse Methods: - client.originTLSClientAuth.hostnames.certificates.create({ ...params }) -> CertificateCreateResponse -- client.originTLSClientAuth.hostnames.certificates.list({ ...params }) -> AuthenticatedOriginPullsSinglePage +- client.originTLSClientAuth.hostnames.certificates.list({ ...params }) -> CertificateListResponsesSinglePage - client.originTLSClientAuth.hostnames.certificates.delete(certificateId, { ...params }) -> CertificateDeleteResponse - client.originTLSClientAuth.hostnames.certificates.get(certificateId, { ...params }) -> CertificateGetResponse @@ -1458,38 +1813,23 @@ Methods: - client.originTLSClientAuth.settings.update({ ...params }) -> SettingUpdateResponse - client.originTLSClientAuth.settings.get({ ...params }) -> SettingGetResponse -# Pagerules +# PageRules Types: -- PageRule -- Route -- Target -- PageruleCreateResponse -- PageruleUpdateResponse -- PageruleListResponse -- PageruleDeleteResponse -- PageruleEditResponse -- PageruleGetResponse +- PageRule +- Target +- PageRuleListResponse +- PageRuleDeleteResponse Methods: -- client.pagerules.create({ ...params }) -> PageruleCreateResponse -- client.pagerules.update(pageruleId, { ...params }) -> PageruleUpdateResponse -- client.pagerules.list({ ...params }) -> PageruleListResponse -- client.pagerules.delete(pageruleId, { ...params }) -> PageruleDeleteResponse | null -- client.pagerules.edit(pageruleId, { ...params }) -> PageruleEditResponse -- client.pagerules.get(pageruleId, { ...params }) -> PageruleGetResponse - -## Settings - -Types: - -- SettingListResponse - -Methods: - -- client.pagerules.settings.list({ ...params }) -> SettingListResponse +- client.pageRules.create({ ...params }) -> PageRule +- client.pageRules.update(pageruleId, { ...params }) -> PageRule +- client.pageRules.list({ ...params }) -> PageRuleListResponse +- client.pageRules.delete(pageruleId, { ...params }) -> PageRuleDeleteResponse | null +- client.pageRules.edit(pageruleId, { ...params }) -> PageRule +- client.pageRules.get(pageruleId, { ...params }) -> PageRule # RateLimits @@ -1498,122 +1838,15 @@ Types: - Action - Methods - RateLimit -- RateLimitCreateResponse - RateLimitDeleteResponse -- RateLimitEditResponse -- RateLimitGetResponse Methods: -- client.rateLimits.create(zoneIdentifier, { ...params }) -> RateLimitCreateResponse -- client.rateLimits.list(zoneIdentifier, { ...params }) -> RateLimitsV4PagePaginationArray -- client.rateLimits.delete(zoneIdentifier, id) -> RateLimitDeleteResponse -- client.rateLimits.edit(zoneIdentifier, id, { ...params }) -> RateLimitEditResponse -- client.rateLimits.get(zoneIdentifier, id) -> RateLimitGetResponse - -# SecondaryDNS - -## ForceAXFR - -Types: - -- ForceAXFR - -Methods: - -- client.secondaryDNS.forceAXFR.create({ ...params }) -> ForceAXFR - -## Incoming - -Types: - -- Incoming -- IncomingCreateResponse -- IncomingUpdateResponse -- IncomingDeleteResponse -- IncomingGetResponse - -Methods: - -- client.secondaryDNS.incoming.create({ ...params }) -> IncomingCreateResponse -- client.secondaryDNS.incoming.update({ ...params }) -> IncomingUpdateResponse -- client.secondaryDNS.incoming.delete({ ...params }) -> IncomingDeleteResponse -- client.secondaryDNS.incoming.get({ ...params }) -> IncomingGetResponse - -## Outgoing - -Types: - -- DisableTransfer -- EnableTransfer -- Outgoing -- OutgoingStatus -- OutgoingCreateResponse -- OutgoingUpdateResponse -- OutgoingDeleteResponse -- OutgoingForceNotifyResponse -- OutgoingGetResponse - -Methods: - -- client.secondaryDNS.outgoing.create({ ...params }) -> OutgoingCreateResponse -- client.secondaryDNS.outgoing.update({ ...params }) -> OutgoingUpdateResponse -- client.secondaryDNS.outgoing.delete({ ...params }) -> OutgoingDeleteResponse -- client.secondaryDNS.outgoing.disable({ ...params }) -> DisableTransfer -- client.secondaryDNS.outgoing.enable({ ...params }) -> EnableTransfer -- client.secondaryDNS.outgoing.forceNotify({ ...params }) -> OutgoingForceNotifyResponse -- client.secondaryDNS.outgoing.get({ ...params }) -> OutgoingGetResponse - -### Status - -Methods: - -- client.secondaryDNS.outgoing.status.get({ ...params }) -> EnableTransfer - -## ACLs - -Types: - -- ACL -- ACLDeleteResponse - -Methods: - -- client.secondaryDNS.acls.create({ ...params }) -> ACL -- client.secondaryDNS.acls.update(aclId, { ...params }) -> ACL -- client.secondaryDNS.acls.list({ ...params }) -> ACLsSinglePage -- client.secondaryDNS.acls.delete(aclId, { ...params }) -> ACLDeleteResponse -- client.secondaryDNS.acls.get(aclId, { ...params }) -> ACL - -## Peers - -Types: - -- Peer -- PeerDeleteResponse - -Methods: - -- client.secondaryDNS.peers.create({ ...params }) -> Peer -- client.secondaryDNS.peers.update(peerId, { ...params }) -> Peer -- client.secondaryDNS.peers.list({ ...params }) -> PeersSinglePage -- client.secondaryDNS.peers.delete(peerId, { ...params }) -> PeerDeleteResponse -- client.secondaryDNS.peers.get(peerId, { ...params }) -> Peer - -## TSIGs - -Types: - -- TSIG -- TSIGDeleteResponse - -Methods: - -- client.secondaryDNS.tsigs.create({ ...params }) -> TSIG -- client.secondaryDNS.tsigs.update(tsigId, { ...params }) -> TSIG -- client.secondaryDNS.tsigs.list({ ...params }) -> TSIGsSinglePage -- client.secondaryDNS.tsigs.delete(tsigId, { ...params }) -> TSIGDeleteResponse -- client.secondaryDNS.tsigs.get(tsigId, { ...params }) -> TSIG +- client.rateLimits.create({ ...params }) -> RateLimit +- client.rateLimits.list({ ...params }) -> RateLimitsV4PagePaginationArray +- client.rateLimits.delete(rateLimitId, { ...params }) -> RateLimitDeleteResponse +- client.rateLimits.edit(rateLimitId, { ...params }) -> RateLimit +- client.rateLimits.get(rateLimitId, { ...params }) -> RateLimit # WaitingRooms @@ -1629,7 +1862,7 @@ Methods: - client.waitingRooms.create({ ...params }) -> WaitingRoom - client.waitingRooms.update(waitingRoomId, { ...params }) -> WaitingRoom -- client.waitingRooms.list({ ...params }) -> WaitingRoomsSinglePage +- client.waitingRooms.list({ ...params }) -> WaitingRoomsV4PagePaginationArray - client.waitingRooms.delete(waitingRoomId, { ...params }) -> WaitingRoomDeleteResponse - client.waitingRooms.edit(waitingRoomId, { ...params }) -> WaitingRoom - client.waitingRooms.get(waitingRoomId, { ...params }) -> WaitingRoom @@ -1655,7 +1888,7 @@ Methods: - client.waitingRooms.events.create(waitingRoomId, { ...params }) -> Event - client.waitingRooms.events.update(waitingRoomId, eventId, { ...params }) -> Event -- client.waitingRooms.events.list(waitingRoomId, { ...params }) -> EventsSinglePage +- client.waitingRooms.events.list(waitingRoomId, { ...params }) -> EventsV4PagePaginationArray - client.waitingRooms.events.delete(waitingRoomId, eventId, { ...params }) -> EventDeleteResponse - client.waitingRooms.events.edit(waitingRoomId, eventId, { ...params }) -> Event - client.waitingRooms.events.get(waitingRoomId, eventId, { ...params }) -> Event @@ -1680,14 +1913,15 @@ Types: - RuleUpdateResponse - RuleDeleteResponse - RuleEditResponse +- RuleGetResponse Methods: -- client.waitingRooms.rules.create(waitingRoomId, { ...params }) -> RuleCreateResponse | null -- client.waitingRooms.rules.update(waitingRoomId, [ ...body ]) -> RuleUpdateResponse | null -- client.waitingRooms.rules.list(waitingRoomId, { ...params }) -> WaitingRoomRulesSinglePage -- client.waitingRooms.rules.delete(waitingRoomId, ruleId, { ...params }) -> RuleDeleteResponse | null -- client.waitingRooms.rules.edit(waitingRoomId, ruleId, { ...params }) -> RuleEditResponse | null +- client.waitingRooms.rules.create(waitingRoomId, { ...params }) -> RuleCreateResponse +- client.waitingRooms.rules.update(waitingRoomId, [ ...rules ]) -> RuleUpdateResponse +- client.waitingRooms.rules.delete(waitingRoomId, ruleId, { ...params }) -> RuleDeleteResponse +- client.waitingRooms.rules.edit(waitingRoomId, ruleId, { ...params }) -> RuleEditResponse +- client.waitingRooms.rules.get(waitingRoomId, { ...params }) -> RuleGetResponse ## Statuses @@ -1725,11 +1959,11 @@ Types: Methods: -- client.web3.hostnames.create(zoneIdentifier, { ...params }) -> Hostname -- client.web3.hostnames.list(zoneIdentifier) -> HostnamesSinglePage -- client.web3.hostnames.delete(zoneIdentifier, identifier) -> HostnameDeleteResponse | null -- client.web3.hostnames.edit(zoneIdentifier, identifier, { ...params }) -> Hostname -- client.web3.hostnames.get(zoneIdentifier, identifier) -> Hostname +- client.web3.hostnames.create({ ...params }) -> Hostname +- client.web3.hostnames.list({ ...params }) -> HostnamesSinglePage +- client.web3.hostnames.delete(identifier, { ...params }) -> HostnameDeleteResponse | null +- client.web3.hostnames.edit(identifier, { ...params }) -> Hostname +- client.web3.hostnames.get(identifier, { ...params }) -> Hostname ### IPFSUniversalPaths @@ -1741,8 +1975,8 @@ Types: Methods: -- client.web3.hostnames.ipfsUniversalPaths.contentLists.update(zoneIdentifier, identifier, { ...params }) -> ContentList -- client.web3.hostnames.ipfsUniversalPaths.contentLists.get(zoneIdentifier, identifier) -> ContentList +- client.web3.hostnames.ipfsUniversalPaths.contentLists.update(identifier, { ...params }) -> ContentList +- client.web3.hostnames.ipfsUniversalPaths.contentLists.get(identifier, { ...params }) -> ContentList ##### Entries @@ -1756,51 +1990,49 @@ Types: Methods: -- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.create(zoneIdentifier, identifier, { ...params }) -> EntryCreateResponse -- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.update(zoneIdentifier, identifier, contentListEntryIdentifier, { ...params }) -> EntryUpdateResponse -- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.list(zoneIdentifier, identifier) -> EntryListResponse | null -- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.delete(zoneIdentifier, identifier, contentListEntryIdentifier) -> EntryDeleteResponse | null -- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.get(zoneIdentifier, identifier, contentListEntryIdentifier) -> EntryGetResponse +- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.create(identifier, { ...params }) -> EntryCreateResponse +- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.update(identifier, contentListEntryIdentifier, { ...params }) -> EntryUpdateResponse +- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.list(identifier, { ...params }) -> EntryListResponse | null +- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.delete(identifier, contentListEntryIdentifier, { ...params }) -> EntryDeleteResponse | null +- client.web3.hostnames.ipfsUniversalPaths.contentLists.entries.get(identifier, contentListEntryIdentifier, { ...params }) -> EntryGetResponse # Workers Types: -- Binding -- D1Binding -- DispatchNamespaceBinding -- DurableObjectBinding -- KVNamespaceBinding - MigrationStep -- MTLSCERTBinding -- PlacementConfiguration -- R2Binding -- ServiceBinding - SingleStepMigration -- SteppedMigration - WorkerMetadata -## AI +## Routes Types: -- AIRunResponse +- RouteCreateResponse +- RouteUpdateResponse +- RouteListResponse +- RouteDeleteResponse +- RouteGetResponse Methods: -- client.workers.ai.run(modelName, { ...params }) -> AIRunResponse +- client.workers.routes.create({ ...params }) -> RouteCreateResponse +- client.workers.routes.update(routeId, { ...params }) -> RouteUpdateResponse +- client.workers.routes.list({ ...params }) -> RouteListResponsesSinglePage +- client.workers.routes.delete(routeId, { ...params }) -> RouteDeleteResponse +- client.workers.routes.get(routeId, { ...params }) -> RouteGetResponse -### Models +## Assets -#### Schema +### Upload Types: -- SchemaGetResponse +- UploadCreateResponse Methods: -- client.workers.ai.models.schema.get({ ...params }) -> SchemaGetResponse +- client.workers.assets.upload.create({ ...params }) -> UploadCreateResponse ## Scripts @@ -1808,13 +2040,39 @@ Types: - Script - ScriptSetting +- ScriptUpdateResponse +- ScriptGetResponse Methods: -- client.workers.scripts.update(scriptName, { ...params }) -> Script +- client.workers.scripts.update(scriptName, { ...params }) -> ScriptUpdateResponse - client.workers.scripts.list({ ...params }) -> ScriptsSinglePage - client.workers.scripts.delete(scriptName, { ...params }) -> void -- client.workers.scripts.get(scriptName, { ...params }) -> Response +- client.workers.scripts.get(scriptName, { ...params }) -> string + +### Assets + +#### Upload + +Types: + +- UploadCreateResponse + +Methods: + +- client.workers.scripts.assets.upload.create(scriptName, { ...params }) -> UploadCreateResponse + +### Subdomain + +Types: + +- SubdomainCreateResponse +- SubdomainGetResponse + +Methods: + +- client.workers.scripts.subdomain.create(scriptName, { ...params }) -> SubdomainCreateResponse +- client.workers.scripts.subdomain.get(scriptName, { ...params }) -> SubdomainGetResponse ### Schedules @@ -1826,7 +2084,7 @@ Types: Methods: -- client.workers.scripts.schedules.update(scriptName, { ...params }) -> ScheduleUpdateResponse +- client.workers.scripts.schedules.update(scriptName, [ ...body ]) -> ScheduleUpdateResponse - client.workers.scripts.schedules.get(scriptName, { ...params }) -> ScheduleGetResponse ### Tail @@ -1931,6 +2189,8 @@ Types: - Namespace - NamespaceUpdateResponse - NamespaceDeleteResponse +- NamespaceBulkDeleteResponse +- NamespaceBulkUpdateResponse Methods: @@ -1938,19 +2198,21 @@ Methods: - client.kv.namespaces.update(namespaceId, { ...params }) -> NamespaceUpdateResponse | null - client.kv.namespaces.list({ ...params }) -> NamespacesV4PagePaginationArray - client.kv.namespaces.delete(namespaceId, { ...params }) -> NamespaceDeleteResponse | null +- client.kv.namespaces.bulkDelete(namespaceId, [ ...body ]) -> NamespaceBulkDeleteResponse | null +- client.kv.namespaces.bulkUpdate(namespaceId, [ ...body ]) -> NamespaceBulkUpdateResponse | null - client.kv.namespaces.get(namespaceId, { ...params }) -> Namespace -### Bulk +### Analytics Types: -- BulkUpdateResponse -- BulkDeleteResponse +- Components +- Schema Methods: -- client.kv.namespaces.bulk.update(namespaceId, [ ...body ]) -> BulkUpdateResponse | null -- client.kv.namespaces.bulk.delete(namespaceId, { ...params }) -> BulkDeleteResponse | null +- client.kv.namespaces.analytics.list({ ...params }) -> Schema +- client.kv.namespaces.analytics.stored({ ...params }) -> Components ### Keys @@ -2012,34 +2274,30 @@ Methods: Types: - Queue -- QueueCreated -- QueueUpdated - QueueDeleteResponse Methods: -- client.queues.create({ ...params }) -> QueueCreated | null -- client.queues.update(queueId, { ...params }) -> QueueUpdated | null +- client.queues.create({ ...params }) -> Queue +- client.queues.update(queueId, { ...params }) -> Queue - client.queues.list({ ...params }) -> QueuesSinglePage -- client.queues.delete(queueId, { ...params }) -> QueueDeleteResponse | null -- client.queues.get(queueId, { ...params }) -> Queue | null +- client.queues.delete(queueId, { ...params }) -> QueueDeleteResponse +- client.queues.get(queueId, { ...params }) -> Queue ## Consumers Types: - Consumer -- ConsumerCreateResponse -- ConsumerUpdateResponse - ConsumerDeleteResponse - ConsumerGetResponse Methods: -- client.queues.consumers.create(queueId, { ...params }) -> ConsumerCreateResponse | null -- client.queues.consumers.update(queueId, consumerId, { ...params }) -> ConsumerUpdateResponse | null -- client.queues.consumers.delete(queueId, consumerId, { ...params }) -> ConsumerDeleteResponse | null -- client.queues.consumers.get(queueId, { ...params }) -> ConsumerGetResponse | null +- client.queues.consumers.create(queueId, { ...params }) -> Consumer +- client.queues.consumers.update(queueId, consumerId, { ...params }) -> Consumer +- client.queues.consumers.delete(queueId, consumerId, { ...params }) -> ConsumerDeleteResponse +- client.queues.consumers.get(queueId, { ...params }) -> ConsumerGetResponse ## Messages @@ -2050,8 +2308,8 @@ Types: Methods: -- client.queues.messages.ack(queueId, { ...params }) -> MessageAckResponse | null -- client.queues.messages.pull(queueId, { ...params }) -> MessagePullResponse | null +- client.queues.messages.ack(queueId, { ...params }) -> MessageAckResponse +- client.queues.messages.pull(queueId, { ...params }) -> MessagePullResponse # APIGateway @@ -2082,11 +2340,13 @@ Methods: Types: +- OperationBulkEditResponse - OperationEditResponse Methods: - client.apiGateway.discovery.operations.list({ ...params }) -> DiscoveryOperationsV4PagePaginationArray +- client.apiGateway.discovery.operations.bulkEdit({ ...params }) -> OperationBulkEditResponse - client.apiGateway.discovery.operations.edit(operationId, { ...params }) -> OperationEditResponse ## Operations @@ -2097,13 +2357,17 @@ Types: - OperationCreateResponse - OperationListResponse - OperationDeleteResponse +- OperationBulkCreateResponse +- OperationBulkDeleteResponse - OperationGetResponse Methods: -- client.apiGateway.operations.create([ ...body ]) -> OperationCreateResponse +- client.apiGateway.operations.create({ ...params }) -> OperationCreateResponse - client.apiGateway.operations.list({ ...params }) -> OperationListResponsesV4PagePaginationArray - client.apiGateway.operations.delete(operationId, { ...params }) -> OperationDeleteResponse +- client.apiGateway.operations.bulkCreate([ ...body ]) -> OperationBulkCreateResponse +- client.apiGateway.operations.bulkDelete({ ...params }) -> OperationBulkDeleteResponse - client.apiGateway.operations.get(operationId, { ...params }) -> OperationGetResponse ### SchemaValidation @@ -2171,18 +2435,40 @@ Methods: - client.apiGateway.userSchemas.operations.list(schemaId, { ...params }) -> OperationListResponsesV4PagePaginationArray -# ManagedHeaders +### Hosts + +Types: + +- HostListResponse + +Methods: + +- client.apiGateway.userSchemas.hosts.list({ ...params }) -> HostListResponsesV4PagePaginationArray + +## ExpressionTemplate + +### Fallthrough + +Types: + +- FallthroughCreateResponse + +Methods: + +- client.apiGateway.expressionTemplate.fallthrough.create({ ...params }) -> FallthroughCreateResponse + +# ManagedTransforms Types: -- RequestModel -- ManagedHeaderListResponse -- ManagedHeaderEditResponse +- ManagedTransformListResponse +- ManagedTransformEditResponse Methods: -- client.managedHeaders.list({ ...params }) -> ManagedHeaderListResponse -- client.managedHeaders.edit({ ...params }) -> ManagedHeaderEditResponse +- client.managedTransforms.list({ ...params }) -> ManagedTransformListResponse +- client.managedTransforms.delete({ ...params }) -> void +- client.managedTransforms.edit({ ...params }) -> ManagedTransformEditResponse # PageShield @@ -2298,10 +2584,11 @@ Methods: Types: - BlockRule -- ChallengeRule - CompressResponseRule +- DDoSDynamicRule - ExecuteRule -- JSChallengeRule +- ForceConnectionCloseRule +- LogCustomFieldRule - LogRule - Logging - ManagedChallengeRule @@ -2329,24 +2616,14 @@ Methods: Types: -- VersionListResponse -- VersionGetResponse +- VersionListResponse +- VersionGetResponse Methods: -- client.rulesets.versions.list(rulesetId, { ...params }) -> VersionListResponsesSinglePage -- client.rulesets.versions.delete(rulesetId, rulesetVersion, { ...params }) -> void -- client.rulesets.versions.get(rulesetId, rulesetVersion, { ...params }) -> VersionGetResponse - -### ByTag - -Types: - -- ByTagGetResponse - -Methods: - -- client.rulesets.versions.byTag.get(rulesetId, rulesetVersion, ruleTag, { ...params }) -> ByTagGetResponse +- client.rulesets.versions.list(rulesetId, { ...params }) -> VersionListResponsesSinglePage +- client.rulesets.versions.delete(rulesetId, rulesetVersion, { ...params }) -> void +- client.rulesets.versions.get(rulesetId, rulesetVersion, { ...params }) -> VersionGetResponse # URLNormalization @@ -2358,6 +2635,7 @@ Types: Methods: - client.urlNormalization.update({ ...params }) -> URLNormalizationUpdateResponse +- client.urlNormalization.delete({ ...params }) -> void - client.urlNormalization.get({ ...params }) -> URLNormalizationGetResponse # Spectrum @@ -2381,7 +2659,7 @@ Types: Methods: -- client.spectrum.analytics.aggregates.currents.get(zone, { ...params }) -> CurrentGetResponse +- client.spectrum.analytics.aggregates.currents.get({ ...params }) -> CurrentGetResponse ### Events @@ -2397,7 +2675,7 @@ Types: Methods: -- client.spectrum.analytics.events.bytimes.get(zone, { ...params }) -> BytimeGetResponse | null +- client.spectrum.analytics.events.bytimes.get({ ...params }) -> BytimeGetResponse #### Summaries @@ -2407,7 +2685,7 @@ Types: Methods: -- client.spectrum.analytics.events.summaries.get(zone, { ...params }) -> SummaryGetResponse | null +- client.spectrum.analytics.events.summaries.get({ ...params }) -> SummaryGetResponse ## Apps @@ -2421,11 +2699,11 @@ Types: Methods: -- client.spectrum.apps.create(zone, { ...params }) -> AppCreateResponse | null -- client.spectrum.apps.update(zone, appId, { ...params }) -> AppUpdateResponse | null -- client.spectrum.apps.list(zone, { ...params }) -> AppListResponsesV4PagePaginationArray -- client.spectrum.apps.delete(zone, appId) -> AppDeleteResponse | null -- client.spectrum.apps.get(zone, appId) -> AppGetResponse +- client.spectrum.apps.create({ ...params }) -> AppCreateResponse +- client.spectrum.apps.update(appId, { ...params }) -> AppUpdateResponse +- client.spectrum.apps.list({ ...params }) -> AppListResponsesV4PagePaginationArray +- client.spectrum.apps.delete(appId, { ...params }) -> AppDeleteResponse | null +- client.spectrum.apps.get(appId, { ...params }) -> AppGetResponse # Addressing @@ -2481,7 +2759,7 @@ Methods: - client.addressing.addressMaps.create({ ...params }) -> AddressMapCreateResponse - client.addressing.addressMaps.list({ ...params }) -> AddressMapsSinglePage -- client.addressing.addressMaps.delete(addressMapId, { ...params }) -> AddressMapDeleteResponse | null +- client.addressing.addressMaps.delete(addressMapId, { ...params }) -> AddressMapDeleteResponse - client.addressing.addressMaps.edit(addressMapId, { ...params }) -> AddressMap - client.addressing.addressMaps.get(addressMapId, { ...params }) -> AddressMapGetResponse @@ -2494,8 +2772,8 @@ Types: Methods: -- client.addressing.addressMaps.accounts.update(addressMapId, { ...params }) -> AccountUpdateResponse | null -- client.addressing.addressMaps.accounts.delete(addressMapId, { ...params }) -> AccountDeleteResponse | null +- client.addressing.addressMaps.accounts.update(addressMapId, { ...params }) -> AccountUpdateResponse +- client.addressing.addressMaps.accounts.delete(addressMapId, { ...params }) -> AccountDeleteResponse ### IPs @@ -2506,8 +2784,8 @@ Types: Methods: -- client.addressing.addressMaps.ips.update(addressMapId, ipAddress, { ...params }) -> IPUpdateResponse | null -- client.addressing.addressMaps.ips.delete(addressMapId, ipAddress, { ...params }) -> IPDeleteResponse | null +- client.addressing.addressMaps.ips.update(addressMapId, ipAddress, { ...params }) -> IPUpdateResponse +- client.addressing.addressMaps.ips.delete(addressMapId, ipAddress, { ...params }) -> IPDeleteResponse ### Zones @@ -2518,24 +2796,19 @@ Types: Methods: -- client.addressing.addressMaps.zones.update(addressMapId, { ...params }) -> ZoneUpdateResponse | null -- client.addressing.addressMaps.zones.delete(addressMapId, { ...params }) -> ZoneDeleteResponse | null +- client.addressing.addressMaps.zones.update(addressMapId, { ...params }) -> ZoneUpdateResponse +- client.addressing.addressMaps.zones.delete(addressMapId, { ...params }) -> ZoneDeleteResponse ## LOADocuments Types: -- LOADocumentCreateResponse - -Methods: - -- client.addressing.loaDocuments.create({ ...params }) -> LOADocumentCreateResponse - -### Downloads +- LOADocumentCreateResponse Methods: -- client.addressing.loaDocuments.downloads.get(loaDocumentId, { ...params }) -> Response +- client.addressing.loaDocuments.create({ ...params }) -> LOADocumentCreateResponse +- client.addressing.loaDocuments.get(loaDocumentId, { ...params }) -> Response ## Prefixes @@ -2548,49 +2821,48 @@ Methods: - client.addressing.prefixes.create({ ...params }) -> Prefix - client.addressing.prefixes.list({ ...params }) -> PrefixesSinglePage -- client.addressing.prefixes.delete(prefixId, { ...params }) -> PrefixDeleteResponse | null +- client.addressing.prefixes.delete(prefixId, { ...params }) -> PrefixDeleteResponse - client.addressing.prefixes.edit(prefixId, { ...params }) -> Prefix - client.addressing.prefixes.get(prefixId, { ...params }) -> Prefix -### BGP - -#### Bindings +### ServiceBindings Types: -- ServiceBinding -- BindingDeleteResponse +- ServiceBinding +- ServiceBindingDeleteResponse Methods: -- client.addressing.prefixes.bgp.bindings.create(prefixId, { ...params }) -> ServiceBinding -- client.addressing.prefixes.bgp.bindings.list(prefixId, { ...params }) -> ServiceBindingsSinglePage -- client.addressing.prefixes.bgp.bindings.delete(prefixId, bindingId, { ...params }) -> BindingDeleteResponse -- client.addressing.prefixes.bgp.bindings.get(prefixId, bindingId, { ...params }) -> ServiceBinding +- client.addressing.prefixes.serviceBindings.create(prefixId, { ...params }) -> ServiceBinding +- client.addressing.prefixes.serviceBindings.list(prefixId, { ...params }) -> ServiceBindingsSinglePage +- client.addressing.prefixes.serviceBindings.delete(prefixId, bindingId, { ...params }) -> ServiceBindingDeleteResponse +- client.addressing.prefixes.serviceBindings.get(prefixId, bindingId, { ...params }) -> ServiceBinding -#### Prefixes +### BGPPrefixes Types: -- BGPPrefix +- BGPPrefix Methods: -- client.addressing.prefixes.bgp.prefixes.list(prefixId, { ...params }) -> BGPPrefixesSinglePage -- client.addressing.prefixes.bgp.prefixes.edit(prefixId, bgpPrefixId, { ...params }) -> BGPPrefix -- client.addressing.prefixes.bgp.prefixes.get(prefixId, bgpPrefixId, { ...params }) -> BGPPrefix +- client.addressing.prefixes.bgpPrefixes.create(prefixId, { ...params }) -> BGPPrefix +- client.addressing.prefixes.bgpPrefixes.list(prefixId, { ...params }) -> BGPPrefixesSinglePage +- client.addressing.prefixes.bgpPrefixes.edit(prefixId, bgpPrefixId, { ...params }) -> BGPPrefix +- client.addressing.prefixes.bgpPrefixes.get(prefixId, bgpPrefixId, { ...params }) -> BGPPrefix -#### Statuses +### AdvertisementStatus Types: -- StatusEditResponse -- StatusGetResponse +- AdvertisementStatusEditResponse +- AdvertisementStatusGetResponse Methods: -- client.addressing.prefixes.bgp.statuses.edit(prefixId, { ...params }) -> StatusEditResponse -- client.addressing.prefixes.bgp.statuses.get(prefixId, { ...params }) -> StatusGetResponse +- client.addressing.prefixes.advertisementStatus.edit(prefixId, { ...params }) -> AdvertisementStatusEditResponse +- client.addressing.prefixes.advertisementStatus.get(prefixId, { ...params }) -> AdvertisementStatusGetResponse ### Delegations @@ -2621,7 +2893,7 @@ Types: Methods: -- client.billing.profiles.get(accountIdentifier) -> ProfileGetResponse +- client.billing.profiles.get({ ...params }) -> ProfileGetResponse # BrandProtection @@ -2761,11 +3033,10 @@ Methods: Types: - DNS -- DNSListResponse Methods: -- client.intel.dns.list({ ...params }) -> DNSListResponsesV4PagePagination +- client.intel.dns.list({ ...params }) -> DNSV4PagePagination ## Domains @@ -2883,6 +3154,16 @@ Methods: - client.intel.indicatorFeeds.permissions.list({ ...params }) -> PermissionListResponse - client.intel.indicatorFeeds.permissions.delete({ ...params }) -> PermissionDeleteResponse +### Downloads + +Types: + +- DownloadGetResponse + +Methods: + +- client.intel.indicatorFeeds.downloads.get(feedId, { ...params }) -> DownloadGetResponse + ## Sinkholes Types: @@ -2955,12 +3236,14 @@ Types: - CfInterconnectUpdateResponse - CfInterconnectListResponse +- CfInterconnectBulkUpdateResponse - CfInterconnectGetResponse Methods: - client.magicTransit.cfInterconnects.update(cfInterconnectId, { ...params }) -> CfInterconnectUpdateResponse - client.magicTransit.cfInterconnects.list({ ...params }) -> CfInterconnectListResponse +- client.magicTransit.cfInterconnects.bulkUpdate({ ...params }) -> CfInterconnectBulkUpdateResponse - client.magicTransit.cfInterconnects.get(cfInterconnectId, { ...params }) -> CfInterconnectGetResponse ## GRETunnels @@ -2971,6 +3254,7 @@ Types: - GRETunnelUpdateResponse - GRETunnelListResponse - GRETunnelDeleteResponse +- GRETunnelBulkUpdateResponse - GRETunnelGetResponse Methods: @@ -2979,6 +3263,7 @@ Methods: - client.magicTransit.greTunnels.update(greTunnelId, { ...params }) -> GRETunnelUpdateResponse - client.magicTransit.greTunnels.list({ ...params }) -> GRETunnelListResponse - client.magicTransit.greTunnels.delete(greTunnelId, { ...params }) -> GRETunnelDeleteResponse +- client.magicTransit.greTunnels.bulkUpdate({ ...params }) -> GRETunnelBulkUpdateResponse - client.magicTransit.greTunnels.get(greTunnelId, { ...params }) -> GRETunnelGetResponse ## IPSECTunnels @@ -2990,6 +3275,7 @@ Types: - IPSECTunnelUpdateResponse - IPSECTunnelListResponse - IPSECTunnelDeleteResponse +- IPSECTunnelBulkUpdateResponse - IPSECTunnelGetResponse - IPSECTunnelPSKGenerateResponse @@ -2999,6 +3285,7 @@ Methods: - client.magicTransit.ipsecTunnels.update(ipsecTunnelId, { ...params }) -> IPSECTunnelUpdateResponse - client.magicTransit.ipsecTunnels.list({ ...params }) -> IPSECTunnelListResponse - client.magicTransit.ipsecTunnels.delete(ipsecTunnelId, { ...params }) -> IPSECTunnelDeleteResponse +- client.magicTransit.ipsecTunnels.bulkUpdate({ ...params }) -> IPSECTunnelBulkUpdateResponse - client.magicTransit.ipsecTunnels.get(ipsecTunnelId, { ...params }) -> IPSECTunnelGetResponse - client.magicTransit.ipsecTunnels.pskGenerate(ipsecTunnelId, { ...params }) -> IPSECTunnelPSKGenerateResponse @@ -3011,6 +3298,7 @@ Types: - RouteUpdateResponse - RouteListResponse - RouteDeleteResponse +- RouteBulkUpdateResponse - RouteEmptyResponse - RouteGetResponse @@ -3020,6 +3308,7 @@ Methods: - client.magicTransit.routes.update(routeId, { ...params }) -> RouteUpdateResponse - client.magicTransit.routes.list({ ...params }) -> RouteListResponse - client.magicTransit.routes.delete(routeId, { ...params }) -> RouteDeleteResponse +- client.magicTransit.routes.bulkUpdate({ ...params }) -> RouteBulkUpdateResponse - client.magicTransit.routes.empty({ ...params }) -> RouteEmptyResponse - client.magicTransit.routes.get(routeId, { ...params }) -> RouteGetResponse @@ -3111,6 +3400,42 @@ Methods: - client.magicTransit.connectors.edit(connectorId, { ...params }) -> ConnectorEditResponse - client.magicTransit.connectors.get(connectorId, { ...params }) -> ConnectorGetResponse +## PCAPs + +Types: + +- PCAP +- PCAPFilter +- PCAPCreateResponse +- PCAPListResponse +- PCAPGetResponse + +Methods: + +- client.magicTransit.pcaps.create({ ...params }) -> PCAPCreateResponse +- client.magicTransit.pcaps.list({ ...params }) -> PCAPListResponsesSinglePage +- client.magicTransit.pcaps.get(pcapId, { ...params }) -> PCAPGetResponse + +### Ownership + +Types: + +- Ownership +- OwnershipGetResponse + +Methods: + +- client.magicTransit.pcaps.ownership.create({ ...params }) -> Ownership +- client.magicTransit.pcaps.ownership.delete(ownershipId, { ...params }) -> void +- client.magicTransit.pcaps.ownership.get({ ...params }) -> OwnershipGetResponse | null +- client.magicTransit.pcaps.ownership.validate({ ...params }) -> Ownership + +### Download + +Methods: + +- client.magicTransit.pcaps.download.get(pcapId, { ...params }) -> Response + # MagicNetworkMonitoring ## Configs @@ -3181,7 +3506,7 @@ Types: Methods: -- client.mtlsCertificates.associations.get(mtlsCertificateId, { ...params }) -> AssociationGetResponse | null +- client.mtlsCertificates.associations.get(mtlsCertificateId, { ...params }) -> AssociationGetResponse # Pages @@ -3192,19 +3517,17 @@ Types: - Deployment - Project - Stage -- ProjectCreateResponse - ProjectDeleteResponse -- ProjectEditResponse - ProjectPurgeBuildCacheResponse Methods: -- client.pages.projects.create({ ...params }) -> ProjectCreateResponse +- client.pages.projects.create({ ...params }) -> Project - client.pages.projects.list({ ...params }) -> DeploymentsSinglePage -- client.pages.projects.delete(projectName, { ...params }) -> unknown -- client.pages.projects.edit(projectName, { ...params }) -> ProjectEditResponse +- client.pages.projects.delete(projectName, { ...params }) -> ProjectDeleteResponse | null +- client.pages.projects.edit(projectName, { ...params }) -> Project - client.pages.projects.get(projectName, { ...params }) -> Project -- client.pages.projects.purgeBuildCache(projectName, { ...params }) -> unknown +- client.pages.projects.purgeBuildCache(projectName, { ...params }) -> ProjectPurgeBuildCacheResponse | null ### Deployments @@ -3216,7 +3539,7 @@ Methods: - client.pages.projects.deployments.create(projectName, { ...params }) -> Deployment - client.pages.projects.deployments.list(projectName, { ...params }) -> DeploymentsSinglePage -- client.pages.projects.deployments.delete(projectName, deploymentId, { ...params }) -> unknown +- client.pages.projects.deployments.delete(projectName, deploymentId, { ...params }) -> DeploymentDeleteResponse | null - client.pages.projects.deployments.get(projectName, deploymentId, { ...params }) -> Deployment - client.pages.projects.deployments.retry(projectName, deploymentId, { ...params }) -> Deployment - client.pages.projects.deployments.rollback(projectName, deploymentId, { ...params }) -> Deployment @@ -3227,65 +3550,29 @@ Methods: Types: -- LogGetResponse - -Methods: - -- client.pages.projects.deployments.history.logs.get(projectName, deploymentId, { ...params }) -> LogGetResponse - -### Domains - -Types: - -- DomainCreateResponse -- DomainListResponse -- DomainDeleteResponse -- DomainEditResponse -- DomainGetResponse - -Methods: - -- client.pages.projects.domains.create(projectName, { ...params }) -> DomainCreateResponse | null -- client.pages.projects.domains.list(projectName, { ...params }) -> DomainListResponsesSinglePage -- client.pages.projects.domains.delete(projectName, domainName, { ...params }) -> unknown -- client.pages.projects.domains.edit(projectName, domainName, { ...params }) -> DomainEditResponse | null -- client.pages.projects.domains.get(projectName, domainName, { ...params }) -> DomainGetResponse | null - -# PCAPs - -Types: - -- PCAP -- PCAPFilter -- PCAPCreateResponse -- PCAPListResponse -- PCAPGetResponse - -Methods: - -- client.pcaps.create({ ...params }) -> PCAPCreateResponse -- client.pcaps.list({ ...params }) -> PCAPListResponsesSinglePage -- client.pcaps.get(pcapId, { ...params }) -> PCAPGetResponse - -## Ownership - -Types: - -- Ownership -- OwnershipGetResponse +- LogGetResponse Methods: -- client.pcaps.ownership.create({ ...params }) -> Ownership -- client.pcaps.ownership.delete(ownershipId, { ...params }) -> void -- client.pcaps.ownership.get({ ...params }) -> OwnershipGetResponse | null -- client.pcaps.ownership.validate({ ...params }) -> Ownership +- client.pages.projects.deployments.history.logs.get(projectName, deploymentId, { ...params }) -> LogGetResponse + +### Domains + +Types: -## Download +- DomainCreateResponse +- DomainListResponse +- DomainDeleteResponse +- DomainEditResponse +- DomainGetResponse Methods: -- client.pcaps.download.get(pcapId, { ...params }) -> Response +- client.pages.projects.domains.create(projectName, { ...params }) -> DomainCreateResponse | null +- client.pages.projects.domains.list(projectName, { ...params }) -> DomainListResponsesSinglePage +- client.pages.projects.domains.delete(projectName, domainName, { ...params }) -> DomainDeleteResponse | null +- client.pages.projects.domains.edit(projectName, domainName, { ...params }) -> DomainEditResponse | null +- client.pages.projects.domains.get(projectName, domainName, { ...params }) -> DomainGetResponse | null # Registrar @@ -3330,11 +3617,11 @@ Types: Methods: -- client.rules.lists.create({ ...params }) -> ListsList | null -- client.rules.lists.update(listId, { ...params }) -> ListsList | null +- client.rules.lists.create({ ...params }) -> ListsList +- client.rules.lists.update(listId, { ...params }) -> ListsList - client.rules.lists.list({ ...params }) -> ListsListsSinglePage -- client.rules.lists.delete(listId, { ...params }) -> ListDeleteResponse | null -- client.rules.lists.get(listId, { ...params }) -> ListsList | null +- client.rules.lists.delete(listId, { ...params }) -> ListDeleteResponse +- client.rules.lists.get(listId, { ...params }) -> ListsList ### BulkOperations @@ -3345,7 +3632,7 @@ Types: Methods: -- client.rules.lists.bulkOperations.get(accountIdentifier, operationId) -> BulkOperationGetResponse | null +- client.rules.lists.bulkOperations.get(accountIdentifier, operationId) -> BulkOperationGetResponse ### Items @@ -3361,25 +3648,11 @@ Types: Methods: -- client.rules.lists.items.create(listId, [ ...body ]) -> ItemCreateResponse | null -- client.rules.lists.items.update(listId, [ ...body ]) -> ItemUpdateResponse | null +- client.rules.lists.items.create(listId, [ ...body ]) -> ItemCreateResponse +- client.rules.lists.items.update(listId, [ ...body ]) -> ItemUpdateResponse - client.rules.lists.items.list(listId, { ...params }) -> ItemListResponsesCursorPagination -- client.rules.lists.items.delete(listId, { ...params }) -> ItemDeleteResponse | null -- client.rules.lists.items.get(accountIdentifier, listId, itemId) -> ItemGetResponse | null - -# Storage - -## Analytics - -Types: - -- Components -- Schema - -Methods: - -- client.storage.analytics.list({ ...params }) -> Schema -- client.storage.analytics.stored({ ...params }) -> Components +- client.rules.lists.items.delete(listId, { ...params }) -> ItemDeleteResponse +- client.rules.lists.items.get(accountIdentifier, listId, itemId) -> ItemGetResponse # Stream @@ -3393,6 +3666,7 @@ Methods: - client.stream.create({ ...params }) -> void - client.stream.list({ ...params }) -> VideosSinglePage - client.stream.delete(identifier, { ...params }) -> void +- client.stream.edit(identifier, { ...params }) -> Video - client.stream.get(identifier, { ...params }) -> Video ## AudioTracks @@ -3682,18 +3956,21 @@ Types: Types: - QueryResult -- DatabaseCreateResponse - DatabaseListResponse - DatabaseDeleteResponse +- DatabaseExportResponse +- DatabaseImportResponse - DatabaseQueryResponse - DatabaseRawResponse Methods: -- client.d1.database.create({ ...params }) -> DatabaseCreateResponse +- client.d1.database.create({ ...params }) -> D1 - client.d1.database.list({ ...params }) -> DatabaseListResponsesV4PagePaginationArray -- client.d1.database.delete(databaseId, { ...params }) -> DatabaseDeleteResponse +- client.d1.database.delete(databaseId, { ...params }) -> DatabaseDeleteResponse | null +- client.d1.database.export(databaseId, { ...params }) -> DatabaseExportResponse - client.d1.database.get(databaseId, { ...params }) -> D1 +- client.d1.database.import(databaseId, { ...params }) -> DatabaseImportResponse - client.d1.database.query(databaseId, { ...params }) -> DatabaseQueryResponse - client.d1.database.raw(databaseId, { ...params }) -> DatabaseRawResponse @@ -3703,60 +3980,123 @@ Methods: Types: -- Bucket -- BucketDeleteResponse +- Bucket +- BucketListResponse +- BucketDeleteResponse Methods: -- client.r2.buckets.create({ ...params }) -> Bucket -- client.r2.buckets.list({ ...params }) -> BucketsCursorPagination -- client.r2.buckets.delete(bucketName, { ...params }) -> BucketDeleteResponse -- client.r2.buckets.get(bucketName, { ...params }) -> Bucket +- client.r2.buckets.create({ ...params }) -> Bucket +- client.r2.buckets.list({ ...params }) -> BucketListResponse +- client.r2.buckets.delete(bucketName, { ...params }) -> BucketDeleteResponse +- client.r2.buckets.get(bucketName, { ...params }) -> Bucket -## Sippy +### Lifecycle Types: -- Provider -- Sippy -- SippyDeleteResponse +- LifecycleUpdateResponse +- LifecycleGetResponse Methods: -- client.r2.sippy.update(bucketName, { ...params }) -> Sippy -- client.r2.sippy.delete(bucketName, { ...params }) -> SippyDeleteResponse -- client.r2.sippy.get(bucketName, { ...params }) -> Sippy +- client.r2.buckets.lifecycle.update(bucketName, { ...params }) -> LifecycleUpdateResponse +- client.r2.buckets.lifecycle.get(bucketName, { ...params }) -> LifecycleGetResponse -## TemporaryCredentials +### CORS Types: -- TemporaryCredential -- TemporaryCredentialCreateResponse +- CORSUpdateResponse +- CORSDeleteResponse +- CORSGetResponse Methods: -- client.r2.temporaryCredentials.create({ ...params }) -> TemporaryCredentialCreateResponse +- client.r2.buckets.cors.update(bucketName, { ...params }) -> CORSUpdateResponse +- client.r2.buckets.cors.delete(bucketName, { ...params }) -> CORSDeleteResponse +- client.r2.buckets.cors.get(bucketName, { ...params }) -> CORSGetResponse + +### Domains + +#### Custom + +Types: + +- CustomCreateResponse +- CustomUpdateResponse +- CustomListResponse +- CustomDeleteResponse +- CustomGetResponse + +Methods: + +- client.r2.buckets.domains.custom.create(bucketName, { ...params }) -> CustomCreateResponse +- client.r2.buckets.domains.custom.update(bucketName, domainName, { ...params }) -> CustomUpdateResponse +- client.r2.buckets.domains.custom.list(bucketName, { ...params }) -> CustomListResponse +- client.r2.buckets.domains.custom.delete(bucketName, domainName, { ...params }) -> CustomDeleteResponse +- client.r2.buckets.domains.custom.get(bucketName, domainName, { ...params }) -> CustomGetResponse + +#### Managed + +Types: + +- ManagedUpdateResponse +- ManagedListResponse + +Methods: + +- client.r2.buckets.domains.managed.update(bucketName, { ...params }) -> ManagedUpdateResponse +- client.r2.buckets.domains.managed.list(bucketName, { ...params }) -> ManagedListResponse + +### EventNotifications + +#### Configuration + +Types: + +- ConfigurationGetResponse + +Methods: + +- client.r2.buckets.eventNotifications.configuration.get(bucketName, { ...params }) -> ConfigurationGetResponse + +##### Queues + +Types: + +- QueueUpdateResponse +- QueueDeleteResponse + +Methods: + +- client.r2.buckets.eventNotifications.configuration.queues.update(bucketName, queueId, { ...params }) -> QueueUpdateResponse +- client.r2.buckets.eventNotifications.configuration.queues.delete(bucketName, queueId, { ...params }) -> QueueDeleteResponse + +### Sippy + +Types: + +- Provider +- Sippy +- SippyDeleteResponse -# WARPConnector +Methods: + +- client.r2.buckets.sippy.update(bucketName, { ...params }) -> Sippy +- client.r2.buckets.sippy.delete(bucketName, { ...params }) -> SippyDeleteResponse +- client.r2.buckets.sippy.get(bucketName, { ...params }) -> Sippy + +## TemporaryCredentials Types: -- WARPConnectorCreateResponse -- WARPConnectorListResponse -- WARPConnectorDeleteResponse -- WARPConnectorEditResponse -- WARPConnectorGetResponse -- WARPConnectorTokenResponse +- TemporaryCredential +- TemporaryCredentialCreateResponse Methods: -- client.warpConnector.create({ ...params }) -> WARPConnectorCreateResponse -- client.warpConnector.list({ ...params }) -> WARPConnectorListResponsesV4PagePaginationArray -- client.warpConnector.delete(tunnelId, { ...params }) -> WARPConnectorDeleteResponse -- client.warpConnector.edit(tunnelId, { ...params }) -> WARPConnectorEditResponse -- client.warpConnector.get(tunnelId, { ...params }) -> WARPConnectorGetResponse -- client.warpConnector.token(tunnelId, { ...params }) -> WARPConnectorTokenResponse +- client.r2.temporaryCredentials.create({ ...params }) -> TemporaryCredentialCreateResponse # WorkersForPlatforms @@ -3783,13 +4123,24 @@ Methods: Types: - Script +- ScriptUpdateResponse Methods: -- client.workersForPlatforms.dispatch.namespaces.scripts.update(dispatchNamespace, scriptName, { ...params }) -> Script +- client.workersForPlatforms.dispatch.namespaces.scripts.update(dispatchNamespace, scriptName, { ...params }) -> ScriptUpdateResponse - client.workersForPlatforms.dispatch.namespaces.scripts.delete(dispatchNamespace, scriptName, { ...params }) -> void - client.workersForPlatforms.dispatch.namespaces.scripts.get(dispatchNamespace, scriptName, { ...params }) -> Script +##### AssetUpload + +Types: + +- AssetUploadCreateResponse + +Methods: + +- client.workersForPlatforms.dispatch.namespaces.scripts.assetUpload.create(dispatchNamespace, scriptName, { ...params }) -> AssetUploadCreateResponse + ##### Content Methods: @@ -3823,13 +4174,16 @@ Methods: Types: +- WorkersSecretModel - SecretUpdateResponse - SecretListResponse +- SecretGetResponse Methods: - client.workersForPlatforms.dispatch.namespaces.scripts.secrets.update(dispatchNamespace, scriptName, { ...params }) -> SecretUpdateResponse - client.workersForPlatforms.dispatch.namespaces.scripts.secrets.list(dispatchNamespace, scriptName, { ...params }) -> SecretListResponsesSinglePage +- client.workersForPlatforms.dispatch.namespaces.scripts.secrets.get(dispatchNamespace, scriptName, secretName, { ...params }) -> SecretGetResponse ##### Tags @@ -3857,7 +4211,7 @@ Types: Methods: - client.zeroTrust.devices.list({ ...params }) -> DevicesSinglePage -- client.zeroTrust.devices.get(deviceId, { ...params }) -> DeviceGetResponse +- client.zeroTrust.devices.get(deviceId, { ...params }) -> DeviceGetResponse | null ### DEXTests @@ -3873,7 +4227,7 @@ Methods: - client.zeroTrust.devices.dexTests.create({ ...params }) -> SchemaHTTP | null - client.zeroTrust.devices.dexTests.update(dexTestId, { ...params }) -> SchemaHTTP | null - client.zeroTrust.devices.dexTests.list({ ...params }) -> SchemaHTTPSSinglePage -- client.zeroTrust.devices.dexTests.delete(dexTestId, { ...params }) -> DEXTestDeleteResponse | null +- client.zeroTrust.devices.dexTests.delete(dexTestId, { ...params }) -> DEXTestDeleteResponse - client.zeroTrust.devices.dexTests.get(dexTestId, { ...params }) -> SchemaHTTP | null ### Networks @@ -3891,73 +4245,136 @@ Methods: - client.zeroTrust.devices.networks.delete(networkId, { ...params }) -> NetworkDeleteResponse | null - client.zeroTrust.devices.networks.get(networkId, { ...params }) -> DeviceNetwork | null +### FleetStatus + +Types: + +- FleetStatusGetResponse + +Methods: + +- client.zeroTrust.devices.fleetStatus.get(deviceId, { ...params }) -> FleetStatusGetResponse + ### Policies Types: +- DevicePolicyCertificates +- FallbackDomain +- FallbackDomainPolicy - SettingsPolicy -- PolicyDeleteResponse +- SplitTunnelExclude +- SplitTunnelInclude + +#### Default + +Types: + +- DefaultEditResponse +- DefaultGetResponse + +Methods: + +- client.zeroTrust.devices.policies.default.edit({ ...params }) -> DefaultEditResponse | null +- client.zeroTrust.devices.policies.default.get({ ...params }) -> DefaultGetResponse | null + +##### Excludes + +Types: + +- ExcludeUpdateResponse +- ExcludeGetResponse + +Methods: + +- client.zeroTrust.devices.policies.default.excludes.update([ ...body ]) -> ExcludeUpdateResponse | null +- client.zeroTrust.devices.policies.default.excludes.get({ ...params }) -> ExcludeGetResponse | null + +##### Includes + +Types: + +- IncludeUpdateResponse +- IncludeGetResponse + +Methods: + +- client.zeroTrust.devices.policies.default.includes.update([ ...body ]) -> IncludeUpdateResponse | null +- client.zeroTrust.devices.policies.default.includes.get({ ...params }) -> IncludeGetResponse | null + +##### FallbackDomains + +Types: + +- FallbackDomainUpdateResponse +- FallbackDomainGetResponse + +Methods: + +- client.zeroTrust.devices.policies.default.fallbackDomains.update([ ...domains ]) -> FallbackDomainUpdateResponse | null +- client.zeroTrust.devices.policies.default.fallbackDomains.get({ ...params }) -> FallbackDomainGetResponse | null + +##### Certificates + +Types: + +- CertificateEditResponse +- CertificateGetResponse Methods: -- client.zeroTrust.devices.policies.create({ ...params }) -> SettingsPolicy | null -- client.zeroTrust.devices.policies.list({ ...params }) -> SettingsPoliciesSinglePage -- client.zeroTrust.devices.policies.delete(policyId, { ...params }) -> PolicyDeleteResponse | null -- client.zeroTrust.devices.policies.edit(policyId, { ...params }) -> SettingsPolicy | null -- client.zeroTrust.devices.policies.get(policyId, { ...params }) -> SettingsPolicy | null +- client.zeroTrust.devices.policies.default.certificates.edit({ ...params }) -> CertificateEditResponse | null +- client.zeroTrust.devices.policies.default.certificates.get({ ...params }) -> CertificateGetResponse | null -#### DefaultPolicy +#### Custom Types: -- DefaultPolicyGetResponse +- CustomDeleteResponse Methods: -- client.zeroTrust.devices.policies.defaultPolicy.get({ ...params }) -> DefaultPolicyGetResponse | null +- client.zeroTrust.devices.policies.custom.create({ ...params }) -> SettingsPolicy | null +- client.zeroTrust.devices.policies.custom.list({ ...params }) -> SettingsPoliciesSinglePage +- client.zeroTrust.devices.policies.custom.delete(policyId, { ...params }) -> CustomDeleteResponse | null +- client.zeroTrust.devices.policies.custom.edit(policyId, { ...params }) -> SettingsPolicy | null +- client.zeroTrust.devices.policies.custom.get(policyId, { ...params }) -> SettingsPolicy | null -#### Excludes +##### Excludes Types: -- SplitTunnelExclude -- ExcludeUpdateResponse -- ExcludeGetResponse +- ExcludeUpdateResponse +- ExcludeGetResponse Methods: -- client.zeroTrust.devices.policies.excludes.update([ ...body ]) -> ExcludeUpdateResponse | null -- client.zeroTrust.devices.policies.excludes.list({ ...params }) -> SplitTunnelExcludesSinglePage -- client.zeroTrust.devices.policies.excludes.get(policyId, { ...params }) -> ExcludeGetResponse | null +- client.zeroTrust.devices.policies.custom.excludes.update(policyId, [ ...body ]) -> ExcludeUpdateResponse | null +- client.zeroTrust.devices.policies.custom.excludes.get(policyId, { ...params }) -> ExcludeGetResponse | null -#### FallbackDomains +##### Includes Types: -- FallbackDomain -- FallbackDomainPolicy -- FallbackDomainUpdateResponse -- FallbackDomainGetResponse +- IncludeUpdateResponse +- IncludeGetResponse Methods: -- client.zeroTrust.devices.policies.fallbackDomains.update(policyId, [ ...body ]) -> FallbackDomainUpdateResponse | null -- client.zeroTrust.devices.policies.fallbackDomains.list({ ...params }) -> FallbackDomainsSinglePage -- client.zeroTrust.devices.policies.fallbackDomains.get(policyId, { ...params }) -> FallbackDomainGetResponse | null +- client.zeroTrust.devices.policies.custom.includes.update(policyId, [ ...body ]) -> IncludeUpdateResponse | null +- client.zeroTrust.devices.policies.custom.includes.get(policyId, { ...params }) -> IncludeGetResponse | null -#### Includes +##### FallbackDomains Types: -- SplitTunnelInclude -- IncludeUpdateResponse -- IncludeGetResponse +- FallbackDomainUpdateResponse +- FallbackDomainGetResponse Methods: -- client.zeroTrust.devices.policies.includes.update([ ...body ]) -> IncludeUpdateResponse | null -- client.zeroTrust.devices.policies.includes.list({ ...params }) -> SplitTunnelIncludesSinglePage -- client.zeroTrust.devices.policies.includes.get(policyId, { ...params }) -> IncludeGetResponse | null +- client.zeroTrust.devices.policies.custom.fallbackDomains.update(policyId, [ ...domains ]) -> FallbackDomainUpdateResponse | null +- client.zeroTrust.devices.policies.custom.fallbackDomains.get(policyId, { ...params }) -> FallbackDomainGetResponse | null ### Posture @@ -4002,7 +4419,7 @@ Methods: - client.zeroTrust.devices.posture.integrations.create({ ...params }) -> Integration | null - client.zeroTrust.devices.posture.integrations.list({ ...params }) -> IntegrationsSinglePage -- client.zeroTrust.devices.posture.integrations.delete(integrationId, { ...params }) -> IntegrationDeleteResponse +- client.zeroTrust.devices.posture.integrations.delete(integrationId, { ...params }) -> IntegrationDeleteResponse | null - client.zeroTrust.devices.posture.integrations.edit(integrationId, { ...params }) -> Integration | null - client.zeroTrust.devices.posture.integrations.get(integrationId, { ...params }) -> Integration | null @@ -4014,7 +4431,7 @@ Types: Methods: -- client.zeroTrust.devices.revoke.create([ ...body ]) -> RevokeCreateResponse +- client.zeroTrust.devices.revoke.create([ ...body ]) -> RevokeCreateResponse | null ### Settings @@ -4026,6 +4443,7 @@ Methods: - client.zeroTrust.devices.settings.update({ ...params }) -> DeviceSettings | null - client.zeroTrust.devices.settings.list({ ...params }) -> DeviceSettings | null +- client.zeroTrust.devices.settings.edit({ ...params }) -> DeviceSettings | null ### Unrevoke @@ -4035,7 +4453,7 @@ Types: Methods: -- client.zeroTrust.devices.unrevoke.create([ ...body ]) -> UnrevokeCreateResponse +- client.zeroTrust.devices.unrevoke.create([ ...body ]) -> UnrevokeCreateResponse | null ### OverrideCodes @@ -4054,8 +4472,8 @@ Types: - AzureAD - GenericOAuthConfig - IdentityProvider +- IdentityProviderSCIMConfig - IdentityProviderType -- SCIMConfig - IdentityProviderListResponse - IdentityProviderDeleteResponse @@ -4071,16 +4489,28 @@ Methods: Types: -- LoginDesign -- Organization -- OrganizationRevokeUsersResponse +- LoginDesign +- Organization +- OrganizationRevokeUsersResponse + +Methods: + +- client.zeroTrust.organizations.create({ ...params }) -> Organization +- client.zeroTrust.organizations.update({ ...params }) -> Organization +- client.zeroTrust.organizations.list({ ...params }) -> Organization +- client.zeroTrust.organizations.revokeUsers({ ...params }) -> OrganizationRevokeUsersResponse + +### DOH + +Types: + +- DOHUpdateResponse +- DOHGetResponse Methods: -- client.zeroTrust.organizations.create({ ...params }) -> Organization -- client.zeroTrust.organizations.update({ ...params }) -> Organization -- client.zeroTrust.organizations.list({ ...params }) -> Organization -- client.zeroTrust.organizations.revokeUsers({ ...params }) -> OrganizationRevokeUsersResponse +- client.zeroTrust.organizations.doh.update({ ...params }) -> DOHUpdateResponse +- client.zeroTrust.organizations.doh.get({ ...params }) -> DOHGetResponse ## Seats @@ -4091,7 +4521,7 @@ Types: Methods: -- client.zeroTrust.seats.edit([ ...body ]) -> SeatEditResponse | null +- client.zeroTrust.seats.edit([ ...body ]) -> SeatEditResponse ## Access @@ -4118,6 +4548,42 @@ Types: - SAMLGroupRule - ServiceTokenRule +### GatewayCA + +Types: + +- GatewayCACreateResponse +- GatewayCAListResponse +- GatewayCADeleteResponse + +Methods: + +- client.zeroTrust.access.gatewayCA.create({ ...params }) -> GatewayCACreateResponse +- client.zeroTrust.access.gatewayCA.list({ ...params }) -> GatewayCAListResponsesSinglePage +- client.zeroTrust.access.gatewayCA.delete(certificateId, { ...params }) -> GatewayCADeleteResponse + +### Infrastructure + +#### Targets + +Types: + +- TargetCreateResponse +- TargetUpdateResponse +- TargetListResponse +- TargetBulkUpdateResponse +- TargetGetResponse + +Methods: + +- client.zeroTrust.access.infrastructure.targets.create({ ...params }) -> TargetCreateResponse +- client.zeroTrust.access.infrastructure.targets.update(targetId, { ...params }) -> TargetUpdateResponse +- client.zeroTrust.access.infrastructure.targets.list({ ...params }) -> TargetListResponsesV4PagePaginationArray +- client.zeroTrust.access.infrastructure.targets.delete(targetId, { ...params }) -> void +- client.zeroTrust.access.infrastructure.targets.bulkDelete({ ...params }) -> void +- client.zeroTrust.access.infrastructure.targets.bulkUpdate([ ...body ]) -> TargetBulkUpdateResponse +- client.zeroTrust.access.infrastructure.targets.get(targetId, { ...params }) -> TargetGetResponse + ### Applications Types: @@ -4128,13 +4594,18 @@ Types: - AllowedOrigins - AppID - Application +- ApplicationPolicy +- ApplicationSCIMConfig - ApplicationType - CORSHeaders - Decision -- SaaSAppNameFormat +- OIDCSaaSApp - SaaSAppNameIDFormat -- SaaSAppSource - SAMLSaaSApp +- SCIMConfigAuthenticationHTTPBasic +- SCIMConfigAuthenticationOAuthBearerToken +- SCIMConfigAuthenticationOauth2 +- SCIMConfigMapping - SelfHostedDomains - ApplicationCreateResponse - ApplicationUpdateResponse @@ -4157,16 +4628,14 @@ Methods: Types: - CA -- CACreateResponse - CADeleteResponse -- CAGetResponse Methods: -- client.zeroTrust.access.applications.cas.create(appId, { ...params }) -> CACreateResponse +- client.zeroTrust.access.applications.cas.create(appId, { ...params }) -> CA - client.zeroTrust.access.applications.cas.list({ ...params }) -> CAsSinglePage - client.zeroTrust.access.applications.cas.delete(appId, { ...params }) -> CADeleteResponse -- client.zeroTrust.access.applications.cas.get(appId, { ...params }) -> CAGetResponse +- client.zeroTrust.access.applications.cas.get(appId, { ...params }) -> CA #### UserPolicyChecks @@ -4183,8 +4652,6 @@ Methods: Types: -- ApprovalGroup -- Policy - PolicyCreateResponse - PolicyUpdateResponse - PolicyListResponse @@ -4199,6 +4666,28 @@ Methods: - client.zeroTrust.access.applications.policies.delete(appId, policyId, { ...params }) -> PolicyDeleteResponse - client.zeroTrust.access.applications.policies.get(appId, policyId, { ...params }) -> PolicyGetResponse +#### PolicyTests + +Types: + +- PolicyTestCreateResponse +- PolicyTestGetResponse + +Methods: + +- client.zeroTrust.access.applications.policyTests.create({ ...params }) -> PolicyTestCreateResponse +- client.zeroTrust.access.applications.policyTests.get(policyTestId, { ...params }) -> PolicyTestGetResponse + +##### Users + +Types: + +- UserListResponse + +Methods: + +- client.zeroTrust.access.applications.policyTests.users.list(policyTestId, { ...params }) -> UserListResponse + ### Certificates Types: @@ -4225,8 +4714,8 @@ Types: Methods: -- client.zeroTrust.access.certificates.settings.update({ ...params }) -> SettingUpdateResponse | null -- client.zeroTrust.access.certificates.settings.get({ ...params }) -> SettingGetResponse | null +- client.zeroTrust.access.certificates.settings.update({ ...params }) -> SettingUpdateResponse +- client.zeroTrust.access.certificates.settings.get({ ...params }) -> SettingGetResponse ### Groups @@ -4380,6 +4869,8 @@ Methods: Types: +- ApprovalGroup +- Policy - PolicyCreateResponse - PolicyUpdateResponse - PolicyListResponse @@ -4398,11 +4889,59 @@ Methods: Types: -- DeviceExperienceMonitor +- DigitalExperienceMonitor - NetworkPath - NetworkPathResponse - Percentiles +### Commands + +Types: + +- CommandCreateResponse +- CommandListResponse + +Methods: + +- client.zeroTrust.dex.commands.create({ ...params }) -> CommandCreateResponse +- client.zeroTrust.dex.commands.list({ ...params }) -> CommandListResponsesV4PagePagination + +#### Users + +Types: + +- UserListResponse + +Methods: + +- client.zeroTrust.dex.commands.users.list({ ...params }) -> UserListResponse + +#### Devices + +Types: + +- DeviceListResponse + +Methods: + +- client.zeroTrust.dex.commands.devices.list({ ...params }) -> DeviceListResponsesV4PagePagination + +#### Downloads + +Methods: + +- client.zeroTrust.dex.commands.downloads.get(commandId, filename, { ...params }) -> Response + +#### Quota + +Types: + +- QuotaGetResponse + +Methods: + +- client.zeroTrust.dex.commands.quota.get({ ...params }) -> QuotaGetResponse + ### Colos Types: @@ -4462,11 +5001,10 @@ Types: - AggregateTimePeriod - Tests -- TestListResponse Methods: -- client.zeroTrust.dex.tests.list({ ...params }) -> TestListResponsesV4PagePagination +- client.zeroTrust.dex.tests.list({ ...params }) -> TestsV4PagePagination #### UniqueDevices @@ -4516,11 +5054,31 @@ Types: Methods: -- client.zeroTrust.tunnels.create({ ...params }) -> TunnelCreateResponse -- client.zeroTrust.tunnels.list({ ...params }) -> TunnelListResponsesV4PagePaginationArray -- client.zeroTrust.tunnels.delete(tunnelId, { ...params }) -> TunnelDeleteResponse +- client.zeroTrust.tunnels.create({ ...params }) -> TunnelCreateResponse +- client.zeroTrust.tunnels.list({ ...params }) -> TunnelListResponsesV4PagePaginationArray +- client.zeroTrust.tunnels.delete(tunnelId, { ...params }) -> TunnelDeleteResponse - client.zeroTrust.tunnels.edit(tunnelId, { ...params }) -> TunnelEditResponse -- client.zeroTrust.tunnels.get(tunnelId, { ...params }) -> TunnelGetResponse +- client.zeroTrust.tunnels.get(tunnelId, { ...params }) -> TunnelGetResponse + +### WARPConnector + +Types: + +- WARPConnectorCreateResponse +- WARPConnectorListResponse +- WARPConnectorDeleteResponse +- WARPConnectorEditResponse +- WARPConnectorGetResponse +- WARPConnectorTokenResponse + +Methods: + +- client.zeroTrust.tunnels.warpConnector.create({ ...params }) -> WARPConnectorCreateResponse +- client.zeroTrust.tunnels.warpConnector.list({ ...params }) -> WARPConnectorListResponsesV4PagePaginationArray +- client.zeroTrust.tunnels.warpConnector.delete(tunnelId, { ...params }) -> WARPConnectorDeleteResponse +- client.zeroTrust.tunnels.warpConnector.edit(tunnelId, { ...params }) -> WARPConnectorEditResponse +- client.zeroTrust.tunnels.warpConnector.get(tunnelId, { ...params }) -> WARPConnectorGetResponse +- client.zeroTrust.tunnels.warpConnector.token(tunnelId, { ...params }) -> WARPConnectorTokenResponse ### Configurations @@ -4544,7 +5102,7 @@ Types: Methods: -- client.zeroTrust.tunnels.connections.delete(tunnelId, { ...params }) -> ConnectionDeleteResponse +- client.zeroTrust.tunnels.connections.delete(tunnelId, { ...params }) -> ConnectionDeleteResponse | null - client.zeroTrust.tunnels.connections.get(tunnelId, { ...params }) -> ConnectionGetResponse | null ### Token @@ -4614,11 +5172,35 @@ Methods: - client.zeroTrust.dlp.datasets.upload.create(datasetId, { ...params }) -> NewVersion - client.zeroTrust.dlp.datasets.upload.edit(datasetId, version, { ...params }) -> Dataset +#### Versions + +Types: + +- VersionCreateResponse + +Methods: + +- client.zeroTrust.dlp.datasets.versions.create(datasetId, version, [ ...body ]) -> VersionCreateResponse + +##### Entries + +Types: + +- EntryCreateResponse + +Methods: + +- client.zeroTrust.dlp.datasets.versions.entries.create(datasetId, version, entryId, { ...params }) -> EntryCreateResponse + ### Patterns +Types: + +- PatternValidateResponse + Methods: -- client.zeroTrust.dlp.patterns.validate({ ...params }) -> OwnershipValidation | null +- client.zeroTrust.dlp.patterns.validate({ ...params }) -> PatternValidateResponse ### PayloadLogs @@ -4632,6 +5214,40 @@ Methods: - client.zeroTrust.dlp.payloadLogs.update({ ...params }) -> PayloadLogUpdateResponse - client.zeroTrust.dlp.payloadLogs.get({ ...params }) -> PayloadLogGetResponse +### Email + +#### AccountMapping + +Types: + +- AccountMappingCreateResponse +- AccountMappingGetResponse + +Methods: + +- client.zeroTrust.dlp.email.accountMapping.create({ ...params }) -> AccountMappingCreateResponse +- client.zeroTrust.dlp.email.accountMapping.get({ ...params }) -> AccountMappingGetResponse + +#### Rules + +Types: + +- RuleCreateResponse +- RuleUpdateResponse +- RuleListResponse +- RuleDeleteResponse +- RuleBulkEditResponse +- RuleGetResponse + +Methods: + +- client.zeroTrust.dlp.email.rules.create({ ...params }) -> RuleCreateResponse +- client.zeroTrust.dlp.email.rules.update(ruleId, { ...params }) -> RuleUpdateResponse +- client.zeroTrust.dlp.email.rules.list({ ...params }) -> RuleListResponsesSinglePage +- client.zeroTrust.dlp.email.rules.delete(ruleId, { ...params }) -> RuleDeleteResponse +- client.zeroTrust.dlp.email.rules.bulkEdit({ ...params }) -> RuleBulkEditResponse +- client.zeroTrust.dlp.email.rules.get(ruleId, { ...params }) -> RuleGetResponse + ### Profiles Types: @@ -4639,12 +5255,11 @@ Types: - ContextAwareness - Profile - SkipConfiguration -- ProfileGetResponse Methods: - client.zeroTrust.dlp.profiles.list({ ...params }) -> ProfilesSinglePage -- client.zeroTrust.dlp.profiles.get(profileId, { ...params }) -> ProfileGetResponse +- client.zeroTrust.dlp.profiles.get(profileId, { ...params }) -> Profile #### Custom @@ -4657,10 +5272,10 @@ Types: Methods: -- client.zeroTrust.dlp.profiles.custom.create({ ...params }) -> CustomCreateResponse | null -- client.zeroTrust.dlp.profiles.custom.update(profileId, { ...params }) -> CustomProfile -- client.zeroTrust.dlp.profiles.custom.delete(profileId, { ...params }) -> CustomDeleteResponse -- client.zeroTrust.dlp.profiles.custom.get(profileId, { ...params }) -> CustomProfile +- client.zeroTrust.dlp.profiles.custom.create({ ...params }) -> CustomCreateResponse +- client.zeroTrust.dlp.profiles.custom.update(profileId, { ...params }) -> Profile +- client.zeroTrust.dlp.profiles.custom.delete(profileId, { ...params }) -> CustomDeleteResponse | null +- client.zeroTrust.dlp.profiles.custom.get(profileId, { ...params }) -> Profile #### Predefined @@ -4670,8 +5285,36 @@ Types: Methods: -- client.zeroTrust.dlp.profiles.predefined.update(profileId, { ...params }) -> PredefinedProfile -- client.zeroTrust.dlp.profiles.predefined.get(profileId, { ...params }) -> PredefinedProfile +- client.zeroTrust.dlp.profiles.predefined.update(profileId, { ...params }) -> Profile +- client.zeroTrust.dlp.profiles.predefined.get(profileId, { ...params }) -> Profile + +### Limits + +Types: + +- LimitListResponse + +Methods: + +- client.zeroTrust.dlp.limits.list({ ...params }) -> LimitListResponse + +### Entries + +Types: + +- EntryCreateResponse +- EntryUpdateResponse +- EntryListResponse +- EntryDeleteResponse +- EntryGetResponse + +Methods: + +- client.zeroTrust.dlp.entries.create({ ...params }) -> EntryCreateResponse +- client.zeroTrust.dlp.entries.update(entryId, { ...params }) -> EntryUpdateResponse +- client.zeroTrust.dlp.entries.list({ ...params }) -> EntryListResponsesSinglePage +- client.zeroTrust.dlp.entries.delete(entryId, { ...params }) -> EntryDeleteResponse | null +- client.zeroTrust.dlp.entries.get(entryId, { ...params }) -> EntryGetResponse ## Gateway @@ -4695,6 +5338,7 @@ Methods: - client.zeroTrust.gateway.auditSSHSettings.update({ ...params }) -> GatewaySettings - client.zeroTrust.gateway.auditSSHSettings.get({ ...params }) -> GatewaySettings +- client.zeroTrust.gateway.auditSSHSettings.rotateSeed({ ...params }) -> GatewaySettings ### Categories @@ -4720,27 +5364,33 @@ Methods: Types: -- ActivityLogSettings -- AntiVirusSettings -- BlockPageSettings -- BodyScanningSettings -- BrowserIsolationSettings -- CustomCertificateSettings -- ExtendedEmailMatching -- FipsSettings -- GatewayConfigurationSettings -- NotificationSettings -- ProtocolDetection -- TLSSettings -- ConfigurationUpdateResponse -- ConfigurationEditResponse -- ConfigurationGetResponse +- ActivityLogSettings +- AntiVirusSettings +- BlockPageSettings +- BodyScanningSettings +- BrowserIsolationSettings +- CustomCertificateSettings +- ExtendedEmailMatching +- FipsSettings +- GatewayConfigurationSettings +- NotificationSettings +- ProtocolDetection +- TLSSettings +- ConfigurationUpdateResponse +- ConfigurationEditResponse +- ConfigurationGetResponse + +Methods: + +- client.zeroTrust.gateway.configurations.update({ ...params }) -> ConfigurationUpdateResponse +- client.zeroTrust.gateway.configurations.edit({ ...params }) -> ConfigurationEditResponse +- client.zeroTrust.gateway.configurations.get({ ...params }) -> ConfigurationGetResponse + +#### CustomCertificate Methods: -- client.zeroTrust.gateway.configurations.update({ ...params }) -> ConfigurationUpdateResponse -- client.zeroTrust.gateway.configurations.edit({ ...params }) -> ConfigurationEditResponse -- client.zeroTrust.gateway.configurations.get({ ...params }) -> ConfigurationGetResponse +- client.zeroTrust.gateway.configurations.customCertificate.get({ ...params }) -> CustomCertificateSettings ### Lists @@ -4774,6 +5424,13 @@ Methods: Types: +- DOHEndpoint +- DOTEndpoint +- Endpoint +- IPNetwork +- IPV4Endpoint +- IPV6Endpoint +- IPV6Network - Location - LocationDeleteResponse @@ -4811,7 +5468,7 @@ Methods: - client.zeroTrust.gateway.proxyEndpoints.list({ ...params }) -> ProxyEndpoint - client.zeroTrust.gateway.proxyEndpoints.delete(proxyEndpointId, { ...params }) -> ProxyEndpointDeleteResponse - client.zeroTrust.gateway.proxyEndpoints.edit(proxyEndpointId, { ...params }) -> ProxyEndpoint -- client.zeroTrust.gateway.proxyEndpoints.get(proxyEndpointId, { ...params }) -> ProxyEndpointGetResponse | null +- client.zeroTrust.gateway.proxyEndpoints.get(proxyEndpointId, { ...params }) -> ProxyEndpointGetResponse ### Rules @@ -4832,6 +5489,7 @@ Methods: - client.zeroTrust.gateway.rules.list({ ...params }) -> GatewayRulesSinglePage - client.zeroTrust.gateway.rules.delete(ruleId, { ...params }) -> RuleDeleteResponse - client.zeroTrust.gateway.rules.get(ruleId, { ...params }) -> GatewayRule +- client.zeroTrust.gateway.rules.resetExpiration(ruleId, { ...params }) -> GatewayRule ### Certificates @@ -4840,6 +5498,8 @@ Types: - CertificateCreateResponse - CertificateListResponse - CertificateDeleteResponse +- CertificateActivateResponse +- CertificateDeactivateResponse - CertificateGetResponse Methods: @@ -4847,6 +5507,8 @@ Methods: - client.zeroTrust.gateway.certificates.create({ ...params }) -> CertificateCreateResponse - client.zeroTrust.gateway.certificates.list({ ...params }) -> CertificateListResponsesSinglePage - client.zeroTrust.gateway.certificates.delete(certificateId, { ...params }) -> CertificateDeleteResponse +- client.zeroTrust.gateway.certificates.activate(certificateId, { ...params }) -> CertificateActivateResponse +- client.zeroTrust.gateway.certificates.deactivate(certificateId, { ...params }) -> CertificateDeactivateResponse - client.zeroTrust.gateway.certificates.get(certificateId, { ...params }) -> CertificateGetResponse ## Networks @@ -4865,6 +5527,7 @@ Methods: - client.zeroTrust.networks.routes.list({ ...params }) -> TeamnetsV4PagePaginationArray - client.zeroTrust.networks.routes.delete(routeId, { ...params }) -> Route - client.zeroTrust.networks.routes.edit(routeId, { ...params }) -> Route +- client.zeroTrust.networks.routes.get(routeId, { ...params }) -> Route #### IPs @@ -4885,16 +5548,14 @@ Methods: Types: - VirtualNetwork -- VirtualNetworkCreateResponse -- VirtualNetworkDeleteResponse -- VirtualNetworkEditResponse Methods: -- client.zeroTrust.networks.virtualNetworks.create({ ...params }) -> VirtualNetworkCreateResponse +- client.zeroTrust.networks.virtualNetworks.create({ ...params }) -> VirtualNetwork - client.zeroTrust.networks.virtualNetworks.list({ ...params }) -> VirtualNetworksSinglePage -- client.zeroTrust.networks.virtualNetworks.delete(virtualNetworkId, { ...params }) -> VirtualNetworkDeleteResponse -- client.zeroTrust.networks.virtualNetworks.edit(virtualNetworkId, { ...params }) -> VirtualNetworkEditResponse +- client.zeroTrust.networks.virtualNetworks.delete(virtualNetworkId, { ...params }) -> VirtualNetwork +- client.zeroTrust.networks.virtualNetworks.edit(virtualNetworkId, { ...params }) -> VirtualNetwork +- client.zeroTrust.networks.virtualNetworks.get(virtualNetworkId, { ...params }) -> VirtualNetwork ## RiskScoring @@ -4905,8 +5566,8 @@ Types: Methods: -- client.zeroTrust.riskScoring.get(accountIdentifier, userId, { ...params }) -> RiskScoringGetResponse -- client.zeroTrust.riskScoring.reset(accountIdentifier, userId) -> RiskScoringResetResponse +- client.zeroTrust.riskScoring.get(userId, { ...params }) -> RiskScoringGetResponse +- client.zeroTrust.riskScoring.reset(userId, { ...params }) -> RiskScoringResetResponse | null ### Behaviours @@ -4917,8 +5578,8 @@ Types: Methods: -- client.zeroTrust.riskScoring.behaviours.update(accountIdentifier, { ...params }) -> BehaviourUpdateResponse -- client.zeroTrust.riskScoring.behaviours.get(accountIdentifier) -> BehaviourGetResponse +- client.zeroTrust.riskScoring.behaviours.update({ ...params }) -> BehaviourUpdateResponse +- client.zeroTrust.riskScoring.behaviours.get({ ...params }) -> BehaviourGetResponse ### Summary @@ -4928,7 +5589,7 @@ Types: Methods: -- client.zeroTrust.riskScoring.summary.get(accountIdentifier, { ...params }) -> SummaryGetResponse +- client.zeroTrust.riskScoring.summary.get({ ...params }) -> SummaryGetResponse ### Integrations @@ -4945,7 +5606,7 @@ Methods: - client.zeroTrust.riskScoring.integrations.create({ ...params }) -> IntegrationCreateResponse - client.zeroTrust.riskScoring.integrations.update(integrationId, { ...params }) -> IntegrationUpdateResponse - client.zeroTrust.riskScoring.integrations.list({ ...params }) -> IntegrationListResponsesSinglePage -- client.zeroTrust.riskScoring.integrations.delete(integrationId, { ...params }) -> IntegrationDeleteResponse +- client.zeroTrust.riskScoring.integrations.delete(integrationId, { ...params }) -> IntegrationDeleteResponse | null - client.zeroTrust.riskScoring.integrations.get(integrationId, { ...params }) -> IntegrationGetResponse #### References @@ -4958,24 +5619,24 @@ Methods: - client.zeroTrust.riskScoring.integrations.references.get(referenceId, { ...params }) -> ReferenceGetResponse -# Challenges +# Turnstile ## Widgets Types: -- Widget -- WidgetDomain -- WidgetListResponse +- Widget +- WidgetDomain +- WidgetListResponse Methods: -- client.challenges.widgets.create({ ...params }) -> Widget -- client.challenges.widgets.update(sitekey, { ...params }) -> Widget -- client.challenges.widgets.list({ ...params }) -> WidgetListResponsesV4PagePaginationArray -- client.challenges.widgets.delete(sitekey, { ...params }) -> Widget -- client.challenges.widgets.get(sitekey, { ...params }) -> Widget -- client.challenges.widgets.rotateSecret(sitekey, { ...params }) -> Widget +- client.turnstile.widgets.create({ ...params }) -> Widget +- client.turnstile.widgets.update(sitekey, { ...params }) -> Widget +- client.turnstile.widgets.list({ ...params }) -> WidgetListResponsesV4PagePaginationArray +- client.turnstile.widgets.delete(sitekey, { ...params }) -> Widget +- client.turnstile.widgets.get(sitekey, { ...params }) -> Widget +- client.turnstile.widgets.rotateSecret(sitekey, { ...params }) -> Widget # Hyperdrive @@ -4992,12 +5653,12 @@ Types: Methods: -- client.hyperdrive.configs.create({ ...params }) -> Hyperdrive | null -- client.hyperdrive.configs.update(hyperdriveId, { ...params }) -> Hyperdrive | null +- client.hyperdrive.configs.create({ ...params }) -> Hyperdrive +- client.hyperdrive.configs.update(hyperdriveId, { ...params }) -> Hyperdrive - client.hyperdrive.configs.list({ ...params }) -> HyperdrivesSinglePage -- client.hyperdrive.configs.delete(hyperdriveId, { ...params }) -> ConfigDeleteResponse -- client.hyperdrive.configs.edit(hyperdriveId, { ...params }) -> Hyperdrive | null -- client.hyperdrive.configs.get(hyperdriveId, { ...params }) -> Hyperdrive | null +- client.hyperdrive.configs.delete(hyperdriveId, { ...params }) -> ConfigDeleteResponse | null +- client.hyperdrive.configs.edit(hyperdriveId, { ...params }) -> Hyperdrive +- client.hyperdrive.configs.get(hyperdriveId, { ...params }) -> Hyperdrive # RUM @@ -5023,6 +5684,7 @@ Types: - RUMRule - RuleListResponse - RuleDeleteResponse +- RuleBulkCreateResponse Methods: @@ -5030,66 +5692,129 @@ Methods: - client.rum.rules.update(rulesetId, ruleId, { ...params }) -> RUMRule - client.rum.rules.list(rulesetId, { ...params }) -> RuleListResponse - client.rum.rules.delete(rulesetId, ruleId, { ...params }) -> RuleDeleteResponse +- client.rum.rules.bulkCreate(rulesetId, { ...params }) -> RuleBulkCreateResponse + +# Vectorize + +## Indexes + +Types: + +- CreateIndex +- IndexDeleteVectorsByID +- IndexDimensionConfiguration +- IndexInsert +- IndexQuery +- IndexUpsert +- IndexDeleteResponse +- IndexDeleteByIDsResponse +- IndexGetByIDsResponse +- IndexInfoResponse +- IndexInsertResponse +- IndexQueryResponse +- IndexUpsertResponse + +Methods: -# Vectorize +- client.vectorize.indexes.create({ ...params }) -> CreateIndex | null +- client.vectorize.indexes.list({ ...params }) -> CreateIndicesSinglePage +- client.vectorize.indexes.delete(indexName, { ...params }) -> IndexDeleteResponse | null +- client.vectorize.indexes.deleteByIds(indexName, { ...params }) -> IndexDeleteByIDsResponse | null +- client.vectorize.indexes.get(indexName, { ...params }) -> CreateIndex | null +- client.vectorize.indexes.getByIds(indexName, { ...params }) -> IndexGetByIDsResponse | null +- client.vectorize.indexes.info(indexName, { ...params }) -> IndexInfoResponse | null +- client.vectorize.indexes.insert(indexName, { ...params }) -> IndexInsertResponse | null +- client.vectorize.indexes.query(indexName, { ...params }) -> IndexQueryResponse | null +- client.vectorize.indexes.upsert(indexName, { ...params }) -> IndexUpsertResponse | null -## Indexes +### MetadataIndex Types: -- CreateIndex -- IndexDeleteVectorsByID -- IndexDimensionConfiguration -- IndexInsert -- IndexQuery -- IndexUpsert -- IndexDeleteResponse -- IndexGetByIDsResponse +- MetadataIndexCreateResponse +- MetadataIndexListResponse +- MetadataIndexDeleteResponse Methods: -- client.vectorize.indexes.create({ ...params }) -> CreateIndex | null -- client.vectorize.indexes.update(indexName, { ...params }) -> CreateIndex | null -- client.vectorize.indexes.list({ ...params }) -> CreateIndicesSinglePage -- client.vectorize.indexes.delete(indexName, { ...params }) -> IndexDeleteResponse -- client.vectorize.indexes.deleteByIds(indexName, { ...params }) -> IndexDeleteVectorsByID | null -- client.vectorize.indexes.get(indexName, { ...params }) -> CreateIndex | null -- client.vectorize.indexes.getByIds(indexName, { ...params }) -> IndexGetByIDsResponse | null -- client.vectorize.indexes.insert(indexName, { ...params }) -> IndexInsert | null -- client.vectorize.indexes.query(indexName, { ...params }) -> IndexQuery | null -- client.vectorize.indexes.upsert(indexName, { ...params }) -> IndexUpsert | null +- client.vectorize.indexes.metadataIndex.create(indexName, { ...params }) -> MetadataIndexCreateResponse | null +- client.vectorize.indexes.metadataIndex.list(indexName, { ...params }) -> MetadataIndexListResponse | null +- client.vectorize.indexes.metadataIndex.delete(indexName, { ...params }) -> MetadataIndexDeleteResponse | null # URLScanner Types: -- URLScannerScanResponse +- URLScannerDomain +- URLScannerTask + +## Responses + +Types: + +- ResponseGetResponse Methods: -- client.urlScanner.scan(accountId, { ...params }) -> URLScannerScanResponse +- client.urlScanner.responses.get(responseId, { ...params }) -> string ## Scans Types: -- URLScannerDomain -- URLScannerTask - ScanCreateResponse +- ScanListResponse +- ScanBulkCreateResponse +- ScanDOMResponse - ScanGetResponse -- ScanHarResponse +- ScanHARResponse Methods: -- client.urlScanner.scans.create(accountId, { ...params }) -> ScanCreateResponse -- client.urlScanner.scans.get(accountId, scanId, { ...params }) -> ScanGetResponse -- client.urlScanner.scans.har(accountId, scanId) -> ScanHarResponse -- client.urlScanner.scans.screenshot(accountId, scanId, { ...params }) -> Response +- client.urlScanner.scans.create({ ...params }) -> ScanCreateResponse +- client.urlScanner.scans.list({ ...params }) -> ScanListResponse +- client.urlScanner.scans.bulkCreate([ ...body ]) -> ScanBulkCreateResponse +- client.urlScanner.scans.dom(scanId, { ...params }) -> string +- client.urlScanner.scans.get(scanId, { ...params }) -> ScanGetResponse +- client.urlScanner.scans.har(scanId, { ...params }) -> ScanHARResponse +- client.urlScanner.scans.screenshot(scanId, { ...params }) -> Response # Radar +## AI + +### Bots + +#### Summary + +Types: + +- SummaryUserAgentResponse + +Methods: + +- client.radar.ai.bots.summary.userAgent({ ...params }) -> SummaryUserAgentResponse + +### TimeseriesGroups + +Types: + +- TimeseriesGroupUserAgentResponse + +Methods: + +- client.radar.ai.timeseriesGroups.userAgent({ ...params }) -> TimeseriesGroupUserAgentResponse + ## Annotations +Types: + +- AnnotationListResponse + +Methods: + +- client.radar.annotations.list({ ...params }) -> AnnotationListResponse + ### Outages Types: @@ -5216,10 +5941,12 @@ Methods: Types: +- NetflowSummaryResponse - NetflowTimeseriesResponse Methods: +- client.radar.netflows.summary({ ...params }) -> NetflowSummaryResponse - client.radar.netflows.timeseries({ ...params }) -> NetflowTimeseriesResponse ### Top @@ -5689,19 +6416,6 @@ Methods: - client.radar.http.timeseries({ ...params }) -> HTTPTimeseriesResponse -### Top - -Types: - -- Browser -- TopBrowserFamiliesResponse -- TopBrowsersResponse - -Methods: - -- client.radar.http.top.browserFamilies({ ...params }) -> TopBrowserFamiliesResponse -- client.radar.http.top.browsers({ ...params }) -> TopBrowsersResponse - ### Locations Types: @@ -5934,6 +6648,18 @@ Methods: - client.radar.http.timeseriesGroups.postQuantum({ ...params }) -> TimeseriesGroupPostQuantumResponse - client.radar.http.timeseriesGroups.tlsVersion({ ...params }) -> TimeseriesGroupTLSVersionResponse +### Top + +Types: + +- TopBrowserResponse +- TopBrowserFamilyResponse + +Methods: + +- client.radar.http.top.browser({ ...params }) -> TopBrowserResponse +- client.radar.http.top.browserFamily({ ...params }) -> TopBrowserFamilyResponse + ## Quality ### IQI @@ -6102,13 +6828,12 @@ Methods: Types: - Test -- TestListResponse - TestDeleteResponse Methods: - client.speed.pages.tests.create(url, { ...params }) -> Test -- client.speed.pages.tests.list(url, { ...params }) -> TestListResponse +- client.speed.pages.tests.list(url, { ...params }) -> TestsV4PagePaginationArray - client.speed.pages.tests.delete(url, { ...params }) -> TestDeleteResponse - client.speed.pages.tests.get(url, testId, { ...params }) -> Test @@ -6139,7 +6864,7 @@ Methods: - client.hostnames.settings.tls.update(settingId, hostname, { ...params }) -> Setting - client.hostnames.settings.tls.delete(settingId, hostname, { ...params }) -> TLSDeleteResponse -- client.hostnames.settings.tls.get(settingId, { ...params }) -> TLSGetResponse | null +- client.hostnames.settings.tls.get(settingId, { ...params }) -> TLSGetResponse # Snippets @@ -6167,47 +6892,51 @@ Types: - RuleUpdateResponse - RuleListResponse +- RuleDeleteResponse Methods: - client.snippets.rules.update({ ...params }) -> RuleUpdateResponse - client.snippets.rules.list({ ...params }) -> RuleListResponsesSinglePage +- client.snippets.rules.delete({ ...params }) -> RuleDeleteResponse # Calls +## SFU + Types: -- CallsApp -- CallsAppWithSecret -- CallListResponse +- SFUCreateResponse +- SFUUpdateResponse +- SFUListResponse +- SFUDeleteResponse +- SFUGetResponse Methods: -- client.calls.create({ ...params }) -> CallsAppWithSecret -- client.calls.update(appId, { ...params }) -> CallsApp -- client.calls.list({ ...params }) -> CallListResponsesSinglePage -- client.calls.delete(appId, { ...params }) -> CallsApp -- client.calls.get(appId, { ...params }) -> CallsApp +- client.calls.sfu.create({ ...params }) -> SFUCreateResponse +- client.calls.sfu.update(appId, { ...params }) -> SFUUpdateResponse +- client.calls.sfu.list({ ...params }) -> SFUListResponsesSinglePage +- client.calls.sfu.delete(appId, { ...params }) -> SFUDeleteResponse +- client.calls.sfu.get(appId, { ...params }) -> SFUGetResponse ## TURN -### Keys - Types: -- KeyCreateResponse -- KeyUpdateResponse -- KeyListResponse -- KeyDeleteResponse -- KeyGetResponse +- TURNCreateResponse +- TURNUpdateResponse +- TURNListResponse +- TURNDeleteResponse +- TURNGetResponse Methods: -- client.calls.turn.keys.create({ ...params }) -> KeyCreateResponse -- client.calls.turn.keys.update(keyId, { ...params }) -> KeyUpdateResponse -- client.calls.turn.keys.list({ ...params }) -> KeyListResponsesSinglePage -- client.calls.turn.keys.delete(keyId, { ...params }) -> KeyDeleteResponse -- client.calls.turn.keys.get(keyId, { ...params }) -> KeyGetResponse +- client.calls.turn.create({ ...params }) -> TURNCreateResponse +- client.calls.turn.update(keyId, { ...params }) -> TURNUpdateResponse +- client.calls.turn.list({ ...params }) -> TURNListResponsesSinglePage +- client.calls.turn.delete(keyId, { ...params }) -> TURNDeleteResponse +- client.calls.turn.get(keyId, { ...params }) -> TURNGetResponse # CloudforceOne @@ -6265,31 +6994,21 @@ Methods: - client.cloudforceOne.requests.priority.get(accountIdentifier, priorityIdentifer) -> Item - client.cloudforceOne.requests.priority.quota(accountIdentifier) -> Quota -# EventNotifications - -## R2 - -### Configuration - -Types: - -- ConfigurationGetResponse - -Methods: - -- client.eventNotifications.r2.configuration.get(bucketName, { ...params }) -> ConfigurationGetResponse - -#### Queues +### Assets Types: -- QueueUpdateResponse -- QueueDeleteResponse +- AssetCreateResponse +- AssetUpdateResponse +- AssetDeleteResponse +- AssetGetResponse Methods: -- client.eventNotifications.r2.configuration.queues.update(bucketName, queueId, { ...params }) -> QueueUpdateResponse -- client.eventNotifications.r2.configuration.queues.delete(bucketName, queueId, { ...params }) -> QueueDeleteResponse +- client.cloudforceOne.requests.assets.create(accountIdentifier, requestIdentifier, { ...params }) -> AssetCreateResponse +- client.cloudforceOne.requests.assets.update(accountIdentifier, requestIdentifier, assetIdentifer, { ...params }) -> AssetUpdateResponse +- client.cloudforceOne.requests.assets.delete(accountIdentifier, requestIdentifier, assetIdentifer) -> AssetDeleteResponse +- client.cloudforceOne.requests.assets.get(accountIdentifier, requestIdentifier, assetIdentifer) -> AssetGetResponse # AIGateway @@ -6309,15 +7028,69 @@ Methods: - client.aiGateway.delete(id, { ...params }) -> AIGatewayDeleteResponse - client.aiGateway.get(id, { ...params }) -> AIGatewayGetResponse +## EvaluationTypes + +Types: + +- EvaluationTypeGetResponse + +Methods: + +- client.aiGateway.evaluationTypes.get({ ...params }) -> EvaluationTypeGetResponse + ## Logs Types: - LogListResponse +- LogDeleteResponse +- LogEditResponse +- LogGetResponse +- LogRequestResponse +- LogResponseResponse + +Methods: + +- client.aiGateway.logs.list(gatewayId, { ...params }) -> LogListResponsesV4PagePaginationArray +- client.aiGateway.logs.delete(gatewayId, { ...params }) -> LogDeleteResponse +- client.aiGateway.logs.edit(gatewayId, id, { ...params }) -> LogEditResponse +- client.aiGateway.logs.get(gatewayId, id, { ...params }) -> LogGetResponse +- client.aiGateway.logs.request(gatewayId, id, { ...params }) -> unknown +- client.aiGateway.logs.response(gatewayId, id, { ...params }) -> unknown + +## Datasets + +Types: + +- DatasetCreateResponse +- DatasetUpdateResponse +- DatasetListResponse +- DatasetDeleteResponse +- DatasetGetResponse + +Methods: + +- client.aiGateway.datasets.create(gatewayId, { ...params }) -> DatasetCreateResponse +- client.aiGateway.datasets.update(gatewayId, id, { ...params }) -> DatasetUpdateResponse +- client.aiGateway.datasets.list(gatewayId, { ...params }) -> DatasetListResponsesV4PagePaginationArray +- client.aiGateway.datasets.delete(gatewayId, id, { ...params }) -> DatasetDeleteResponse +- client.aiGateway.datasets.get(gatewayId, id, { ...params }) -> DatasetGetResponse + +## Evaluations + +Types: + +- EvaluationCreateResponse +- EvaluationListResponse +- EvaluationDeleteResponse +- EvaluationGetResponse Methods: -- client.aiGateway.logs.list(id, { ...params }) -> LogListResponsesV4PagePaginationArray +- client.aiGateway.evaluations.create(gatewayId, { ...params }) -> EvaluationCreateResponse +- client.aiGateway.evaluations.list(gatewayId, { ...params }) -> EvaluationListResponsesV4PagePaginationArray +- client.aiGateway.evaluations.delete(gatewayId, id, { ...params }) -> EvaluationDeleteResponse +- client.aiGateway.evaluations.get(gatewayId, id, { ...params }) -> EvaluationGetResponse # IAM @@ -6362,5 +7135,305 @@ Types: Methods: -- client.cloudConnector.rules.update([ ...body ]) -> RuleUpdateResponse +- client.cloudConnector.rules.update([ ...rules ]) -> RuleUpdateResponse - client.cloudConnector.rules.list({ ...params }) -> RuleListResponsesSinglePage + +# BotnetFeed + +## ASN + +Types: + +- ASNDayReportResponse +- ASNFullReportResponse + +Methods: + +- client.botnetFeed.asn.dayReport(asnId, { ...params }) -> ASNDayReportResponse +- client.botnetFeed.asn.fullReport(asnId, { ...params }) -> ASNFullReportResponse + +## Configs + +### ASN + +Types: + +- ASNDeleteResponse +- ASNGetResponse + +Methods: + +- client.botnetFeed.configs.asn.delete(asnId, { ...params }) -> ASNDeleteResponse +- client.botnetFeed.configs.asn.get({ ...params }) -> ASNGetResponse + +# SecurityTXT + +Types: + +- SecurityTXTUpdateResponse +- SecurityTXTDeleteResponse +- SecurityTXTGetResponse + +Methods: + +- client.securityTXT.update({ ...params }) -> SecurityTXTUpdateResponse +- client.securityTXT.delete({ ...params }) -> SecurityTXTDeleteResponse +- client.securityTXT.get({ ...params }) -> SecurityTXTGetResponse + +# Workflows + +Types: + +- WorkflowUpdateResponse +- WorkflowListResponse +- WorkflowGetResponse + +Methods: + +- client.workflows.update(workflowName, { ...params }) -> WorkflowUpdateResponse +- client.workflows.list({ ...params }) -> WorkflowListResponsesV4PagePaginationArray +- client.workflows.get(workflowName, { ...params }) -> WorkflowGetResponse + +## Instances + +Types: + +- InstanceCreateResponse +- InstanceListResponse +- InstanceGetResponse + +Methods: + +- client.workflows.instances.create(workflowName, { ...params }) -> InstanceCreateResponse +- client.workflows.instances.list(workflowName, { ...params }) -> InstanceListResponsesV4PagePaginationArray +- client.workflows.instances.get(workflowName, instanceId, { ...params }) -> InstanceGetResponse + +### Status + +Types: + +- StatusEditResponse + +Methods: + +- client.workflows.instances.status.edit(workflowName, instanceId, { ...params }) -> StatusEditResponse + +## Versions + +Types: + +- VersionListResponse +- VersionGetResponse + +Methods: + +- client.workflows.versions.list(workflowName, { ...params }) -> VersionListResponsesV4PagePaginationArray +- client.workflows.versions.get(workflowName, versionId, { ...params }) -> VersionGetResponse + +# ResourceSharing + +Types: + +- ResourceSharingCreateResponse +- ResourceSharingUpdateResponse +- ResourceSharingListResponse +- ResourceSharingDeleteResponse +- ResourceSharingGetResponse + +Methods: + +- client.resourceSharing.create({ ...params }) -> ResourceSharingCreateResponse +- client.resourceSharing.update(shareId, { ...params }) -> ResourceSharingUpdateResponse +- client.resourceSharing.list({ ...params }) -> ResourceSharingListResponsesV4PagePaginationArray +- client.resourceSharing.delete(shareId, { ...params }) -> ResourceSharingDeleteResponse +- client.resourceSharing.get(shareId, { ...params }) -> ResourceSharingGetResponse + +## Recipients + +Types: + +- RecipientCreateResponse +- RecipientListResponse +- RecipientDeleteResponse +- RecipientGetResponse + +Methods: + +- client.resourceSharing.recipients.create(shareId, { ...params }) -> RecipientCreateResponse +- client.resourceSharing.recipients.list(shareId, { ...params }) -> RecipientListResponsesV4PagePaginationArray +- client.resourceSharing.recipients.delete(shareId, recipientId, { ...params }) -> RecipientDeleteResponse +- client.resourceSharing.recipients.get(shareId, recipientId, { ...params }) -> RecipientGetResponse + +## Resources + +Types: + +- ResourceCreateResponse +- ResourceUpdateResponse +- ResourceListResponse +- ResourceDeleteResponse +- ResourceGetResponse + +Methods: + +- client.resourceSharing.resources.create(shareId, { ...params }) -> ResourceCreateResponse +- client.resourceSharing.resources.update(shareId, resourceId, { ...params }) -> ResourceUpdateResponse +- client.resourceSharing.resources.list(shareId, { ...params }) -> ResourceListResponsesV4PagePaginationArray +- client.resourceSharing.resources.delete(shareId, resourceId, { ...params }) -> ResourceDeleteResponse +- client.resourceSharing.resources.get(shareId, resourceId, { ...params }) -> ResourceGetResponse + +# LeakedCredentialChecks + +Types: + +- LeakedCredentialCheckCreateResponse +- LeakedCredentialCheckGetResponse + +Methods: + +- client.leakedCredentialChecks.create({ ...params }) -> LeakedCredentialCheckCreateResponse +- client.leakedCredentialChecks.get({ ...params }) -> LeakedCredentialCheckGetResponse + +## Detections + +Types: + +- DetectionCreateResponse +- DetectionUpdateResponse +- DetectionListResponse +- DetectionDeleteResponse + +Methods: + +- client.leakedCredentialChecks.detections.create({ ...params }) -> DetectionCreateResponse +- client.leakedCredentialChecks.detections.update(detectionId, { ...params }) -> DetectionUpdateResponse +- client.leakedCredentialChecks.detections.list({ ...params }) -> DetectionListResponsesSinglePage +- client.leakedCredentialChecks.detections.delete(detectionId, { ...params }) -> DetectionDeleteResponse + +# ContentScanning + +Types: + +- ContentScanningDisableResponse +- ContentScanningEnableResponse + +Methods: + +- client.contentScanning.disable({ ...params }) -> ContentScanningDisableResponse +- client.contentScanning.enable({ ...params }) -> ContentScanningEnableResponse + +## Payloads + +Types: + +- PayloadCreateResponse +- PayloadListResponse +- PayloadDeleteResponse + +Methods: + +- client.contentScanning.payloads.create([ ...body ]) -> PayloadCreateResponse | null +- client.contentScanning.payloads.list({ ...params }) -> PayloadListResponsesSinglePage +- client.contentScanning.payloads.delete(expressionId, { ...params }) -> PayloadDeleteResponse | null + +## Settings + +Types: + +- SettingGetResponse + +Methods: + +- client.contentScanning.settings.get({ ...params }) -> SettingGetResponse + +# AbuseReports + +Types: + +- AbuseReportCreateResponse + +Methods: + +- client.abuseReports.create(reportType, { ...params }) -> AbuseReportCreateResponse + +# AI + +Types: + +- AIRunResponse + +Methods: + +- client.ai.run(modelName, { ...params }) -> AIRunResponse + +## Finetunes + +Types: + +- FinetuneCreateResponse +- FinetuneListResponse + +Methods: + +- client.ai.finetunes.create({ ...params }) -> FinetuneCreateResponse +- client.ai.finetunes.list({ ...params }) -> FinetuneListResponse + +### Assets + +Types: + +- AssetCreateResponse + +Methods: + +- client.ai.finetunes.assets.create(finetuneId, { ...params }) -> AssetCreateResponse + +### Public + +Types: + +- PublicListResponse + +Methods: + +- client.ai.finetunes.public.list({ ...params }) -> PublicListResponsesSinglePage + +## Authors + +Types: + +- AuthorListResponse + +Methods: + +- client.ai.authors.list({ ...params }) -> AuthorListResponsesSinglePage + +## Tasks + +Types: + +- TaskListResponse + +Methods: + +- client.ai.tasks.list({ ...params }) -> TaskListResponsesSinglePage + +## Models + +Types: + +- ModelListResponse + +Methods: + +- client.ai.models.list({ ...params }) -> ModelListResponsesV4PagePaginationArray + +### Schema + +Types: + +- SchemaGetResponse + +Methods: + +- client.ai.models.schema.get({ ...params }) -> SchemaGetResponse diff --git a/bin/check-release-environment b/bin/check-release-environment index 624db5612a..40ffb77f52 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -19,3 +19,4 @@ if [[ lenErrors -gt 0 ]]; then fi echo "The environment is ready to push releases!" + diff --git a/bin/publish-npm b/bin/publish-npm index 4d6c9f3572..4c21181bb9 100644 --- a/bin/publish-npm +++ b/bin/publish-npm @@ -2,8 +2,24 @@ set -eux -npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN +npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" +# Build the project yarn build + +# Navigate to the dist directory cd dist -yarn publish --access public + +# Get the version from package.json +VERSION="$(node -p "require('./package.json').version")" + +# Extract the pre-release tag if it exists +if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then + # Extract the part before any dot in the pre-release identifier + TAG="${BASH_REMATCH[1]}" +else + TAG="latest" +fi + +# Publish with the appropriate tag +yarn publish --access public --tag "$TAG" diff --git a/examples/.keep b/examples/.keep deleted file mode 100644 index 0651c89c0c..0000000000 --- a/examples/.keep +++ /dev/null @@ -1,4 +0,0 @@ -File generated from our OpenAPI spec by Stainless. - -This directory can be used to store example files demonstrating usage of this SDK. -It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. diff --git a/examples/workers/ai/demo.ts b/examples/ai/demo.ts similarity index 80% rename from examples/workers/ai/demo.ts rename to examples/ai/demo.ts index c72869bc0c..1a027b2b87 100644 --- a/examples/workers/ai/demo.ts +++ b/examples/ai/demo.ts @@ -6,7 +6,7 @@ import Cloudflare from 'cloudflare'; const client = new Cloudflare(); async function main() { - const response = await client.workers.ai.run('@cf/meta/llama-2-7b-chat-int8', { + const response = await client.ai.run('@cf/meta/llama-2-7b-chat-int8', { account_id: process.env['CLOUDFLARE_ACCOUNT_ID']!, prompt: 'Tell me about Workers AI', }); diff --git a/package.json b/package.json index 1367f49898..3ccbb81843 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cloudflare", - "version": "3.5.0", + "version": "4.0.0", "description": "The official TypeScript library for the Cloudflare API", "author": "Cloudflare ", "types": "dist/index.d.ts", @@ -10,7 +10,7 @@ "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ - "*" + "**/*" ], "private": false, "scripts": { @@ -18,22 +18,19 @@ "build": "./scripts/build", "prepublishOnly": "echo 'to publish, run yarn build && (cd dist; yarn publish)' && exit 1", "format": "prettier --write --cache --cache-strategy metadata . !dist", - "prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build; fi", + "prepare": "if ./scripts/utils/check-is-in-git-install.sh; then ./scripts/build && ./scripts/utils/git-swap.sh; fi", "tsn": "ts-node -r tsconfig-paths/register", "lint": "./scripts/lint", - "fix": "eslint --fix --ext ts,js ." + "fix": "./scripts/format" }, "dependencies": { "@types/node": "^18.11.18", "@types/node-fetch": "^2.6.4", - "@types/qs": "^6.9.7", "abort-controller": "^3.0.0", "agentkeepalive": "^4.2.1", "form-data-encoder": "1.7.2", "formdata-node": "^4.3.2", - "node-fetch": "^2.6.7", - "qs": "^6.10.3", - "web-streams-polyfill": "^3.2.1" + "node-fetch": "^2.6.7" }, "devDependencies": { "@swc/core": "^1.3.102", @@ -44,10 +41,10 @@ "eslint": "^8.49.0", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-unused-imports": "^3.0.0", + "iconv-lite": "^0.6.3", "jest": "^29.4.0", "prettier": "^3.0.0", "ts-jest": "^29.1.0", - "ts-morph": "^19.0.0", "ts-node": "^10.5.0", "tsc-multi": "^1.1.0", "tsconfig-paths": "^4.0.0", diff --git a/scripts/build b/scripts/build index f3ed9ba2bd..4925d5addb 100755 --- a/scripts/build +++ b/scripts/build @@ -32,7 +32,7 @@ npm exec tsc-multi # copy over handwritten .js/.mjs/.d.ts files cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto -# we need to add exports = module.exports = Cloudflare Node to index.js; +# we need to add exports = module.exports = Cloudflare to index.js; # No way to get that from index.ts because it would cause compile errors # when building .mjs node scripts/utils/fix-index-exports.cjs @@ -50,7 +50,7 @@ node scripts/utils/postprocess-files.cjs (cd dist && node -e 'require("cloudflare")') (cd dist && node -e 'import("cloudflare")' --input-type=module) -if command -v deno &> /dev/null && [ -e ./scripts/build-deno ] +if [ -e ./scripts/build-deno ] then ./scripts/build-deno fi diff --git a/scripts/format b/scripts/format index d297e762f6..a6bb9d03ae 100755 --- a/scripts/format +++ b/scripts/format @@ -5,4 +5,4 @@ set -e cd "$(dirname "$0")/.." echo "==> Running eslint --fix" -./node_modules/.bin/eslint --fix --ext ts,js . +ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --fix --ext ts,js . diff --git a/scripts/lint b/scripts/lint index 6b0e5dc3eb..6ba75dfb55 100755 --- a/scripts/lint +++ b/scripts/lint @@ -5,4 +5,7 @@ set -e cd "$(dirname "$0")/.." echo "==> Running eslint" -./node_modules/.bin/eslint --ext ts,js . +ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js . + +echo "==> Running tsc" +./node_modules/.bin/tsc --noEmit diff --git a/scripts/mock b/scripts/mock index fe89a1d084..d2814ae6a0 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=@stoplight/prism-cli@~5.8 -- prism mock "$URL" &> .prism.log & + npm exec --package=@stainless-api/prism-cli@5.8.5 -- 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=@stoplight/prism-cli@~5.8 -- prism mock "$URL" + npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" fi diff --git a/scripts/utils/check-is-in-git-install.sh b/scripts/utils/check-is-in-git-install.sh index 36bcedc206..1354eb4329 100755 --- a/scripts/utils/check-is-in-git-install.sh +++ b/scripts/utils/check-is-in-git-install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Check if you happen to call prepare for a repository that's already in node_modules. [ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] || # The name of the containing directory that 'npm` uses, which looks like diff --git a/scripts/utils/git-swap.sh b/scripts/utils/git-swap.sh new file mode 100755 index 0000000000..79d1888eb2 --- /dev/null +++ b/scripts/utils/git-swap.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -exuo pipefail +# the package is published to NPM from ./dist +# we want the final file structure for git installs to match the npm installs, so we + +# delete everything except ./dist and ./node_modules +find . -maxdepth 1 -mindepth 1 ! -name 'dist' ! -name 'node_modules' -exec rm -rf '{}' + + +# move everything from ./dist to . +mv dist/* . + +# delete the now-empty ./dist +rmdir dist diff --git a/src/_shims/node-runtime.ts b/src/_shims/node-runtime.ts index a9c42ebeb6..ab9f2ab5c4 100644 --- a/src/_shims/node-runtime.ts +++ b/src/_shims/node-runtime.ts @@ -13,9 +13,7 @@ import { Readable } from 'node:stream'; import { type RequestOptions } from '../core'; import { MultipartBody } from './MultipartBody'; import { type Shims } from './registry'; - -// @ts-ignore (this package does not have proper export maps for this export) -import { ReadableStream } from 'web-streams-polyfill/dist/ponyfill.es2018.js'; +import { ReadableStream } from 'node:stream/web'; type FileFromPathOptions = Omit; diff --git a/src/_shims/node-types.d.ts b/src/_shims/node-types.d.ts index b31698f780..c159e5fa74 100644 --- a/src/_shims/node-types.d.ts +++ b/src/_shims/node-types.d.ts @@ -7,7 +7,7 @@ import * as fd from 'formdata-node'; export { type Agent } from 'node:http'; export { type Readable } from 'node:stream'; export { type ReadStream as FsReadStream } from 'node:fs'; -export { ReadableStream } from 'web-streams-polyfill'; +export { ReadableStream } from 'node:stream/web'; export const fetch: typeof nf.default; diff --git a/src/core.ts b/src/core.ts index 2a6ff76440..aaf763797d 100644 --- a/src/core.ts +++ b/src/core.ts @@ -84,8 +84,10 @@ export class APIPromise extends Promise { }); } - _thenUnwrap(transform: (data: T) => U): APIPromise { - return new APIPromise(this.responsePromise, async (props) => transform(await this.parseResponse(props))); + _thenUnwrap(transform: (data: T, props: APIResponseProps) => U): APIPromise { + return new APIPromise(this.responsePromise, async (props) => + transform(await this.parseResponse(props), props), + ); } /** @@ -161,7 +163,7 @@ export abstract class APIClient { maxRetries = 2, timeout = 60000, // 1 minute httpAgent, - fetch: overridenFetch, + fetch: overriddenFetch, }: { baseURL: string; maxRetries?: number | undefined; @@ -174,7 +176,7 @@ export abstract class APIClient { this.timeout = validatePositiveInteger('timeout', timeout); this.httpAgent = httpAgent; - this.fetch = overridenFetch ?? fetch; + this.fetch = overriddenFetch ?? fetch; } protected authHeaders(opts: FinalRequestOptions): Headers { @@ -274,7 +276,10 @@ export abstract class APIClient { return null; } - buildRequest(options: FinalRequestOptions): { req: RequestInit; url: string; timeout: number } { + buildRequest( + options: FinalRequestOptions, + { retryCount = 0 }: { retryCount?: number } = {}, + ): { req: RequestInit; url: string; timeout: number } { const { method, path, query, headers: headers = {} } = options; const body = @@ -306,7 +311,7 @@ export abstract class APIClient { headers[this.idempotencyHeader] = options.idempotencyKey; } - const reqHeaders = this.buildHeaders({ options, headers, contentLength }); + const reqHeaders = this.buildHeaders({ options, headers, contentLength, retryCount }); const req: RequestInit = { method, @@ -325,10 +330,12 @@ export abstract class APIClient { options, headers, contentLength, + retryCount, }: { options: FinalRequestOptions; headers: Record; contentLength: string | null | undefined; + retryCount: number; }): Record { const reqHeaders: Record = {}; if (contentLength) { @@ -344,6 +351,16 @@ export abstract class APIClient { delete reqHeaders['content-type']; } + // Don't set the retry count header if it was already set or removed through default headers or by the + // caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to + // account for the removal case. + if ( + getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined && + getHeader(headers, 'x-stainless-retry-count') === undefined + ) { + reqHeaders['x-stainless-retry-count'] = String(retryCount); + } + this.validateHeaders(reqHeaders, headers); return reqHeaders; @@ -379,7 +396,7 @@ export abstract class APIClient { error: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { + ): APIError { return APIError.generate(status, error, message, headers); } @@ -395,13 +412,14 @@ export abstract class APIClient { retriesRemaining: number | null, ): Promise { const options = await optionsInput; + const maxRetries = options.maxRetries ?? this.maxRetries; if (retriesRemaining == null) { - retriesRemaining = options.maxRetries ?? this.maxRetries; + retriesRemaining = maxRetries; } await this.prepareOptions(options); - const { req, url, timeout } = this.buildRequest(options); + const { req, url, timeout } = this.buildRequest(options, { retryCount: maxRetries - retriesRemaining }); await this.prepareRequest(req, { url, options }); @@ -504,20 +522,24 @@ export abstract class APIClient { const timeout = setTimeout(() => controller.abort(), ms); + const fetchOptions = { + signal: controller.signal as any, + ...options, + }; + if (fetchOptions.method) { + // Custom methods like 'patch' need to be uppercased + // See https://github.com/nodejs/undici/issues/2294 + fetchOptions.method = fetchOptions.method.toUpperCase(); + } + return ( - this.getRequestClient() - // use undefined this binding; fetch errors if bound to something else in browser/cloudflare - .fetch.call(undefined, url, { signal: controller.signal as any, ...options }) - .finally(() => { - clearTimeout(timeout); - }) + // use undefined this binding; fetch errors if bound to something else in browser/cloudflare + this.fetch.call(undefined, url, fetchOptions).finally(() => { + clearTimeout(timeout); + }) ); } - protected getRequestClient(): RequestClient { - return { fetch: this.fetch }; - } - private shouldRetry(response: Response): boolean { // Note this is not a standard header. const shouldRetryHeader = response.headers.get('x-should-retry'); @@ -650,9 +672,9 @@ export abstract class AbstractPage implements AsyncIterable { return await this.#client.requestAPIList(this.constructor as any, nextOptions); } - async *iterPages() { + async *iterPages(): AsyncGenerator { // eslint-disable-next-line @typescript-eslint/no-this-alias - let page: AbstractPage = this; + let page: this = this; yield page; while (page.hasNextPage()) { page = await page.getNextPage(); @@ -660,7 +682,7 @@ export abstract class AbstractPage implements AsyncIterable { } } - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { for await (const page of this.iterPages()) { for (const item of page.getPaginatedItems()) { yield item; @@ -703,7 +725,7 @@ export class PagePromise< * console.log(item) * } */ - async *[Symbol.asyncIterator]() { + async *[Symbol.asyncIterator](): AsyncGenerator { const page = await this; for await (const item of page) { yield item; @@ -958,8 +980,8 @@ export const safeJSON = (text: string) => { } }; -// https://stackoverflow.com/a/19709846 -const startsWithSchemeRegexp = new RegExp('^(?:[a-z]+:)?//', 'i'); +// https://url.spec.whatwg.org/#url-scheme-string +const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i; const isAbsoluteURL = (url: string): boolean => { return startsWithSchemeRegexp.test(url); }; @@ -978,6 +1000,11 @@ const validatePositiveInteger = (name: string, n: unknown): number => { export const castToError = (err: any): Error => { if (err instanceof Error) return err; + if (typeof err === 'object' && err !== null) { + try { + return new Error(JSON.stringify(err)); + } catch {} + } return new Error(err); }; @@ -1115,7 +1142,15 @@ export const isHeadersProtocol = (headers: any): headers is HeadersProtocol => { return typeof headers?.get === 'function'; }; -export const getRequiredHeader = (headers: HeadersLike, header: string): string => { +export const getRequiredHeader = (headers: HeadersLike | Headers, header: string): string => { + const foundHeader = getHeader(headers, header); + if (foundHeader === undefined) { + throw new Error(`Could not find ${header} header`); + } + return foundHeader; +}; + +export const getHeader = (headers: HeadersLike | Headers, header: string): string | undefined => { const lowerCasedHeader = header.toLowerCase(); if (isHeadersProtocol(headers)) { // to deal with the case where the header looks like Stainless-Event-Id @@ -1141,7 +1176,7 @@ export const getRequiredHeader = (headers: HeadersLike, header: string): string } } - throw new Error(`Could not find ${header} header`); + return undefined; }; /** diff --git a/src/error.ts b/src/error.ts index 481076817d..2c74bf0342 100644 --- a/src/error.ts +++ b/src/error.ts @@ -5,25 +5,27 @@ import * as Shared from './resources/shared'; export class CloudflareError extends Error {} -export class APIError extends CloudflareError { - readonly status: number | undefined; - readonly headers: Headers | undefined; - readonly error: Object | undefined; +export class APIError< + TStatus extends number | undefined = number | undefined, + THeaders extends Headers | undefined = Headers | undefined, + TError extends Object | undefined = Object | undefined, +> extends CloudflareError { + /** HTTP status for the response that caused the error */ + readonly status: TStatus; + /** HTTP headers for the response that caused the error */ + readonly headers: THeaders; + /** JSON body of the response that caused the error */ + readonly error: TError; readonly errors: Array; - constructor( - status: number | undefined, - error: Object | undefined, - message: string | undefined, - headers: Headers | undefined, - ) { + constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) { super(`${APIError.makeMessage(status, error, message)}`); this.status = status; this.headers = headers; + this.error = error; const data = error as Record; - this.error = data; this.errors = data?.['errors'] ?? []; } @@ -53,9 +55,9 @@ export class APIError extends CloudflareError { errorResponse: Object | undefined, message: string | undefined, headers: Headers | undefined, - ) { - if (!status) { - return new APIConnectionError({ cause: castToError(errorResponse) }); + ): APIError { + if (!status || !headers) { + return new APIConnectionError({ message, cause: castToError(errorResponse) }); } const error = errorResponse as Record; @@ -96,18 +98,14 @@ export class APIError extends CloudflareError { } } -export class APIUserAbortError extends APIError { - override readonly status: undefined = undefined; - +export class APIUserAbortError extends APIError { constructor({ message }: { message?: string } = {}) { super(undefined, undefined, message || 'Request was aborted.', undefined); } } -export class APIConnectionError extends APIError { - override readonly status: undefined = undefined; - - constructor({ message, cause }: { message?: string; cause?: Error | undefined }) { +export class APIConnectionError extends APIError { + constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) { super(undefined, undefined, message || 'Connection error.', undefined); // in some environments the 'cause' property is already declared // @ts-ignore @@ -121,32 +119,18 @@ export class APIConnectionTimeoutError extends APIConnectionError { } } -export class BadRequestError extends APIError { - override readonly status: 400 = 400; -} +export class BadRequestError extends APIError<400, Headers> {} -export class AuthenticationError extends APIError { - override readonly status: 401 = 401; -} +export class AuthenticationError extends APIError<401, Headers> {} -export class PermissionDeniedError extends APIError { - override readonly status: 403 = 403; -} +export class PermissionDeniedError extends APIError<403, Headers> {} -export class NotFoundError extends APIError { - override readonly status: 404 = 404; -} +export class NotFoundError extends APIError<404, Headers> {} -export class ConflictError extends APIError { - override readonly status: 409 = 409; -} +export class ConflictError extends APIError<409, Headers> {} -export class UnprocessableEntityError extends APIError { - override readonly status: 422 = 422; -} +export class UnprocessableEntityError extends APIError<422, Headers> {} -export class RateLimitError extends APIError { - override readonly status: 429 = 429; -} +export class RateLimitError extends APIError<429, Headers> {} -export class InternalServerError extends APIError {} +export class InternalServerError extends APIError {} diff --git a/src/index.ts b/src/index.ts index 27056ebbce..f68d33b3e4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,31 +1,128 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import * as Errors from './error'; -import * as Uploads from './uploads'; import { type Agent } from './_shims/index'; -import * as qs from 'qs'; +import * as qs from './internal/qs'; import * as Core from './core'; +import * as Errors from './error'; import * as Pagination from './pagination'; +import { + type CursorLimitPaginationParams, + CursorLimitPaginationResponse, + type CursorPaginationParams, + CursorPaginationResponse, + SinglePageResponse, + type V4PagePaginationArrayParams, + V4PagePaginationArrayResponse, + type V4PagePaginationParams, + V4PagePaginationResponse, +} from './pagination'; +import * as Uploads from './uploads'; import * as API from './resources/index'; +import { AbuseReports } from './resources/abuse-reports'; +import { AuditLogs } from './resources/audit-logs'; +import { BotManagement } from './resources/bot-management'; +import { BrandProtection } from './resources/brand-protection'; +import { ClientCertificates } from './resources/client-certificates'; +import { CustomNameservers } from './resources/custom-nameservers'; +import { DCVDelegation } from './resources/dcv-delegation'; +import { Filters } from './resources/filters'; +import { IPs } from './resources/ips'; +import { KeylessCertificates } from './resources/keyless-certificates'; +import { ManagedTransforms } from './resources/managed-transforms'; +import { Memberships } from './resources/memberships'; +import { OriginCACertificates } from './resources/origin-ca-certificates'; +import { OriginPostQuantumEncryption } from './resources/origin-post-quantum-encryption'; +import { PageRules } from './resources/page-rules'; +import { RateLimits } from './resources/rate-limits'; +import { SecurityTXT } from './resources/security-txt'; +import { URLNormalization } from './resources/url-normalization'; +import { Accounts } from './resources/accounts/accounts'; +import { ACM } from './resources/acm/acm'; +import { Addressing } from './resources/addressing/addressing'; +import { AIGateway } from './resources/ai-gateway/ai-gateway'; +import { AI } from './resources/ai/ai'; +import { Alerting } from './resources/alerting/alerting'; +import { APIGateway } from './resources/api-gateway/api-gateway'; +import { Argo } from './resources/argo/argo'; +import { Billing } from './resources/billing/billing'; +import { BotnetFeed } from './resources/botnet-feed/botnet-feed'; +import { Cache } from './resources/cache/cache'; +import { Calls } from './resources/calls/calls'; +import { CertificateAuthorities } from './resources/certificate-authorities/certificate-authorities'; +import { CloudConnector } from './resources/cloud-connector/cloud-connector'; +import { CloudforceOne } from './resources/cloudforce-one/cloudforce-one'; +import { ContentScanning } from './resources/content-scanning/content-scanning'; +import { CustomCertificates } from './resources/custom-certificates/custom-certificates'; +import { CustomHostnames } from './resources/custom-hostnames/custom-hostnames'; +import { D1Resource } from './resources/d1/d1'; +import { Diagnostics } from './resources/diagnostics/diagnostics'; +import { DNSFirewall } from './resources/dns-firewall/dns-firewall'; +import { DNS } from './resources/dns/dns'; +import { DurableObjects } from './resources/durable-objects/durable-objects'; +import { EmailRouting } from './resources/email-routing/email-routing'; +import { EmailSecurity } from './resources/email-security/email-security'; +import { Firewall } from './resources/firewall/firewall'; +import { Healthchecks } from './resources/healthchecks/healthchecks'; +import { Hostnames } from './resources/hostnames/hostnames'; +import { HyperdriveResource } from './resources/hyperdrive/hyperdrive'; +import { IAM } from './resources/iam/iam'; +import { Images } from './resources/images/images'; +import { Intel } from './resources/intel/intel'; +import { KV } from './resources/kv/kv'; +import { LeakedCredentialChecks } from './resources/leaked-credential-checks/leaked-credential-checks'; +import { LoadBalancers } from './resources/load-balancers/load-balancers'; +import { Logpush } from './resources/logpush/logpush'; +import { Logs } from './resources/logs/logs'; +import { MagicNetworkMonitoring } from './resources/magic-network-monitoring/magic-network-monitoring'; +import { MagicTransit } from './resources/magic-transit/magic-transit'; +import { MTLSCertificates } from './resources/mtls-certificates/mtls-certificates'; +import { OriginTLSClientAuth } from './resources/origin-tls-client-auth/origin-tls-client-auth'; +import { PageShield } from './resources/page-shield/page-shield'; +import { Pages } from './resources/pages/pages'; +import { Queues } from './resources/queues/queues'; +import { R2 } from './resources/r2/r2'; +import { Radar } from './resources/radar/radar'; +import { Registrar } from './resources/registrar/registrar'; +import { RequestTracers } from './resources/request-tracers/request-tracers'; +import { ResourceSharing } from './resources/resource-sharing/resource-sharing'; +import { Rules } from './resources/rules/rules'; +import { Rulesets } from './resources/rulesets/rulesets'; +import { RUM } from './resources/rum/rum'; +import { Snippets } from './resources/snippets/snippets'; +import { Spectrum } from './resources/spectrum/spectrum'; +import { Speed } from './resources/speed/speed'; +import { SSL } from './resources/ssl/ssl'; +import { Stream } from './resources/stream/stream'; +import { Turnstile } from './resources/turnstile/turnstile'; +import { URLScanner } from './resources/url-scanner/url-scanner'; +import { User } from './resources/user/user'; +import { Vectorize } from './resources/vectorize/vectorize'; +import { WaitingRooms } from './resources/waiting-rooms/waiting-rooms'; +import { Web3 } from './resources/web3/web3'; +import { WorkersForPlatforms } from './resources/workers-for-platforms/workers-for-platforms'; +import { Workers } from './resources/workers/workers'; +import { Workflows } from './resources/workflows/workflows'; +import { ZeroTrust } from './resources/zero-trust/zero-trust'; +import { Zones } from './resources/zones/zones'; export interface ClientOptions { /** - * Defaults to process.env['CLOUDFLARE_API_TOKEN']. + * The preferred authorization scheme for interacting with the Cloudflare API. [Create a token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/). */ apiToken?: string | null | undefined; /** - * Defaults to process.env['CLOUDFLARE_API_KEY']. + * The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys. */ apiKey?: string | null | undefined; /** - * Defaults to process.env['CLOUDFLARE_EMAIL']. + * The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key. */ apiEmail?: string | null | undefined; /** - * Defaults to process.env['CLOUDFLARE_API_USER_SERVICE_KEY']. + * Used when interacting with the Origin CA certificates API. [View/change your key](https://developers.cloudflare.com/fundamentals/api/get-started/ca-keys/#viewchange-your-origin-ca-keys). */ userServiceKey?: string | null | undefined; @@ -154,18 +251,16 @@ export class Cloudflare extends Core.APIClient { loadBalancers: API.LoadBalancers = new API.LoadBalancers(this); cache: API.Cache = new API.Cache(this); ssl: API.SSL = new API.SSL(this); - subscriptions: API.Subscriptions = new API.Subscriptions(this); acm: API.ACM = new API.ACM(this); argo: API.Argo = new API.Argo(this); - plans: API.Plans = new API.Plans(this); - ratePlans: API.RatePlans = new API.RatePlans(this); certificateAuthorities: API.CertificateAuthorities = new API.CertificateAuthorities(this); clientCertificates: API.ClientCertificates = new API.ClientCertificates(this); customCertificates: API.CustomCertificates = new API.CustomCertificates(this); customHostnames: API.CustomHostnames = new API.CustomHostnames(this); customNameservers: API.CustomNameservers = new API.CustomNameservers(this); + dnsFirewall: API.DNSFirewall = new API.DNSFirewall(this); dns: API.DNS = new API.DNS(this); - dnssec: API.DNSSECResource = new API.DNSSECResource(this); + emailSecurity: API.EmailSecurity = new API.EmailSecurity(this); emailRouting: API.EmailRouting = new API.EmailRouting(this); filters: API.Filters = new API.Filters(this); firewall: API.Firewall = new API.Firewall(this); @@ -174,9 +269,8 @@ export class Cloudflare extends Core.APIClient { logpush: API.Logpush = new API.Logpush(this); logs: API.Logs = new API.Logs(this); originTLSClientAuth: API.OriginTLSClientAuth = new API.OriginTLSClientAuth(this); - pagerules: API.Pagerules = new API.Pagerules(this); + pageRules: API.PageRules = new API.PageRules(this); rateLimits: API.RateLimits = new API.RateLimits(this); - secondaryDNS: API.SecondaryDNS = new API.SecondaryDNS(this); waitingRooms: API.WaitingRooms = new API.WaitingRooms(this); web3: API.Web3 = new API.Web3(this); workers: API.Workers = new API.Workers(this); @@ -184,7 +278,7 @@ export class Cloudflare extends Core.APIClient { durableObjects: API.DurableObjects = new API.DurableObjects(this); queues: API.Queues = new API.Queues(this); apiGateway: API.APIGateway = new API.APIGateway(this); - managedHeaders: API.ManagedHeaders = new API.ManagedHeaders(this); + managedTransforms: API.ManagedTransforms = new API.ManagedTransforms(this); pageShield: API.PageShield = new API.PageShield(this); rulesets: API.Rulesets = new API.Rulesets(this); urlNormalization: API.URLNormalization = new API.URLNormalization(this); @@ -200,19 +294,16 @@ export class Cloudflare extends Core.APIClient { magicNetworkMonitoring: API.MagicNetworkMonitoring = new API.MagicNetworkMonitoring(this); mtlsCertificates: API.MTLSCertificates = new API.MTLSCertificates(this); pages: API.Pages = new API.Pages(this); - pcaps: API.PCAPs = new API.PCAPs(this); registrar: API.Registrar = new API.Registrar(this); requestTracers: API.RequestTracers = new API.RequestTracers(this); rules: API.Rules = new API.Rules(this); - storage: API.Storage = new API.Storage(this); stream: API.Stream = new API.Stream(this); alerting: API.Alerting = new API.Alerting(this); d1: API.D1Resource = new API.D1Resource(this); r2: API.R2 = new API.R2(this); - warpConnector: API.WARPConnector = new API.WARPConnector(this); workersForPlatforms: API.WorkersForPlatforms = new API.WorkersForPlatforms(this); zeroTrust: API.ZeroTrust = new API.ZeroTrust(this); - challenges: API.Challenges = new API.Challenges(this); + turnstile: API.Turnstile = new API.Turnstile(this); hyperdrive: API.HyperdriveResource = new API.HyperdriveResource(this); rum: API.RUM = new API.RUM(this); vectorize: API.Vectorize = new API.Vectorize(this); @@ -226,10 +317,17 @@ export class Cloudflare extends Core.APIClient { snippets: API.Snippets = new API.Snippets(this); calls: API.Calls = new API.Calls(this); cloudforceOne: API.CloudforceOne = new API.CloudforceOne(this); - eventNotifications: API.EventNotifications = new API.EventNotifications(this); aiGateway: API.AIGateway = new API.AIGateway(this); iam: API.IAM = new API.IAM(this); cloudConnector: API.CloudConnector = new API.CloudConnector(this); + botnetFeed: API.BotnetFeed = new API.BotnetFeed(this); + securityTXT: API.SecurityTXT = new API.SecurityTXT(this); + workflows: API.Workflows = new API.Workflows(this); + resourceSharing: API.ResourceSharing = new API.ResourceSharing(this); + leakedCredentialChecks: API.LeakedCredentialChecks = new API.LeakedCredentialChecks(this); + contentScanning: API.ContentScanning = new API.ContentScanning(this); + abuseReports: API.AbuseReports = new API.AbuseReports(this); + ai: API.AI = new API.AI(this); protected override defaultQuery(): Core.DefaultQuery | undefined { return this._options.defaultQuery; @@ -336,6 +434,7 @@ export class Cloudflare extends Core.APIClient { } static Cloudflare = this; + static DEFAULT_TIMEOUT = 60000; // 1 minute static CloudflareError = Errors.CloudflareError; static APIError = Errors.APIError; @@ -355,233 +454,335 @@ export class Cloudflare extends Core.APIClient { static fileFromPath = Uploads.fileFromPath; } -export const { - CloudflareError, - APIError, - APIConnectionError, - APIConnectionTimeoutError, - APIUserAbortError, - NotFoundError, - ConflictError, - RateLimitError, - BadRequestError, - AuthenticationError, - InternalServerError, - PermissionDeniedError, - UnprocessableEntityError, -} = Errors; - -export import toFile = Uploads.toFile; -export import fileFromPath = Uploads.fileFromPath; - -export namespace Cloudflare { - export import RequestOptions = Core.RequestOptions; +Cloudflare.Accounts = Accounts; +Cloudflare.OriginCACertificates = OriginCACertificates; +Cloudflare.IPs = IPs; +Cloudflare.Memberships = Memberships; +Cloudflare.User = User; +Cloudflare.Zones = Zones; +Cloudflare.LoadBalancers = LoadBalancers; +Cloudflare.Cache = Cache; +Cloudflare.SSL = SSL; +Cloudflare.ACM = ACM; +Cloudflare.Argo = Argo; +Cloudflare.CertificateAuthorities = CertificateAuthorities; +Cloudflare.ClientCertificates = ClientCertificates; +Cloudflare.CustomCertificates = CustomCertificates; +Cloudflare.CustomHostnames = CustomHostnames; +Cloudflare.CustomNameservers = CustomNameservers; +Cloudflare.DNSFirewall = DNSFirewall; +Cloudflare.DNS = DNS; +Cloudflare.EmailSecurity = EmailSecurity; +Cloudflare.EmailRouting = EmailRouting; +Cloudflare.Filters = Filters; +Cloudflare.Firewall = Firewall; +Cloudflare.Healthchecks = Healthchecks; +Cloudflare.KeylessCertificates = KeylessCertificates; +Cloudflare.Logpush = Logpush; +Cloudflare.Logs = Logs; +Cloudflare.OriginTLSClientAuth = OriginTLSClientAuth; +Cloudflare.PageRules = PageRules; +Cloudflare.RateLimits = RateLimits; +Cloudflare.WaitingRooms = WaitingRooms; +Cloudflare.Web3 = Web3; +Cloudflare.Workers = Workers; +Cloudflare.KV = KV; +Cloudflare.DurableObjects = DurableObjects; +Cloudflare.Queues = Queues; +Cloudflare.APIGateway = APIGateway; +Cloudflare.ManagedTransforms = ManagedTransforms; +Cloudflare.PageShield = PageShield; +Cloudflare.Rulesets = Rulesets; +Cloudflare.URLNormalization = URLNormalization; +Cloudflare.Spectrum = Spectrum; +Cloudflare.Addressing = Addressing; +Cloudflare.AuditLogs = AuditLogs; +Cloudflare.Billing = Billing; +Cloudflare.BrandProtection = BrandProtection; +Cloudflare.Diagnostics = Diagnostics; +Cloudflare.Images = Images; +Cloudflare.Intel = Intel; +Cloudflare.MagicTransit = MagicTransit; +Cloudflare.MagicNetworkMonitoring = MagicNetworkMonitoring; +Cloudflare.MTLSCertificates = MTLSCertificates; +Cloudflare.Pages = Pages; +Cloudflare.Registrar = Registrar; +Cloudflare.RequestTracers = RequestTracers; +Cloudflare.Rules = Rules; +Cloudflare.Stream = Stream; +Cloudflare.Alerting = Alerting; +Cloudflare.D1Resource = D1Resource; +Cloudflare.R2 = R2; +Cloudflare.WorkersForPlatforms = WorkersForPlatforms; +Cloudflare.ZeroTrust = ZeroTrust; +Cloudflare.Turnstile = Turnstile; +Cloudflare.HyperdriveResource = HyperdriveResource; +Cloudflare.RUM = RUM; +Cloudflare.Vectorize = Vectorize; +Cloudflare.URLScanner = URLScanner; +Cloudflare.Radar = Radar; +Cloudflare.BotManagement = BotManagement; +Cloudflare.OriginPostQuantumEncryption = OriginPostQuantumEncryption; +Cloudflare.Speed = Speed; +Cloudflare.DCVDelegation = DCVDelegation; +Cloudflare.Hostnames = Hostnames; +Cloudflare.Snippets = Snippets; +Cloudflare.Calls = Calls; +Cloudflare.CloudforceOne = CloudforceOne; +Cloudflare.AIGateway = AIGateway; +Cloudflare.IAM = IAM; +Cloudflare.CloudConnector = CloudConnector; +Cloudflare.BotnetFeed = BotnetFeed; +Cloudflare.SecurityTXT = SecurityTXT; +Cloudflare.Workflows = Workflows; +Cloudflare.ResourceSharing = ResourceSharing; +Cloudflare.LeakedCredentialChecks = LeakedCredentialChecks; +Cloudflare.ContentScanning = ContentScanning; +Cloudflare.AbuseReports = AbuseReports; +Cloudflare.AI = AI; +export declare namespace Cloudflare { + export type RequestOptions = Core.RequestOptions; export import V4PagePagination = Pagination.V4PagePagination; - export import V4PagePaginationParams = Pagination.V4PagePaginationParams; - export import V4PagePaginationResponse = Pagination.V4PagePaginationResponse; + export { + type V4PagePaginationParams as V4PagePaginationParams, + type V4PagePaginationResponse as V4PagePaginationResponse, + }; export import V4PagePaginationArray = Pagination.V4PagePaginationArray; - export import V4PagePaginationArrayParams = Pagination.V4PagePaginationArrayParams; - export import V4PagePaginationArrayResponse = Pagination.V4PagePaginationArrayResponse; + export { + type V4PagePaginationArrayParams as V4PagePaginationArrayParams, + type V4PagePaginationArrayResponse as V4PagePaginationArrayResponse, + }; export import CursorPagination = Pagination.CursorPagination; - export import CursorPaginationParams = Pagination.CursorPaginationParams; - export import CursorPaginationResponse = Pagination.CursorPaginationResponse; + export { + type CursorPaginationParams as CursorPaginationParams, + type CursorPaginationResponse as CursorPaginationResponse, + }; export import CursorLimitPagination = Pagination.CursorLimitPagination; - export import CursorLimitPaginationParams = Pagination.CursorLimitPaginationParams; - export import CursorLimitPaginationResponse = Pagination.CursorLimitPaginationResponse; + export { + type CursorLimitPaginationParams as CursorLimitPaginationParams, + type CursorLimitPaginationResponse as CursorLimitPaginationResponse, + }; export import SinglePage = Pagination.SinglePage; - export import SinglePageResponse = Pagination.SinglePageResponse; + export { type SinglePageResponse as SinglePageResponse }; + + export { Accounts as Accounts }; - export import Accounts = API.Accounts; + export { OriginCACertificates as OriginCACertificates }; - export import OriginCACertificates = API.OriginCACertificates; + export { IPs as IPs }; - export import IPs = API.IPs; + export { Memberships as Memberships }; - export import Memberships = API.Memberships; + export { User as User }; - export import User = API.User; + export { Zones as Zones }; - export import Zones = API.Zones; + export { LoadBalancers as LoadBalancers }; - export import LoadBalancers = API.LoadBalancers; + export { Cache as Cache }; - export import Cache = API.Cache; + export { SSL as SSL }; - export import SSL = API.SSL; + export { ACM as ACM }; - export import Subscriptions = API.Subscriptions; + export { Argo as Argo }; - export import ACM = API.ACM; + export { CertificateAuthorities as CertificateAuthorities }; - export import Argo = API.Argo; + export { ClientCertificates as ClientCertificates }; - export import Plans = API.Plans; + export { CustomCertificates as CustomCertificates }; - export import RatePlans = API.RatePlans; + export { CustomHostnames as CustomHostnames }; - export import CertificateAuthorities = API.CertificateAuthorities; + export { CustomNameservers as CustomNameservers }; - export import ClientCertificates = API.ClientCertificates; + export { DNSFirewall as DNSFirewall }; - export import CustomCertificates = API.CustomCertificates; + export { DNS as DNS }; - export import CustomHostnames = API.CustomHostnames; + export { EmailSecurity as EmailSecurity }; - export import CustomNameservers = API.CustomNameservers; + export { EmailRouting as EmailRouting }; - export import DNS = API.DNS; + export { Filters as Filters }; - export import DNSSECResource = API.DNSSECResource; + export { Firewall as Firewall }; - export import EmailRouting = API.EmailRouting; + export { Healthchecks as Healthchecks }; - export import Filters = API.Filters; + export { KeylessCertificates as KeylessCertificates }; - export import Firewall = API.Firewall; + export { Logpush as Logpush }; - export import Healthchecks = API.Healthchecks; + export { Logs as Logs }; - export import KeylessCertificates = API.KeylessCertificates; + export { OriginTLSClientAuth as OriginTLSClientAuth }; - export import Logpush = API.Logpush; + export { PageRules as PageRules }; - export import Logs = API.Logs; + export { RateLimits as RateLimits }; - export import OriginTLSClientAuth = API.OriginTLSClientAuth; + export { WaitingRooms as WaitingRooms }; - export import Pagerules = API.Pagerules; + export { Web3 as Web3 }; - export import RateLimits = API.RateLimits; + export { Workers as Workers }; - export import SecondaryDNS = API.SecondaryDNS; + export { KV as KV }; - export import WaitingRooms = API.WaitingRooms; + export { DurableObjects as DurableObjects }; - export import Web3 = API.Web3; + export { Queues as Queues }; - export import Workers = API.Workers; + export { APIGateway as APIGateway }; - export import KV = API.KV; + export { ManagedTransforms as ManagedTransforms }; - export import DurableObjects = API.DurableObjects; + export { PageShield as PageShield }; - export import Queues = API.Queues; + export { Rulesets as Rulesets }; - export import APIGateway = API.APIGateway; + export { URLNormalization as URLNormalization }; - export import ManagedHeaders = API.ManagedHeaders; + export { Spectrum as Spectrum }; - export import PageShield = API.PageShield; + export { Addressing as Addressing }; - export import Rulesets = API.Rulesets; + export { AuditLogs as AuditLogs }; - export import URLNormalization = API.URLNormalization; + export { Billing as Billing }; - export import Spectrum = API.Spectrum; + export { BrandProtection as BrandProtection }; - export import Addressing = API.Addressing; + export { Diagnostics as Diagnostics }; - export import AuditLogs = API.AuditLogs; + export { Images as Images }; - export import Billing = API.Billing; + export { Intel as Intel }; - export import BrandProtection = API.BrandProtection; + export { MagicTransit as MagicTransit }; - export import Diagnostics = API.Diagnostics; + export { MagicNetworkMonitoring as MagicNetworkMonitoring }; - export import Images = API.Images; + export { MTLSCertificates as MTLSCertificates }; - export import Intel = API.Intel; + export { Pages as Pages }; - export import MagicTransit = API.MagicTransit; + export { Registrar as Registrar }; - export import MagicNetworkMonitoring = API.MagicNetworkMonitoring; + export { RequestTracers as RequestTracers }; - export import MTLSCertificates = API.MTLSCertificates; + export { Rules as Rules }; - export import Pages = API.Pages; + export { Stream as Stream }; - export import PCAPs = API.PCAPs; + export { Alerting as Alerting }; - export import Registrar = API.Registrar; + export { D1Resource as D1Resource }; - export import RequestTracers = API.RequestTracers; + export { R2 as R2 }; - export import Rules = API.Rules; + export { WorkersForPlatforms as WorkersForPlatforms }; - export import Storage = API.Storage; + export { ZeroTrust as ZeroTrust }; - export import Stream = API.Stream; + export { Turnstile as Turnstile }; - export import Alerting = API.Alerting; + export { HyperdriveResource as HyperdriveResource }; - export import D1Resource = API.D1Resource; + export { RUM as RUM }; - export import R2 = API.R2; + export { Vectorize as Vectorize }; - export import WARPConnector = API.WARPConnector; + export { URLScanner as URLScanner }; - export import WorkersForPlatforms = API.WorkersForPlatforms; + export { Radar as Radar }; - export import ZeroTrust = API.ZeroTrust; + export { BotManagement as BotManagement }; - export import Challenges = API.Challenges; + export { OriginPostQuantumEncryption as OriginPostQuantumEncryption }; - export import HyperdriveResource = API.HyperdriveResource; + export { Speed as Speed }; - export import RUM = API.RUM; + export { DCVDelegation as DCVDelegation }; - export import Vectorize = API.Vectorize; + export { Hostnames as Hostnames }; - export import URLScanner = API.URLScanner; + export { Snippets as Snippets }; - export import Radar = API.Radar; + export { Calls as Calls }; - export import BotManagement = API.BotManagement; + export { CloudforceOne as CloudforceOne }; - export import OriginPostQuantumEncryption = API.OriginPostQuantumEncryption; + export { AIGateway as AIGateway }; - export import Speed = API.Speed; + export { IAM as IAM }; - export import DCVDelegation = API.DCVDelegation; + export { CloudConnector as CloudConnector }; - export import Hostnames = API.Hostnames; + export { BotnetFeed as BotnetFeed }; - export import Snippets = API.Snippets; + export { SecurityTXT as SecurityTXT }; - export import Calls = API.Calls; + export { Workflows as Workflows }; - export import CloudforceOne = API.CloudforceOne; + export { ResourceSharing as ResourceSharing }; - export import EventNotifications = API.EventNotifications; + export { LeakedCredentialChecks as LeakedCredentialChecks }; - export import AIGateway = API.AIGateway; + export { ContentScanning as ContentScanning }; - export import IAM = API.IAM; + export { AbuseReports as AbuseReports }; - export import CloudConnector = API.CloudConnector; + export { AI as AI }; - export import ASN = API.ASN; - export import AuditLog = API.AuditLog; - export import CertificateCA = API.CertificateCA; - export import CertificateRequestType = API.CertificateRequestType; - export import CloudflareTunnel = API.CloudflareTunnel; - export import ErrorData = API.ErrorData; - export import Identifier = API.Identifier; - export import LoadBalancerPreview = API.LoadBalancerPreview; - export import Member = API.Member; - export import PaginationInfo = API.PaginationInfo; - export import Permission = API.Permission; - export import PermissionGrant = API.PermissionGrant; - export import ResponseInfo = API.ResponseInfo; - export import Result = API.Result; - export import Role = API.Role; - export import SortDirection = API.SortDirection; + export type ASN = API.ASN; + export type AuditLog = API.AuditLog; + export type CertificateCA = API.CertificateCA; + export type CertificateRequestType = API.CertificateRequestType; + export type CloudflareTunnel = API.CloudflareTunnel; + export type ErrorData = API.ErrorData; + export type Identifier = API.Identifier; + export type LoadBalancerPreview = API.LoadBalancerPreview; + export type Member = API.Member; + export type PaginationInfo = API.PaginationInfo; + export type Permission = API.Permission; + export type PermissionGrant = API.PermissionGrant; + export type RatePlan = API.RatePlan; + export type ResponseInfo = API.ResponseInfo; + export type Result = API.Result; + export type Role = API.Role; + export type SortDirection = API.SortDirection; + export type Subscription = API.Subscription; + export type SubscriptionComponent = API.SubscriptionComponent; + export type SubscriptionZone = API.SubscriptionZone; + export type Token = API.Token; + export type TokenConditionCIDRList = API.TokenConditionCIDRList; + export type TokenPolicy = API.TokenPolicy; + export type TokenValue = API.TokenValue; } +export { toFile, fileFromPath } from './uploads'; +export { + CloudflareError, + APIError, + APIConnectionError, + APIConnectionTimeoutError, + APIUserAbortError, + NotFoundError, + ConflictError, + RateLimitError, + BadRequestError, + AuthenticationError, + InternalServerError, + PermissionDeniedError, + UnprocessableEntityError, +} from './error'; + export default Cloudflare; diff --git a/src/internal/qs/LICENSE.md b/src/internal/qs/LICENSE.md new file mode 100644 index 0000000000..3fda1573bb --- /dev/null +++ b/src/internal/qs/LICENSE.md @@ -0,0 +1,13 @@ +BSD 3-Clause License + +Copyright (c) 2014, Nathan LaFreniere and other [contributors](https://github.com/puruvj/neoqs/graphs/contributors) All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/internal/qs/README.md b/src/internal/qs/README.md new file mode 100644 index 0000000000..67ae04ecd5 --- /dev/null +++ b/src/internal/qs/README.md @@ -0,0 +1,3 @@ +# qs + +This is a vendored version of [neoqs](https://github.com/PuruVJ/neoqs) which is a TypeScript rewrite of [qs](https://github.com/ljharb/qs), a query string library. diff --git a/src/internal/qs/formats.ts b/src/internal/qs/formats.ts new file mode 100644 index 0000000000..1cf9e2cde5 --- /dev/null +++ b/src/internal/qs/formats.ts @@ -0,0 +1,9 @@ +import type { Format } from './types'; + +export const default_format: Format = 'RFC3986'; +export const formatters: Record string> = { + RFC1738: (v: PropertyKey) => String(v).replace(/%20/g, '+'), + RFC3986: (v: PropertyKey) => String(v), +}; +export const RFC1738 = 'RFC1738'; +export const RFC3986 = 'RFC3986'; diff --git a/src/internal/qs/index.ts b/src/internal/qs/index.ts new file mode 100644 index 0000000000..c3a3620d01 --- /dev/null +++ b/src/internal/qs/index.ts @@ -0,0 +1,13 @@ +import { default_format, formatters, RFC1738, RFC3986 } from './formats'; + +const formats = { + formatters, + RFC1738, + RFC3986, + default: default_format, +}; + +export { stringify } from './stringify'; +export { formats }; + +export type { DefaultDecoder, DefaultEncoder, Format, ParseOptions, StringifyOptions } from './types'; diff --git a/src/internal/qs/stringify.ts b/src/internal/qs/stringify.ts new file mode 100644 index 0000000000..67497561a4 --- /dev/null +++ b/src/internal/qs/stringify.ts @@ -0,0 +1,388 @@ +import { encode, is_buffer, maybe_map } from './utils'; +import { default_format, formatters } from './formats'; +import type { NonNullableProperties, StringifyOptions } from './types'; + +const has = Object.prototype.hasOwnProperty; + +const array_prefix_generators = { + brackets(prefix: PropertyKey) { + return String(prefix) + '[]'; + }, + comma: 'comma', + indices(prefix: PropertyKey, key: string) { + return String(prefix) + '[' + key + ']'; + }, + repeat(prefix: PropertyKey) { + return String(prefix); + }, +}; + +const is_array = Array.isArray; +const push = Array.prototype.push; +const push_to_array = function (arr: any[], value_or_array: any) { + push.apply(arr, is_array(value_or_array) ? value_or_array : [value_or_array]); +}; + +const to_ISO = Date.prototype.toISOString; + +const defaults = { + addQueryPrefix: false, + allowDots: false, + allowEmptyArrays: false, + arrayFormat: 'indices', + charset: 'utf-8', + charsetSentinel: false, + delimiter: '&', + encode: true, + encodeDotInKeys: false, + encoder: encode, + encodeValuesOnly: false, + format: default_format, + formatter: formatters[default_format], + /** @deprecated */ + indices: false, + serializeDate(date) { + return to_ISO.call(date); + }, + skipNulls: false, + strictNullHandling: false, +} as NonNullableProperties; + +function is_non_nullish_primitive(v: unknown): v is string | number | boolean | symbol | bigint { + return ( + typeof v === 'string' || + typeof v === 'number' || + typeof v === 'boolean' || + typeof v === 'symbol' || + typeof v === 'bigint' + ); +} + +const sentinel = {}; + +function inner_stringify( + object: any, + prefix: PropertyKey, + generateArrayPrefix: StringifyOptions['arrayFormat'] | ((prefix: string, key: string) => string), + commaRoundTrip: boolean, + allowEmptyArrays: boolean, + strictNullHandling: boolean, + skipNulls: boolean, + encodeDotInKeys: boolean, + encoder: StringifyOptions['encoder'], + filter: StringifyOptions['filter'], + sort: StringifyOptions['sort'], + allowDots: StringifyOptions['allowDots'], + serializeDate: StringifyOptions['serializeDate'], + format: StringifyOptions['format'], + formatter: StringifyOptions['formatter'], + encodeValuesOnly: boolean, + charset: StringifyOptions['charset'], + sideChannel: WeakMap, +) { + let obj = object; + + let tmp_sc = sideChannel; + let step = 0; + let find_flag = false; + while ((tmp_sc = tmp_sc.get(sentinel)) !== void undefined && !find_flag) { + // Where object last appeared in the ref tree + const pos = tmp_sc.get(object); + step += 1; + if (typeof pos !== 'undefined') { + if (pos === step) { + throw new RangeError('Cyclic object value'); + } else { + find_flag = true; // Break while + } + } + if (typeof tmp_sc.get(sentinel) === 'undefined') { + step = 0; + } + } + + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate?.(obj); + } else if (generateArrayPrefix === 'comma' && is_array(obj)) { + obj = maybe_map(obj, function (value) { + if (value instanceof Date) { + return serializeDate?.(value); + } + return value; + }); + } + + if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? + // @ts-expect-error + encoder(prefix, defaults.encoder, charset, 'key', format) + : prefix; + } + + obj = ''; + } + + if (is_non_nullish_primitive(obj) || is_buffer(obj)) { + if (encoder) { + const key_value = + encodeValuesOnly ? prefix + // @ts-expect-error + : encoder(prefix, defaults.encoder, charset, 'key', format); + return [ + formatter?.(key_value) + + '=' + + // @ts-expect-error + formatter?.(encoder(obj, defaults.encoder, charset, 'value', format)), + ]; + } + return [formatter?.(prefix) + '=' + formatter?.(String(obj))]; + } + + const values: string[] = []; + + if (typeof obj === 'undefined') { + return values; + } + + let obj_keys; + if (generateArrayPrefix === 'comma' && is_array(obj)) { + // we need to join elements in + if (encodeValuesOnly && encoder) { + // @ts-expect-error values only + obj = maybe_map(obj, encoder); + } + obj_keys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }]; + } else if (is_array(filter)) { + obj_keys = filter; + } else { + const keys = Object.keys(obj); + obj_keys = sort ? keys.sort(sort) : keys; + } + + const encoded_prefix = encodeDotInKeys ? String(prefix).replace(/\./g, '%2E') : String(prefix); + + const adjusted_prefix = + commaRoundTrip && is_array(obj) && obj.length === 1 ? encoded_prefix + '[]' : encoded_prefix; + + if (allowEmptyArrays && is_array(obj) && obj.length === 0) { + return adjusted_prefix + '[]'; + } + + for (let j = 0; j < obj_keys.length; ++j) { + const key = obj_keys[j]; + const value = + // @ts-ignore + typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key as any]; + + if (skipNulls && value === null) { + continue; + } + + // @ts-ignore + const encoded_key = allowDots && encodeDotInKeys ? (key as any).replace(/\./g, '%2E') : key; + const key_prefix = + is_array(obj) ? + typeof generateArrayPrefix === 'function' ? + generateArrayPrefix(adjusted_prefix, encoded_key) + : adjusted_prefix + : adjusted_prefix + (allowDots ? '.' + encoded_key : '[' + encoded_key + ']'); + + sideChannel.set(object, step); + const valueSideChannel = new WeakMap(); + valueSideChannel.set(sentinel, sideChannel); + push_to_array( + values, + inner_stringify( + value, + key_prefix, + generateArrayPrefix, + commaRoundTrip, + allowEmptyArrays, + strictNullHandling, + skipNulls, + encodeDotInKeys, + // @ts-ignore + generateArrayPrefix === 'comma' && encodeValuesOnly && is_array(obj) ? null : encoder, + filter, + sort, + allowDots, + serializeDate, + format, + formatter, + encodeValuesOnly, + charset, + valueSideChannel, + ), + ); + } + + return values; +} + +function normalize_stringify_options( + opts: StringifyOptions = defaults, +): NonNullableProperties> & { indices?: boolean } { + if (typeof opts.allowEmptyArrays !== 'undefined' && typeof opts.allowEmptyArrays !== 'boolean') { + throw new TypeError('`allowEmptyArrays` option can only be `true` or `false`, when provided'); + } + + if (typeof opts.encodeDotInKeys !== 'undefined' && typeof opts.encodeDotInKeys !== 'boolean') { + throw new TypeError('`encodeDotInKeys` option can only be `true` or `false`, when provided'); + } + + if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + const charset = opts.charset || defaults.charset; + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + + let format = default_format; + if (typeof opts.format !== 'undefined') { + if (!has.call(formatters, opts.format)) { + throw new TypeError('Unknown format option provided.'); + } + format = opts.format; + } + const formatter = formatters[format]; + + let filter = defaults.filter; + if (typeof opts.filter === 'function' || is_array(opts.filter)) { + filter = opts.filter; + } + + let arrayFormat: StringifyOptions['arrayFormat']; + if (opts.arrayFormat && opts.arrayFormat in array_prefix_generators) { + arrayFormat = opts.arrayFormat; + } else if ('indices' in opts) { + arrayFormat = opts.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = defaults.arrayFormat; + } + + if ('commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') { + throw new TypeError('`commaRoundTrip` must be a boolean, or absent'); + } + + const allowDots = + typeof opts.allowDots === 'undefined' ? + !!opts.encodeDotInKeys === true ? + true + : defaults.allowDots + : !!opts.allowDots; + + return { + addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix, + // @ts-ignore + allowDots: allowDots, + allowEmptyArrays: + typeof opts.allowEmptyArrays === 'boolean' ? !!opts.allowEmptyArrays : defaults.allowEmptyArrays, + arrayFormat: arrayFormat, + charset: charset, + charsetSentinel: + typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + commaRoundTrip: !!opts.commaRoundTrip, + delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, + encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, + encodeDotInKeys: + typeof opts.encodeDotInKeys === 'boolean' ? opts.encodeDotInKeys : defaults.encodeDotInKeys, + encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder, + encodeValuesOnly: + typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly, + filter: filter, + format: format, + formatter: formatter, + serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate, + skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls, + // @ts-ignore + sort: typeof opts.sort === 'function' ? opts.sort : null, + strictNullHandling: + typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling, + }; +} + +export function stringify(object: any, opts: StringifyOptions = {}) { + let obj = object; + const options = normalize_stringify_options(opts); + + let obj_keys: PropertyKey[] | undefined; + let filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (is_array(options.filter)) { + filter = options.filter; + obj_keys = filter; + } + + const keys: string[] = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + const generateArrayPrefix = array_prefix_generators[options.arrayFormat]; + const commaRoundTrip = generateArrayPrefix === 'comma' && options.commaRoundTrip; + + if (!obj_keys) { + obj_keys = Object.keys(obj); + } + + if (options.sort) { + obj_keys.sort(options.sort); + } + + const sideChannel = new WeakMap(); + for (let i = 0; i < obj_keys.length; ++i) { + const key = obj_keys[i]!; + + if (options.skipNulls && obj[key] === null) { + continue; + } + push_to_array( + keys, + inner_stringify( + obj[key], + key, + // @ts-expect-error + generateArrayPrefix, + commaRoundTrip, + options.allowEmptyArrays, + options.strictNullHandling, + options.skipNulls, + options.encodeDotInKeys, + options.encode ? options.encoder : null, + options.filter, + options.sort, + options.allowDots, + options.serializeDate, + options.format, + options.formatter, + options.encodeValuesOnly, + options.charset, + sideChannel, + ), + ); + } + + const joined = keys.join(options.delimiter); + let prefix = options.addQueryPrefix === true ? '?' : ''; + + if (options.charsetSentinel) { + if (options.charset === 'iso-8859-1') { + // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark + prefix += 'utf8=%26%2310003%3B&'; + } else { + // encodeURIComponent('✓') + prefix += 'utf8=%E2%9C%93&'; + } + } + + return joined.length > 0 ? prefix + joined : ''; +} diff --git a/src/internal/qs/types.ts b/src/internal/qs/types.ts new file mode 100644 index 0000000000..7c28dbb46f --- /dev/null +++ b/src/internal/qs/types.ts @@ -0,0 +1,71 @@ +export type Format = 'RFC1738' | 'RFC3986'; + +export type DefaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string; +export type DefaultDecoder = (str: string, decoder?: any, charset?: string) => string; + +export type BooleanOptional = boolean | undefined; + +export type StringifyBaseOptions = { + delimiter?: string; + allowDots?: boolean; + encodeDotInKeys?: boolean; + strictNullHandling?: boolean; + skipNulls?: boolean; + encode?: boolean; + encoder?: ( + str: any, + defaultEncoder: DefaultEncoder, + charset: string, + type: 'key' | 'value', + format?: Format, + ) => string; + filter?: Array | ((prefix: PropertyKey, value: any) => any); + arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma'; + indices?: boolean; + sort?: ((a: PropertyKey, b: PropertyKey) => number) | null; + serializeDate?: (d: Date) => string; + format?: 'RFC1738' | 'RFC3986'; + formatter?: (str: PropertyKey) => string; + encodeValuesOnly?: boolean; + addQueryPrefix?: boolean; + charset?: 'utf-8' | 'iso-8859-1'; + charsetSentinel?: boolean; + allowEmptyArrays?: boolean; + commaRoundTrip?: boolean; +}; + +export type StringifyOptions = StringifyBaseOptions; + +export type ParseBaseOptions = { + comma?: boolean; + delimiter?: string | RegExp; + depth?: number | false; + decoder?: (str: string, defaultDecoder: DefaultDecoder, charset: string, type: 'key' | 'value') => any; + arrayLimit?: number; + parseArrays?: boolean; + plainObjects?: boolean; + allowPrototypes?: boolean; + allowSparse?: boolean; + parameterLimit?: number; + strictDepth?: boolean; + strictNullHandling?: boolean; + ignoreQueryPrefix?: boolean; + charset?: 'utf-8' | 'iso-8859-1'; + charsetSentinel?: boolean; + interpretNumericEntities?: boolean; + allowEmptyArrays?: boolean; + duplicates?: 'combine' | 'first' | 'last'; + allowDots?: boolean; + decodeDotInKeys?: boolean; +}; + +export type ParseOptions = ParseBaseOptions; + +export type ParsedQs = { + [key: string]: undefined | string | string[] | ParsedQs | ParsedQs[]; +}; + +// Type to remove null or undefined union from each property +export type NonNullableProperties = { + [K in keyof T]-?: Exclude; +}; diff --git a/src/internal/qs/utils.ts b/src/internal/qs/utils.ts new file mode 100644 index 0000000000..113b18fb9b --- /dev/null +++ b/src/internal/qs/utils.ts @@ -0,0 +1,265 @@ +import { RFC1738 } from './formats'; +import type { DefaultEncoder, Format } from './types'; + +const has = Object.prototype.hasOwnProperty; +const is_array = Array.isArray; + +const hex_table = (() => { + const array = []; + for (let i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +})(); + +function compact_queue>(queue: Array<{ obj: T; prop: string }>) { + while (queue.length > 1) { + const item = queue.pop(); + if (!item) continue; + + const obj = item.obj[item.prop]; + + if (is_array(obj)) { + const compacted: unknown[] = []; + + for (let j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + // @ts-ignore + item.obj[item.prop] = compacted; + } + } +} + +function array_to_object(source: any[], options: { plainObjects: boolean }) { + const obj = options && options.plainObjects ? Object.create(null) : {}; + for (let i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +} + +export function merge( + target: any, + source: any, + options: { plainObjects?: boolean; allowPrototypes?: boolean } = {}, +) { + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (is_array(target)) { + target.push(source); + } else if (target && typeof target === 'object') { + if ( + (options && (options.plainObjects || options.allowPrototypes)) || + !has.call(Object.prototype, source) + ) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (!target || typeof target !== 'object') { + return [target].concat(source); + } + + let mergeTarget = target; + if (is_array(target) && !is_array(source)) { + // @ts-ignore + mergeTarget = array_to_object(target, options); + } + + if (is_array(target) && is_array(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + const targetItem = target[i]; + if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { + target[i] = merge(targetItem, item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } + }); + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + const value = source[key]; + + if (has.call(acc, key)) { + acc[key] = merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +} + +export function assign_single_source(target: any, source: any) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +} + +export function decode(str: string, _: any, charset: string) { + const strWithoutPlus = str.replace(/\+/g, ' '); + if (charset === 'iso-8859-1') { + // unescape never throws, no try...catch needed: + return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); + } + // utf-8 + try { + return decodeURIComponent(strWithoutPlus); + } catch (e) { + return strWithoutPlus; + } +} + +const limit = 1024; + +export const encode: ( + str: any, + defaultEncoder: DefaultEncoder, + charset: string, + type: 'key' | 'value', + format: Format, +) => string = (str, _defaultEncoder, charset, _kind, format: Format) => { + // This code was originally written by Brian White for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + let string = str; + if (typeof str === 'symbol') { + string = Symbol.prototype.toString.call(str); + } else if (typeof str !== 'string') { + string = String(str); + } + + if (charset === 'iso-8859-1') { + return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) { + return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; + }); + } + + let out = ''; + for (let j = 0; j < string.length; j += limit) { + const segment = string.length >= limit ? string.slice(j, j + limit) : string; + const arr = []; + + for (let i = 0; i < segment.length; ++i) { + let c = segment.charCodeAt(i); + if ( + c === 0x2d || // - + c === 0x2e || // . + c === 0x5f || // _ + c === 0x7e || // ~ + (c >= 0x30 && c <= 0x39) || // 0-9 + (c >= 0x41 && c <= 0x5a) || // a-z + (c >= 0x61 && c <= 0x7a) || // A-Z + (format === RFC1738 && (c === 0x28 || c === 0x29)) // ( ) + ) { + arr[arr.length] = segment.charAt(i); + continue; + } + + if (c < 0x80) { + arr[arr.length] = hex_table[c]; + continue; + } + + if (c < 0x800) { + arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)]; + continue; + } + + if (c < 0xd800 || c >= 0xe000) { + arr[arr.length] = + hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)]; + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff)); + + arr[arr.length] = + hex_table[0xf0 | (c >> 18)]! + + hex_table[0x80 | ((c >> 12) & 0x3f)] + + hex_table[0x80 | ((c >> 6) & 0x3f)] + + hex_table[0x80 | (c & 0x3f)]; + } + + out += arr.join(''); + } + + return out; +}; + +export function compact(value: any) { + const queue = [{ obj: { o: value }, prop: 'o' }]; + const refs = []; + + for (let i = 0; i < queue.length; ++i) { + const item = queue[i]; + // @ts-ignore + const obj = item.obj[item.prop]; + + const keys = Object.keys(obj); + for (let j = 0; j < keys.length; ++j) { + const key = keys[j]!; + const val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + compact_queue(queue); + + return value; +} + +export function is_regexp(obj: any) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +} + +export function is_buffer(obj: any) { + if (!obj || typeof obj !== 'object') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +} + +export function combine(a: any, b: any) { + return [].concat(a, b); +} + +export function maybe_map(val: T[], fn: (v: T) => T) { + if (is_array(val)) { + const mapped = []; + for (let i = 0; i < val.length; i += 1) { + mapped.push(fn(val[i]!)); + } + return mapped; + } + return fn(val); +} diff --git a/src/resources/abuse-reports.ts b/src/resources/abuse-reports.ts new file mode 100644 index 0000000000..dfa8eb0b1e --- /dev/null +++ b/src/resources/abuse-reports.ts @@ -0,0 +1,209 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../resource'; +import * as Core from '../core'; + +export class AbuseReports extends APIResource { + /** + * Submit the Abuse Report of a particular type + */ + create( + reportType: + | 'abuse_dmca' + | 'abuse_trademark' + | 'abuse_general' + | 'abuse_phishing' + | 'abuse_children' + | 'abuse_threat' + | 'abuse_registrar_whois' + | 'abuse_ncsei', + params: AbuseReportCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/abuse-reports/${reportType}`, { + body, + ...options, + }) as Core.APIPromise<{ result: AbuseReportCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * The result should be 'success' for successful response + */ +export type AbuseReportCreateResponse = string; + +export interface AbuseReportCreateParams { + /** + * Path param: The account ID of the submitter. + */ + account_id: string; + + /** + * Body param: The abuse report type + */ + act: + | 'abuse_dmca' + | 'abuse_trademark' + | 'abuse_general' + | 'abuse_phishing' + | 'abuse_children' + | 'abuse_threat' + | 'abuse_registrar_whois' + | 'abuse_ncsei'; + + /** + * Body param: A valid email of the abuse reporter + */ + email: string; + + /** + * Body param: Should match the value provided in `email` + */ + email2: string; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + host_notification: 'send' | 'send-anon' | 'none'; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + ncmec_notification: 'send' | 'send-anon' | 'none'; + + /** + * Body param: Notification type based on the abuse type. NOTE: Copyright (DMCA) + * and Trademark reports cannot be anonymous. + */ + owner_notification: 'send' | 'send-anon' | 'none'; + + /** + * Body param: 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 + */ + urls: string; + + /** + * Body param: Text not exceeding 100 characters + */ + address1?: string; + + /** + * Body param: The name of the copyright holder. Text not exceeding 60 characters. + */ + agent_name?: string; + + /** + * Body param: Can be 0 or 1 + */ + agree?: 0 | 1; + + /** + * Body param: Text not exceeding 255 characters + */ + city?: string; + + /** + * Body param: Any additional comments about the infringement not exceeding 2000 + * characters + */ + comments?: string; + + /** + * Body param: Text not exceeding 100 characters + */ + company?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + country?: string; + + /** + * Body param: 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 + */ + destination_ips?: string; + + /** + * Body param: A detailed description of the infringement, including any necessary + * access details and the exact steps needed to view the content, not exceeding + * 5000 characters + */ + justification?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + name?: string; + + /** + * Body param: If the submitter is the target of NCSEI in the URLs of the abuse + * report + */ + ncsei_subject_representation?: boolean; + + /** + * Body param: Text not exceeding 255 characters + */ + original_work?: string; + + /** + * Body param: 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. + */ + ports_protocols?: string; + + /** + * Body param: 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 + */ + signature?: string; + + /** + * Body param: 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 + */ + source_ips?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + state?: string; + + /** + * Body param: Text not exceeding 20 characters + */ + tele?: string; + + /** + * Body param: Text not exceeding 255 characters + */ + title?: string; + + /** + * Body param: Text not exceeding 1000 characters + */ + trademark_number?: string; + + /** + * Body param: Text not exceeding 1000 characters + */ + trademark_office?: string; + + /** + * Body param: Text not exceeding 1000 characters + */ + trademark_symbol?: string; +} diff --git a/src/resources/accounts/accounts.ts b/src/resources/accounts/accounts.ts index 7196067e2b..06526e1f05 100644 --- a/src/resources/accounts/accounts.ts +++ b/src/resources/accounts/accounts.ts @@ -4,21 +4,71 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as MembersAPI from './members'; +import { + MemberCreateParams, + MemberDeleteParams, + MemberDeleteResponse, + MemberGetParams, + MemberListParams, + MemberUpdateParams, + Members, + Status, +} from './members'; import * as RolesAPI from './roles'; +import { RoleGetParams, RoleListParams, Roles } from './roles'; +import * as SubscriptionsAPI from './subscriptions'; +import { + SubscriptionCreateParams, + SubscriptionCreateResponse, + SubscriptionDeleteParams, + SubscriptionDeleteResponse, + SubscriptionGetParams, + SubscriptionGetResponse, + SubscriptionUpdateParams, + SubscriptionUpdateResponse, + Subscriptions, +} from './subscriptions'; +import * as LogsAPI from './logs/logs'; +import { Logs } from './logs/logs'; +import * as TokensAPI from './tokens/tokens'; +import { + TokenCreateParams, + TokenCreateResponse, + TokenDeleteParams, + TokenDeleteResponse, + TokenGetParams, + TokenListParams, + TokenUpdateParams, + TokenVerifyParams, + TokenVerifyResponse, + Tokens, +} from './tokens/tokens'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class Accounts extends APIResource { members: MembersAPI.Members = new MembersAPI.Members(this._client); roles: RolesAPI.Roles = new RolesAPI.Roles(this._client); + subscriptions: SubscriptionsAPI.Subscriptions = new SubscriptionsAPI.Subscriptions(this._client); + tokens: TokensAPI.Tokens = new TokensAPI.Tokens(this._client); + logs: LogsAPI.Logs = new LogsAPI.Logs(this._client); + + /** + * Create an account (only available for tenant admins at this time) + */ + create(body: AccountCreateParams, options?: Core.RequestOptions): Core.APIPromise { + return ( + this._client.post('/accounts', { body, ...options }) as Core.APIPromise<{ result: Account }> + )._thenUnwrap((obj) => obj.result); + } /** * Update an existing account. */ - update(params: AccountUpdateParams, options?: Core.RequestOptions): Core.APIPromise { + update(params: AccountUpdateParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.put(`/accounts/${account_id}`, { body, ...options }) as Core.APIPromise<{ - result: AccountUpdateResponse; + result: Account; }> )._thenUnwrap((obj) => obj.result); } @@ -29,35 +79,47 @@ export class Accounts extends APIResource { list( query?: AccountListParams, options?: Core.RequestOptions, - ): Core.PagePromise; - list( - options?: Core.RequestOptions, - ): Core.PagePromise; + ): Core.PagePromise; + list(options?: Core.RequestOptions): Core.PagePromise; list( query: AccountListParams | Core.RequestOptions = {}, options?: Core.RequestOptions, - ): Core.PagePromise { + ): Core.PagePromise { if (isRequestOptions(query)) { return this.list({}, query); } - return this._client.getAPIList('/accounts', AccountListResponsesV4PagePaginationArray, { - query, - ...options, - }); + return this._client.getAPIList('/accounts', AccountsV4PagePaginationArray, { query, ...options }); + } + + /** + * Delete a specific account (only available for tenant admins at this time). This + * is a permanent operation that will delete any zones or other resources under the + * account + */ + delete( + params: AccountDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}`, options) as Core.APIPromise<{ + result: AccountDeleteResponse | null; + }> + )._thenUnwrap((obj) => obj.result); } /** * Get information about a specific account that you are a member of. */ - get(params: AccountGetParams, options?: Core.RequestOptions): Core.APIPromise { + get(params: AccountGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id } = params; return ( - this._client.get(`/accounts/${account_id}`, options) as Core.APIPromise<{ result: AccountGetResponse }> + this._client.get(`/accounts/${account_id}`, options) as Core.APIPromise<{ result: Account }> )._thenUnwrap((obj) => obj.result); } } -export class AccountListResponsesV4PagePaginationArray extends V4PagePaginationArray {} +export class AccountsV4PagePaginationArray extends V4PagePaginationArray {} export interface Account { /** @@ -92,8 +154,8 @@ export namespace Account { abuse_contact_email?: string; /** - * Specifies the default nameservers to be used for new zones added to this - * account. + * @deprecated: Specifies the default nameservers to be used for new zones added to + * this account. * * - `cloudflare.standard` for Cloudflare-branded nameservers * - `custom.account` for account custom nameservers @@ -102,6 +164,9 @@ export namespace Account { * See * [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) * for more information. + * + * Deprecated in favor of + * [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings). */ default_nameservers?: 'cloudflare.standard' | 'custom.account' | 'custom.tenant'; @@ -115,23 +180,59 @@ export namespace Account { * @deprecated: Indicates whether new zones should use the account-level custom * nameservers by default. * - * Deprecated in favor of `default_nameservers`. + * Deprecated in favor of + * [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings). */ use_account_custom_ns_by_default?: boolean; } } -export type AccountUpdateResponse = unknown; +export interface AccountDeleteResponse { + /** + * Identifier + */ + id: string; +} + +export interface AccountCreateParams { + /** + * Account name + */ + name: string; + + /** + * the type of account being created. For self-serve customers, use standard. for + * enterprise customers, use enterprise. + */ + type: 'standard' | 'enterprise'; -export type AccountListResponse = unknown; + /** + * 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/ + */ + unit?: AccountCreateParams.Unit; +} -export type AccountGetResponse = unknown; +export namespace AccountCreateParams { + /** + * 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/ + */ + export interface Unit { + /** + * Tenant unit ID + */ + id?: string; + } +} export interface AccountUpdateParams { /** - * Path param: + * Path param: Account identifier tag. */ - account_id: unknown; + account_id: string; /** * Body param: Account name @@ -155,8 +256,8 @@ export namespace AccountUpdateParams { abuse_contact_email?: string; /** - * Specifies the default nameservers to be used for new zones added to this - * account. + * @deprecated: Specifies the default nameservers to be used for new zones added to + * this account. * * - `cloudflare.standard` for Cloudflare-branded nameservers * - `custom.account` for account custom nameservers @@ -165,6 +266,9 @@ export namespace AccountUpdateParams { * See * [Custom Nameservers](https://developers.cloudflare.com/dns/additional-options/custom-nameservers/) * for more information. + * + * Deprecated in favor of + * [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings). */ default_nameservers?: 'cloudflare.standard' | 'custom.account' | 'custom.tenant'; @@ -178,7 +282,8 @@ export namespace AccountUpdateParams { * @deprecated: Indicates whether new zones should use the account-level custom * nameservers by default. * - * Deprecated in favor of `default_nameservers`. + * Deprecated in favor of + * [DNS Settings](https://developers.cloudflare.com/api/operations/dns-settings-for-an-account-update-dns-settings). */ use_account_custom_ns_by_default?: boolean; } @@ -196,27 +301,64 @@ export interface AccountListParams extends V4PagePaginationArrayParams { name?: string; } +export interface AccountDeleteParams { + /** + * The account ID of the account to be deleted + */ + account_id: string; +} + export interface AccountGetParams { - account_id: unknown; + /** + * Account identifier tag. + */ + account_id: string; } -export namespace Accounts { - export import Members = MembersAPI.Members; - export import Status = MembersAPI.Status; - export import UserWithInviteCode = MembersAPI.UserWithInviteCode; - export import MemberCreateResponse = MembersAPI.MemberCreateResponse; - export import MemberUpdateResponse = MembersAPI.MemberUpdateResponse; - export import MemberListResponse = MembersAPI.MemberListResponse; - export import MemberDeleteResponse = MembersAPI.MemberDeleteResponse; - export import MemberGetResponse = MembersAPI.MemberGetResponse; - export import MemberListResponsesV4PagePaginationArray = MembersAPI.MemberListResponsesV4PagePaginationArray; - export import MemberCreateParams = MembersAPI.MemberCreateParams; - export import MemberUpdateParams = MembersAPI.MemberUpdateParams; - export import MemberListParams = MembersAPI.MemberListParams; - export import MemberDeleteParams = MembersAPI.MemberDeleteParams; - export import MemberGetParams = MembersAPI.MemberGetParams; - export import Roles = RolesAPI.Roles; - export import RoleGetResponse = RolesAPI.RoleGetResponse; - export import RoleListParams = RolesAPI.RoleListParams; - export import RoleGetParams = RolesAPI.RoleGetParams; +Accounts.Members = Members; +Accounts.Roles = Roles; +Accounts.Subscriptions = Subscriptions; +Accounts.Tokens = Tokens; +Accounts.Logs = Logs; + +export declare namespace Accounts { + export { + Members as Members, + type Status as Status, + type MemberDeleteResponse as MemberDeleteResponse, + type MemberCreateParams as MemberCreateParams, + type MemberUpdateParams as MemberUpdateParams, + type MemberListParams as MemberListParams, + type MemberDeleteParams as MemberDeleteParams, + type MemberGetParams as MemberGetParams, + }; + + export { Roles as Roles, type RoleListParams as RoleListParams, type RoleGetParams as RoleGetParams }; + + export { + Subscriptions as Subscriptions, + type SubscriptionCreateResponse as SubscriptionCreateResponse, + type SubscriptionUpdateResponse as SubscriptionUpdateResponse, + type SubscriptionDeleteResponse as SubscriptionDeleteResponse, + type SubscriptionGetResponse as SubscriptionGetResponse, + type SubscriptionCreateParams as SubscriptionCreateParams, + type SubscriptionUpdateParams as SubscriptionUpdateParams, + type SubscriptionDeleteParams as SubscriptionDeleteParams, + type SubscriptionGetParams as SubscriptionGetParams, + }; + + export { + Tokens as Tokens, + type TokenCreateResponse as TokenCreateResponse, + type TokenDeleteResponse as TokenDeleteResponse, + type TokenVerifyResponse as TokenVerifyResponse, + type TokenCreateParams as TokenCreateParams, + type TokenUpdateParams as TokenUpdateParams, + type TokenListParams as TokenListParams, + type TokenDeleteParams as TokenDeleteParams, + type TokenGetParams as TokenGetParams, + type TokenVerifyParams as TokenVerifyParams, + }; + + export { Logs as Logs }; } diff --git a/src/resources/accounts/index.ts b/src/resources/accounts/index.ts index 9651605ee3..e27d659bf3 100644 --- a/src/resources/accounts/index.ts +++ b/src/resources/accounts/index.ts @@ -1,20 +1,38 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Accounts } from './accounts'; -export { RoleGetResponse, RoleListParams, RoleGetParams, Roles } from './roles'; +export { Logs } from './logs/index'; export { - Status, - UserWithInviteCode, - MemberCreateResponse, - MemberUpdateResponse, - MemberListResponse, - MemberDeleteResponse, - MemberGetResponse, - MemberCreateParams, - MemberUpdateParams, - MemberListParams, - MemberDeleteParams, - MemberGetParams, - MemberListResponsesV4PagePaginationArray, Members, + type Status, + type MemberDeleteResponse, + type MemberCreateParams, + type MemberUpdateParams, + type MemberListParams, + type MemberDeleteParams, + type MemberGetParams, } from './members'; +export { Roles, type RoleListParams, type RoleGetParams } from './roles'; +export { + Subscriptions, + type SubscriptionCreateResponse, + type SubscriptionUpdateResponse, + type SubscriptionDeleteResponse, + type SubscriptionGetResponse, + type SubscriptionCreateParams, + type SubscriptionUpdateParams, + type SubscriptionDeleteParams, + type SubscriptionGetParams, +} from './subscriptions'; +export { + Tokens, + type TokenCreateResponse, + type TokenDeleteResponse, + type TokenVerifyResponse, + type TokenCreateParams, + type TokenUpdateParams, + type TokenListParams, + type TokenDeleteParams, + type TokenGetParams, + type TokenVerifyParams, +} from './tokens/index'; diff --git a/src/resources/accounts/logs/audit.ts b/src/resources/accounts/logs/audit.ts new file mode 100644 index 0000000000..b396a10369 --- /dev/null +++ b/src/resources/accounts/logs/audit.ts @@ -0,0 +1,364 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { CursorLimitPagination, type CursorLimitPaginationParams } from '../../../pagination'; + +export class Audit extends APIResource { + /** + * Gets a list of audit logs for an account.

This is the beta release + * of Audit Logs Version 2. Since this is a beta version, there may be gaps or + * missing entries in the available audit logs. Be aware of the following + * limitations.
  • Audit logs are available only for the past 30 days. + *
  • Error handling is not yet implemented.
+ */ + list( + params: AuditListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/logs/audit`, + AuditListResponsesCursorLimitPagination, + { query, ...options }, + ); + } +} + +export class AuditListResponsesCursorLimitPagination extends CursorLimitPagination {} + +export interface AuditListResponse { + /** + * A unique identifier for the audit log entry. + */ + id?: string; + + /** + * Contains account related information. + */ + account?: AuditListResponse.Account; + + /** + * Provides information about the action performed. + */ + action?: AuditListResponse.Action; + + /** + * Provides details about the actor who performed the action. + */ + actor?: AuditListResponse.Actor; + + /** + * Provides raw information about the request and response. + */ + raw?: AuditListResponse.Raw; + + /** + * Provides details about the affected resource. + */ + resource?: AuditListResponse.Resource; + + /** + * Provides details about the zone affected by the action. + */ + zone?: AuditListResponse.Zone; +} + +export namespace AuditListResponse { + /** + * Contains account related information. + */ + export interface Account { + /** + * A unique identifier for the account. + */ + id?: string; + + /** + * A string that identifies the account name. + */ + name?: string; + } + + /** + * Provides information about the action performed. + */ + export interface Action { + /** + * A short description of the action performed. + */ + description?: string; + + /** + * The result of the action, indicating success or failure. + */ + result?: string; + + /** + * A timestamp indicating when the action was logged. + */ + time?: string; + + /** + * A short string that describes the action that was performed. + */ + type?: string; + } + + /** + * Provides details about the actor who performed the action. + */ + export interface Actor { + /** + * The ID of the actor who performed the action. If a user performed the action, + * this will be their User ID. + */ + id?: string; + + context?: 'api_key' | 'api_token' | 'dash' | 'oauth' | 'origin_ca_key'; + + /** + * The email of the actor who performed the action. + */ + email?: string; + + /** + * The IP address of the request that performed the action. + */ + ip_address?: string; + + /** + * Filters by the API token ID when the actor context is an api_token. + */ + token_id?: string; + + /** + * Filters by the API token name when the actor context is an api_token. + */ + token_name?: string; + + /** + * The type of actor. + */ + type?: 'user' | 'account' | 'cloudflare-admin'; + } + + /** + * Provides raw information about the request and response. + */ + export interface Raw { + /** + * The Cloudflare Ray ID for the request. + */ + cf_ray_id?: string; + + /** + * The HTTP method of the request. + */ + method?: string; + + /** + * The HTTP response status code returned by the API. + */ + status_code?: number; + + /** + * The URI of the request. + */ + uri?: string; + + /** + * The client's user agent string sent with the request. + */ + user_agent?: string; + } + + /** + * Provides details about the affected resource. + */ + export interface Resource { + /** + * The unique identifier for the affected resource. + */ + id?: string; + + /** + * The Cloudflare product associated with the resource. + */ + product?: string; + + request?: unknown; + + response?: unknown; + + /** + * The scope of the resource. + */ + scope?: unknown; + + /** + * The type of the resource. + */ + type?: string; + } + + /** + * Provides details about the zone affected by the action. + */ + export interface Zone { + /** + * A string that identifies the zone id. + */ + id?: string; + + /** + * A string that identifies the zone name. + */ + name?: string; + } +} + +export interface AuditListParams extends CursorLimitPaginationParams { + /** + * Path param: The unique id that identifies the account. + */ + account_id: string; + + /** + * Query param: Filters actions based on a given timestamp in the format + * yyyy-mm-dd, returning only logs that occurred on and before the specified date. + */ + before: string; + + /** + * Query param: Filters actions based on a given timestamp in the format + * yyyy-mm-dd, returning only logs that occurred on and after the specified date. + */ + since: string; + + /** + * Query param: Filters by the account name. + */ + account_name?: string; + + /** + * Query param: Whether the action was successful or not. + */ + action_result?: 'success' | 'failure'; + + /** + * Query param: Filters by the action type. + */ + action_type?: 'create' | 'delete' | 'view' | 'update'; + + /** + * Query param: Filters by the actor context. + */ + actor_context?: 'api_key' | 'api_token' | 'dash' | 'oauth' | 'origin_ca_key'; + + /** + * Query param: Filters by the actor's email address. + */ + actor_email?: string; + + /** + * Query param: Filters by the actor ID. This can be either the Account ID or User + * ID. + */ + actor_id?: string; + + /** + * Query param: The IP address where the action was initiated. + */ + actor_ip_address?: string; + + /** + * Query param: Filters by the API token ID when the actor context is an api_token + * or oauth. + */ + actor_token_id?: string; + + /** + * Query param: Filters by the API token name when the actor context is an + * api_token or oauth. + */ + actor_token_name?: string; + + /** + * Query param: Filters by the actor type. + */ + actor_type?: 'cloudflare_admin' | 'account' | 'user'; + + /** + * Query param: Finds a specific log by its ID. + */ + audit_log_id?: string; + + /** + * Query param: Sets sorting order. + */ + direction?: 'desc' | 'asc'; + + /** + * Query param: Filters by the response CF Ray ID. + */ + raw_cf_ray_id?: string; + + /** + * Query param: The HTTP method for the API call. + */ + raw_method?: string; + + /** + * Query param: The response status code that was returned. + */ + raw_status_code?: number; + + /** + * Query param: Filters by the request URI. + */ + raw_uri?: string; + + /** + * Query param: Filters by the resource ID. + */ + resource_id?: string; + + /** + * Query param: Filters audit logs by the Cloudflare product associated with the + * changed resource. + */ + resource_product?: string; + + /** + * Query param: Filters by the resource scope, specifying whether the resource is + * associated with an user, an account, or a zone. + */ + resource_scope?: 'accounts' | 'user' | 'zones'; + + /** + * Query param: Filters audit logs based on the unique type of resource changed by + * the action. + */ + resource_type?: string; + + /** + * Query param: Filters by the zone ID. + */ + zone_id?: string; + + /** + * Query param: Filters by the zone name associated with the change. + */ + zone_name?: string; +} + +Audit.AuditListResponsesCursorLimitPagination = AuditListResponsesCursorLimitPagination; + +export declare namespace Audit { + export { + type AuditListResponse as AuditListResponse, + AuditListResponsesCursorLimitPagination as AuditListResponsesCursorLimitPagination, + type AuditListParams as AuditListParams, + }; +} diff --git a/src/resources/accounts/logs/index.ts b/src/resources/accounts/logs/index.ts new file mode 100644 index 0000000000..92a21aa38b --- /dev/null +++ b/src/resources/accounts/logs/index.ts @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + AuditListResponsesCursorLimitPagination, + Audit, + type AuditListResponse, + type AuditListParams, +} from './audit'; +export { Logs } from './logs'; diff --git a/src/resources/accounts/logs/logs.ts b/src/resources/accounts/logs/logs.ts new file mode 100644 index 0000000000..0966ebbb45 --- /dev/null +++ b/src/resources/accounts/logs/logs.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as AuditAPI from './audit'; +import { Audit, AuditListParams, AuditListResponse, AuditListResponsesCursorLimitPagination } from './audit'; + +export class Logs extends APIResource { + audit: AuditAPI.Audit = new AuditAPI.Audit(this._client); +} + +Logs.Audit = Audit; +Logs.AuditListResponsesCursorLimitPagination = AuditListResponsesCursorLimitPagination; + +export declare namespace Logs { + export { + Audit as Audit, + type AuditListResponse as AuditListResponse, + AuditListResponsesCursorLimitPagination as AuditListResponsesCursorLimitPagination, + type AuditListParams as AuditListParams, + }; +} diff --git a/src/resources/accounts/members.ts b/src/resources/accounts/members.ts index b5d1e0df68..c7cf9ca499 100644 --- a/src/resources/accounts/members.ts +++ b/src/resources/accounts/members.ts @@ -2,19 +2,19 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as MembersAPI from './members'; import * as Shared from '../shared'; -import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; +import { MembersV4PagePaginationArray } from '../shared'; +import { type V4PagePaginationArrayParams } from '../../pagination'; export class Members extends APIResource { /** * Add a user to the list of members for this account. */ - create(params: MemberCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(params: MemberCreateParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/members`, { body, ...options }) as Core.APIPromise<{ - result: MemberCreateResponse; + result: Shared.Member; }> )._thenUnwrap((obj) => obj.result); } @@ -26,13 +26,13 @@ export class Members extends APIResource { memberId: string, params: MemberUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.put(`/accounts/${account_id}/members/${memberId}`, { body, ...options, - }) as Core.APIPromise<{ result: MemberUpdateResponse }> + }) as Core.APIPromise<{ result: Shared.Member }> )._thenUnwrap((obj) => obj.result); } @@ -42,13 +42,12 @@ export class Members extends APIResource { list( params: MemberListParams, options?: Core.RequestOptions, - ): Core.PagePromise { + ): Core.PagePromise { const { account_id, ...query } = params; - return this._client.getAPIList( - `/accounts/${account_id}/members`, - MemberListResponsesV4PagePaginationArray, - { query, ...options }, - ); + return this._client.getAPIList(`/accounts/${account_id}/members`, MembersV4PagePaginationArray, { + query, + ...options, + }); } /** @@ -74,616 +73,21 @@ export class Members extends APIResource { memberId: string, params: MemberGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get(`/accounts/${account_id}/members/${memberId}`, options) as Core.APIPromise<{ - result: MemberGetResponse; + result: Shared.Member; }> )._thenUnwrap((obj) => obj.result); } } -export class MemberListResponsesV4PagePaginationArray extends V4PagePaginationArray {} - /** * Whether the user is a member of the organization or has an invitation pending. */ export type Status = 'member' | 'invited'; -export interface UserWithInviteCode { - /** - * Membership identifier tag. - */ - id?: string; - - /** - * The unique activation code for the account membership. - */ - code?: string; - - /** - * Roles assigned to this member. - */ - roles?: Array; - - /** - * A member's status in the account. - */ - status?: 'accepted' | 'pending'; - - /** - * Details of the user associated to the membership. - */ - user?: UserWithInviteCode.User; -} - -export namespace UserWithInviteCode { - export interface Role { - /** - * Role identifier tag. - */ - id: string; - - /** - * Description of role's permissions. - */ - description: string; - - /** - * Role name. - */ - name: string; - - permissions: Role.Permissions; - } - - export namespace Role { - export interface Permissions { - analytics?: Shared.PermissionGrant; - - billing?: Shared.PermissionGrant; - - cache_purge?: Shared.PermissionGrant; - - dns?: Shared.PermissionGrant; - - dns_records?: Shared.PermissionGrant; - - lb?: Shared.PermissionGrant; - - logs?: Shared.PermissionGrant; - - organization?: Shared.PermissionGrant; - - ssl?: Shared.PermissionGrant; - - waf?: Shared.PermissionGrant; - - zone_settings?: Shared.PermissionGrant; - - zones?: Shared.PermissionGrant; - } - } - - /** - * Details of the user associated to the membership. - */ - export interface User { - /** - * The contact email address of the user. - */ - email: string; - - /** - * Identifier - */ - id?: string; - - /** - * User's first name - */ - first_name?: string | null; - - /** - * User's last name - */ - last_name?: string | null; - - /** - * Indicates whether two-factor authentication is enabled for the user account. - * Does not apply to API authentication. - */ - two_factor_authentication_enabled?: boolean; - } -} - -export interface MemberCreateResponse { - /** - * Membership identifier tag. - */ - id?: string; - - /** - * Access policy for the membership - */ - policies?: Array; - - /** - * Roles assigned to this Member. - */ - roles?: Array; - - /** - * A member's status in the account. - */ - status?: 'accepted' | 'pending'; - - /** - * Details of the user associated to the membership. - */ - user?: MemberCreateResponse.User; -} - -export namespace MemberCreateResponse { - export interface Policy { - /** - * Policy identifier. - */ - id?: string; - - /** - * Allow or deny operations against the resources. - */ - access?: 'allow' | 'deny'; - - /** - * A set of permission groups that are specified to the policy. - */ - permission_groups?: Array; - - /** - * A list of resource groups that the policy applies to. - */ - resource_groups?: Array; - } - - export namespace Policy { - /** - * A named group of permissions that map to a group of operations against - * resources. - */ - export interface PermissionGroup { - /** - * Identifier of the group. - */ - id: string; - - /** - * Attributes associated to the permission group. - */ - meta?: unknown; - - /** - * Name of the group. - */ - name?: string; - } - - /** - * A group of scoped resources. - */ - export interface ResourceGroup { - /** - * Identifier of the group. - */ - id: string; - - /** - * The scope associated to the resource group - */ - scope: Array; - - /** - * Attributes associated to the resource group. - */ - meta?: unknown; - - /** - * Name of the resource group. - */ - name?: string; - } - - export namespace ResourceGroup { - /** - * A scope is a combination of scope objects which provides additional context. - */ - export interface Scope { - /** - * This is a combination of pre-defined resource name and identifier (like Account - * ID etc.) - */ - key: string; - - /** - * A list of scope objects for additional context. - */ - objects: Array; - } - - export namespace Scope { - /** - * A scope object represents any resource that can have actions applied against - * invite. - */ - export interface Object { - /** - * This is a combination of pre-defined resource name and identifier (like Zone ID - * etc.) - */ - key: string; - } - } - } - } - - /** - * Details of the user associated to the membership. - */ - export interface User { - /** - * The contact email address of the user. - */ - email: string; - - /** - * Identifier - */ - id?: string; - - /** - * User's first name - */ - first_name?: string | null; - - /** - * User's last name - */ - last_name?: string | null; - - /** - * Indicates whether two-factor authentication is enabled for the user account. - * Does not apply to API authentication. - */ - two_factor_authentication_enabled?: boolean; - } -} - -export interface MemberUpdateResponse { - /** - * Membership identifier tag. - */ - id?: string; - - /** - * Access policy for the membership - */ - policies?: Array; - - /** - * Roles assigned to this Member. - */ - roles?: Array; - - /** - * A member's status in the account. - */ - status?: 'accepted' | 'pending'; - - /** - * Details of the user associated to the membership. - */ - user?: MemberUpdateResponse.User; -} - -export namespace MemberUpdateResponse { - export interface Policy { - /** - * Policy identifier. - */ - id?: string; - - /** - * Allow or deny operations against the resources. - */ - access?: 'allow' | 'deny'; - - /** - * A set of permission groups that are specified to the policy. - */ - permission_groups?: Array; - - /** - * A list of resource groups that the policy applies to. - */ - resource_groups?: Array; - } - - export namespace Policy { - /** - * A named group of permissions that map to a group of operations against - * resources. - */ - export interface PermissionGroup { - /** - * Identifier of the group. - */ - id: string; - - /** - * Attributes associated to the permission group. - */ - meta?: unknown; - - /** - * Name of the group. - */ - name?: string; - } - - /** - * A group of scoped resources. - */ - export interface ResourceGroup { - /** - * Identifier of the group. - */ - id: string; - - /** - * The scope associated to the resource group - */ - scope: Array; - - /** - * Attributes associated to the resource group. - */ - meta?: unknown; - - /** - * Name of the resource group. - */ - name?: string; - } - - export namespace ResourceGroup { - /** - * A scope is a combination of scope objects which provides additional context. - */ - export interface Scope { - /** - * This is a combination of pre-defined resource name and identifier (like Account - * ID etc.) - */ - key: string; - - /** - * A list of scope objects for additional context. - */ - objects: Array; - } - - export namespace Scope { - /** - * A scope object represents any resource that can have actions applied against - * invite. - */ - export interface Object { - /** - * This is a combination of pre-defined resource name and identifier (like Zone ID - * etc.) - */ - key: string; - } - } - } - } - - /** - * Details of the user associated to the membership. - */ - export interface User { - /** - * The contact email address of the user. - */ - email: string; - - /** - * Identifier - */ - id?: string; - - /** - * User's first name - */ - first_name?: string | null; - - /** - * User's last name - */ - last_name?: string | null; - - /** - * Indicates whether two-factor authentication is enabled for the user account. - * Does not apply to API authentication. - */ - two_factor_authentication_enabled?: boolean; - } -} - -export interface MemberListResponse { - /** - * Membership identifier tag. - */ - id?: string; - - /** - * Access policy for the membership - */ - policies?: Array; - - /** - * Roles assigned to this Member. - */ - roles?: Array; - - /** - * A member's status in the account. - */ - status?: 'accepted' | 'pending'; - - /** - * Details of the user associated to the membership. - */ - user?: MemberListResponse.User; -} - -export namespace MemberListResponse { - export interface Policy { - /** - * Policy identifier. - */ - id?: string; - - /** - * Allow or deny operations against the resources. - */ - access?: 'allow' | 'deny'; - - /** - * A set of permission groups that are specified to the policy. - */ - permission_groups?: Array; - - /** - * A list of resource groups that the policy applies to. - */ - resource_groups?: Array; - } - - export namespace Policy { - /** - * A named group of permissions that map to a group of operations against - * resources. - */ - export interface PermissionGroup { - /** - * Identifier of the group. - */ - id: string; - - /** - * Attributes associated to the permission group. - */ - meta?: unknown; - - /** - * Name of the group. - */ - name?: string; - } - - /** - * A group of scoped resources. - */ - export interface ResourceGroup { - /** - * Identifier of the group. - */ - id: string; - - /** - * The scope associated to the resource group - */ - scope: Array; - - /** - * Attributes associated to the resource group. - */ - meta?: unknown; - - /** - * Name of the resource group. - */ - name?: string; - } - - export namespace ResourceGroup { - /** - * A scope is a combination of scope objects which provides additional context. - */ - export interface Scope { - /** - * This is a combination of pre-defined resource name and identifier (like Account - * ID etc.) - */ - key: string; - - /** - * A list of scope objects for additional context. - */ - objects: Array; - } - - export namespace Scope { - /** - * A scope object represents any resource that can have actions applied against - * invite. - */ - export interface Object { - /** - * This is a combination of pre-defined resource name and identifier (like Zone ID - * etc.) - */ - key: string; - } - } - } - } - - /** - * Details of the user associated to the membership. - */ - export interface User { - /** - * The contact email address of the user. - */ - email: string; - - /** - * Identifier - */ - id?: string; - - /** - * User's first name - */ - first_name?: string | null; - - /** - * User's last name - */ - last_name?: string | null; - - /** - * Indicates whether two-factor authentication is enabled for the user account. - * Does not apply to API authentication. - */ - two_factor_authentication_enabled?: boolean; - } -} - export interface MemberDeleteResponse { /** * Identifier @@ -691,173 +95,11 @@ export interface MemberDeleteResponse { id: string; } -export interface MemberGetResponse { - /** - * Membership identifier tag. - */ - id?: string; - - /** - * Access policy for the membership - */ - policies?: Array; - - /** - * Roles assigned to this Member. - */ - roles?: Array; - - /** - * A member's status in the account. - */ - status?: 'accepted' | 'pending'; - - /** - * Details of the user associated to the membership. - */ - user?: MemberGetResponse.User; -} - -export namespace MemberGetResponse { - export interface Policy { - /** - * Policy identifier. - */ - id?: string; - - /** - * Allow or deny operations against the resources. - */ - access?: 'allow' | 'deny'; - - /** - * A set of permission groups that are specified to the policy. - */ - permission_groups?: Array; - - /** - * A list of resource groups that the policy applies to. - */ - resource_groups?: Array; - } - - export namespace Policy { - /** - * A named group of permissions that map to a group of operations against - * resources. - */ - export interface PermissionGroup { - /** - * Identifier of the group. - */ - id: string; - - /** - * Attributes associated to the permission group. - */ - meta?: unknown; - - /** - * Name of the group. - */ - name?: string; - } - - /** - * A group of scoped resources. - */ - export interface ResourceGroup { - /** - * Identifier of the group. - */ - id: string; - - /** - * The scope associated to the resource group - */ - scope: Array; - - /** - * Attributes associated to the resource group. - */ - meta?: unknown; - - /** - * Name of the resource group. - */ - name?: string; - } - - export namespace ResourceGroup { - /** - * A scope is a combination of scope objects which provides additional context. - */ - export interface Scope { - /** - * This is a combination of pre-defined resource name and identifier (like Account - * ID etc.) - */ - key: string; - - /** - * A list of scope objects for additional context. - */ - objects: Array; - } - - export namespace Scope { - /** - * A scope object represents any resource that can have actions applied against - * invite. - */ - export interface Object { - /** - * This is a combination of pre-defined resource name and identifier (like Zone ID - * etc.) - */ - key: string; - } - } - } - } - - /** - * Details of the user associated to the membership. - */ - export interface User { - /** - * The contact email address of the user. - */ - email: string; - - /** - * Identifier - */ - id?: string; - - /** - * User's first name - */ - first_name?: string | null; - - /** - * User's last name - */ - last_name?: string | null; - - /** - * Indicates whether two-factor authentication is enabled for the user account. - * Does not apply to API authentication. - */ - two_factor_authentication_enabled?: boolean; - } -} - export type MemberCreateParams = | MemberCreateParams.IAMCreateMemberWithRoles | MemberCreateParams.IAMCreateMemberWithPolicies; -export namespace MemberCreateParams { +export declare namespace MemberCreateParams { export interface IAMCreateMemberWithRoles { /** * Path param: Account identifier tag. @@ -944,10 +186,12 @@ export namespace MemberCreateParams { } } -export type MemberUpdateParams = MemberUpdateParams.Member | MemberUpdateParams.IAMUpdateMemberWithPolicies; +export type MemberUpdateParams = + | MemberUpdateParams.IAMUpdateMemberWithRoles + | MemberUpdateParams.IAMUpdateMemberWithPolicies; -export namespace MemberUpdateParams { - export interface Member { +export declare namespace MemberUpdateParams { + export interface IAMUpdateMemberWithRoles { /** * Path param: Account identifier tag. */ @@ -956,16 +200,7 @@ export namespace MemberUpdateParams { /** * Body param: Roles assigned to this member. */ - roles?: Array; - } - - export namespace Member { - export interface Role { - /** - * Role identifier tag. - */ - id: string; - } + roles?: Array; } export interface IAMUpdateMemberWithPolicies { @@ -1058,18 +293,16 @@ export interface MemberGetParams { account_id: string; } -export namespace Members { - export import Status = MembersAPI.Status; - export import UserWithInviteCode = MembersAPI.UserWithInviteCode; - export import MemberCreateResponse = MembersAPI.MemberCreateResponse; - export import MemberUpdateResponse = MembersAPI.MemberUpdateResponse; - export import MemberListResponse = MembersAPI.MemberListResponse; - export import MemberDeleteResponse = MembersAPI.MemberDeleteResponse; - export import MemberGetResponse = MembersAPI.MemberGetResponse; - export import MemberListResponsesV4PagePaginationArray = MembersAPI.MemberListResponsesV4PagePaginationArray; - export import MemberCreateParams = MembersAPI.MemberCreateParams; - export import MemberUpdateParams = MembersAPI.MemberUpdateParams; - export import MemberListParams = MembersAPI.MemberListParams; - export import MemberDeleteParams = MembersAPI.MemberDeleteParams; - export import MemberGetParams = MembersAPI.MemberGetParams; +export declare namespace Members { + export { + type Status as Status, + type MemberDeleteResponse as MemberDeleteResponse, + type MemberCreateParams as MemberCreateParams, + type MemberUpdateParams as MemberUpdateParams, + type MemberListParams as MemberListParams, + type MemberDeleteParams as MemberDeleteParams, + type MemberGetParams as MemberGetParams, + }; } + +export { MembersV4PagePaginationArray }; diff --git a/src/resources/accounts/roles.ts b/src/resources/accounts/roles.ts index 56ef76649f..ab35bff975 100644 --- a/src/resources/accounts/roles.ts +++ b/src/resources/accounts/roles.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as RolesAPI from './roles'; import * as Shared from '../shared'; import { RolesSinglePage } from '../shared'; @@ -21,22 +20,16 @@ export class Roles extends APIResource { /** * Get information about a specific role for an account. */ - get( - roleId: unknown, - params: RoleGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + get(roleId: string, params: RoleGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id } = params; return ( this._client.get(`/accounts/${account_id}/roles/${roleId}`, options) as Core.APIPromise<{ - result: RoleGetResponse; + result: Shared.Role; }> )._thenUnwrap((obj) => obj.result); } } -export type RoleGetResponse = unknown; - export interface RoleListParams { /** * Account identifier tag. @@ -51,10 +44,8 @@ export interface RoleGetParams { account_id: string; } -export namespace Roles { - export import RoleGetResponse = RolesAPI.RoleGetResponse; - export import RoleListParams = RolesAPI.RoleListParams; - export import RoleGetParams = RolesAPI.RoleGetParams; +export declare namespace Roles { + export { type RoleListParams as RoleListParams, type RoleGetParams as RoleGetParams }; } export { RolesSinglePage }; diff --git a/src/resources/accounts/subscriptions.ts b/src/resources/accounts/subscriptions.ts new file mode 100644 index 0000000000..2f37c42613 --- /dev/null +++ b/src/resources/accounts/subscriptions.ts @@ -0,0 +1,145 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as Shared from '../shared'; + +export class Subscriptions extends APIResource { + /** + * Creates an account subscription. + */ + create( + params: SubscriptionCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/subscriptions`, { body, ...options }) as Core.APIPromise<{ + result: SubscriptionCreateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Updates an account subscription. + */ + update( + subscriptionIdentifier: string, + params: SubscriptionUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/subscriptions/${subscriptionIdentifier}`, { + body, + ...options, + }) as Core.APIPromise<{ result: SubscriptionUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Deletes an account's subscription. + */ + delete( + subscriptionIdentifier: string, + params: SubscriptionDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/subscriptions/${subscriptionIdentifier}`, + options, + ) as Core.APIPromise<{ result: SubscriptionDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Lists all of an account's subscriptions. + */ + get( + params: SubscriptionGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/subscriptions`, options) as Core.APIPromise<{ + result: SubscriptionGetResponse | null; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type SubscriptionCreateResponse = unknown | string | null; + +export type SubscriptionUpdateResponse = unknown | string | null; + +export interface SubscriptionDeleteResponse { + /** + * Subscription identifier tag. + */ + subscription_id?: string; +} + +export type SubscriptionGetResponse = Array; + +export interface SubscriptionCreateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: How often the subscription is renewed automatically. + */ + frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; + + /** + * Body param: The rate plan applied to the subscription. + */ + rate_plan?: Shared.RatePlanParam; +} + +export interface SubscriptionUpdateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: How often the subscription is renewed automatically. + */ + frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; + + /** + * Body param: The rate plan applied to the subscription. + */ + rate_plan?: Shared.RatePlanParam; +} + +export interface SubscriptionDeleteParams { + /** + * Identifier + */ + account_id: string; +} + +export interface SubscriptionGetParams { + /** + * Identifier + */ + account_id: string; +} + +export declare namespace Subscriptions { + export { + type SubscriptionCreateResponse as SubscriptionCreateResponse, + type SubscriptionUpdateResponse as SubscriptionUpdateResponse, + type SubscriptionDeleteResponse as SubscriptionDeleteResponse, + type SubscriptionGetResponse as SubscriptionGetResponse, + type SubscriptionCreateParams as SubscriptionCreateParams, + type SubscriptionUpdateParams as SubscriptionUpdateParams, + type SubscriptionDeleteParams as SubscriptionDeleteParams, + type SubscriptionGetParams as SubscriptionGetParams, + }; +} diff --git a/src/resources/accounts/tokens/index.ts b/src/resources/accounts/tokens/index.ts new file mode 100644 index 0000000000..82d6105efa --- /dev/null +++ b/src/resources/accounts/tokens/index.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + PermissionGroupListResponsesSinglePage, + PermissionGroups, + type PermissionGroupListResponse, + type PermissionGroupListParams, +} from './permission-groups'; +export { + Tokens, + type TokenCreateResponse, + type TokenDeleteResponse, + type TokenVerifyResponse, + type TokenCreateParams, + type TokenUpdateParams, + type TokenListParams, + type TokenDeleteParams, + type TokenGetParams, + type TokenVerifyParams, +} from './tokens'; +export { Value, type ValueUpdateParams } from './value'; diff --git a/src/resources/accounts/tokens/permission-groups.ts b/src/resources/accounts/tokens/permission-groups.ts new file mode 100644 index 0000000000..bc548ee0fb --- /dev/null +++ b/src/resources/accounts/tokens/permission-groups.ts @@ -0,0 +1,43 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { SinglePage } from '../../../pagination'; + +export class PermissionGroups extends APIResource { + /** + * Find all available permission groups for Account Owned API Tokens + */ + list( + params: PermissionGroupListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/tokens/permission_groups`, + PermissionGroupListResponsesSinglePage, + options, + ); + } +} + +export class PermissionGroupListResponsesSinglePage extends SinglePage {} + +export type PermissionGroupListResponse = unknown; + +export interface PermissionGroupListParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +PermissionGroups.PermissionGroupListResponsesSinglePage = PermissionGroupListResponsesSinglePage; + +export declare namespace PermissionGroups { + export { + type PermissionGroupListResponse as PermissionGroupListResponse, + PermissionGroupListResponsesSinglePage as PermissionGroupListResponsesSinglePage, + type PermissionGroupListParams as PermissionGroupListParams, + }; +} diff --git a/src/resources/accounts/tokens/tokens.ts b/src/resources/accounts/tokens/tokens.ts new file mode 100644 index 0000000000..c2bd95ca0c --- /dev/null +++ b/src/resources/accounts/tokens/tokens.ts @@ -0,0 +1,401 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as Shared from '../../shared'; +import { TokensV4PagePaginationArray } from '../../shared'; +import * as PermissionGroupsAPI from './permission-groups'; +import { + PermissionGroupListParams, + PermissionGroupListResponse, + PermissionGroupListResponsesSinglePage, + PermissionGroups, +} from './permission-groups'; +import * as ValueAPI from './value'; +import { Value, ValueUpdateParams } from './value'; +import { type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Tokens extends APIResource { + permissionGroups: PermissionGroupsAPI.PermissionGroups = new PermissionGroupsAPI.PermissionGroups( + this._client, + ); + value: ValueAPI.Value = new ValueAPI.Value(this._client); + + /** + * Create a new Account Owned API token. + */ + create(params: TokenCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/tokens`, { body, ...options }) as Core.APIPromise<{ + result: TokenCreateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update an existing token. + */ + update( + tokenId: string, + params: TokenUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/tokens/${tokenId}`, { body, ...options }) as Core.APIPromise<{ + result: Shared.Token; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List all Account Owned API tokens created for this account. + */ + list( + params: TokenListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList(`/accounts/${account_id}/tokens`, TokensV4PagePaginationArray, { + query, + ...options, + }); + } + + /** + * Destroy an Account Owned API token. + */ + delete( + tokenId: string, + params: TokenDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}/tokens/${tokenId}`, options) as Core.APIPromise<{ + result: TokenDeleteResponse | null; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get information about a specific Account Owned API token. + */ + get(tokenId: string, params: TokenGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/tokens/${tokenId}`, options) as Core.APIPromise<{ + result: Shared.Token; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Test whether a token works. + */ + verify(params: TokenVerifyParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/tokens/verify`, options) as Core.APIPromise<{ + result: TokenVerifyResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface TokenCreateResponse { + /** + * Token identifier tag. + */ + id?: string; + + condition?: TokenCreateResponse.Condition; + + /** + * The expiration time on or after which the JWT MUST NOT be accepted for + * processing. + */ + expires_on?: string; + + /** + * The time on which the token was created. + */ + issued_on?: string; + + /** + * Last time the token was used. + */ + last_used_on?: string; + + /** + * Last time the token was modified. + */ + modified_on?: string; + + /** + * Token name. + */ + name?: string; + + /** + * The time before which the token MUST NOT be accepted for processing. + */ + not_before?: string; + + /** + * List of access policies assigned to the token. + */ + policies?: Array; + + /** + * Status of the token. + */ + status?: 'active' | 'disabled' | 'expired'; + + /** + * The token value. + */ + value?: Shared.TokenValue; +} + +export namespace TokenCreateResponse { + export interface Condition { + /** + * Client IP restrictions. + */ + request_ip?: Condition.RequestIP; + } + + export namespace Condition { + /** + * Client IP restrictions. + */ + export interface RequestIP { + /** + * List of IPv4/IPv6 CIDR addresses. + */ + in?: Array; + + /** + * List of IPv4/IPv6 CIDR addresses. + */ + not_in?: Array; + } + } +} + +export interface TokenDeleteResponse { + /** + * Identifier + */ + id: string; +} + +export interface TokenVerifyResponse { + /** + * Token identifier tag. + */ + id: string; + + /** + * Status of the token. + */ + status: 'active' | 'disabled' | 'expired'; + + /** + * The expiration time on or after which the JWT MUST NOT be accepted for + * processing. + */ + expires_on?: string; + + /** + * The time before which the token MUST NOT be accepted for processing. + */ + not_before?: string; +} + +export interface TokenCreateParams { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: Token name. + */ + name: string; + + /** + * Body param: List of access policies assigned to the token. + */ + policies: Array; + + /** + * Body param: + */ + condition?: TokenCreateParams.Condition; + + /** + * Body param: The expiration time on or after which the JWT MUST NOT be accepted + * for processing. + */ + expires_on?: string; + + /** + * Body param: The time before which the token MUST NOT be accepted for processing. + */ + not_before?: string; +} + +export namespace TokenCreateParams { + export interface Condition { + /** + * Client IP restrictions. + */ + request_ip?: Condition.RequestIP; + } + + export namespace Condition { + /** + * Client IP restrictions. + */ + export interface RequestIP { + /** + * List of IPv4/IPv6 CIDR addresses. + */ + in?: Array; + + /** + * List of IPv4/IPv6 CIDR addresses. + */ + not_in?: Array; + } + } +} + +export interface TokenUpdateParams { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: + */ + condition?: TokenUpdateParams.Condition; + + /** + * Body param: The expiration time on or after which the JWT MUST NOT be accepted + * for processing. + */ + expires_on?: string; + + /** + * Body param: Token name. + */ + name?: string; + + /** + * Body param: The time before which the token MUST NOT be accepted for processing. + */ + not_before?: string; + + /** + * Body param: List of access policies assigned to the token. + */ + policies?: Array; + + /** + * Body param: Status of the token. + */ + status?: 'active' | 'disabled' | 'expired'; +} + +export namespace TokenUpdateParams { + export interface Condition { + /** + * Client IP restrictions. + */ + request_ip?: Condition.RequestIP; + } + + export namespace Condition { + /** + * Client IP restrictions. + */ + export interface RequestIP { + /** + * List of IPv4/IPv6 CIDR addresses. + */ + in?: Array; + + /** + * List of IPv4/IPv6 CIDR addresses. + */ + not_in?: Array; + } + } +} + +export interface TokenListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Query param: Direction to order results. + */ + direction?: 'asc' | 'desc'; +} + +export interface TokenDeleteParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +export interface TokenGetParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +export interface TokenVerifyParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +Tokens.PermissionGroups = PermissionGroups; +Tokens.PermissionGroupListResponsesSinglePage = PermissionGroupListResponsesSinglePage; +Tokens.Value = Value; + +export declare namespace Tokens { + export { + type TokenCreateResponse as TokenCreateResponse, + type TokenDeleteResponse as TokenDeleteResponse, + type TokenVerifyResponse as TokenVerifyResponse, + type TokenCreateParams as TokenCreateParams, + type TokenUpdateParams as TokenUpdateParams, + type TokenListParams as TokenListParams, + type TokenDeleteParams as TokenDeleteParams, + type TokenGetParams as TokenGetParams, + type TokenVerifyParams as TokenVerifyParams, + }; + + export { + PermissionGroups as PermissionGroups, + type PermissionGroupListResponse as PermissionGroupListResponse, + PermissionGroupListResponsesSinglePage as PermissionGroupListResponsesSinglePage, + type PermissionGroupListParams as PermissionGroupListParams, + }; + + export { Value as Value, type ValueUpdateParams as ValueUpdateParams }; +} + +export { TokensV4PagePaginationArray }; diff --git a/src/resources/accounts/tokens/value.ts b/src/resources/accounts/tokens/value.ts new file mode 100644 index 0000000000..fc9b58dfd9 --- /dev/null +++ b/src/resources/accounts/tokens/value.ts @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as Shared from '../../shared'; + +export class Value extends APIResource { + /** + * Roll the Account Owned API token secret. + */ + update( + tokenId: string, + params: ValueUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, body } = params; + return ( + this._client.put(`/accounts/${account_id}/tokens/${tokenId}/value`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: Shared.TokenValue }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ValueUpdateParams { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: + */ + body: unknown; +} + +export declare namespace Value { + export { type ValueUpdateParams as ValueUpdateParams }; +} diff --git a/src/resources/acm/acm.ts b/src/resources/acm/acm.ts index d6c5e8b41d..eb27fa949d 100644 --- a/src/resources/acm/acm.ts +++ b/src/resources/acm/acm.ts @@ -2,16 +2,28 @@ import { APIResource } from '../../resource'; import * as TotalTLSAPI from './total-tls'; +import { + CertificateAuthority, + TotalTLS, + TotalTLSCreateParams, + TotalTLSCreateResponse, + TotalTLSGetParams, + TotalTLSGetResponse, +} from './total-tls'; export class ACM extends APIResource { totalTLS: TotalTLSAPI.TotalTLS = new TotalTLSAPI.TotalTLS(this._client); } -export namespace ACM { - export import TotalTLS = TotalTLSAPI.TotalTLS; - export import CertificateAuthority = TotalTLSAPI.CertificateAuthority; - export import TotalTLSCreateResponse = TotalTLSAPI.TotalTLSCreateResponse; - export import TotalTLSGetResponse = TotalTLSAPI.TotalTLSGetResponse; - export import TotalTLSCreateParams = TotalTLSAPI.TotalTLSCreateParams; - export import TotalTLSGetParams = TotalTLSAPI.TotalTLSGetParams; +ACM.TotalTLS = TotalTLS; + +export declare namespace ACM { + export { + TotalTLS as TotalTLS, + type CertificateAuthority as CertificateAuthority, + type TotalTLSCreateResponse as TotalTLSCreateResponse, + type TotalTLSGetResponse as TotalTLSGetResponse, + type TotalTLSCreateParams as TotalTLSCreateParams, + type TotalTLSGetParams as TotalTLSGetParams, + }; } diff --git a/src/resources/acm/index.ts b/src/resources/acm/index.ts index 1602f61a20..d4dd566321 100644 --- a/src/resources/acm/index.ts +++ b/src/resources/acm/index.ts @@ -2,10 +2,10 @@ export { ACM } from './acm'; export { - CertificateAuthority, - TotalTLSCreateResponse, - TotalTLSGetResponse, - TotalTLSCreateParams, - TotalTLSGetParams, TotalTLS, + type CertificateAuthority, + type TotalTLSCreateResponse, + type TotalTLSGetResponse, + type TotalTLSCreateParams, + type TotalTLSGetParams, } from './total-tls'; diff --git a/src/resources/acm/total-tls.ts b/src/resources/acm/total-tls.ts index d095ae071a..07d170f690 100644 --- a/src/resources/acm/total-tls.ts +++ b/src/resources/acm/total-tls.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TotalTLSAPI from './total-tls'; export class TotalTLS extends APIResource { /** @@ -36,12 +35,12 @@ export class TotalTLS extends APIResource { /** * The Certificate Authority that Total TLS certificates will be issued through. */ -export type CertificateAuthority = 'google' | 'lets_encrypt'; +export type CertificateAuthority = 'google' | 'lets_encrypt' | 'ssl_com'; /** * The Certificate Authority that Total TLS certificates will be issued through. */ -export type CertificateAuthorityParam = 'google' | 'lets_encrypt'; +export type CertificateAuthorityParam = 'google' | 'lets_encrypt' | 'ssl_com'; export interface TotalTLSCreateResponse { /** @@ -58,7 +57,7 @@ export interface TotalTLSCreateResponse { /** * The validity period in days for the certificates ordered via Total TLS. */ - validity_days?: 90; + validity_period?: 90; } export interface TotalTLSGetResponse { @@ -76,7 +75,7 @@ export interface TotalTLSGetResponse { /** * The validity period in days for the certificates ordered via Total TLS. */ - validity_days?: 90; + validity_period?: 90; } export interface TotalTLSCreateParams { @@ -105,10 +104,12 @@ export interface TotalTLSGetParams { zone_id: string; } -export namespace TotalTLS { - export import CertificateAuthority = TotalTLSAPI.CertificateAuthority; - export import TotalTLSCreateResponse = TotalTLSAPI.TotalTLSCreateResponse; - export import TotalTLSGetResponse = TotalTLSAPI.TotalTLSGetResponse; - export import TotalTLSCreateParams = TotalTLSAPI.TotalTLSCreateParams; - export import TotalTLSGetParams = TotalTLSAPI.TotalTLSGetParams; +export declare namespace TotalTLS { + export { + type CertificateAuthority as CertificateAuthority, + type TotalTLSCreateResponse as TotalTLSCreateResponse, + type TotalTLSGetResponse as TotalTLSGetResponse, + type TotalTLSCreateParams as TotalTLSCreateParams, + type TotalTLSGetParams as TotalTLSGetParams, + }; } diff --git a/src/resources/addressing/address-maps/accounts.ts b/src/resources/addressing/address-maps/accounts.ts index 9d2d72417a..589190d231 100644 --- a/src/resources/addressing/address-maps/accounts.ts +++ b/src/resources/addressing/address-maps/accounts.ts @@ -2,7 +2,7 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as AccountsAPI from './accounts'; +import * as Shared from '../../shared'; export class Accounts extends APIResource { /** @@ -12,14 +12,12 @@ export class Accounts extends APIResource { addressMapId: string, params: AccountUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, body } = params; - return ( - this._client.put( - `/accounts/${account_id}/addressing/address_maps/${addressMapId}/accounts/${account_id}`, - { body: body, ...options }, - ) as Core.APIPromise<{ result: AccountUpdateResponse | null }> - )._thenUnwrap((obj) => obj.result); + return this._client.put( + `/accounts/${account_id}/addressing/address_maps/${addressMapId}/accounts/${account_id}`, + { body: body, ...options }, + ); } /** @@ -29,24 +27,92 @@ export class Accounts extends APIResource { addressMapId: string, params: AccountDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/addressing/address_maps/${addressMapId}/accounts/${account_id}`, - options, - ) as Core.APIPromise<{ result: AccountDeleteResponse | null }> - )._thenUnwrap((obj) => obj.result); + return this._client.delete( + `/accounts/${account_id}/addressing/address_maps/${addressMapId}/accounts/${account_id}`, + options, + ); } } -export type AccountUpdateResponse = Array; +export interface AccountUpdateResponse { + errors: Array; -export type AccountDeleteResponse = Array; + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result_info?: AccountUpdateResponse.ResultInfo; +} + +export namespace AccountUpdateResponse { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } +} + +export interface AccountDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result_info?: AccountDeleteResponse.ResultInfo; +} + +export namespace AccountDeleteResponse { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } +} export interface AccountUpdateParams { /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; @@ -58,14 +124,16 @@ export interface AccountUpdateParams { export interface AccountDeleteParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export namespace Accounts { - export import AccountUpdateResponse = AccountsAPI.AccountUpdateResponse; - export import AccountDeleteResponse = AccountsAPI.AccountDeleteResponse; - export import AccountUpdateParams = AccountsAPI.AccountUpdateParams; - export import AccountDeleteParams = AccountsAPI.AccountDeleteParams; +export declare namespace Accounts { + export { + type AccountUpdateResponse as AccountUpdateResponse, + type AccountDeleteResponse as AccountDeleteResponse, + type AccountUpdateParams as AccountUpdateParams, + type AccountDeleteParams as AccountDeleteParams, + }; } diff --git a/src/resources/addressing/address-maps/address-maps.ts b/src/resources/addressing/address-maps/address-maps.ts index 7f6c87302f..c179e49a71 100644 --- a/src/resources/addressing/address-maps/address-maps.ts +++ b/src/resources/addressing/address-maps/address-maps.ts @@ -3,9 +3,19 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; import * as AddressMapsAPI from './address-maps'; +import * as Shared from '../../shared'; import * as AccountsAPI from './accounts'; +import { + AccountDeleteParams, + AccountDeleteResponse, + AccountUpdateParams, + AccountUpdateResponse, + Accounts, +} from './accounts'; import * as IPsAPI from './ips'; +import { IPDeleteParams, IPDeleteResponse, IPUpdateParams, IPUpdateResponse, IPs } from './ips'; import * as ZonesAPI from './zones'; +import { ZoneDeleteParams, ZoneDeleteResponse, ZoneUpdateParams, ZoneUpdateResponse, Zones } from './zones'; import { SinglePage } from '../../../pagination'; export class AddressMaps extends APIResource { @@ -52,14 +62,9 @@ export class AddressMaps extends APIResource { addressMapId: string, params: AddressMapDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/addressing/address_maps/${addressMapId}`, - options, - ) as Core.APIPromise<{ result: AddressMapDeleteResponse | null }> - )._thenUnwrap((obj) => obj.result); + return this._client.delete(`/accounts/${account_id}/addressing/address_maps/${addressMapId}`, options); } /** @@ -101,7 +106,7 @@ export class AddressMapsSinglePage extends SinglePage {} export interface AddressMap { /** - * Identifier + * Identifier of an Address Map. */ id?: string; @@ -155,7 +160,7 @@ export type KindParam = 'zone' | 'account'; export interface AddressMapCreateResponse { /** - * Identifier + * Identifier of an Address Map. */ id?: string; @@ -238,11 +243,46 @@ export namespace AddressMapCreateResponse { } } -export type AddressMapDeleteResponse = Array; +export interface AddressMapDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result_info?: AddressMapDeleteResponse.ResultInfo; +} + +export namespace AddressMapDeleteResponse { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } +} export interface AddressMapGetResponse { /** - * Identifier + * Identifier of an Address Map. */ id?: string; @@ -327,7 +367,7 @@ export namespace AddressMapGetResponse { export interface AddressMapCreateParams { /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; @@ -357,8 +397,6 @@ export interface AddressMapCreateParams { export namespace AddressMapCreateParams { export interface Membership { - created_at?: string; - /** * The identifier for the membership (eg. a zone or account tag). */ @@ -373,21 +411,21 @@ export namespace AddressMapCreateParams { export interface AddressMapListParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } export interface AddressMapDeleteParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } export interface AddressMapEditParams { /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; @@ -415,36 +453,52 @@ export interface AddressMapEditParams { export interface AddressMapGetParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export namespace AddressMaps { - export import AddressMap = AddressMapsAPI.AddressMap; - export import Kind = AddressMapsAPI.Kind; - export import AddressMapCreateResponse = AddressMapsAPI.AddressMapCreateResponse; - export import AddressMapDeleteResponse = AddressMapsAPI.AddressMapDeleteResponse; - export import AddressMapGetResponse = AddressMapsAPI.AddressMapGetResponse; - export import AddressMapsSinglePage = AddressMapsAPI.AddressMapsSinglePage; - export import AddressMapCreateParams = AddressMapsAPI.AddressMapCreateParams; - export import AddressMapListParams = AddressMapsAPI.AddressMapListParams; - export import AddressMapDeleteParams = AddressMapsAPI.AddressMapDeleteParams; - export import AddressMapEditParams = AddressMapsAPI.AddressMapEditParams; - export import AddressMapGetParams = AddressMapsAPI.AddressMapGetParams; - export import Accounts = AccountsAPI.Accounts; - export import AccountUpdateResponse = AccountsAPI.AccountUpdateResponse; - export import AccountDeleteResponse = AccountsAPI.AccountDeleteResponse; - export import AccountUpdateParams = AccountsAPI.AccountUpdateParams; - export import AccountDeleteParams = AccountsAPI.AccountDeleteParams; - export import IPs = IPsAPI.IPs; - export import IPUpdateResponse = IPsAPI.IPUpdateResponse; - export import IPDeleteResponse = IPsAPI.IPDeleteResponse; - export import IPUpdateParams = IPsAPI.IPUpdateParams; - export import IPDeleteParams = IPsAPI.IPDeleteParams; - export import Zones = ZonesAPI.Zones; - export import ZoneUpdateResponse = ZonesAPI.ZoneUpdateResponse; - export import ZoneDeleteResponse = ZonesAPI.ZoneDeleteResponse; - export import ZoneUpdateParams = ZonesAPI.ZoneUpdateParams; - export import ZoneDeleteParams = ZonesAPI.ZoneDeleteParams; +AddressMaps.AddressMapsSinglePage = AddressMapsSinglePage; +AddressMaps.Accounts = Accounts; +AddressMaps.IPs = IPs; +AddressMaps.Zones = Zones; + +export declare namespace AddressMaps { + export { + type AddressMap as AddressMap, + type Kind as Kind, + type AddressMapCreateResponse as AddressMapCreateResponse, + type AddressMapDeleteResponse as AddressMapDeleteResponse, + type AddressMapGetResponse as AddressMapGetResponse, + AddressMapsSinglePage as AddressMapsSinglePage, + type AddressMapCreateParams as AddressMapCreateParams, + type AddressMapListParams as AddressMapListParams, + type AddressMapDeleteParams as AddressMapDeleteParams, + type AddressMapEditParams as AddressMapEditParams, + type AddressMapGetParams as AddressMapGetParams, + }; + + export { + Accounts as Accounts, + type AccountUpdateResponse as AccountUpdateResponse, + type AccountDeleteResponse as AccountDeleteResponse, + type AccountUpdateParams as AccountUpdateParams, + type AccountDeleteParams as AccountDeleteParams, + }; + + export { + IPs as IPs, + type IPUpdateResponse as IPUpdateResponse, + type IPDeleteResponse as IPDeleteResponse, + type IPUpdateParams as IPUpdateParams, + type IPDeleteParams as IPDeleteParams, + }; + + export { + Zones as Zones, + type ZoneUpdateResponse as ZoneUpdateResponse, + type ZoneDeleteResponse as ZoneDeleteResponse, + type ZoneUpdateParams as ZoneUpdateParams, + type ZoneDeleteParams as ZoneDeleteParams, + }; } diff --git a/src/resources/addressing/address-maps/index.ts b/src/resources/addressing/address-maps/index.ts index b53d4b9edc..091fdac225 100644 --- a/src/resources/addressing/address-maps/index.ts +++ b/src/resources/addressing/address-maps/index.ts @@ -1,25 +1,37 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AccountUpdateResponse, - AccountDeleteResponse, - AccountUpdateParams, - AccountDeleteParams, Accounts, + type AccountUpdateResponse, + type AccountDeleteResponse, + type AccountUpdateParams, + type AccountDeleteParams, } from './accounts'; export { - AddressMap, - Kind, - AddressMapCreateResponse, - AddressMapDeleteResponse, - AddressMapGetResponse, - AddressMapCreateParams, - AddressMapListParams, - AddressMapDeleteParams, - AddressMapEditParams, - AddressMapGetParams, AddressMapsSinglePage, AddressMaps, + type AddressMap, + type Kind, + type AddressMapCreateResponse, + type AddressMapDeleteResponse, + type AddressMapGetResponse, + type AddressMapCreateParams, + type AddressMapListParams, + type AddressMapDeleteParams, + type AddressMapEditParams, + type AddressMapGetParams, } from './address-maps'; -export { IPUpdateResponse, IPDeleteResponse, IPUpdateParams, IPDeleteParams, IPs } from './ips'; -export { ZoneUpdateResponse, ZoneDeleteResponse, ZoneUpdateParams, ZoneDeleteParams, Zones } from './zones'; +export { + IPs, + type IPUpdateResponse, + type IPDeleteResponse, + type IPUpdateParams, + type IPDeleteParams, +} from './ips'; +export { + Zones, + type ZoneUpdateResponse, + type ZoneDeleteResponse, + type ZoneUpdateParams, + type ZoneDeleteParams, +} from './zones'; diff --git a/src/resources/addressing/address-maps/ips.ts b/src/resources/addressing/address-maps/ips.ts index 0ee3c21d52..b68855f9bb 100644 --- a/src/resources/addressing/address-maps/ips.ts +++ b/src/resources/addressing/address-maps/ips.ts @@ -2,7 +2,7 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as IPsAPI from './ips'; +import * as Shared from '../../shared'; export class IPs extends APIResource { /** @@ -13,14 +13,12 @@ export class IPs extends APIResource { ipAddress: string, params: IPUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, body } = params; - return ( - this._client.put(`/accounts/${account_id}/addressing/address_maps/${addressMapId}/ips/${ipAddress}`, { - body: body, - ...options, - }) as Core.APIPromise<{ result: IPUpdateResponse | null }> - )._thenUnwrap((obj) => obj.result); + return this._client.put( + `/accounts/${account_id}/addressing/address_maps/${addressMapId}/ips/${ipAddress}`, + { body: body, ...options }, + ); } /** @@ -31,24 +29,92 @@ export class IPs extends APIResource { ipAddress: string, params: IPDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/addressing/address_maps/${addressMapId}/ips/${ipAddress}`, - options, - ) as Core.APIPromise<{ result: IPDeleteResponse | null }> - )._thenUnwrap((obj) => obj.result); + return this._client.delete( + `/accounts/${account_id}/addressing/address_maps/${addressMapId}/ips/${ipAddress}`, + options, + ); } } -export type IPUpdateResponse = Array; +export interface IPUpdateResponse { + errors: Array; -export type IPDeleteResponse = Array; + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result_info?: IPUpdateResponse.ResultInfo; +} + +export namespace IPUpdateResponse { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } +} + +export interface IPDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result_info?: IPDeleteResponse.ResultInfo; +} + +export namespace IPDeleteResponse { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } +} export interface IPUpdateParams { /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; @@ -60,14 +126,16 @@ export interface IPUpdateParams { export interface IPDeleteParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export namespace IPs { - export import IPUpdateResponse = IPsAPI.IPUpdateResponse; - export import IPDeleteResponse = IPsAPI.IPDeleteResponse; - export import IPUpdateParams = IPsAPI.IPUpdateParams; - export import IPDeleteParams = IPsAPI.IPDeleteParams; +export declare namespace IPs { + export { + type IPUpdateResponse as IPUpdateResponse, + type IPDeleteResponse as IPDeleteResponse, + type IPUpdateParams as IPUpdateParams, + type IPDeleteParams as IPDeleteParams, + }; } diff --git a/src/resources/addressing/address-maps/zones.ts b/src/resources/addressing/address-maps/zones.ts index 92c518fc49..263fc1ee81 100644 --- a/src/resources/addressing/address-maps/zones.ts +++ b/src/resources/addressing/address-maps/zones.ts @@ -2,7 +2,7 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ZonesAPI from './zones'; +import * as Shared from '../../shared'; export class Zones extends APIResource { /** @@ -12,14 +12,12 @@ export class Zones extends APIResource { addressMapId: string, params: ZoneUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, account_id, body } = params; - return ( - this._client.put(`/accounts/${account_id}/addressing/address_maps/${addressMapId}/zones/${zone_id}`, { - body: body, - ...options, - }) as Core.APIPromise<{ result: ZoneUpdateResponse | null }> - )._thenUnwrap((obj) => obj.result); + return this._client.put( + `/accounts/${account_id}/addressing/address_maps/${addressMapId}/zones/${zone_id}`, + { body: body, ...options }, + ); } /** @@ -29,29 +27,97 @@ export class Zones extends APIResource { addressMapId: string, params: ZoneDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/addressing/address_maps/${addressMapId}/zones/${zone_id}`, - options, - ) as Core.APIPromise<{ result: ZoneDeleteResponse | null }> - )._thenUnwrap((obj) => obj.result); + return this._client.delete( + `/accounts/${account_id}/addressing/address_maps/${addressMapId}/zones/${zone_id}`, + options, + ); } } -export type ZoneUpdateResponse = Array; +export interface ZoneUpdateResponse { + errors: Array; -export type ZoneDeleteResponse = Array; + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result_info?: ZoneUpdateResponse.ResultInfo; +} + +export namespace ZoneUpdateResponse { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } +} + +export interface ZoneDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result_info?: ZoneDeleteResponse.ResultInfo; +} + +export namespace ZoneDeleteResponse { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } +} export interface ZoneUpdateParams { /** - * Path param: Identifier + * Path param: Identifier of a zone. */ zone_id: string; /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; @@ -63,19 +129,21 @@ export interface ZoneUpdateParams { export interface ZoneDeleteParams { /** - * Identifier + * Identifier of a zone. */ zone_id: string; /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export namespace Zones { - export import ZoneUpdateResponse = ZonesAPI.ZoneUpdateResponse; - export import ZoneDeleteResponse = ZonesAPI.ZoneDeleteResponse; - export import ZoneUpdateParams = ZonesAPI.ZoneUpdateParams; - export import ZoneDeleteParams = ZonesAPI.ZoneDeleteParams; +export declare namespace Zones { + export { + type ZoneUpdateResponse as ZoneUpdateResponse, + type ZoneDeleteResponse as ZoneDeleteResponse, + type ZoneUpdateParams as ZoneUpdateParams, + type ZoneDeleteParams as ZoneDeleteParams, + }; } diff --git a/src/resources/addressing/addressing.ts b/src/resources/addressing/addressing.ts index 475a0d7a7d..06599a8421 100644 --- a/src/resources/addressing/addressing.ts +++ b/src/resources/addressing/addressing.ts @@ -1,11 +1,57 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as LOADocumentsAPI from './loa-documents'; +import { + LOADocumentCreateParams, + LOADocumentCreateResponse, + LOADocumentGetParams, + LOADocuments, +} from './loa-documents'; import * as ServicesAPI from './services'; +import { ServiceListParams, ServiceListResponse, ServiceListResponsesSinglePage, Services } from './services'; import * as AddressMapsAPI from './address-maps/address-maps'; -import * as LOADocumentsAPI from './loa-documents/loa-documents'; +import { + AddressMap, + AddressMapCreateParams, + AddressMapCreateResponse, + AddressMapDeleteParams, + AddressMapDeleteResponse, + AddressMapEditParams, + AddressMapGetParams, + AddressMapGetResponse, + AddressMapListParams, + AddressMaps, + AddressMapsSinglePage, + Kind, +} from './address-maps/address-maps'; import * as PrefixesAPI from './prefixes/prefixes'; +import { + Prefix, + PrefixCreateParams, + PrefixDeleteParams, + PrefixDeleteResponse, + PrefixEditParams, + PrefixGetParams, + PrefixListParams, + Prefixes, + PrefixesSinglePage, +} from './prefixes/prefixes'; import * as RegionalHostnamesAPI from './regional-hostnames/regional-hostnames'; +import { + RegionalHostnameCreateParams, + RegionalHostnameCreateResponse, + RegionalHostnameDeleteParams, + RegionalHostnameDeleteResponse, + RegionalHostnameEditParams, + RegionalHostnameEditResponse, + RegionalHostnameGetParams, + RegionalHostnameGetResponse, + RegionalHostnameListParams, + RegionalHostnameListResponse, + RegionalHostnameListResponsesSinglePage, + RegionalHostnames, +} from './regional-hostnames/regional-hostnames'; export class Addressing extends APIResource { regionalHostnames: RegionalHostnamesAPI.RegionalHostnames = new RegionalHostnamesAPI.RegionalHostnames( @@ -17,45 +63,70 @@ export class Addressing extends APIResource { prefixes: PrefixesAPI.Prefixes = new PrefixesAPI.Prefixes(this._client); } -export namespace Addressing { - export import RegionalHostnames = RegionalHostnamesAPI.RegionalHostnames; - export import RegionalHostnameCreateResponse = RegionalHostnamesAPI.RegionalHostnameCreateResponse; - export import RegionalHostnameListResponse = RegionalHostnamesAPI.RegionalHostnameListResponse; - export import RegionalHostnameDeleteResponse = RegionalHostnamesAPI.RegionalHostnameDeleteResponse; - export import RegionalHostnameEditResponse = RegionalHostnamesAPI.RegionalHostnameEditResponse; - export import RegionalHostnameGetResponse = RegionalHostnamesAPI.RegionalHostnameGetResponse; - export import RegionalHostnameListResponsesSinglePage = RegionalHostnamesAPI.RegionalHostnameListResponsesSinglePage; - export import RegionalHostnameCreateParams = RegionalHostnamesAPI.RegionalHostnameCreateParams; - export import RegionalHostnameListParams = RegionalHostnamesAPI.RegionalHostnameListParams; - export import RegionalHostnameDeleteParams = RegionalHostnamesAPI.RegionalHostnameDeleteParams; - export import RegionalHostnameEditParams = RegionalHostnamesAPI.RegionalHostnameEditParams; - export import RegionalHostnameGetParams = RegionalHostnamesAPI.RegionalHostnameGetParams; - export import Services = ServicesAPI.Services; - export import ServiceListResponse = ServicesAPI.ServiceListResponse; - export import ServiceListResponsesSinglePage = ServicesAPI.ServiceListResponsesSinglePage; - export import ServiceListParams = ServicesAPI.ServiceListParams; - export import AddressMaps = AddressMapsAPI.AddressMaps; - export import AddressMap = AddressMapsAPI.AddressMap; - export import Kind = AddressMapsAPI.Kind; - export import AddressMapCreateResponse = AddressMapsAPI.AddressMapCreateResponse; - export import AddressMapDeleteResponse = AddressMapsAPI.AddressMapDeleteResponse; - export import AddressMapGetResponse = AddressMapsAPI.AddressMapGetResponse; - export import AddressMapsSinglePage = AddressMapsAPI.AddressMapsSinglePage; - export import AddressMapCreateParams = AddressMapsAPI.AddressMapCreateParams; - export import AddressMapListParams = AddressMapsAPI.AddressMapListParams; - export import AddressMapDeleteParams = AddressMapsAPI.AddressMapDeleteParams; - export import AddressMapEditParams = AddressMapsAPI.AddressMapEditParams; - export import AddressMapGetParams = AddressMapsAPI.AddressMapGetParams; - export import LOADocuments = LOADocumentsAPI.LOADocuments; - export import LOADocumentCreateResponse = LOADocumentsAPI.LOADocumentCreateResponse; - export import LOADocumentCreateParams = LOADocumentsAPI.LOADocumentCreateParams; - export import Prefixes = PrefixesAPI.Prefixes; - export import Prefix = PrefixesAPI.Prefix; - export import PrefixDeleteResponse = PrefixesAPI.PrefixDeleteResponse; - export import PrefixesSinglePage = PrefixesAPI.PrefixesSinglePage; - export import PrefixCreateParams = PrefixesAPI.PrefixCreateParams; - export import PrefixListParams = PrefixesAPI.PrefixListParams; - export import PrefixDeleteParams = PrefixesAPI.PrefixDeleteParams; - export import PrefixEditParams = PrefixesAPI.PrefixEditParams; - export import PrefixGetParams = PrefixesAPI.PrefixGetParams; +Addressing.RegionalHostnames = RegionalHostnames; +Addressing.RegionalHostnameListResponsesSinglePage = RegionalHostnameListResponsesSinglePage; +Addressing.Services = Services; +Addressing.ServiceListResponsesSinglePage = ServiceListResponsesSinglePage; +Addressing.AddressMaps = AddressMaps; +Addressing.AddressMapsSinglePage = AddressMapsSinglePage; +Addressing.LOADocuments = LOADocuments; +Addressing.Prefixes = Prefixes; +Addressing.PrefixesSinglePage = PrefixesSinglePage; + +export declare namespace Addressing { + export { + RegionalHostnames as RegionalHostnames, + type RegionalHostnameCreateResponse as RegionalHostnameCreateResponse, + type RegionalHostnameListResponse as RegionalHostnameListResponse, + type RegionalHostnameDeleteResponse as RegionalHostnameDeleteResponse, + type RegionalHostnameEditResponse as RegionalHostnameEditResponse, + type RegionalHostnameGetResponse as RegionalHostnameGetResponse, + RegionalHostnameListResponsesSinglePage as RegionalHostnameListResponsesSinglePage, + type RegionalHostnameCreateParams as RegionalHostnameCreateParams, + type RegionalHostnameListParams as RegionalHostnameListParams, + type RegionalHostnameDeleteParams as RegionalHostnameDeleteParams, + type RegionalHostnameEditParams as RegionalHostnameEditParams, + type RegionalHostnameGetParams as RegionalHostnameGetParams, + }; + + export { + Services as Services, + type ServiceListResponse as ServiceListResponse, + ServiceListResponsesSinglePage as ServiceListResponsesSinglePage, + type ServiceListParams as ServiceListParams, + }; + + export { + AddressMaps as AddressMaps, + type AddressMap as AddressMap, + type Kind as Kind, + type AddressMapCreateResponse as AddressMapCreateResponse, + type AddressMapDeleteResponse as AddressMapDeleteResponse, + type AddressMapGetResponse as AddressMapGetResponse, + AddressMapsSinglePage as AddressMapsSinglePage, + type AddressMapCreateParams as AddressMapCreateParams, + type AddressMapListParams as AddressMapListParams, + type AddressMapDeleteParams as AddressMapDeleteParams, + type AddressMapEditParams as AddressMapEditParams, + type AddressMapGetParams as AddressMapGetParams, + }; + + export { + LOADocuments as LOADocuments, + type LOADocumentCreateResponse as LOADocumentCreateResponse, + type LOADocumentCreateParams as LOADocumentCreateParams, + type LOADocumentGetParams as LOADocumentGetParams, + }; + + export { + Prefixes as Prefixes, + type Prefix as Prefix, + type PrefixDeleteResponse as PrefixDeleteResponse, + PrefixesSinglePage as PrefixesSinglePage, + type PrefixCreateParams as PrefixCreateParams, + type PrefixListParams as PrefixListParams, + type PrefixDeleteParams as PrefixDeleteParams, + type PrefixEditParams as PrefixEditParams, + type PrefixGetParams as PrefixGetParams, + }; } diff --git a/src/resources/addressing/index.ts b/src/resources/addressing/index.ts index ce13d9565a..6b64a96cdf 100644 --- a/src/resources/addressing/index.ts +++ b/src/resources/addressing/index.ts @@ -1,44 +1,54 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AddressMap, - Kind, - AddressMapCreateResponse, - AddressMapDeleteResponse, - AddressMapGetResponse, - AddressMapCreateParams, - AddressMapListParams, - AddressMapDeleteParams, - AddressMapEditParams, - AddressMapGetParams, AddressMapsSinglePage, AddressMaps, + type AddressMap, + type Kind, + type AddressMapCreateResponse, + type AddressMapDeleteResponse, + type AddressMapGetResponse, + type AddressMapCreateParams, + type AddressMapListParams, + type AddressMapDeleteParams, + type AddressMapEditParams, + type AddressMapGetParams, } from './address-maps/index'; export { Addressing } from './addressing'; -export { LOADocumentCreateResponse, LOADocumentCreateParams, LOADocuments } from './loa-documents/index'; export { - Prefix, - PrefixDeleteResponse, - PrefixCreateParams, - PrefixListParams, - PrefixDeleteParams, - PrefixEditParams, - PrefixGetParams, + LOADocuments, + type LOADocumentCreateResponse, + type LOADocumentCreateParams, + type LOADocumentGetParams, +} from './loa-documents'; +export { PrefixesSinglePage, Prefixes, + type Prefix, + type PrefixDeleteResponse, + type PrefixCreateParams, + type PrefixListParams, + type PrefixDeleteParams, + type PrefixEditParams, + type PrefixGetParams, } from './prefixes/index'; export { - RegionalHostnameCreateResponse, - RegionalHostnameListResponse, - RegionalHostnameDeleteResponse, - RegionalHostnameEditResponse, - RegionalHostnameGetResponse, - RegionalHostnameCreateParams, - RegionalHostnameListParams, - RegionalHostnameDeleteParams, - RegionalHostnameEditParams, - RegionalHostnameGetParams, RegionalHostnameListResponsesSinglePage, RegionalHostnames, + type RegionalHostnameCreateResponse, + type RegionalHostnameListResponse, + type RegionalHostnameDeleteResponse, + type RegionalHostnameEditResponse, + type RegionalHostnameGetResponse, + type RegionalHostnameCreateParams, + type RegionalHostnameListParams, + type RegionalHostnameDeleteParams, + type RegionalHostnameEditParams, + type RegionalHostnameGetParams, } from './regional-hostnames/index'; -export { ServiceListResponse, ServiceListParams, ServiceListResponsesSinglePage, Services } from './services'; +export { + ServiceListResponsesSinglePage, + Services, + type ServiceListResponse, + type ServiceListParams, +} from './services'; diff --git a/src/resources/addressing/loa-documents.ts b/src/resources/addressing/loa-documents.ts new file mode 100644 index 0000000000..ba1b9a39f8 --- /dev/null +++ b/src/resources/addressing/loa-documents.ts @@ -0,0 +1,100 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { type Response } from '../../_shims/index'; + +export class LOADocuments extends APIResource { + /** + * Submit LOA document (pdf format) under the account. + */ + create( + params: LOADocumentCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post( + `/accounts/${account_id}/addressing/loa_documents`, + Core.multipartFormRequestOptions({ body, ...options }), + ) as Core.APIPromise<{ result: LOADocumentCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Download specified LOA document under the account. + */ + get( + loaDocumentId: string | null, + params: LOADocumentGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.get(`/accounts/${account_id}/addressing/loa_documents/${loaDocumentId}/download`, { + ...options, + headers: { Accept: 'application/pdf', ...options?.headers }, + __binaryResponse: true, + }); + } +} + +export interface LOADocumentCreateResponse { + /** + * Identifier for the uploaded LOA document. + */ + id?: string | null; + + /** + * Identifier of a Cloudflare account. + */ + account_id?: string; + + created?: string; + + /** + * Name of LOA document. Max file size 10MB, and supported filetype is pdf. + */ + filename?: string; + + /** + * File size of the uploaded LOA document. + */ + size_bytes?: number; + + /** + * Whether the LOA has been verified by Cloudflare staff. + */ + verified?: boolean; + + /** + * Timestamp of the moment the LOA was marked as validated. + */ + verified_at?: string | null; +} + +export interface LOADocumentCreateParams { + /** + * Path param: Identifier of a Cloudflare account. + */ + account_id: string; + + /** + * Body param: LOA document to upload. + */ + loa_document: string; +} + +export interface LOADocumentGetParams { + /** + * Identifier of a Cloudflare account. + */ + account_id: string; +} + +export declare namespace LOADocuments { + export { + type LOADocumentCreateResponse as LOADocumentCreateResponse, + type LOADocumentCreateParams as LOADocumentCreateParams, + type LOADocumentGetParams as LOADocumentGetParams, + }; +} diff --git a/src/resources/addressing/loa-documents/downloads.ts b/src/resources/addressing/loa-documents/downloads.ts deleted file mode 100644 index 3cb8be1d83..0000000000 --- a/src/resources/addressing/loa-documents/downloads.ts +++ /dev/null @@ -1,34 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as DownloadsAPI from './downloads'; -import { type Response } from '../../../_shims/index'; - -export class Downloads extends APIResource { - /** - * Download specified LOA document under the account. - */ - get( - loaDocumentId: string | null, - params: DownloadGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return this._client.get(`/accounts/${account_id}/addressing/loa_documents/${loaDocumentId}/download`, { - ...options, - __binaryResponse: true, - }); - } -} - -export interface DownloadGetParams { - /** - * Identifier - */ - account_id: string; -} - -export namespace Downloads { - export import DownloadGetParams = DownloadsAPI.DownloadGetParams; -} diff --git a/src/resources/addressing/loa-documents/index.ts b/src/resources/addressing/loa-documents/index.ts deleted file mode 100644 index 40c4791998..0000000000 --- a/src/resources/addressing/loa-documents/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { DownloadGetParams, Downloads } from './downloads'; -export { LOADocumentCreateResponse, LOADocumentCreateParams, LOADocuments } from './loa-documents'; diff --git a/src/resources/addressing/loa-documents/loa-documents.ts b/src/resources/addressing/loa-documents/loa-documents.ts deleted file mode 100644 index d3275ba16c..0000000000 --- a/src/resources/addressing/loa-documents/loa-documents.ts +++ /dev/null @@ -1,52 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as LOADocumentsAPI from './loa-documents'; -import * as DownloadsAPI from './downloads'; - -export class LOADocuments extends APIResource { - downloads: DownloadsAPI.Downloads = new DownloadsAPI.Downloads(this._client); - - /** - * Submit LOA document (pdf format) under the account. - */ - create( - params: LOADocumentCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.post( - `/accounts/${account_id}/addressing/loa_documents`, - Core.multipartFormRequestOptions({ body, ...options }), - ) as Core.APIPromise<{ result: LOADocumentCreateResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export interface LOADocumentCreateResponse { - /** - * Name of LOA document. - */ - filename?: string; -} - -export interface LOADocumentCreateParams { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: LOA document to upload. - */ - loa_document: string; -} - -export namespace LOADocuments { - export import LOADocumentCreateResponse = LOADocumentsAPI.LOADocumentCreateResponse; - export import LOADocumentCreateParams = LOADocumentsAPI.LOADocumentCreateParams; - export import Downloads = DownloadsAPI.Downloads; - export import DownloadGetParams = DownloadsAPI.DownloadGetParams; -} diff --git a/src/resources/addressing/prefixes/advertisement-status.ts b/src/resources/addressing/prefixes/advertisement-status.ts new file mode 100644 index 0000000000..73a0c2a1e5 --- /dev/null +++ b/src/resources/addressing/prefixes/advertisement-status.ts @@ -0,0 +1,103 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class AdvertisementStatus extends APIResource { + /** + * Advertise or withdraw the BGP route for a prefix. + * + * **Deprecated:** Prefer the BGP Prefixes endpoints, which additionally allow for + * advertising and withdrawing subnets of an IP prefix. + */ + edit( + prefixId: string, + params: AdvertisementStatusEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/addressing/prefixes/${prefixId}/bgp/status`, { + body, + ...options, + }) as Core.APIPromise<{ result: AdvertisementStatusEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * View the current advertisement state for a prefix. + * + * **Deprecated:** Prefer the BGP Prefixes endpoints, which additionally allow for + * advertising and withdrawing subnets of an IP prefix. + */ + get( + prefixId: string, + params: AdvertisementStatusGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/addressing/prefixes/${prefixId}/bgp/status`, + options, + ) as Core.APIPromise<{ result: AdvertisementStatusGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface AdvertisementStatusEditResponse { + /** + * Advertisement status of the prefix. If `true`, the BGP route for the prefix is + * advertised to the Internet. If `false`, the BGP route is withdrawn. + */ + advertised?: boolean; + + /** + * Last time the advertisement status was changed. This field is only not 'null' if + * on demand is enabled. + */ + advertised_modified_at?: string | null; +} + +export interface AdvertisementStatusGetResponse { + /** + * Advertisement status of the prefix. If `true`, the BGP route for the prefix is + * advertised to the Internet. If `false`, the BGP route is withdrawn. + */ + advertised?: boolean; + + /** + * Last time the advertisement status was changed. This field is only not 'null' if + * on demand is enabled. + */ + advertised_modified_at?: string | null; +} + +export interface AdvertisementStatusEditParams { + /** + * Path param: Identifier of a Cloudflare account. + */ + account_id: string; + + /** + * Body param: Advertisement status of the prefix. If `true`, the BGP route for the + * prefix is advertised to the Internet. If `false`, the BGP route is withdrawn. + */ + advertised: boolean; +} + +export interface AdvertisementStatusGetParams { + /** + * Identifier of a Cloudflare account. + */ + account_id: string; +} + +export declare namespace AdvertisementStatus { + export { + type AdvertisementStatusEditResponse as AdvertisementStatusEditResponse, + type AdvertisementStatusGetResponse as AdvertisementStatusGetResponse, + type AdvertisementStatusEditParams as AdvertisementStatusEditParams, + type AdvertisementStatusGetParams as AdvertisementStatusGetParams, + }; +} diff --git a/src/resources/addressing/prefixes/bgp/prefixes.ts b/src/resources/addressing/prefixes/bgp-prefixes.ts similarity index 64% rename from src/resources/addressing/prefixes/bgp/prefixes.ts rename to src/resources/addressing/prefixes/bgp-prefixes.ts index e987f384ec..a49a099a4b 100644 --- a/src/resources/addressing/prefixes/bgp/prefixes.ts +++ b/src/resources/addressing/prefixes/bgp-prefixes.ts @@ -1,11 +1,29 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../../resource'; -import * as Core from '../../../../core'; -import * as PrefixesAPI from './prefixes'; -import { SinglePage } from '../../../../pagination'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { SinglePage } from '../../../pagination'; + +export class BGPPrefixes extends APIResource { + /** + * Create a BGP prefix, controlling the BGP advertisement status of a specific + * subnet. When created, BGP prefixes are initially withdrawn, and can be + * advertised with the Update BGP Prefix API. + */ + create( + prefixId: string, + params: BGPPrefixCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/addressing/prefixes/${prefixId}/bgp/prefixes`, { + body, + ...options, + }) as Core.APIPromise<{ result: BGPPrefix }> + )._thenUnwrap((obj) => obj.result); + } -export class Prefixes extends APIResource { /** * List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to * control which specific subnets are advertised to the Internet. It is possible to @@ -14,7 +32,7 @@ export class Prefixes extends APIResource { */ list( prefixId: string, - params: PrefixListParams, + params: BGPPrefixListParams, options?: Core.RequestOptions, ): Core.PagePromise { const { account_id } = params; @@ -32,7 +50,7 @@ export class Prefixes extends APIResource { edit( prefixId: string, bgpPrefixId: string, - params: PrefixEditParams, + params: BGPPrefixEditParams, options?: Core.RequestOptions, ): Core.APIPromise { const { account_id, ...body } = params; @@ -50,7 +68,7 @@ export class Prefixes extends APIResource { get( prefixId: string, bgpPrefixId: string, - params: PrefixGetParams, + params: BGPPrefixGetParams, options?: Core.RequestOptions, ): Core.APIPromise { const { account_id } = params; @@ -67,7 +85,7 @@ export class BGPPrefixesSinglePage extends SinglePage {} export interface BGPPrefix { /** - * Identifier + * Identifier of BGP Prefix. */ id?: string; @@ -132,42 +150,59 @@ export namespace BGPPrefix { } } -export interface PrefixListParams { +export interface BGPPrefixCreateParams { + /** + * Path param: Identifier of a Cloudflare account. + */ + account_id: string; + + /** + * Body param: IP Prefix in Classless Inter-Domain Routing format. + */ + cidr?: string; +} + +export interface BGPPrefixListParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export interface PrefixEditParams { +export interface BGPPrefixEditParams { /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; /** * Body param: */ - on_demand?: PrefixEditParams.OnDemand; + on_demand?: BGPPrefixEditParams.OnDemand; } -export namespace PrefixEditParams { +export namespace BGPPrefixEditParams { export interface OnDemand { advertised?: boolean; } } -export interface PrefixGetParams { +export interface BGPPrefixGetParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export namespace Prefixes { - export import BGPPrefix = PrefixesAPI.BGPPrefix; - export import BGPPrefixesSinglePage = PrefixesAPI.BGPPrefixesSinglePage; - export import PrefixListParams = PrefixesAPI.PrefixListParams; - export import PrefixEditParams = PrefixesAPI.PrefixEditParams; - export import PrefixGetParams = PrefixesAPI.PrefixGetParams; +BGPPrefixes.BGPPrefixesSinglePage = BGPPrefixesSinglePage; + +export declare namespace BGPPrefixes { + export { + type BGPPrefix as BGPPrefix, + BGPPrefixesSinglePage as BGPPrefixesSinglePage, + type BGPPrefixCreateParams as BGPPrefixCreateParams, + type BGPPrefixListParams as BGPPrefixListParams, + type BGPPrefixEditParams as BGPPrefixEditParams, + type BGPPrefixGetParams as BGPPrefixGetParams, + }; } diff --git a/src/resources/addressing/prefixes/bgp/bgp.ts b/src/resources/addressing/prefixes/bgp/bgp.ts deleted file mode 100644 index a6c0766ac7..0000000000 --- a/src/resources/addressing/prefixes/bgp/bgp.ts +++ /dev/null @@ -1,34 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../../resource'; -import * as BindingsAPI from './bindings'; -import * as PrefixesAPI from './prefixes'; -import * as StatusesAPI from './statuses'; - -export class BGP extends APIResource { - bindings: BindingsAPI.Bindings = new BindingsAPI.Bindings(this._client); - prefixes: PrefixesAPI.Prefixes = new PrefixesAPI.Prefixes(this._client); - statuses: StatusesAPI.Statuses = new StatusesAPI.Statuses(this._client); -} - -export namespace BGP { - export import Bindings = BindingsAPI.Bindings; - export import ServiceBinding = BindingsAPI.ServiceBinding; - export import BindingDeleteResponse = BindingsAPI.BindingDeleteResponse; - export import ServiceBindingsSinglePage = BindingsAPI.ServiceBindingsSinglePage; - export import BindingCreateParams = BindingsAPI.BindingCreateParams; - export import BindingListParams = BindingsAPI.BindingListParams; - export import BindingDeleteParams = BindingsAPI.BindingDeleteParams; - export import BindingGetParams = BindingsAPI.BindingGetParams; - export import Prefixes = PrefixesAPI.Prefixes; - export import BGPPrefix = PrefixesAPI.BGPPrefix; - export import BGPPrefixesSinglePage = PrefixesAPI.BGPPrefixesSinglePage; - export import PrefixListParams = PrefixesAPI.PrefixListParams; - export import PrefixEditParams = PrefixesAPI.PrefixEditParams; - export import PrefixGetParams = PrefixesAPI.PrefixGetParams; - export import Statuses = StatusesAPI.Statuses; - export import StatusEditResponse = StatusesAPI.StatusEditResponse; - export import StatusGetResponse = StatusesAPI.StatusGetResponse; - export import StatusEditParams = StatusesAPI.StatusEditParams; - export import StatusGetParams = StatusesAPI.StatusGetParams; -} diff --git a/src/resources/addressing/prefixes/bgp/index.ts b/src/resources/addressing/prefixes/bgp/index.ts deleted file mode 100644 index 2ac5233947..0000000000 --- a/src/resources/addressing/prefixes/bgp/index.ts +++ /dev/null @@ -1,28 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { BGP } from './bgp'; -export { - BGPPrefix, - PrefixListParams, - PrefixEditParams, - PrefixGetParams, - BGPPrefixesSinglePage, - Prefixes, -} from './prefixes'; -export { - ServiceBinding, - BindingDeleteResponse, - BindingCreateParams, - BindingListParams, - BindingDeleteParams, - BindingGetParams, - ServiceBindingsSinglePage, - Bindings, -} from './bindings'; -export { - StatusEditResponse, - StatusGetResponse, - StatusEditParams, - StatusGetParams, - Statuses, -} from './statuses'; diff --git a/src/resources/addressing/prefixes/bgp/statuses.ts b/src/resources/addressing/prefixes/bgp/statuses.ts deleted file mode 100644 index 524257b5b5..0000000000 --- a/src/resources/addressing/prefixes/bgp/statuses.ts +++ /dev/null @@ -1,93 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../../resource'; -import * as Core from '../../../../core'; -import * as StatusesAPI from './statuses'; - -export class Statuses extends APIResource { - /** - * Advertise or withdraw BGP route for a prefix. - */ - edit( - prefixId: string, - params: StatusEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.patch(`/accounts/${account_id}/addressing/prefixes/${prefixId}/bgp/status`, { - body, - ...options, - }) as Core.APIPromise<{ result: StatusEditResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * List the current advertisement state for a prefix. - */ - get( - prefixId: string, - params: StatusGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get( - `/accounts/${account_id}/addressing/prefixes/${prefixId}/bgp/status`, - options, - ) as Core.APIPromise<{ result: StatusGetResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export interface StatusEditResponse { - /** - * Enablement of prefix advertisement to the Internet. - */ - advertised?: boolean; - - /** - * Last time the advertisement status was changed. This field is only not 'null' if - * on demand is enabled. - */ - advertised_modified_at?: string | null; -} - -export interface StatusGetResponse { - /** - * Enablement of prefix advertisement to the Internet. - */ - advertised?: boolean; - - /** - * Last time the advertisement status was changed. This field is only not 'null' if - * on demand is enabled. - */ - advertised_modified_at?: string | null; -} - -export interface StatusEditParams { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: Enablement of prefix advertisement to the Internet. - */ - advertised: boolean; -} - -export interface StatusGetParams { - /** - * Identifier - */ - account_id: string; -} - -export namespace Statuses { - export import StatusEditResponse = StatusesAPI.StatusEditResponse; - export import StatusGetResponse = StatusesAPI.StatusGetResponse; - export import StatusEditParams = StatusesAPI.StatusEditParams; - export import StatusGetParams = StatusesAPI.StatusGetParams; -} diff --git a/src/resources/addressing/prefixes/delegations.ts b/src/resources/addressing/prefixes/delegations.ts index 5eb3880d2e..7566c99df8 100644 --- a/src/resources/addressing/prefixes/delegations.ts +++ b/src/resources/addressing/prefixes/delegations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as DelegationsAPI from './delegations'; import { SinglePage } from '../../../pagination'; export class Delegations extends APIResource { @@ -62,7 +61,7 @@ export class DelegationsSinglePage extends SinglePage {} export interface Delegations { /** - * Delegation identifier tag. + * Identifier of a Delegation. */ id?: string; @@ -81,21 +80,21 @@ export interface Delegations { modified_at?: string; /** - * Identifier + * Identifier of an IP Prefix. */ parent_prefix_id?: string; } export interface DelegationDeleteResponse { /** - * Delegation identifier tag. + * Identifier of a Delegation. */ id?: string; } export interface DelegationCreateParams { /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; @@ -113,23 +112,27 @@ export interface DelegationCreateParams { export interface DelegationListParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } export interface DelegationDeleteParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export namespace Delegations { - export import Delegations = DelegationsAPI.Delegations; - export import DelegationDeleteResponse = DelegationsAPI.DelegationDeleteResponse; - export import DelegationsSinglePage = DelegationsAPI.DelegationsSinglePage; - export import DelegationCreateParams = DelegationsAPI.DelegationCreateParams; - export import DelegationListParams = DelegationsAPI.DelegationListParams; - export import DelegationDeleteParams = DelegationsAPI.DelegationDeleteParams; +Delegations.DelegationsSinglePage = DelegationsSinglePage; + +export declare namespace Delegations { + export { + type Delegations as Delegations, + type DelegationDeleteResponse as DelegationDeleteResponse, + DelegationsSinglePage as DelegationsSinglePage, + type DelegationCreateParams as DelegationCreateParams, + type DelegationListParams as DelegationListParams, + type DelegationDeleteParams as DelegationDeleteParams, + }; } diff --git a/src/resources/addressing/prefixes/index.ts b/src/resources/addressing/prefixes/index.ts index f5c6f15ce2..1448718c77 100644 --- a/src/resources/addressing/prefixes/index.ts +++ b/src/resources/addressing/prefixes/index.ts @@ -1,22 +1,47 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { BGP } from './bgp/index'; export { - Delegations, - DelegationDeleteResponse, - DelegationCreateParams, - DelegationListParams, - DelegationDeleteParams, + AdvertisementStatus, + type AdvertisementStatusEditResponse, + type AdvertisementStatusGetResponse, + type AdvertisementStatusEditParams, + type AdvertisementStatusGetParams, +} from './advertisement-status'; +export { + BGPPrefixesSinglePage, + BGPPrefixes, + type BGPPrefix, + type BGPPrefixCreateParams, + type BGPPrefixListParams, + type BGPPrefixEditParams, + type BGPPrefixGetParams, +} from './bgp-prefixes'; +export { DelegationsSinglePage, + Delegations, + type DelegationDeleteResponse, + type DelegationCreateParams, + type DelegationListParams, + type DelegationDeleteParams, } from './delegations'; export { - Prefix, - PrefixDeleteResponse, - PrefixCreateParams, - PrefixListParams, - PrefixDeleteParams, - PrefixEditParams, - PrefixGetParams, PrefixesSinglePage, Prefixes, + type Prefix, + type PrefixDeleteResponse, + type PrefixCreateParams, + type PrefixListParams, + type PrefixDeleteParams, + type PrefixEditParams, + type PrefixGetParams, } from './prefixes'; +export { + ServiceBindingsSinglePage, + ServiceBindings, + type ServiceBinding, + type ServiceBindingDeleteResponse, + type ServiceBindingCreateParams, + type ServiceBindingListParams, + type ServiceBindingDeleteParams, + type ServiceBindingGetParams, +} from './service-bindings'; diff --git a/src/resources/addressing/prefixes/prefixes.ts b/src/resources/addressing/prefixes/prefixes.ts index ed4872a2bd..e3389f7360 100644 --- a/src/resources/addressing/prefixes/prefixes.ts +++ b/src/resources/addressing/prefixes/prefixes.ts @@ -2,13 +2,52 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as PrefixesAPI from './prefixes'; +import * as Shared from '../../shared'; +import * as AdvertisementStatusAPI from './advertisement-status'; +import { + AdvertisementStatus, + AdvertisementStatusEditParams, + AdvertisementStatusEditResponse, + AdvertisementStatusGetParams, + AdvertisementStatusGetResponse, +} from './advertisement-status'; +import * as BGPPrefixesAPI from './bgp-prefixes'; +import { + BGPPrefix, + BGPPrefixCreateParams, + BGPPrefixEditParams, + BGPPrefixGetParams, + BGPPrefixListParams, + BGPPrefixes, + BGPPrefixesSinglePage, +} from './bgp-prefixes'; import * as DelegationsAPI from './delegations'; -import * as BGPAPI from './bgp/bgp'; +import { + DelegationCreateParams, + DelegationDeleteParams, + DelegationDeleteResponse, + DelegationListParams, + Delegations, + DelegationsSinglePage, +} from './delegations'; +import * as ServiceBindingsAPI from './service-bindings'; +import { + ServiceBinding, + ServiceBindingCreateParams, + ServiceBindingDeleteParams, + ServiceBindingDeleteResponse, + ServiceBindingGetParams, + ServiceBindingListParams, + ServiceBindings, + ServiceBindingsSinglePage, +} from './service-bindings'; import { SinglePage } from '../../../pagination'; export class Prefixes extends APIResource { - bgp: BGPAPI.BGP = new BGPAPI.BGP(this._client); + serviceBindings: ServiceBindingsAPI.ServiceBindings = new ServiceBindingsAPI.ServiceBindings(this._client); + bgpPrefixes: BGPPrefixesAPI.BGPPrefixes = new BGPPrefixesAPI.BGPPrefixes(this._client); + advertisementStatus: AdvertisementStatusAPI.AdvertisementStatus = + new AdvertisementStatusAPI.AdvertisementStatus(this._client); delegations: DelegationsAPI.Delegations = new DelegationsAPI.Delegations(this._client); /** @@ -46,14 +85,9 @@ export class Prefixes extends APIResource { prefixId: string, params: PrefixDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/addressing/prefixes/${prefixId}`, - options, - ) as Core.APIPromise<{ result: PrefixDeleteResponse | null }> - )._thenUnwrap((obj) => obj.result); + return this._client.delete(`/accounts/${account_id}/addressing/prefixes/${prefixId}`, options); } /** @@ -87,12 +121,12 @@ export class PrefixesSinglePage extends SinglePage {} export interface Prefix { /** - * Identifier + * Identifier of an IP Prefix. */ id?: string; /** - * Identifier + * Identifier of a Cloudflare account. */ account_id?: string; @@ -150,11 +184,46 @@ export interface Prefix { on_demand_locked?: boolean; } -export type PrefixDeleteResponse = Array; +export interface PrefixDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result_info?: PrefixDeleteResponse.ResultInfo; +} + +export namespace PrefixDeleteResponse { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } +} export interface PrefixCreateParams { /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; @@ -176,21 +245,21 @@ export interface PrefixCreateParams { export interface PrefixListParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } export interface PrefixDeleteParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } export interface PrefixEditParams { /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; @@ -202,25 +271,66 @@ export interface PrefixEditParams { export interface PrefixGetParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export namespace Prefixes { - export import Prefix = PrefixesAPI.Prefix; - export import PrefixDeleteResponse = PrefixesAPI.PrefixDeleteResponse; - export import PrefixesSinglePage = PrefixesAPI.PrefixesSinglePage; - export import PrefixCreateParams = PrefixesAPI.PrefixCreateParams; - export import PrefixListParams = PrefixesAPI.PrefixListParams; - export import PrefixDeleteParams = PrefixesAPI.PrefixDeleteParams; - export import PrefixEditParams = PrefixesAPI.PrefixEditParams; - export import PrefixGetParams = PrefixesAPI.PrefixGetParams; - export import BGP = BGPAPI.BGP; - export import Delegations = DelegationsAPI.Delegations; - export import DelegationDeleteResponse = DelegationsAPI.DelegationDeleteResponse; - export import DelegationsSinglePage = DelegationsAPI.DelegationsSinglePage; - export import DelegationCreateParams = DelegationsAPI.DelegationCreateParams; - export import DelegationListParams = DelegationsAPI.DelegationListParams; - export import DelegationDeleteParams = DelegationsAPI.DelegationDeleteParams; +Prefixes.PrefixesSinglePage = PrefixesSinglePage; +Prefixes.ServiceBindings = ServiceBindings; +Prefixes.ServiceBindingsSinglePage = ServiceBindingsSinglePage; +Prefixes.BGPPrefixes = BGPPrefixes; +Prefixes.BGPPrefixesSinglePage = BGPPrefixesSinglePage; +Prefixes.AdvertisementStatus = AdvertisementStatus; +Prefixes.DelegationsSinglePage = DelegationsSinglePage; + +export declare namespace Prefixes { + export { + type Prefix as Prefix, + type PrefixDeleteResponse as PrefixDeleteResponse, + PrefixesSinglePage as PrefixesSinglePage, + type PrefixCreateParams as PrefixCreateParams, + type PrefixListParams as PrefixListParams, + type PrefixDeleteParams as PrefixDeleteParams, + type PrefixEditParams as PrefixEditParams, + type PrefixGetParams as PrefixGetParams, + }; + + export { + ServiceBindings as ServiceBindings, + type ServiceBinding as ServiceBinding, + type ServiceBindingDeleteResponse as ServiceBindingDeleteResponse, + ServiceBindingsSinglePage as ServiceBindingsSinglePage, + type ServiceBindingCreateParams as ServiceBindingCreateParams, + type ServiceBindingListParams as ServiceBindingListParams, + type ServiceBindingDeleteParams as ServiceBindingDeleteParams, + type ServiceBindingGetParams as ServiceBindingGetParams, + }; + + export { + BGPPrefixes as BGPPrefixes, + type BGPPrefix as BGPPrefix, + BGPPrefixesSinglePage as BGPPrefixesSinglePage, + type BGPPrefixCreateParams as BGPPrefixCreateParams, + type BGPPrefixListParams as BGPPrefixListParams, + type BGPPrefixEditParams as BGPPrefixEditParams, + type BGPPrefixGetParams as BGPPrefixGetParams, + }; + + export { + AdvertisementStatus as AdvertisementStatus, + type AdvertisementStatusEditResponse as AdvertisementStatusEditResponse, + type AdvertisementStatusGetResponse as AdvertisementStatusGetResponse, + type AdvertisementStatusEditParams as AdvertisementStatusEditParams, + type AdvertisementStatusGetParams as AdvertisementStatusGetParams, + }; + + export { + type Delegations as Delegations, + type DelegationDeleteResponse as DelegationDeleteResponse, + DelegationsSinglePage as DelegationsSinglePage, + type DelegationCreateParams as DelegationCreateParams, + type DelegationListParams as DelegationListParams, + type DelegationDeleteParams as DelegationDeleteParams, + }; } diff --git a/src/resources/addressing/prefixes/bgp/bindings.ts b/src/resources/addressing/prefixes/service-bindings.ts similarity index 68% rename from src/resources/addressing/prefixes/bgp/bindings.ts rename to src/resources/addressing/prefixes/service-bindings.ts index d7b46f66ba..763fe5c7ff 100644 --- a/src/resources/addressing/prefixes/bgp/bindings.ts +++ b/src/resources/addressing/prefixes/service-bindings.ts @@ -1,12 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../../resource'; -import * as Core from '../../../../core'; -import * as BindingsAPI from './bindings'; -import * as Shared from '../../../shared'; -import { SinglePage } from '../../../../pagination'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as Shared from '../../shared'; +import { SinglePage } from '../../../pagination'; -export class Bindings extends APIResource { +export class ServiceBindings extends APIResource { /** * 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 @@ -15,7 +14,7 @@ export class Bindings extends APIResource { */ create( prefixId: string, - params: BindingCreateParams, + params: ServiceBindingCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { const { account_id, ...body } = params; @@ -37,7 +36,7 @@ export class Bindings extends APIResource { */ list( prefixId: string, - params: BindingListParams, + params: ServiceBindingListParams, options?: Core.RequestOptions, ): Core.PagePromise { const { account_id } = params; @@ -54,9 +53,9 @@ export class Bindings extends APIResource { delete( prefixId: string, bindingId: string, - params: BindingDeleteParams, + params: ServiceBindingDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return this._client.delete( `/accounts/${account_id}/addressing/prefixes/${prefixId}/bindings/${bindingId}`, @@ -70,7 +69,7 @@ export class Bindings extends APIResource { get( prefixId: string, bindingId: string, - params: BindingGetParams, + params: ServiceBindingGetParams, options?: Core.RequestOptions, ): Core.APIPromise { const { account_id } = params; @@ -87,7 +86,7 @@ export class ServiceBindingsSinglePage extends SinglePage {} export interface ServiceBinding { /** - * Identifier + * Identifier of a Service Binding. */ id?: string; @@ -102,7 +101,8 @@ export interface ServiceBinding { provisioning?: ServiceBinding.Provisioning; /** - * Identifier + * Identifier of a Service on the Cloudflare network. Available services and their + * IDs may be found in the **List Services** endpoint. */ service_id?: string; @@ -125,7 +125,7 @@ export namespace ServiceBinding { } } -export interface BindingDeleteResponse { +export interface ServiceBindingDeleteResponse { errors: Array; messages: Array; @@ -136,9 +136,9 @@ export interface BindingDeleteResponse { success: true; } -export interface BindingCreateParams { +export interface ServiceBindingCreateParams { /** - * Path param: Identifier + * Path param: Identifier of a Cloudflare account. */ account_id: string; @@ -148,38 +148,43 @@ export interface BindingCreateParams { cidr?: string; /** - * Body param: Identifier + * Body param: Identifier of a Service on the Cloudflare network. Available + * services and their IDs may be found in the **List Services** endpoint. */ service_id?: string; } -export interface BindingListParams { +export interface ServiceBindingListParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export interface BindingDeleteParams { +export interface ServiceBindingDeleteParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export interface BindingGetParams { +export interface ServiceBindingGetParams { /** - * Identifier + * Identifier of a Cloudflare account. */ account_id: string; } -export namespace Bindings { - export import ServiceBinding = BindingsAPI.ServiceBinding; - export import BindingDeleteResponse = BindingsAPI.BindingDeleteResponse; - export import ServiceBindingsSinglePage = BindingsAPI.ServiceBindingsSinglePage; - export import BindingCreateParams = BindingsAPI.BindingCreateParams; - export import BindingListParams = BindingsAPI.BindingListParams; - export import BindingDeleteParams = BindingsAPI.BindingDeleteParams; - export import BindingGetParams = BindingsAPI.BindingGetParams; +ServiceBindings.ServiceBindingsSinglePage = ServiceBindingsSinglePage; + +export declare namespace ServiceBindings { + export { + type ServiceBinding as ServiceBinding, + type ServiceBindingDeleteResponse as ServiceBindingDeleteResponse, + ServiceBindingsSinglePage as ServiceBindingsSinglePage, + type ServiceBindingCreateParams as ServiceBindingCreateParams, + type ServiceBindingListParams as ServiceBindingListParams, + type ServiceBindingDeleteParams as ServiceBindingDeleteParams, + type ServiceBindingGetParams as ServiceBindingGetParams, + }; } diff --git a/src/resources/addressing/regional-hostnames/index.ts b/src/resources/addressing/regional-hostnames/index.ts index b283fd5c16..527ec41ccf 100644 --- a/src/resources/addressing/regional-hostnames/index.ts +++ b/src/resources/addressing/regional-hostnames/index.ts @@ -1,17 +1,22 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { RegionListResponse, RegionListParams, RegionListResponsesSinglePage, Regions } from './regions'; export { - RegionalHostnameCreateResponse, - RegionalHostnameListResponse, - RegionalHostnameDeleteResponse, - RegionalHostnameEditResponse, - RegionalHostnameGetResponse, - RegionalHostnameCreateParams, - RegionalHostnameListParams, - RegionalHostnameDeleteParams, - RegionalHostnameEditParams, - RegionalHostnameGetParams, + RegionListResponsesSinglePage, + Regions, + type RegionListResponse, + type RegionListParams, +} from './regions'; +export { RegionalHostnameListResponsesSinglePage, RegionalHostnames, + type RegionalHostnameCreateResponse, + type RegionalHostnameListResponse, + type RegionalHostnameDeleteResponse, + type RegionalHostnameEditResponse, + type RegionalHostnameGetResponse, + type RegionalHostnameCreateParams, + type RegionalHostnameListParams, + type RegionalHostnameDeleteParams, + type RegionalHostnameEditParams, + type RegionalHostnameGetParams, } from './regional-hostnames'; diff --git a/src/resources/addressing/regional-hostnames/regional-hostnames.ts b/src/resources/addressing/regional-hostnames/regional-hostnames.ts index 5845077ed0..3c3b0c2162 100644 --- a/src/resources/addressing/regional-hostnames/regional-hostnames.ts +++ b/src/resources/addressing/regional-hostnames/regional-hostnames.ts @@ -2,9 +2,9 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as RegionalHostnamesAPI from './regional-hostnames'; import * as Shared from '../../shared'; import * as RegionsAPI from './regions'; +import { RegionListParams, RegionListResponse, RegionListResponsesSinglePage, Regions } from './regions'; import { SinglePage } from '../../../pagination'; export class RegionalHostnames extends APIResource { @@ -228,20 +228,29 @@ export interface RegionalHostnameGetParams { zone_id: string; } -export namespace RegionalHostnames { - export import RegionalHostnameCreateResponse = RegionalHostnamesAPI.RegionalHostnameCreateResponse; - export import RegionalHostnameListResponse = RegionalHostnamesAPI.RegionalHostnameListResponse; - export import RegionalHostnameDeleteResponse = RegionalHostnamesAPI.RegionalHostnameDeleteResponse; - export import RegionalHostnameEditResponse = RegionalHostnamesAPI.RegionalHostnameEditResponse; - export import RegionalHostnameGetResponse = RegionalHostnamesAPI.RegionalHostnameGetResponse; - export import RegionalHostnameListResponsesSinglePage = RegionalHostnamesAPI.RegionalHostnameListResponsesSinglePage; - export import RegionalHostnameCreateParams = RegionalHostnamesAPI.RegionalHostnameCreateParams; - export import RegionalHostnameListParams = RegionalHostnamesAPI.RegionalHostnameListParams; - export import RegionalHostnameDeleteParams = RegionalHostnamesAPI.RegionalHostnameDeleteParams; - export import RegionalHostnameEditParams = RegionalHostnamesAPI.RegionalHostnameEditParams; - export import RegionalHostnameGetParams = RegionalHostnamesAPI.RegionalHostnameGetParams; - export import Regions = RegionsAPI.Regions; - export import RegionListResponse = RegionsAPI.RegionListResponse; - export import RegionListResponsesSinglePage = RegionsAPI.RegionListResponsesSinglePage; - export import RegionListParams = RegionsAPI.RegionListParams; +RegionalHostnames.RegionalHostnameListResponsesSinglePage = RegionalHostnameListResponsesSinglePage; +RegionalHostnames.Regions = Regions; +RegionalHostnames.RegionListResponsesSinglePage = RegionListResponsesSinglePage; + +export declare namespace RegionalHostnames { + export { + type RegionalHostnameCreateResponse as RegionalHostnameCreateResponse, + type RegionalHostnameListResponse as RegionalHostnameListResponse, + type RegionalHostnameDeleteResponse as RegionalHostnameDeleteResponse, + type RegionalHostnameEditResponse as RegionalHostnameEditResponse, + type RegionalHostnameGetResponse as RegionalHostnameGetResponse, + RegionalHostnameListResponsesSinglePage as RegionalHostnameListResponsesSinglePage, + type RegionalHostnameCreateParams as RegionalHostnameCreateParams, + type RegionalHostnameListParams as RegionalHostnameListParams, + type RegionalHostnameDeleteParams as RegionalHostnameDeleteParams, + type RegionalHostnameEditParams as RegionalHostnameEditParams, + type RegionalHostnameGetParams as RegionalHostnameGetParams, + }; + + export { + Regions as Regions, + type RegionListResponse as RegionListResponse, + RegionListResponsesSinglePage as RegionListResponsesSinglePage, + type RegionListParams as RegionListParams, + }; } diff --git a/src/resources/addressing/regional-hostnames/regions.ts b/src/resources/addressing/regional-hostnames/regions.ts index db24824dc1..db005d7338 100644 --- a/src/resources/addressing/regional-hostnames/regions.ts +++ b/src/resources/addressing/regional-hostnames/regions.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as RegionsAPI from './regions'; import { SinglePage } from '../../../pagination'; export class Regions extends APIResource { @@ -43,8 +42,12 @@ export interface RegionListParams { account_id: string; } -export namespace Regions { - export import RegionListResponse = RegionsAPI.RegionListResponse; - export import RegionListResponsesSinglePage = RegionsAPI.RegionListResponsesSinglePage; - export import RegionListParams = RegionsAPI.RegionListParams; +Regions.RegionListResponsesSinglePage = RegionListResponsesSinglePage; + +export declare namespace Regions { + export { + type RegionListResponse as RegionListResponse, + RegionListResponsesSinglePage as RegionListResponsesSinglePage, + type RegionListParams as RegionListParams, + }; } diff --git a/src/resources/addressing/services.ts b/src/resources/addressing/services.ts index 13cd36b87f..17341ca348 100644 --- a/src/resources/addressing/services.ts +++ b/src/resources/addressing/services.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ServicesAPI from './services'; import { SinglePage } from '../../pagination'; export class Services extends APIResource { @@ -29,7 +28,8 @@ export class ServiceListResponsesSinglePage extends SinglePage {} export interface AIGatewayCreateResponse { - task: AIGatewayCreateResponse.Task; -} + /** + * gateway id + */ + id: string; + + account_id: string; + + account_tag: string; -export namespace AIGatewayCreateResponse { - export interface Task { - /** - * gateway id - */ - id: string; + cache_invalidate_on_update: boolean; - cache_invalidate_on_update: boolean; + cache_ttl: number | null; - cache_ttl: number | null; + collect_logs: boolean; - collect_logs: boolean; + created_at: string; - created_at: string; + internal_id: string; - modified_at: string; + modified_at: string; - rate_limiting_interval: number | null; + rate_limiting_interval: number | null; - rate_limiting_limit: number | null; + rate_limiting_limit: number | null; - rate_limiting_technique: 'fixed' | 'sliding'; - } + rate_limiting_technique: 'fixed' | 'sliding'; + + logpush?: boolean; + + logpush_public_key?: string | null; } export interface AIGatewayUpdateResponse { @@ -126,6 +179,10 @@ export interface AIGatewayUpdateResponse { */ id: string; + account_id: string; + + account_tag: string; + cache_invalidate_on_update: boolean; cache_ttl: number | null; @@ -134,6 +191,8 @@ export interface AIGatewayUpdateResponse { created_at: string; + internal_id: string; + modified_at: string; rate_limiting_interval: number | null; @@ -141,6 +200,10 @@ export interface AIGatewayUpdateResponse { rate_limiting_limit: number | null; rate_limiting_technique: 'fixed' | 'sliding'; + + logpush?: boolean; + + logpush_public_key?: string | null; } export interface AIGatewayListResponse { @@ -149,6 +212,10 @@ export interface AIGatewayListResponse { */ id: string; + account_id: string; + + account_tag: string; + cache_invalidate_on_update: boolean; cache_ttl: number | null; @@ -157,6 +224,8 @@ export interface AIGatewayListResponse { created_at: string; + internal_id: string; + modified_at: string; rate_limiting_interval: number | null; @@ -164,6 +233,10 @@ export interface AIGatewayListResponse { rate_limiting_limit: number | null; rate_limiting_technique: 'fixed' | 'sliding'; + + logpush?: boolean; + + logpush_public_key?: string | null; } export interface AIGatewayDeleteResponse { @@ -172,6 +245,10 @@ export interface AIGatewayDeleteResponse { */ id: string; + account_id: string; + + account_tag: string; + cache_invalidate_on_update: boolean; cache_ttl: number | null; @@ -180,6 +257,8 @@ export interface AIGatewayDeleteResponse { created_at: string; + internal_id: string; + modified_at: string; rate_limiting_interval: number | null; @@ -187,6 +266,10 @@ export interface AIGatewayDeleteResponse { rate_limiting_limit: number | null; rate_limiting_technique: 'fixed' | 'sliding'; + + logpush?: boolean; + + logpush_public_key?: string | null; } export interface AIGatewayGetResponse { @@ -195,6 +278,10 @@ export interface AIGatewayGetResponse { */ id: string; + account_id: string; + + account_tag: string; + cache_invalidate_on_update: boolean; cache_ttl: number | null; @@ -203,6 +290,8 @@ export interface AIGatewayGetResponse { created_at: string; + internal_id: string; + modified_at: string; rate_limiting_interval: number | null; @@ -210,6 +299,10 @@ export interface AIGatewayGetResponse { rate_limiting_limit: number | null; rate_limiting_technique: 'fixed' | 'sliding'; + + logpush?: boolean; + + logpush_public_key?: string | null; } export interface AIGatewayCreateParams { @@ -252,6 +345,16 @@ export interface AIGatewayCreateParams { * Body param: */ rate_limiting_technique: 'fixed' | 'sliding'; + + /** + * Body param: + */ + logpush?: boolean; + + /** + * Body param: + */ + logpush_public_key?: string | null; } export interface AIGatewayUpdateParams { @@ -289,6 +392,16 @@ export interface AIGatewayUpdateParams { * Body param: */ rate_limiting_technique: 'fixed' | 'sliding'; + + /** + * Body param: + */ + logpush?: boolean; + + /** + * Body param: + */ + logpush_public_key?: string | null; } export interface AIGatewayListParams extends V4PagePaginationArrayParams { @@ -298,14 +411,9 @@ export interface AIGatewayListParams extends V4PagePaginationArrayParams { account_id: string; /** - * Query param: gateway id - */ - id?: string; - - /** - * Query param: Order By Column Name + * Query param: Search by id */ - order_by?: string; + search?: string; } export interface AIGatewayDeleteParams { @@ -316,9 +424,63 @@ export interface AIGatewayGetParams { account_id: string; } -export namespace AIGateway { - export import Logs = LogsAPI.Logs; - export import LogListResponse = LogsAPI.LogListResponse; - export import LogListResponsesV4PagePaginationArray = LogsAPI.LogListResponsesV4PagePaginationArray; - export import LogListParams = LogsAPI.LogListParams; +AIGateway.EvaluationTypes = EvaluationTypes; +AIGateway.Logs = Logs; +AIGateway.LogListResponsesV4PagePaginationArray = LogListResponsesV4PagePaginationArray; +AIGateway.Datasets = Datasets; +AIGateway.DatasetListResponsesV4PagePaginationArray = DatasetListResponsesV4PagePaginationArray; +AIGateway.Evaluations = Evaluations; +AIGateway.EvaluationListResponsesV4PagePaginationArray = EvaluationListResponsesV4PagePaginationArray; + +export declare namespace AIGateway { + export { + EvaluationTypes as EvaluationTypes, + type EvaluationTypeGetResponse as EvaluationTypeGetResponse, + type EvaluationTypeGetParams as EvaluationTypeGetParams, + }; + + export { + Logs as Logs, + type LogListResponse as LogListResponse, + type LogDeleteResponse as LogDeleteResponse, + type LogEditResponse as LogEditResponse, + type LogGetResponse as LogGetResponse, + type LogRequestResponse as LogRequestResponse, + type LogResponseResponse as LogResponseResponse, + LogListResponsesV4PagePaginationArray as LogListResponsesV4PagePaginationArray, + type LogListParams as LogListParams, + type LogDeleteParams as LogDeleteParams, + type LogEditParams as LogEditParams, + type LogGetParams as LogGetParams, + type LogRequestParams as LogRequestParams, + type LogResponseParams as LogResponseParams, + }; + + export { + Datasets as Datasets, + type DatasetCreateResponse as DatasetCreateResponse, + type DatasetUpdateResponse as DatasetUpdateResponse, + type DatasetListResponse as DatasetListResponse, + type DatasetDeleteResponse as DatasetDeleteResponse, + type DatasetGetResponse as DatasetGetResponse, + DatasetListResponsesV4PagePaginationArray as DatasetListResponsesV4PagePaginationArray, + type DatasetCreateParams as DatasetCreateParams, + type DatasetUpdateParams as DatasetUpdateParams, + type DatasetListParams as DatasetListParams, + type DatasetDeleteParams as DatasetDeleteParams, + type DatasetGetParams as DatasetGetParams, + }; + + export { + Evaluations as Evaluations, + type EvaluationCreateResponse as EvaluationCreateResponse, + type EvaluationListResponse as EvaluationListResponse, + type EvaluationDeleteResponse as EvaluationDeleteResponse, + type EvaluationGetResponse as EvaluationGetResponse, + EvaluationListResponsesV4PagePaginationArray as EvaluationListResponsesV4PagePaginationArray, + type EvaluationCreateParams as EvaluationCreateParams, + type EvaluationListParams as EvaluationListParams, + type EvaluationDeleteParams as EvaluationDeleteParams, + type EvaluationGetParams as EvaluationGetParams, + }; } diff --git a/src/resources/ai-gateway/datasets.ts b/src/resources/ai-gateway/datasets.ts new file mode 100644 index 0000000000..6582ad5afa --- /dev/null +++ b/src/resources/ai-gateway/datasets.ts @@ -0,0 +1,464 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Datasets extends APIResource { + /** + * Create a new Dataset + */ + create( + gatewayId: string, + params: DatasetCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/datasets`, { + body, + ...options, + }) as Core.APIPromise<{ result: DatasetCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update a Dataset + */ + update( + gatewayId: string, + id: string, + params: DatasetUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/datasets/${id}`, { + body, + ...options, + }) as Core.APIPromise<{ result: DatasetUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List Datasets + */ + list( + gatewayId: string, + params: DatasetListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/datasets`, + DatasetListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete a Dataset + */ + delete( + gatewayId: string, + id: string, + params: DatasetDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/datasets/${id}`, + options, + ) as Core.APIPromise<{ result: DatasetDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetch a Dataset + */ + get( + gatewayId: string, + id: string, + params: DatasetGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/datasets/${id}`, + options, + ) as Core.APIPromise<{ result: DatasetGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class DatasetListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface DatasetCreateResponse { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + enable: boolean; + + filters: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; +} + +export namespace DatasetCreateResponse { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } +} + +export interface DatasetUpdateResponse { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + enable: boolean; + + filters: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; +} + +export namespace DatasetUpdateResponse { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } +} + +export interface DatasetListResponse { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + enable: boolean; + + filters: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; +} + +export namespace DatasetListResponse { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } +} + +export interface DatasetDeleteResponse { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + enable: boolean; + + filters: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; +} + +export namespace DatasetDeleteResponse { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } +} + +export interface DatasetGetResponse { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + enable: boolean; + + filters: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; +} + +export namespace DatasetGetResponse { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } +} + +export interface DatasetCreateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + enable: boolean; + + /** + * Body param: + */ + filters: Array; + + /** + * Body param: + */ + name: string; +} + +export namespace DatasetCreateParams { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } +} + +export interface DatasetUpdateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + enable: boolean; + + /** + * Body param: + */ + filters: Array; + + /** + * Body param: + */ + name: string; +} + +export namespace DatasetUpdateParams { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } +} + +export interface DatasetListParams extends V4PagePaginationArrayParams { + /** + * Path param: + */ + account_id: string; + + /** + * Query param: + */ + enable?: boolean; + + /** + * Query param: + */ + name?: string; + + /** + * Query param: Search by id, name, filters + */ + search?: string; +} + +export interface DatasetDeleteParams { + account_id: string; +} + +export interface DatasetGetParams { + account_id: string; +} + +Datasets.DatasetListResponsesV4PagePaginationArray = DatasetListResponsesV4PagePaginationArray; + +export declare namespace Datasets { + export { + type DatasetCreateResponse as DatasetCreateResponse, + type DatasetUpdateResponse as DatasetUpdateResponse, + type DatasetListResponse as DatasetListResponse, + type DatasetDeleteResponse as DatasetDeleteResponse, + type DatasetGetResponse as DatasetGetResponse, + DatasetListResponsesV4PagePaginationArray as DatasetListResponsesV4PagePaginationArray, + type DatasetCreateParams as DatasetCreateParams, + type DatasetUpdateParams as DatasetUpdateParams, + type DatasetListParams as DatasetListParams, + type DatasetDeleteParams as DatasetDeleteParams, + type DatasetGetParams as DatasetGetParams, + }; +} diff --git a/src/resources/ai-gateway/evaluation-types.ts b/src/resources/ai-gateway/evaluation-types.ts new file mode 100644 index 0000000000..47d847d1e0 --- /dev/null +++ b/src/resources/ai-gateway/evaluation-types.ts @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class EvaluationTypes extends APIResource { + /** + * List Evaluators + */ + get( + params: EvaluationTypeGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/ai-gateway/evaluation-types`, { + query, + ...options, + }) as Core.APIPromise<{ result: EvaluationTypeGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type EvaluationTypeGetResponse = Array; + +export namespace EvaluationTypeGetResponse { + export interface EvaluationTypeGetResponseItem { + id: string; + + created_at: string; + + description: string; + + enable: boolean; + + mandatory: boolean; + + modified_at: string; + + name: string; + + type: string; + } +} + +export interface EvaluationTypeGetParams { + /** + * Path param: + */ + account_id: string; + + /** + * Query param: + */ + order_by?: string; + + /** + * Query param: + */ + order_by_direction?: 'asc' | 'desc'; + + /** + * Query param: + */ + page?: number; + + /** + * Query param: + */ + per_page?: number; +} + +export declare namespace EvaluationTypes { + export { + type EvaluationTypeGetResponse as EvaluationTypeGetResponse, + type EvaluationTypeGetParams as EvaluationTypeGetParams, + }; +} diff --git a/src/resources/ai-gateway/evaluations.ts b/src/resources/ai-gateway/evaluations.ts new file mode 100644 index 0000000000..b572e53b69 --- /dev/null +++ b/src/resources/ai-gateway/evaluations.ts @@ -0,0 +1,526 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Evaluations extends APIResource { + /** + * Create a new Evaluation + */ + create( + gatewayId: string, + params: EvaluationCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/evaluations`, { + body, + ...options, + }) as Core.APIPromise<{ result: EvaluationCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List Evaluations + */ + list( + gatewayId: string, + params: EvaluationListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/evaluations`, + EvaluationListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete a Evaluation + */ + delete( + gatewayId: string, + id: string, + params: EvaluationDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/evaluations/${id}`, + options, + ) as Core.APIPromise<{ result: EvaluationDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetch a Evaluation + */ + get( + gatewayId: string, + id: string, + params: EvaluationGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/evaluations/${id}`, + options, + ) as Core.APIPromise<{ result: EvaluationGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class EvaluationListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface EvaluationCreateResponse { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + datasets: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; + + processed: boolean; + + results: Array; + + total_logs: number; +} + +export namespace EvaluationCreateResponse { + export interface Dataset { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + enable: boolean; + + filters: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; + } + + export namespace Dataset { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } + } + + export interface Result { + id: string; + + created_at: string; + + evaluation_id: string; + + evaluation_type_id: string; + + modified_at: string; + + result: string; + + status: number; + + status_description: string; + + total_logs: number; + } +} + +export interface EvaluationListResponse { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + datasets: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; + + processed: boolean; + + results: Array; + + total_logs: number; +} + +export namespace EvaluationListResponse { + export interface Dataset { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + enable: boolean; + + filters: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; + } + + export namespace Dataset { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } + } + + export interface Result { + id: string; + + created_at: string; + + evaluation_id: string; + + evaluation_type_id: string; + + modified_at: string; + + result: string; + + status: number; + + status_description: string; + + total_logs: number; + } +} + +export interface EvaluationDeleteResponse { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + datasets: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; + + processed: boolean; + + results: Array; + + total_logs: number; +} + +export namespace EvaluationDeleteResponse { + export interface Dataset { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + enable: boolean; + + filters: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; + } + + export namespace Dataset { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } + } + + export interface Result { + id: string; + + created_at: string; + + evaluation_id: string; + + evaluation_type_id: string; + + modified_at: string; + + result: string; + + status: number; + + status_description: string; + + total_logs: number; + } +} + +export interface EvaluationGetResponse { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + datasets: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; + + processed: boolean; + + results: Array; + + total_logs: number; +} + +export namespace EvaluationGetResponse { + export interface Dataset { + id: string; + + account_id: string; + + account_tag: string; + + created_at: string; + + enable: boolean; + + filters: Array; + + /** + * gateway id + */ + gateway_id: string; + + modified_at: string; + + name: string; + } + + export namespace Dataset { + export interface Filter { + key: + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + operator: 'eq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } + } + + export interface Result { + id: string; + + created_at: string; + + evaluation_id: string; + + evaluation_type_id: string; + + modified_at: string; + + result: string; + + status: number; + + status_description: string; + + total_logs: number; + } +} + +export interface EvaluationCreateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + dataset_ids: Array; + + /** + * Body param: + */ + evaluation_type_ids: Array; + + /** + * Body param: + */ + name: string; +} + +export interface EvaluationListParams extends V4PagePaginationArrayParams { + /** + * Path param: + */ + account_id: string; + + /** + * Query param: + */ + name?: string; + + /** + * Query param: + */ + processed?: boolean; + + /** + * Query param: Search by id, name + */ + search?: string; +} + +export interface EvaluationDeleteParams { + account_id: string; +} + +export interface EvaluationGetParams { + account_id: string; +} + +Evaluations.EvaluationListResponsesV4PagePaginationArray = EvaluationListResponsesV4PagePaginationArray; + +export declare namespace Evaluations { + export { + type EvaluationCreateResponse as EvaluationCreateResponse, + type EvaluationListResponse as EvaluationListResponse, + type EvaluationDeleteResponse as EvaluationDeleteResponse, + type EvaluationGetResponse as EvaluationGetResponse, + EvaluationListResponsesV4PagePaginationArray as EvaluationListResponsesV4PagePaginationArray, + type EvaluationCreateParams as EvaluationCreateParams, + type EvaluationListParams as EvaluationListParams, + type EvaluationDeleteParams as EvaluationDeleteParams, + type EvaluationGetParams as EvaluationGetParams, + }; +} diff --git a/src/resources/ai-gateway/index.ts b/src/resources/ai-gateway/index.ts index 8a6c4921d2..9168fda6da 100644 --- a/src/resources/ai-gateway/index.ts +++ b/src/resources/ai-gateway/index.ts @@ -1,4 +1,50 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { AIGateway } from './ai-gateway'; -export { LogListResponse, LogListParams, LogListResponsesV4PagePaginationArray, Logs } from './logs'; +export { + DatasetListResponsesV4PagePaginationArray, + Datasets, + type DatasetCreateResponse, + type DatasetUpdateResponse, + type DatasetListResponse, + type DatasetDeleteResponse, + type DatasetGetResponse, + type DatasetCreateParams, + type DatasetUpdateParams, + type DatasetListParams, + type DatasetDeleteParams, + type DatasetGetParams, +} from './datasets'; +export { + EvaluationListResponsesV4PagePaginationArray, + Evaluations, + type EvaluationCreateResponse, + type EvaluationListResponse, + type EvaluationDeleteResponse, + type EvaluationGetResponse, + type EvaluationCreateParams, + type EvaluationListParams, + type EvaluationDeleteParams, + type EvaluationGetParams, +} from './evaluations'; +export { + EvaluationTypes, + type EvaluationTypeGetResponse, + type EvaluationTypeGetParams, +} from './evaluation-types'; +export { + LogListResponsesV4PagePaginationArray, + Logs, + type LogListResponse, + type LogDeleteResponse, + type LogEditResponse, + type LogGetResponse, + type LogRequestResponse, + type LogResponseResponse, + type LogListParams, + type LogDeleteParams, + type LogEditParams, + type LogGetParams, + type LogRequestParams, + type LogResponseParams, +} from './logs'; diff --git a/src/resources/ai-gateway/logs.ts b/src/resources/ai-gateway/logs.ts index 68209695b9..a5631d091a 100644 --- a/src/resources/ai-gateway/logs.ts +++ b/src/resources/ai-gateway/logs.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as LogsAPI from './logs'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class Logs extends APIResource { @@ -10,17 +9,100 @@ export class Logs extends APIResource { * List Gateway Logs */ list( - id: string, + gatewayId: string, params: LogListParams, options?: Core.RequestOptions, ): Core.PagePromise { const { account_id, ...query } = params; return this._client.getAPIList( - `/accounts/${account_id}/ai-gateway/gateways/${id}/logs`, + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/logs`, LogListResponsesV4PagePaginationArray, { query, ...options }, ); } + + /** + * Delete Gateway Logs + */ + delete( + gatewayId: string, + params: LogDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, filters, limit, order_by, order_by_direction } = params; + return this._client.delete(`/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/logs`, { + query: { filters, limit, order_by, order_by_direction }, + ...options, + }); + } + + /** + * Patch Gateway Log + */ + edit( + gatewayId: string, + id: string, + params: LogEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/logs/${id}`, { + body, + ...options, + }) as Core.APIPromise<{ result: LogEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get Gateway Log Detail + */ + get( + gatewayId: string, + id: string, + params: LogGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/logs/${id}`, + options, + ) as Core.APIPromise<{ result: LogGetResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get Gateway Log Request + */ + request( + gatewayId: string, + id: string, + params: LogRequestParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.get( + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/logs/${id}/request`, + options, + ); + } + + /** + * Get Gateway Log Response + */ + response( + gatewayId: string, + id: string, + params: LogResponseParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.get( + `/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/logs/${id}/response`, + options, + ); + } } export class LogListResponsesV4PagePaginationArray extends V4PagePaginationArray {} @@ -40,29 +122,93 @@ export interface LogListResponse { provider: string; - request: string; + success: boolean; + + tokens_in: number | null; - response: string; + tokens_out: number | null; + + cost?: number; + + custom_cost?: boolean; + + metadata?: string; + + model_type?: string; + + request_content_type?: string; + request_type?: string; + + response_content_type?: string; + + status_code?: number; + + step?: number; +} + +export interface LogDeleteResponse { success: boolean; +} - tokens_in: number; +export type LogEditResponse = unknown; - tokens_out: number; +export interface LogGetResponse { + id: string; + + cached: boolean; + + created_at: string; + + duration: number; + + model: string; + + path: string; + + provider: string; + + success: boolean; + + tokens_in: number | null; + + tokens_out: number | null; + + cost?: number; + + custom_cost?: boolean; metadata?: string; + model_type?: string; + request_content_type?: string; + request_head?: string; + + request_head_complete?: boolean; + + request_size?: number; + request_type?: string; response_content_type?: string; + response_head?: string; + + response_head_complete?: boolean; + + response_size?: number; + status_code?: number; step?: number; } +export type LogRequestResponse = unknown; + +export type LogResponseResponse = unknown; + export interface LogListParams extends V4PagePaginationArrayParams { /** * Path param: @@ -87,7 +233,102 @@ export interface LogListParams extends V4PagePaginationArrayParams { /** * Query param: */ - order_by?: 'created_at' | 'provider'; + feedback?: 0 | 1; + + /** + * Query param: + */ + filters?: Array; + + /** + * Query param: + */ + max_cost?: number; + + /** + * Query param: + */ + max_duration?: number; + + /** + * Query param: + */ + max_tokens_in?: number; + + /** + * Query param: + */ + max_tokens_out?: number; + + /** + * Query param: + */ + max_total_tokens?: number; + + /** + * Query param: + */ + meta_info?: boolean; + + /** + * Query param: + */ + min_cost?: number; + + /** + * Query param: + */ + min_duration?: number; + + /** + * Query param: + */ + min_tokens_in?: number; + + /** + * Query param: + */ + min_tokens_out?: number; + + /** + * Query param: + */ + min_total_tokens?: number; + + /** + * Query param: + */ + model?: string; + + /** + * Query param: + */ + model_type?: string; + + /** + * Query param: + */ + order_by?: 'created_at' | 'provider' | 'model' | 'model_type' | 'success' | 'cached'; + + /** + * Query param: + */ + order_by_direction?: 'asc' | 'desc'; + + /** + * Query param: + */ + provider?: string; + + /** + * Query param: + */ + request_content_type?: string; + + /** + * Query param: + */ + response_content_type?: string; /** * Query param: @@ -105,8 +346,156 @@ export interface LogListParams extends V4PagePaginationArrayParams { success?: boolean; } -export namespace Logs { - export import LogListResponse = LogsAPI.LogListResponse; - export import LogListResponsesV4PagePaginationArray = LogsAPI.LogListResponsesV4PagePaginationArray; - export import LogListParams = LogsAPI.LogListParams; +export namespace LogListParams { + export interface Filter { + key: + | 'id' + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'model_type' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback' + | 'event_id' + | 'request_type' + | 'metadata.key' + | 'metadata.value' + | 'prompts.prompt_id' + | 'prompts.version_id'; + + operator: 'eq' | 'neq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } +} + +export interface LogDeleteParams { + /** + * Path param: + */ + account_id: string; + + /** + * Query param: + */ + filters?: Array; + + /** + * Query param: + */ + limit?: number; + + /** + * Query param: + */ + order_by?: + | 'created_at' + | 'provider' + | 'model' + | 'model_type' + | 'success' + | 'cached' + | 'cost' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback'; + + /** + * Query param: + */ + order_by_direction?: 'asc' | 'desc'; +} + +export namespace LogDeleteParams { + export interface Filter { + key: + | 'id' + | 'created_at' + | 'request_content_type' + | 'response_content_type' + | 'success' + | 'cached' + | 'provider' + | 'model' + | 'model_type' + | 'cost' + | 'tokens' + | 'tokens_in' + | 'tokens_out' + | 'duration' + | 'feedback' + | 'event_id' + | 'request_type' + | 'metadata.key' + | 'metadata.value' + | 'prompts.prompt_id' + | 'prompts.version_id'; + + operator: 'eq' | 'neq' | 'contains' | 'lt' | 'gt'; + + value: Array; + } +} + +export interface LogEditParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + feedback?: number | null; + + /** + * Body param: + */ + metadata?: Record | null; + + /** + * Body param: + */ + score?: number | null; +} + +export interface LogGetParams { + account_id: string; +} + +export interface LogRequestParams { + account_id: string; +} + +export interface LogResponseParams { + account_id: string; +} + +Logs.LogListResponsesV4PagePaginationArray = LogListResponsesV4PagePaginationArray; + +export declare namespace Logs { + export { + type LogListResponse as LogListResponse, + type LogDeleteResponse as LogDeleteResponse, + type LogEditResponse as LogEditResponse, + type LogGetResponse as LogGetResponse, + type LogRequestResponse as LogRequestResponse, + type LogResponseResponse as LogResponseResponse, + LogListResponsesV4PagePaginationArray as LogListResponsesV4PagePaginationArray, + type LogListParams as LogListParams, + type LogDeleteParams as LogDeleteParams, + type LogEditParams as LogEditParams, + type LogGetParams as LogGetParams, + type LogRequestParams as LogRequestParams, + type LogResponseParams as LogResponseParams, + }; } diff --git a/src/resources/ai/ai.ts b/src/resources/ai/ai.ts new file mode 100644 index 0000000000..5688651c05 --- /dev/null +++ b/src/resources/ai/ai.ts @@ -0,0 +1,812 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as AuthorsAPI from './authors'; +import { AuthorListParams, AuthorListResponse, AuthorListResponsesSinglePage, Authors } from './authors'; +import * as TasksAPI from './tasks'; +import { TaskListParams, TaskListResponse, TaskListResponsesSinglePage, Tasks } from './tasks'; +import * as FinetunesAPI from './finetunes/finetunes'; +import { + FinetuneCreateParams, + FinetuneCreateResponse, + FinetuneListParams, + FinetuneListResponse, + Finetunes, +} from './finetunes/finetunes'; +import * as ModelsAPI from './models/models'; +import { + ModelListParams, + ModelListResponse, + ModelListResponsesV4PagePaginationArray, + Models, +} from './models/models'; + +export class AI extends APIResource { + finetunes: FinetunesAPI.Finetunes = new FinetunesAPI.Finetunes(this._client); + authors: AuthorsAPI.Authors = new AuthorsAPI.Authors(this._client); + tasks: TasksAPI.Tasks = new TasksAPI.Tasks(this._client); + models: ModelsAPI.Models = new ModelsAPI.Models(this._client); + + /** + * 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/). + */ + run(modelName: string, params: AIRunParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai/run/${modelName}`, { + body, + ...options, + }) as Core.APIPromise<{ result: AIRunResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * An array of classification results for the input text + */ +export type AIRunResponse = + | Array + | Core.Uploadable + | AIRunResponse.Audio + | AIRunResponse.TextEmbeddings + | AIRunResponse.AutomaticSpeechRecognition + | Array + | Array + | AIRunResponse.UnionMember7 + | AIRunResponse.Translation + | AIRunResponse.Summarization + | AIRunResponse.ImageToText; + +export namespace AIRunResponse { + export interface TextClassification { + /** + * The classification label assigned to the text (e.g., 'POSITIVE' or 'NEGATIVE') + */ + label?: string; + + /** + * Confidence score indicating the likelihood that the text belongs to the + * specified label + */ + score?: number; + } + + export interface Audio { + /** + * The generated audio in MP3 format, base64-encoded + */ + audio?: string; + } + + export interface TextEmbeddings { + /** + * Embeddings of the requested text values + */ + data?: Array>; + + shape?: Array; + } + + export interface AutomaticSpeechRecognition { + /** + * The transcription + */ + text: string; + + vtt?: string; + + word_count?: number; + + words?: Array; + } + + export namespace AutomaticSpeechRecognition { + export interface Word { + /** + * The ending second when the word completes + */ + end?: number; + + /** + * The second this word begins in the recording + */ + start?: number; + + word?: string; + } + } + + export interface ImageClassification { + /** + * The predicted category or class for the input image based on analysis + */ + label?: string; + + /** + * A confidence value, between 0 and 1, indicating how certain the model is about + * the predicted label + */ + score?: number; + } + + export interface ObjectDetection { + /** + * Coordinates defining the bounding box around the detected object + */ + box?: ObjectDetection.Box; + + /** + * The class label or name of the detected object + */ + label?: string; + + /** + * Confidence score indicating the likelihood that the detection is correct + */ + score?: number; + } + + export namespace ObjectDetection { + /** + * Coordinates defining the bounding box around the detected object + */ + export interface Box { + /** + * The x-coordinate of the bottom-right corner of the bounding box + */ + xmax?: number; + + /** + * The x-coordinate of the top-left corner of the bounding box + */ + xmin?: number; + + /** + * The y-coordinate of the bottom-right corner of the bounding box + */ + ymax?: number; + + /** + * The y-coordinate of the top-left corner of the bounding box + */ + ymin?: number; + } + } + + export interface UnionMember7 { + /** + * The generated text response from the model + */ + response?: string; + + /** + * An array of tool calls requests made during the response generation + */ + tool_calls?: Array; + } + + export namespace UnionMember7 { + export interface ToolCall { + /** + * The arguments passed to be passed to the tool call request + */ + arguments?: unknown; + + /** + * The name of the tool to be called + */ + name?: string; + } + } + + export interface Translation { + /** + * The translated text in the target language + */ + translated_text?: string; + } + + export interface Summarization { + /** + * The summarized version of the input text + */ + summary?: string; + } + + export interface ImageToText { + description?: string; + } +} + +export type AIRunParams = + | AIRunParams.TextClassification + | AIRunParams.TextToImage + | AIRunParams.TextToSpeech + | AIRunParams.TextEmbeddings + | AIRunParams.AutomaticSpeechRecognition + | AIRunParams.ImageClassification + | AIRunParams.ObjectDetection + | AIRunParams.Prompt + | AIRunParams.Messages + | AIRunParams.Translation + | AIRunParams.Summarization + | AIRunParams.ImageToText; + +export declare namespace AIRunParams { + export interface TextClassification { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: The text that you want to classify + */ + text: string; + } + + export interface TextToImage { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: A text description of the image you want to generate + */ + prompt: string; + + /** + * Body param: Controls how closely the generated image should adhere to the + * prompt; higher values make the image more aligned with the prompt + */ + guidance?: number; + + /** + * Body param: The height of the generated image in pixels + */ + height?: number; + + /** + * Body param: For use with img2img tasks. An array of integers that represent the + * image data constrained to 8-bit unsigned integer values + */ + image?: Array; + + /** + * Body param: For use with img2img tasks. A base64-encoded string of the input + * image + */ + image_b64?: string; + + /** + * Body param: An array representing An array of integers that represent mask image + * data for inpainting constrained to 8-bit unsigned integer values + */ + mask?: Array; + + /** + * Body param: Text describing elements to avoid in the generated image + */ + negative_prompt?: string; + + /** + * Body param: The number of diffusion steps; higher values can improve quality but + * take longer + */ + num_steps?: number; + + /** + * Body param: Random seed for reproducibility of the image generation + */ + seed?: number; + + /** + * Body param: A value between 0 and 1 indicating how strongly to apply the + * transformation during img2img tasks; lower values make the output closer to the + * input image + */ + strength?: number; + + /** + * Body param: The width of the generated image in pixels + */ + width?: number; + } + + export interface TextToSpeech { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: A text description of the image you want to generate + */ + prompt: string; + + /** + * Body param: The speech language (e.g., 'en' for English, 'fr' for French). + * Defaults to 'en' if not specified + */ + lang?: string; + } + + export interface TextEmbeddings { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: The text to embed + */ + text: string | Array; + } + + export interface AutomaticSpeechRecognition { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: An array of integers that represent the audio data constrained to + * 8-bit unsigned integer values + */ + audio: Array; + + /** + * Body param: The language of the recorded audio + */ + source_lang?: string; + + /** + * Body param: The language to translate the transcription into. Currently only + * English is supported. + */ + target_lang?: string; + } + + export interface ImageClassification { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: An array of integers that represent the image data constrained to + * 8-bit unsigned integer values + */ + image: Array; + } + + export interface ObjectDetection { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: An array of integers that represent the image data constrained to + * 8-bit unsigned integer values + */ + image?: Array; + } + + export interface Prompt { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: The input text prompt for the model to generate a response. + */ + prompt: string; + + /** + * Body param: Decreases the likelihood of the model repeating the same lines + * verbatim. + */ + frequency_penalty?: number; + + /** + * Body param: Name of the LoRA (Low-Rank Adaptation) model to fine-tune the base + * model. + */ + lora?: string; + + /** + * Body param: The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + + /** + * Body param: Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; + + /** + * Body param: If true, a chat template is not applied and you must adhere to the + * specific model's expected formatting. + */ + raw?: boolean; + + /** + * Body param: Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + + /** + * Body param: Random seed for reproducibility of the generation. + */ + seed?: number; + + /** + * Body param: If true, the response will be streamed back incrementally using SSE, + * Server Sent Events. + */ + stream?: boolean; + + /** + * Body param: Controls the randomness of the output; higher values produce more + * random results. + */ + temperature?: number; + + /** + * Body param: Limits the AI to choose from the top 'k' most probable words. Lower + * values make responses more focused; higher values introduce more variety and + * potential surprises. + */ + top_k?: number; + + /** + * Body param: Adjusts the creativity of the AI's responses by controlling how many + * possible words it considers. Lower values make outputs more predictable; higher + * values allow for more varied and creative responses. + */ + top_p?: number; + } + + export interface Messages { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: An array of message objects representing the conversation history. + */ + messages: Array; + + /** + * Body param: Decreases the likelihood of the model repeating the same lines + * verbatim. + */ + frequency_penalty?: number; + + /** + * Body param: + */ + functions?: Array; + + /** + * Body param: The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + + /** + * Body param: Increases the likelihood of the model introducing new topics. + */ + presence_penalty?: number; + + /** + * Body param: Penalty for repeated tokens; higher values discourage repetition. + */ + repetition_penalty?: number; + + /** + * Body param: Random seed for reproducibility of the generation. + */ + seed?: number; + + /** + * Body param: If true, the response will be streamed back incrementally. + */ + stream?: boolean; + + /** + * Body param: Controls the randomness of the output; higher values produce more + * random results. + */ + temperature?: number; + + /** + * Body param: A list of tools available for the assistant to use. + */ + tools?: Array; + + /** + * Body param: Limits the AI to choose from the top 'k' most probable words. Lower + * values make responses more focused; higher values introduce more variety and + * potential surprises. + */ + top_k?: number; + + /** + * Body param: Controls the creativity of the AI's responses by adjusting how many + * possible words it considers. Lower values make outputs more predictable; higher + * values allow for more varied and creative responses. + */ + top_p?: number; + } + + export namespace Messages { + export interface Message { + /** + * The content of the message as a string. + */ + content: string; + + /** + * The role of the message sender (e.g., 'user', 'assistant', 'system', 'tool'). + */ + role: string; + } + + export interface Function { + code: string; + + name: string; + } + + export interface UnionMember0 { + /** + * A brief description of what the tool does. + */ + description: string; + + /** + * The name of the tool. More descriptive the better. + */ + name: string; + + /** + * Schema defining the parameters accepted by the tool. + */ + parameters: UnionMember0.Parameters; + } + + export namespace UnionMember0 { + /** + * Schema defining the parameters accepted by the tool. + */ + export interface Parameters { + /** + * Definitions of each parameter. + */ + properties: Record; + + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + + /** + * List of required parameter names. + */ + required?: Array; + } + + export namespace Parameters { + export interface Properties { + /** + * A description of the expected parameter. + */ + description: string; + + /** + * The data type of the parameter. + */ + type: string; + } + } + } + + export interface UnionMember1 { + /** + * Details of the function tool. + */ + function: UnionMember1.Function; + + /** + * Specifies the type of tool (e.g., 'function'). + */ + type: string; + } + + export namespace UnionMember1 { + /** + * Details of the function tool. + */ + export interface Function { + /** + * A brief description of what the function does. + */ + description: string; + + /** + * The name of the function. + */ + name: string; + + /** + * Schema defining the parameters accepted by the function. + */ + parameters: Function.Parameters; + } + + export namespace Function { + /** + * Schema defining the parameters accepted by the function. + */ + export interface Parameters { + /** + * Definitions of each parameter. + */ + properties: Record; + + /** + * The type of the parameters object (usually 'object'). + */ + type: string; + + /** + * List of required parameter names. + */ + required?: Array; + } + + export namespace Parameters { + export interface Properties { + /** + * A description of the expected parameter. + */ + description: string; + + /** + * The data type of the parameter. + */ + type: string; + } + } + } + } + } + + export interface Translation { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: The language code to translate the text into (e.g., 'es' for + * Spanish) + */ + target_lang: string; + + /** + * Body param: The text to be translated + */ + text: string; + + /** + * Body param: The language code of the source text (e.g., 'en' for English). + * Defaults to 'en' if not specified + */ + source_lang?: string; + } + + export interface Summarization { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: The text that you want the model to summarize + */ + input_text: string; + + /** + * Body param: The maximum length of the generated summary in tokens + */ + max_length?: number; + } + + export interface ImageToText { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: An array of integers that represent the image data constrained to + * 8-bit unsigned integer values + */ + image: Array; + + /** + * Body param: The maximum number of tokens to generate in the response. + */ + max_tokens?: number; + + /** + * Body param: The input text prompt for the model to generate a response. + */ + prompt?: string; + + /** + * Body param: If true, a chat template is not applied and you must adhere to the + * specific model's expected formatting. + */ + raw?: boolean; + + /** + * Body param: Controls the randomness of the output; higher values produce more + * random results. + */ + temperature?: number; + } +} + +AI.Finetunes = Finetunes; +AI.Authors = Authors; +AI.AuthorListResponsesSinglePage = AuthorListResponsesSinglePage; +AI.Tasks = Tasks; +AI.TaskListResponsesSinglePage = TaskListResponsesSinglePage; +AI.Models = Models; +AI.ModelListResponsesV4PagePaginationArray = ModelListResponsesV4PagePaginationArray; + +export declare namespace AI { + export { + Finetunes as Finetunes, + type FinetuneCreateResponse as FinetuneCreateResponse, + type FinetuneListResponse as FinetuneListResponse, + type FinetuneCreateParams as FinetuneCreateParams, + type FinetuneListParams as FinetuneListParams, + }; + + export { + Authors as Authors, + type AuthorListResponse as AuthorListResponse, + AuthorListResponsesSinglePage as AuthorListResponsesSinglePage, + type AuthorListParams as AuthorListParams, + }; + + export { + Tasks as Tasks, + type TaskListResponse as TaskListResponse, + TaskListResponsesSinglePage as TaskListResponsesSinglePage, + type TaskListParams as TaskListParams, + }; + + export { + Models as Models, + type ModelListResponse as ModelListResponse, + ModelListResponsesV4PagePaginationArray as ModelListResponsesV4PagePaginationArray, + type ModelListParams as ModelListParams, + }; +} diff --git a/src/resources/ai/authors.ts b/src/resources/ai/authors.ts new file mode 100644 index 0000000000..4b672ce143 --- /dev/null +++ b/src/resources/ai/authors.ts @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage } from '../../pagination'; + +export class Authors extends APIResource { + /** + * Author Search + */ + list( + params: AuthorListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai/authors/search`, + AuthorListResponsesSinglePage, + options, + ); + } +} + +export class AuthorListResponsesSinglePage extends SinglePage {} + +export type AuthorListResponse = unknown; + +export interface AuthorListParams { + account_id: string; +} + +Authors.AuthorListResponsesSinglePage = AuthorListResponsesSinglePage; + +export declare namespace Authors { + export { + type AuthorListResponse as AuthorListResponse, + AuthorListResponsesSinglePage as AuthorListResponsesSinglePage, + type AuthorListParams as AuthorListParams, + }; +} diff --git a/src/resources/ai/finetunes/assets.ts b/src/resources/ai/finetunes/assets.ts new file mode 100644 index 0000000000..ec1feaaefd --- /dev/null +++ b/src/resources/ai/finetunes/assets.ts @@ -0,0 +1,58 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Assets extends APIResource { + /** + * Upload a Finetune Asset + */ + create( + finetuneId: string, + params: AssetCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post( + `/accounts/${account_id}/ai/finetunes/${finetuneId}/finetune-assets`, + Core.multipartFormRequestOptions({ body, ...options }), + ) as Core.APIPromise<{ result: AssetCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface AssetCreateResponse { + id: string; + + bucket_name: string; + + created_at: string; + + file_name: string; + + finetune_id: string; + + modified_at: string; +} + +export interface AssetCreateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + file?: Core.Uploadable; + + /** + * Body param: + */ + file_name?: string; +} + +export declare namespace Assets { + export { type AssetCreateResponse as AssetCreateResponse, type AssetCreateParams as AssetCreateParams }; +} diff --git a/src/resources/ai/finetunes/finetunes.ts b/src/resources/ai/finetunes/finetunes.ts new file mode 100644 index 0000000000..a32d999063 --- /dev/null +++ b/src/resources/ai/finetunes/finetunes.ts @@ -0,0 +1,127 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as AssetsAPI from './assets'; +import { AssetCreateParams, AssetCreateResponse, Assets } from './assets'; +import * as PublicAPI from './public'; +import { Public, PublicListParams, PublicListResponse, PublicListResponsesSinglePage } from './public'; + +export class Finetunes extends APIResource { + assets: AssetsAPI.Assets = new AssetsAPI.Assets(this._client); + public: PublicAPI.Public = new PublicAPI.Public(this._client); + + /** + * Create a new Finetune + */ + create( + params: FinetuneCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai/finetunes`, { body, ...options }) as Core.APIPromise<{ + result: FinetuneCreateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List Finetunes + */ + list(params: FinetuneListParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/ai/finetunes`, options) as Core.APIPromise<{ + result: FinetuneListResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface FinetuneCreateResponse { + id: string; + + created_at: string; + + model: string; + + modified_at: string; + + name: string; + + public: boolean; + + description?: string; +} + +export interface FinetuneListResponse { + id: string; + + created_at: string; + + model: string; + + modified_at: string; + + name: string; + + description?: string; +} + +export interface FinetuneCreateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + model: string; + + /** + * Body param: + */ + name: string; + + /** + * Body param: + */ + description?: string; + + /** + * Body param: + */ + public?: boolean; +} + +export interface FinetuneListParams { + account_id: string; +} + +Finetunes.Assets = Assets; +Finetunes.Public = Public; +Finetunes.PublicListResponsesSinglePage = PublicListResponsesSinglePage; + +export declare namespace Finetunes { + export { + type FinetuneCreateResponse as FinetuneCreateResponse, + type FinetuneListResponse as FinetuneListResponse, + type FinetuneCreateParams as FinetuneCreateParams, + type FinetuneListParams as FinetuneListParams, + }; + + export { + Assets as Assets, + type AssetCreateResponse as AssetCreateResponse, + type AssetCreateParams as AssetCreateParams, + }; + + export { + Public as Public, + type PublicListResponse as PublicListResponse, + PublicListResponsesSinglePage as PublicListResponsesSinglePage, + type PublicListParams as PublicListParams, + }; +} diff --git a/src/resources/ai/finetunes/index.ts b/src/resources/ai/finetunes/index.ts new file mode 100644 index 0000000000..b1afe5dee7 --- /dev/null +++ b/src/resources/ai/finetunes/index.ts @@ -0,0 +1,16 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Assets, type AssetCreateResponse, type AssetCreateParams } from './assets'; +export { + Finetunes, + type FinetuneCreateResponse, + type FinetuneListResponse, + type FinetuneCreateParams, + type FinetuneListParams, +} from './finetunes'; +export { + PublicListResponsesSinglePage, + Public, + type PublicListResponse, + type PublicListParams, +} from './public'; diff --git a/src/resources/ai/finetunes/public.ts b/src/resources/ai/finetunes/public.ts new file mode 100644 index 0000000000..8494bc7eb4 --- /dev/null +++ b/src/resources/ai/finetunes/public.ts @@ -0,0 +1,72 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { SinglePage } from '../../../pagination'; + +export class Public extends APIResource { + /** + * List Public Finetunes + */ + list( + params: PublicListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai/finetunes/public`, + PublicListResponsesSinglePage, + { query, ...options }, + ); + } +} + +export class PublicListResponsesSinglePage extends SinglePage {} + +export interface PublicListResponse { + id: string; + + created_at: string; + + model: string; + + modified_at: string; + + name: string; + + public: boolean; + + description?: string; +} + +export interface PublicListParams { + /** + * Path param: + */ + account_id: string; + + /** + * Query param: Pagination Limit + */ + limit?: number; + + /** + * Query param: Pagination Offset + */ + offset?: number; + + /** + * Query param: Order By Column Name + */ + orderBy?: string; +} + +Public.PublicListResponsesSinglePage = PublicListResponsesSinglePage; + +export declare namespace Public { + export { + type PublicListResponse as PublicListResponse, + PublicListResponsesSinglePage as PublicListResponsesSinglePage, + type PublicListParams as PublicListParams, + }; +} diff --git a/src/resources/ai/index.ts b/src/resources/ai/index.ts new file mode 100644 index 0000000000..d75349a3a3 --- /dev/null +++ b/src/resources/ai/index.ts @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { AI } from './ai'; +export { + AuthorListResponsesSinglePage, + Authors, + type AuthorListResponse, + type AuthorListParams, +} from './authors'; +export { + Finetunes, + type FinetuneCreateResponse, + type FinetuneListResponse, + type FinetuneCreateParams, + type FinetuneListParams, +} from './finetunes/index'; +export { + ModelListResponsesV4PagePaginationArray, + Models, + type ModelListResponse, + type ModelListParams, +} from './models/index'; +export { TaskListResponsesSinglePage, Tasks, type TaskListResponse, type TaskListParams } from './tasks'; diff --git a/src/resources/ai/models/index.ts b/src/resources/ai/models/index.ts new file mode 100644 index 0000000000..4d7a7597b2 --- /dev/null +++ b/src/resources/ai/models/index.ts @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + ModelListResponsesV4PagePaginationArray, + Models, + type ModelListResponse, + type ModelListParams, +} from './models'; +export { Schema, type SchemaGetResponse, type SchemaGetParams } from './schema'; diff --git a/src/resources/ai/models/models.ts b/src/resources/ai/models/models.ts new file mode 100644 index 0000000000..3a80c39394 --- /dev/null +++ b/src/resources/ai/models/models.ts @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as SchemaAPI from './schema'; +import { Schema, SchemaGetParams, SchemaGetResponse } from './schema'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Models extends APIResource { + schema: SchemaAPI.Schema = new SchemaAPI.Schema(this._client); + + /** + * Model Search + */ + list( + params: ModelListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai/models/search`, + ModelListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } +} + +export class ModelListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export type ModelListResponse = unknown; + +export interface ModelListParams extends V4PagePaginationArrayParams { + /** + * Path param: + */ + account_id: string; + + /** + * Query param: Filter by Author + */ + author?: string; + + /** + * Query param: Filter to hide experimental models + */ + hide_experimental?: boolean; + + /** + * Query param: Search + */ + search?: string; + + /** + * Query param: Filter by Source Id + */ + source?: number; + + /** + * Query param: Filter by Task Name + */ + task?: string; +} + +Models.ModelListResponsesV4PagePaginationArray = ModelListResponsesV4PagePaginationArray; +Models.Schema = Schema; + +export declare namespace Models { + export { + type ModelListResponse as ModelListResponse, + ModelListResponsesV4PagePaginationArray as ModelListResponsesV4PagePaginationArray, + type ModelListParams as ModelListParams, + }; + + export { + Schema as Schema, + type SchemaGetResponse as SchemaGetResponse, + type SchemaGetParams as SchemaGetParams, + }; +} diff --git a/src/resources/workers/ai/models/schema.ts b/src/resources/ai/models/schema.ts similarity index 71% rename from src/resources/workers/ai/models/schema.ts rename to src/resources/ai/models/schema.ts index b306a1e188..1864a8ba7d 100644 --- a/src/resources/workers/ai/models/schema.ts +++ b/src/resources/ai/models/schema.ts @@ -1,8 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../../resource'; -import * as Core from '../../../../core'; -import * as SchemaAPI from './schema'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; export class Schema extends APIResource { /** @@ -32,7 +31,6 @@ export interface SchemaGetParams { model: string; } -export namespace Schema { - export import SchemaGetResponse = SchemaAPI.SchemaGetResponse; - export import SchemaGetParams = SchemaAPI.SchemaGetParams; +export declare namespace Schema { + export { type SchemaGetResponse as SchemaGetResponse, type SchemaGetParams as SchemaGetParams }; } diff --git a/src/resources/ai/tasks.ts b/src/resources/ai/tasks.ts new file mode 100644 index 0000000000..5e830da4d9 --- /dev/null +++ b/src/resources/ai/tasks.ts @@ -0,0 +1,40 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage } from '../../pagination'; + +export class Tasks extends APIResource { + /** + * Task Search + */ + list( + params: TaskListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/ai/tasks/search`, + TaskListResponsesSinglePage, + options, + ); + } +} + +export class TaskListResponsesSinglePage extends SinglePage {} + +export type TaskListResponse = unknown; + +export interface TaskListParams { + account_id: string; +} + +Tasks.TaskListResponsesSinglePage = TaskListResponsesSinglePage; + +export declare namespace Tasks { + export { + type TaskListResponse as TaskListResponse, + TaskListResponsesSinglePage as TaskListResponsesSinglePage, + type TaskListParams as TaskListParams, + }; +} diff --git a/src/resources/alerting/alerting.ts b/src/resources/alerting/alerting.ts index 031e5284d9..6f955cbcb8 100644 --- a/src/resources/alerting/alerting.ts +++ b/src/resources/alerting/alerting.ts @@ -2,9 +2,27 @@ import { APIResource } from '../../resource'; import * as AvailableAlertsAPI from './available-alerts'; +import { AvailableAlertListParams, AvailableAlertListResponse, AvailableAlerts } from './available-alerts'; import * as HistoryAPI from './history'; +import { HistoriesV4PagePaginationArray, History, HistoryListParams, HistoryResource } from './history'; import * as PoliciesAPI from './policies'; +import { + Mechanism, + Policies, + PoliciesSinglePage, + Policy, + PolicyCreateParams, + PolicyCreateResponse, + PolicyDeleteParams, + PolicyDeleteResponse, + PolicyFilter, + PolicyGetParams, + PolicyListParams, + PolicyUpdateParams, + PolicyUpdateResponse, +} from './policies'; import * as DestinationsAPI from './destinations/destinations'; +import { Destinations } from './destinations/destinations'; export class Alerting extends APIResource { availableAlerts: AvailableAlertsAPI.AvailableAlerts = new AvailableAlertsAPI.AvailableAlerts(this._client); @@ -13,26 +31,42 @@ export class Alerting extends APIResource { policies: PoliciesAPI.Policies = new PoliciesAPI.Policies(this._client); } -export namespace Alerting { - export import AvailableAlerts = AvailableAlertsAPI.AvailableAlerts; - export import AvailableAlertListResponse = AvailableAlertsAPI.AvailableAlertListResponse; - export import AvailableAlertListParams = AvailableAlertsAPI.AvailableAlertListParams; - export import Destinations = DestinationsAPI.Destinations; - export import HistoryResource = HistoryAPI.HistoryResource; - export import History = HistoryAPI.History; - export import HistoriesV4PagePaginationArray = HistoryAPI.HistoriesV4PagePaginationArray; - export import HistoryListParams = HistoryAPI.HistoryListParams; - export import Policies = PoliciesAPI.Policies; - export import Mechanism = PoliciesAPI.Mechanism; - export import Policy = PoliciesAPI.Policy; - export import PolicyFilter = PoliciesAPI.PolicyFilter; - export import PolicyCreateResponse = PoliciesAPI.PolicyCreateResponse; - export import PolicyUpdateResponse = PoliciesAPI.PolicyUpdateResponse; - export import PolicyDeleteResponse = PoliciesAPI.PolicyDeleteResponse; - export import PoliciesSinglePage = PoliciesAPI.PoliciesSinglePage; - export import PolicyCreateParams = PoliciesAPI.PolicyCreateParams; - export import PolicyUpdateParams = PoliciesAPI.PolicyUpdateParams; - export import PolicyListParams = PoliciesAPI.PolicyListParams; - export import PolicyDeleteParams = PoliciesAPI.PolicyDeleteParams; - export import PolicyGetParams = PoliciesAPI.PolicyGetParams; +Alerting.AvailableAlerts = AvailableAlerts; +Alerting.Destinations = Destinations; +Alerting.HistoryResource = HistoryResource; +Alerting.HistoriesV4PagePaginationArray = HistoriesV4PagePaginationArray; +Alerting.Policies = Policies; +Alerting.PoliciesSinglePage = PoliciesSinglePage; + +export declare namespace Alerting { + export { + AvailableAlerts as AvailableAlerts, + type AvailableAlertListResponse as AvailableAlertListResponse, + type AvailableAlertListParams as AvailableAlertListParams, + }; + + export { Destinations as Destinations }; + + export { + HistoryResource as HistoryResource, + type History as History, + HistoriesV4PagePaginationArray as HistoriesV4PagePaginationArray, + type HistoryListParams as HistoryListParams, + }; + + export { + Policies as Policies, + type Mechanism as Mechanism, + type Policy as Policy, + type PolicyFilter as PolicyFilter, + type PolicyCreateResponse as PolicyCreateResponse, + type PolicyUpdateResponse as PolicyUpdateResponse, + type PolicyDeleteResponse as PolicyDeleteResponse, + PoliciesSinglePage as PoliciesSinglePage, + type PolicyCreateParams as PolicyCreateParams, + type PolicyUpdateParams as PolicyUpdateParams, + type PolicyListParams as PolicyListParams, + type PolicyDeleteParams as PolicyDeleteParams, + type PolicyGetParams as PolicyGetParams, + }; } diff --git a/src/resources/alerting/available-alerts.ts b/src/resources/alerting/available-alerts.ts index ca58406b88..acd3a3261e 100644 --- a/src/resources/alerting/available-alerts.ts +++ b/src/resources/alerting/available-alerts.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as AvailableAlertsAPI from './available-alerts'; export class AvailableAlerts extends APIResource { /** @@ -21,13 +20,10 @@ export class AvailableAlerts extends APIResource { } } -export type AvailableAlertListResponse = Record< - string, - Array ->; +export type AvailableAlertListResponse = Record>; export namespace AvailableAlertListResponse { - export interface UnnamedSchemaWithMapParent1 { + export interface Item { /** * Describes the alert type. */ @@ -58,7 +54,9 @@ export interface AvailableAlertListParams { account_id: string; } -export namespace AvailableAlerts { - export import AvailableAlertListResponse = AvailableAlertsAPI.AvailableAlertListResponse; - export import AvailableAlertListParams = AvailableAlertsAPI.AvailableAlertListParams; +export declare namespace AvailableAlerts { + export { + type AvailableAlertListResponse as AvailableAlertListResponse, + type AvailableAlertListParams as AvailableAlertListParams, + }; } diff --git a/src/resources/alerting/destinations/destinations.ts b/src/resources/alerting/destinations/destinations.ts index ed7e2c8144..cc1fd9b34c 100644 --- a/src/resources/alerting/destinations/destinations.ts +++ b/src/resources/alerting/destinations/destinations.ts @@ -2,8 +2,33 @@ import { APIResource } from '../../../resource'; import * as EligibleAPI from './eligible'; +import { Eligible, EligibleGetParams, EligibleGetResponse } from './eligible'; import * as PagerdutyAPI from './pagerduty'; +import { + Pagerduty, + PagerdutyCreateParams, + PagerdutyCreateResponse, + PagerdutyDeleteParams, + PagerdutyDeleteResponse, + PagerdutyGetParams, + PagerdutyGetResponse, + PagerdutyLinkParams, + PagerdutyLinkResponse, + PagerdutyResource, +} from './pagerduty'; import * as WebhooksAPI from './webhooks'; +import { + WebhookCreateParams, + WebhookCreateResponse, + WebhookDeleteParams, + WebhookDeleteResponse, + WebhookGetParams, + WebhookListParams, + WebhookUpdateParams, + WebhookUpdateResponse, + Webhooks, + WebhooksSinglePage, +} from './webhooks'; export class Destinations extends APIResource { eligible: EligibleAPI.Eligible = new EligibleAPI.Eligible(this._client); @@ -11,28 +36,40 @@ export class Destinations extends APIResource { webhooks: WebhooksAPI.Webhooks = new WebhooksAPI.Webhooks(this._client); } -export namespace Destinations { - export import Eligible = EligibleAPI.Eligible; - export import EligibleGetResponse = EligibleAPI.EligibleGetResponse; - export import EligibleGetParams = EligibleAPI.EligibleGetParams; - export import PagerdutyResource = PagerdutyAPI.PagerdutyResource; - export import Pagerduty = PagerdutyAPI.Pagerduty; - export import PagerdutyCreateResponse = PagerdutyAPI.PagerdutyCreateResponse; - export import PagerdutyDeleteResponse = PagerdutyAPI.PagerdutyDeleteResponse; - export import PagerdutyGetResponse = PagerdutyAPI.PagerdutyGetResponse; - export import PagerdutyLinkResponse = PagerdutyAPI.PagerdutyLinkResponse; - export import PagerdutyCreateParams = PagerdutyAPI.PagerdutyCreateParams; - export import PagerdutyDeleteParams = PagerdutyAPI.PagerdutyDeleteParams; - export import PagerdutyGetParams = PagerdutyAPI.PagerdutyGetParams; - export import PagerdutyLinkParams = PagerdutyAPI.PagerdutyLinkParams; - export import Webhooks = WebhooksAPI.Webhooks; - export import WebhookCreateResponse = WebhooksAPI.WebhookCreateResponse; - export import WebhookUpdateResponse = WebhooksAPI.WebhookUpdateResponse; - export import WebhookDeleteResponse = WebhooksAPI.WebhookDeleteResponse; - export import WebhooksSinglePage = WebhooksAPI.WebhooksSinglePage; - export import WebhookCreateParams = WebhooksAPI.WebhookCreateParams; - export import WebhookUpdateParams = WebhooksAPI.WebhookUpdateParams; - export import WebhookListParams = WebhooksAPI.WebhookListParams; - export import WebhookDeleteParams = WebhooksAPI.WebhookDeleteParams; - export import WebhookGetParams = WebhooksAPI.WebhookGetParams; +Destinations.Eligible = Eligible; +Destinations.PagerdutyResource = PagerdutyResource; +Destinations.WebhooksSinglePage = WebhooksSinglePage; + +export declare namespace Destinations { + export { + Eligible as Eligible, + type EligibleGetResponse as EligibleGetResponse, + type EligibleGetParams as EligibleGetParams, + }; + + export { + PagerdutyResource as PagerdutyResource, + type Pagerduty as Pagerduty, + type PagerdutyCreateResponse as PagerdutyCreateResponse, + type PagerdutyDeleteResponse as PagerdutyDeleteResponse, + type PagerdutyGetResponse as PagerdutyGetResponse, + type PagerdutyLinkResponse as PagerdutyLinkResponse, + type PagerdutyCreateParams as PagerdutyCreateParams, + type PagerdutyDeleteParams as PagerdutyDeleteParams, + type PagerdutyGetParams as PagerdutyGetParams, + type PagerdutyLinkParams as PagerdutyLinkParams, + }; + + export { + type Webhooks as Webhooks, + type WebhookCreateResponse as WebhookCreateResponse, + type WebhookUpdateResponse as WebhookUpdateResponse, + type WebhookDeleteResponse as WebhookDeleteResponse, + WebhooksSinglePage as WebhooksSinglePage, + type WebhookCreateParams as WebhookCreateParams, + type WebhookUpdateParams as WebhookUpdateParams, + type WebhookListParams as WebhookListParams, + type WebhookDeleteParams as WebhookDeleteParams, + type WebhookGetParams as WebhookGetParams, + }; } diff --git a/src/resources/alerting/destinations/eligible.ts b/src/resources/alerting/destinations/eligible.ts index be6d7a2f28..93e480679c 100644 --- a/src/resources/alerting/destinations/eligible.ts +++ b/src/resources/alerting/destinations/eligible.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as EligibleAPI from './eligible'; export class Eligible extends APIResource { /** @@ -19,10 +18,10 @@ export class Eligible extends APIResource { } } -export type EligibleGetResponse = Record>; +export type EligibleGetResponse = Record>; export namespace EligibleGetResponse { - export interface UnnamedSchemaWithMapParent2 { + export interface Item { /** * Determines whether or not the account is eligible for the delivery mechanism. */ @@ -48,7 +47,6 @@ export interface EligibleGetParams { account_id: string; } -export namespace Eligible { - export import EligibleGetResponse = EligibleAPI.EligibleGetResponse; - export import EligibleGetParams = EligibleAPI.EligibleGetParams; +export declare namespace Eligible { + export { type EligibleGetResponse as EligibleGetResponse, type EligibleGetParams as EligibleGetParams }; } diff --git a/src/resources/alerting/destinations/index.ts b/src/resources/alerting/destinations/index.ts index 2900a2183c..fae3c4db34 100644 --- a/src/resources/alerting/destinations/index.ts +++ b/src/resources/alerting/destinations/index.ts @@ -1,28 +1,28 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Destinations } from './destinations'; -export { EligibleGetResponse, EligibleGetParams, Eligible } from './eligible'; +export { Eligible, type EligibleGetResponse, type EligibleGetParams } from './eligible'; export { - Pagerduty, - PagerdutyCreateResponse, - PagerdutyDeleteResponse, - PagerdutyGetResponse, - PagerdutyLinkResponse, - PagerdutyCreateParams, - PagerdutyDeleteParams, - PagerdutyGetParams, - PagerdutyLinkParams, PagerdutyResource, + type Pagerduty, + type PagerdutyCreateResponse, + type PagerdutyDeleteResponse, + type PagerdutyGetResponse, + type PagerdutyLinkResponse, + type PagerdutyCreateParams, + type PagerdutyDeleteParams, + type PagerdutyGetParams, + type PagerdutyLinkParams, } from './pagerduty'; export { - Webhooks, - WebhookCreateResponse, - WebhookUpdateResponse, - WebhookDeleteResponse, - WebhookCreateParams, - WebhookUpdateParams, - WebhookListParams, - WebhookDeleteParams, - WebhookGetParams, WebhooksSinglePage, + Webhooks, + type WebhookCreateResponse, + type WebhookUpdateResponse, + type WebhookDeleteResponse, + type WebhookCreateParams, + type WebhookUpdateParams, + type WebhookListParams, + type WebhookDeleteParams, + type WebhookGetParams, } from './webhooks'; diff --git a/src/resources/alerting/destinations/pagerduty.ts b/src/resources/alerting/destinations/pagerduty.ts index 64aca5fb66..6d35088fc5 100644 --- a/src/resources/alerting/destinations/pagerduty.ts +++ b/src/resources/alerting/destinations/pagerduty.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as PagerdutyAPI from './pagerduty'; import * as Shared from '../../shared'; export class PagerdutyResource extends APIResource { @@ -157,14 +156,16 @@ export interface PagerdutyLinkParams { account_id: string; } -export namespace PagerdutyResource { - export import Pagerduty = PagerdutyAPI.Pagerduty; - export import PagerdutyCreateResponse = PagerdutyAPI.PagerdutyCreateResponse; - export import PagerdutyDeleteResponse = PagerdutyAPI.PagerdutyDeleteResponse; - export import PagerdutyGetResponse = PagerdutyAPI.PagerdutyGetResponse; - export import PagerdutyLinkResponse = PagerdutyAPI.PagerdutyLinkResponse; - export import PagerdutyCreateParams = PagerdutyAPI.PagerdutyCreateParams; - export import PagerdutyDeleteParams = PagerdutyAPI.PagerdutyDeleteParams; - export import PagerdutyGetParams = PagerdutyAPI.PagerdutyGetParams; - export import PagerdutyLinkParams = PagerdutyAPI.PagerdutyLinkParams; +export declare namespace PagerdutyResource { + export { + type Pagerduty as Pagerduty, + type PagerdutyCreateResponse as PagerdutyCreateResponse, + type PagerdutyDeleteResponse as PagerdutyDeleteResponse, + type PagerdutyGetResponse as PagerdutyGetResponse, + type PagerdutyLinkResponse as PagerdutyLinkResponse, + type PagerdutyCreateParams as PagerdutyCreateParams, + type PagerdutyDeleteParams as PagerdutyDeleteParams, + type PagerdutyGetParams as PagerdutyGetParams, + type PagerdutyLinkParams as PagerdutyLinkParams, + }; } diff --git a/src/resources/alerting/destinations/webhooks.ts b/src/resources/alerting/destinations/webhooks.ts index 6efe9b21c5..266fb0ef19 100644 --- a/src/resources/alerting/destinations/webhooks.ts +++ b/src/resources/alerting/destinations/webhooks.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as WebhooksAPI from './webhooks'; import * as Shared from '../../shared'; import { SinglePage } from '../../../pagination'; @@ -252,15 +251,19 @@ export interface WebhookGetParams { account_id: string; } -export namespace Webhooks { - export import Webhooks = WebhooksAPI.Webhooks; - export import WebhookCreateResponse = WebhooksAPI.WebhookCreateResponse; - export import WebhookUpdateResponse = WebhooksAPI.WebhookUpdateResponse; - export import WebhookDeleteResponse = WebhooksAPI.WebhookDeleteResponse; - export import WebhooksSinglePage = WebhooksAPI.WebhooksSinglePage; - export import WebhookCreateParams = WebhooksAPI.WebhookCreateParams; - export import WebhookUpdateParams = WebhooksAPI.WebhookUpdateParams; - export import WebhookListParams = WebhooksAPI.WebhookListParams; - export import WebhookDeleteParams = WebhooksAPI.WebhookDeleteParams; - export import WebhookGetParams = WebhooksAPI.WebhookGetParams; +Webhooks.WebhooksSinglePage = WebhooksSinglePage; + +export declare namespace Webhooks { + export { + type Webhooks as Webhooks, + type WebhookCreateResponse as WebhookCreateResponse, + type WebhookUpdateResponse as WebhookUpdateResponse, + type WebhookDeleteResponse as WebhookDeleteResponse, + WebhooksSinglePage as WebhooksSinglePage, + type WebhookCreateParams as WebhookCreateParams, + type WebhookUpdateParams as WebhookUpdateParams, + type WebhookListParams as WebhookListParams, + type WebhookDeleteParams as WebhookDeleteParams, + type WebhookGetParams as WebhookGetParams, + }; } diff --git a/src/resources/alerting/history.ts b/src/resources/alerting/history.ts index 0f0833e193..b6ae964dcc 100644 --- a/src/resources/alerting/history.ts +++ b/src/resources/alerting/history.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as HistoryAPI from './history'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class HistoryResource extends APIResource { @@ -93,8 +92,12 @@ export interface HistoryListParams extends V4PagePaginationArrayParams { since?: string; } -export namespace HistoryResource { - export import History = HistoryAPI.History; - export import HistoriesV4PagePaginationArray = HistoryAPI.HistoriesV4PagePaginationArray; - export import HistoryListParams = HistoryAPI.HistoryListParams; +HistoryResource.HistoriesV4PagePaginationArray = HistoriesV4PagePaginationArray; + +export declare namespace HistoryResource { + export { + type History as History, + HistoriesV4PagePaginationArray as HistoriesV4PagePaginationArray, + type HistoryListParams as HistoryListParams, + }; } diff --git a/src/resources/alerting/index.ts b/src/resources/alerting/index.ts index 4e3c7f7a3b..d249a16557 100644 --- a/src/resources/alerting/index.ts +++ b/src/resources/alerting/index.ts @@ -1,21 +1,30 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Alerting } from './alerting'; -export { AvailableAlertListResponse, AvailableAlertListParams, AvailableAlerts } from './available-alerts'; +export { + AvailableAlerts, + type AvailableAlertListResponse, + type AvailableAlertListParams, +} from './available-alerts'; export { Destinations } from './destinations/index'; -export { History, HistoryListParams, HistoriesV4PagePaginationArray, HistoryResource } from './history'; export { - Mechanism, - Policy, - PolicyFilter, - PolicyCreateResponse, - PolicyUpdateResponse, - PolicyDeleteResponse, - PolicyCreateParams, - PolicyUpdateParams, - PolicyListParams, - PolicyDeleteParams, - PolicyGetParams, + HistoriesV4PagePaginationArray, + HistoryResource, + type History, + type HistoryListParams, +} from './history'; +export { PoliciesSinglePage, Policies, + type Mechanism, + type Policy, + type PolicyFilter, + type PolicyCreateResponse, + type PolicyUpdateResponse, + type PolicyDeleteResponse, + type PolicyCreateParams, + type PolicyUpdateParams, + type PolicyListParams, + type PolicyDeleteParams, + type PolicyGetParams, } from './policies'; diff --git a/src/resources/alerting/policies.ts b/src/resources/alerting/policies.ts index 2e2acdece5..44e7c522cc 100644 --- a/src/resources/alerting/policies.ts +++ b/src/resources/alerting/policies.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PoliciesAPI from './policies'; import * as Shared from '../shared'; import { SinglePage } from '../../pagination'; @@ -84,14 +83,14 @@ export class PoliciesSinglePage extends SinglePage {} * List of IDs that will be used when dispatching a notification. IDs for email * type will be the email address. */ -export type Mechanism = Record>; +export type Mechanism = Record>; export namespace Mechanism { - export interface UnnamedSchemaWithMapParent3 { + export interface Item { /** * UUID */ - id?: string | string; + id?: string; } } @@ -99,14 +98,14 @@ export namespace Mechanism { * List of IDs that will be used when dispatching a notification. IDs for email * type will be the email address. */ -export type MechanismParam = Record>; +export type MechanismParam = Record>; export namespace MechanismParam { - export interface UnnamedSchemaWithMapParent3 { + export interface Item { /** * UUID */ - id?: string | string; + id?: string; } } @@ -116,6 +115,12 @@ export interface Policy { */ id?: string; + /** + * Optional specification of how often to re-alert from the same incident, not + * support on all alert types. + */ + alert_interval?: string; + /** * Refers to which event will trigger a Notification dispatch. You can use the * endpoint to get available alert types which then will give you a list of @@ -135,8 +140,11 @@ export interface Policy { | 'brand_protection_digest' | 'clickhouse_alert_fw_anomaly' | 'clickhouse_alert_fw_ent_anomaly' + | 'cloudforce_one_request_notification' + | 'custom_analytics' | 'custom_ssl_certificate_event_type' | 'dedicated_ssl_certificate_event_type' + | 'device_connectivity_anomaly_alert' | 'dos_attack_l4' | 'dos_attack_l7' | 'expiring_service_token_alert' @@ -149,10 +157,13 @@ export interface Policy { | 'http_alert_edge_error' | 'http_alert_origin_error' | 'incident_alert' + | 'image_notification' + | 'image_resizing_notification' | 'load_balancing_health_alert' | 'load_balancing_pool_enablement_alert' | 'logo_match_alert' | 'magic_tunnel_health_check_event' + | 'magic_wan_tunnel_health' | 'maintenance_event_notification' | 'mtls_certificate_store_certificate_expiration_type' | 'pages_event_alert' @@ -167,10 +178,13 @@ export interface Policy { | 'scriptmonitor_alert_new_resources' | 'secondary_dns_all_primaries_failing' | 'secondary_dns_primaries_failing' + | 'secondary_dns_warning' | 'secondary_dns_zone_successfully_updated' | 'secondary_dns_zone_validation_warning' | 'sentinel_alert' | 'stream_live_notifications' + | 'synthetic_test_latency_alert' + | 'synthetic_test_low_availability_alert' | 'traffic_anomalies_alert' | 'tunnel_health_event' | 'tunnel_update_event' @@ -228,8 +242,7 @@ export interface PolicyFilter { affected_asns?: Array; /** - * Used for configuring incident_alert. A list of identifiers for each component to - * monitor. + * Used for configuring incident_alert */ affected_components?: Array; @@ -249,9 +262,9 @@ export interface PolicyFilter { alert_trigger_preferences?: Array; /** - * Used for configuring magic_tunnel_health_check_event + * Usage depends on specific alert type */ - alert_trigger_preferences_value?: Array<'99.0' | '98.0' | '97.0'>; + alert_trigger_preferences_value?: Array; /** * Used for configuring load_balancing_pool_enablement_alert @@ -335,6 +348,11 @@ export interface PolicyFilter { */ pool_id?: Array; + /** + * Usage depends on specific alert type + */ + pop_name?: Array; + /** * Used for configuring billing_usage_alert */ @@ -406,7 +424,7 @@ export interface PolicyFilter { tunnel_id?: Array; /** - * Used for configuring magic_tunnel_health_check_event + * Usage depends on specific alert type */ tunnel_name?: Array; @@ -438,8 +456,7 @@ export interface PolicyFilterParam { affected_asns?: Array; /** - * Used for configuring incident_alert. A list of identifiers for each component to - * monitor. + * Used for configuring incident_alert */ affected_components?: Array; @@ -459,9 +476,9 @@ export interface PolicyFilterParam { alert_trigger_preferences?: Array; /** - * Used for configuring magic_tunnel_health_check_event + * Usage depends on specific alert type */ - alert_trigger_preferences_value?: Array<'99.0' | '98.0' | '97.0'>; + alert_trigger_preferences_value?: Array; /** * Used for configuring load_balancing_pool_enablement_alert @@ -545,6 +562,11 @@ export interface PolicyFilterParam { */ pool_id?: Array; + /** + * Usage depends on specific alert type + */ + pop_name?: Array; + /** * Used for configuring billing_usage_alert */ @@ -616,7 +638,7 @@ export interface PolicyFilterParam { tunnel_id?: Array; /** - * Used for configuring magic_tunnel_health_check_event + * Usage depends on specific alert type */ tunnel_name?: Array; @@ -707,8 +729,11 @@ export interface PolicyCreateParams { | 'brand_protection_digest' | 'clickhouse_alert_fw_anomaly' | 'clickhouse_alert_fw_ent_anomaly' + | 'cloudforce_one_request_notification' + | 'custom_analytics' | 'custom_ssl_certificate_event_type' | 'dedicated_ssl_certificate_event_type' + | 'device_connectivity_anomaly_alert' | 'dos_attack_l4' | 'dos_attack_l7' | 'expiring_service_token_alert' @@ -721,10 +746,13 @@ export interface PolicyCreateParams { | 'http_alert_edge_error' | 'http_alert_origin_error' | 'incident_alert' + | 'image_notification' + | 'image_resizing_notification' | 'load_balancing_health_alert' | 'load_balancing_pool_enablement_alert' | 'logo_match_alert' | 'magic_tunnel_health_check_event' + | 'magic_wan_tunnel_health' | 'maintenance_event_notification' | 'mtls_certificate_store_certificate_expiration_type' | 'pages_event_alert' @@ -739,10 +767,13 @@ export interface PolicyCreateParams { | 'scriptmonitor_alert_new_resources' | 'secondary_dns_all_primaries_failing' | 'secondary_dns_primaries_failing' + | 'secondary_dns_warning' | 'secondary_dns_zone_successfully_updated' | 'secondary_dns_zone_validation_warning' | 'sentinel_alert' | 'stream_live_notifications' + | 'synthetic_test_latency_alert' + | 'synthetic_test_low_availability_alert' | 'traffic_anomalies_alert' | 'tunnel_health_event' | 'tunnel_update_event' @@ -766,6 +797,12 @@ export interface PolicyCreateParams { */ name: string; + /** + * Body param: Optional specification of how often to re-alert from the same + * incident, not support on all alert types. + */ + alert_interval?: string; + /** * Body param: Optional description for the Notification policy. */ @@ -785,6 +822,12 @@ export interface PolicyUpdateParams { */ account_id: string; + /** + * Body param: Optional specification of how often to re-alert from the same + * incident, not support on all alert types. + */ + alert_interval?: string; + /** * Body param: Refers to which event will trigger a Notification dispatch. You can * use the endpoint to get available alert types which then will give you a list of @@ -804,8 +847,11 @@ export interface PolicyUpdateParams { | 'brand_protection_digest' | 'clickhouse_alert_fw_anomaly' | 'clickhouse_alert_fw_ent_anomaly' + | 'cloudforce_one_request_notification' + | 'custom_analytics' | 'custom_ssl_certificate_event_type' | 'dedicated_ssl_certificate_event_type' + | 'device_connectivity_anomaly_alert' | 'dos_attack_l4' | 'dos_attack_l7' | 'expiring_service_token_alert' @@ -818,10 +864,13 @@ export interface PolicyUpdateParams { | 'http_alert_edge_error' | 'http_alert_origin_error' | 'incident_alert' + | 'image_notification' + | 'image_resizing_notification' | 'load_balancing_health_alert' | 'load_balancing_pool_enablement_alert' | 'logo_match_alert' | 'magic_tunnel_health_check_event' + | 'magic_wan_tunnel_health' | 'maintenance_event_notification' | 'mtls_certificate_store_certificate_expiration_type' | 'pages_event_alert' @@ -836,10 +885,13 @@ export interface PolicyUpdateParams { | 'scriptmonitor_alert_new_resources' | 'secondary_dns_all_primaries_failing' | 'secondary_dns_primaries_failing' + | 'secondary_dns_warning' | 'secondary_dns_zone_successfully_updated' | 'secondary_dns_zone_validation_warning' | 'sentinel_alert' | 'stream_live_notifications' + | 'synthetic_test_latency_alert' + | 'synthetic_test_low_availability_alert' | 'traffic_anomalies_alert' | 'tunnel_health_event' | 'tunnel_update_event' @@ -897,17 +949,21 @@ export interface PolicyGetParams { account_id: string; } -export namespace Policies { - export import Mechanism = PoliciesAPI.Mechanism; - export import Policy = PoliciesAPI.Policy; - export import PolicyFilter = PoliciesAPI.PolicyFilter; - export import PolicyCreateResponse = PoliciesAPI.PolicyCreateResponse; - export import PolicyUpdateResponse = PoliciesAPI.PolicyUpdateResponse; - export import PolicyDeleteResponse = PoliciesAPI.PolicyDeleteResponse; - export import PoliciesSinglePage = PoliciesAPI.PoliciesSinglePage; - export import PolicyCreateParams = PoliciesAPI.PolicyCreateParams; - export import PolicyUpdateParams = PoliciesAPI.PolicyUpdateParams; - export import PolicyListParams = PoliciesAPI.PolicyListParams; - export import PolicyDeleteParams = PoliciesAPI.PolicyDeleteParams; - export import PolicyGetParams = PoliciesAPI.PolicyGetParams; +Policies.PoliciesSinglePage = PoliciesSinglePage; + +export declare namespace Policies { + export { + type Mechanism as Mechanism, + type Policy as Policy, + type PolicyFilter as PolicyFilter, + type PolicyCreateResponse as PolicyCreateResponse, + type PolicyUpdateResponse as PolicyUpdateResponse, + type PolicyDeleteResponse as PolicyDeleteResponse, + PoliciesSinglePage as PoliciesSinglePage, + type PolicyCreateParams as PolicyCreateParams, + type PolicyUpdateParams as PolicyUpdateParams, + type PolicyListParams as PolicyListParams, + type PolicyDeleteParams as PolicyDeleteParams, + type PolicyGetParams as PolicyGetParams, + }; } diff --git a/src/resources/api-gateway/api-gateway.ts b/src/resources/api-gateway/api-gateway.ts index 4f13f5a1a1..6bc719c0a8 100644 --- a/src/resources/api-gateway/api-gateway.ts +++ b/src/resources/api-gateway/api-gateway.ts @@ -2,11 +2,58 @@ import { APIResource } from '../../resource'; import * as ConfigurationsAPI from './configurations'; +import { + Configuration, + ConfigurationGetParams, + ConfigurationUpdateParams, + ConfigurationUpdateResponse, + Configurations, +} from './configurations'; import * as SchemasAPI from './schemas'; +import { SchemaListParams, SchemaListResponse, Schemas } from './schemas'; import * as DiscoveryAPI from './discovery/discovery'; +import { + Discovery, + DiscoveryGetParams, + DiscoveryGetResponse, + DiscoveryOperation, +} from './discovery/discovery'; +import * as ExpressionTemplateAPI from './expression-template/expression-template'; +import { ExpressionTemplate } from './expression-template/expression-template'; import * as OperationsAPI from './operations/operations'; +import { + APIShield, + OperationBulkCreateParams, + OperationBulkCreateResponse, + OperationBulkDeleteParams, + OperationBulkDeleteResponse, + OperationCreateParams, + OperationCreateResponse, + OperationDeleteParams, + OperationDeleteResponse, + OperationGetParams, + OperationGetResponse, + OperationListParams, + OperationListResponse, + OperationListResponsesV4PagePaginationArray, + Operations, +} from './operations/operations'; import * as SettingsAPI from './settings/settings'; +import { Settings } from './settings/settings'; import * as UserSchemasAPI from './user-schemas/user-schemas'; +import { + Message, + PublicSchema, + PublicSchemasV4PagePaginationArray, + SchemaUpload, + UserSchemaCreateParams, + UserSchemaDeleteParams, + UserSchemaDeleteResponse, + UserSchemaEditParams, + UserSchemaGetParams, + UserSchemaListParams, + UserSchemas, +} from './user-schemas/user-schemas'; export class APIGateway extends APIResource { configurations: ConfigurationsAPI.Configurations = new ConfigurationsAPI.Configurations(this._client); @@ -15,42 +62,75 @@ export class APIGateway extends APIResource { schemas: SchemasAPI.Schemas = new SchemasAPI.Schemas(this._client); settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); userSchemas: UserSchemasAPI.UserSchemas = new UserSchemasAPI.UserSchemas(this._client); + expressionTemplate: ExpressionTemplateAPI.ExpressionTemplate = new ExpressionTemplateAPI.ExpressionTemplate( + this._client, + ); } -export namespace APIGateway { - export import Configurations = ConfigurationsAPI.Configurations; - export import Configuration = ConfigurationsAPI.Configuration; - export import ConfigurationUpdateResponse = ConfigurationsAPI.ConfigurationUpdateResponse; - export import ConfigurationUpdateParams = ConfigurationsAPI.ConfigurationUpdateParams; - export import ConfigurationGetParams = ConfigurationsAPI.ConfigurationGetParams; - export import Discovery = DiscoveryAPI.Discovery; - export import DiscoveryOperation = DiscoveryAPI.DiscoveryOperation; - export import DiscoveryGetResponse = DiscoveryAPI.DiscoveryGetResponse; - export import DiscoveryGetParams = DiscoveryAPI.DiscoveryGetParams; - export import Operations = OperationsAPI.Operations; - export import APIShield = OperationsAPI.APIShield; - export import OperationCreateResponse = OperationsAPI.OperationCreateResponse; - export import OperationListResponse = OperationsAPI.OperationListResponse; - export import OperationDeleteResponse = OperationsAPI.OperationDeleteResponse; - export import OperationGetResponse = OperationsAPI.OperationGetResponse; - export import OperationListResponsesV4PagePaginationArray = OperationsAPI.OperationListResponsesV4PagePaginationArray; - export import OperationCreateParams = OperationsAPI.OperationCreateParams; - export import OperationListParams = OperationsAPI.OperationListParams; - export import OperationDeleteParams = OperationsAPI.OperationDeleteParams; - export import OperationGetParams = OperationsAPI.OperationGetParams; - export import Schemas = SchemasAPI.Schemas; - export import SchemaListResponse = SchemasAPI.SchemaListResponse; - export import SchemaListParams = SchemasAPI.SchemaListParams; - export import Settings = SettingsAPI.Settings; - export import UserSchemas = UserSchemasAPI.UserSchemas; - export import Message = UserSchemasAPI.Message; - export import PublicSchema = UserSchemasAPI.PublicSchema; - export import SchemaUpload = UserSchemasAPI.SchemaUpload; - export import UserSchemaDeleteResponse = UserSchemasAPI.UserSchemaDeleteResponse; - export import PublicSchemasV4PagePaginationArray = UserSchemasAPI.PublicSchemasV4PagePaginationArray; - export import UserSchemaCreateParams = UserSchemasAPI.UserSchemaCreateParams; - export import UserSchemaListParams = UserSchemasAPI.UserSchemaListParams; - export import UserSchemaDeleteParams = UserSchemasAPI.UserSchemaDeleteParams; - export import UserSchemaEditParams = UserSchemasAPI.UserSchemaEditParams; - export import UserSchemaGetParams = UserSchemasAPI.UserSchemaGetParams; +APIGateway.Configurations = Configurations; +APIGateway.Discovery = Discovery; +APIGateway.Operations = Operations; +APIGateway.OperationListResponsesV4PagePaginationArray = OperationListResponsesV4PagePaginationArray; +APIGateway.Schemas = Schemas; +APIGateway.UserSchemas = UserSchemas; +APIGateway.PublicSchemasV4PagePaginationArray = PublicSchemasV4PagePaginationArray; +APIGateway.ExpressionTemplate = ExpressionTemplate; + +export declare namespace APIGateway { + export { + Configurations as Configurations, + type Configuration as Configuration, + type ConfigurationUpdateResponse as ConfigurationUpdateResponse, + type ConfigurationUpdateParams as ConfigurationUpdateParams, + type ConfigurationGetParams as ConfigurationGetParams, + }; + + export { + Discovery as Discovery, + type DiscoveryOperation as DiscoveryOperation, + type DiscoveryGetResponse as DiscoveryGetResponse, + type DiscoveryGetParams as DiscoveryGetParams, + }; + + export { + Operations as Operations, + type APIShield as APIShield, + type OperationCreateResponse as OperationCreateResponse, + type OperationListResponse as OperationListResponse, + type OperationDeleteResponse as OperationDeleteResponse, + type OperationBulkCreateResponse as OperationBulkCreateResponse, + type OperationBulkDeleteResponse as OperationBulkDeleteResponse, + type OperationGetResponse as OperationGetResponse, + OperationListResponsesV4PagePaginationArray as OperationListResponsesV4PagePaginationArray, + type OperationCreateParams as OperationCreateParams, + type OperationListParams as OperationListParams, + type OperationDeleteParams as OperationDeleteParams, + type OperationBulkCreateParams as OperationBulkCreateParams, + type OperationBulkDeleteParams as OperationBulkDeleteParams, + type OperationGetParams as OperationGetParams, + }; + + export { + Schemas as Schemas, + type SchemaListResponse as SchemaListResponse, + type SchemaListParams as SchemaListParams, + }; + + export { type Settings as Settings }; + + export { + UserSchemas as UserSchemas, + type Message as Message, + type PublicSchema as PublicSchema, + type SchemaUpload as SchemaUpload, + type UserSchemaDeleteResponse as UserSchemaDeleteResponse, + PublicSchemasV4PagePaginationArray as PublicSchemasV4PagePaginationArray, + type UserSchemaCreateParams as UserSchemaCreateParams, + type UserSchemaListParams as UserSchemaListParams, + type UserSchemaDeleteParams as UserSchemaDeleteParams, + type UserSchemaEditParams as UserSchemaEditParams, + type UserSchemaGetParams as UserSchemaGetParams, + }; + + export { ExpressionTemplate as ExpressionTemplate }; } diff --git a/src/resources/api-gateway/configurations.ts b/src/resources/api-gateway/configurations.ts index 4fc5d930f6..5d7bffa1d2 100644 --- a/src/resources/api-gateway/configurations.ts +++ b/src/resources/api-gateway/configurations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ConfigurationsAPI from './configurations'; import * as UserSchemasAPI from './user-schemas/user-schemas'; export class Configurations extends APIResource { @@ -33,7 +32,7 @@ export class Configurations extends APIResource { export interface Configuration { auth_id_characteristics: Array< - Configuration.APIShieldAuthIDCharacteristic | Configuration.APIShieldAuthIDCharacteristicJwtClaim + Configuration.APIShieldAuthIDCharacteristic | Configuration.APIShieldAuthIDCharacteristicJWTClaim >; } @@ -56,7 +55,7 @@ export namespace Configuration { /** * Auth ID Characteristic extracted from JWT Token Claims */ - export interface APIShieldAuthIDCharacteristicJwtClaim { + export interface APIShieldAuthIDCharacteristicJWTClaim { /** * Claim location expressed as `$(token_config_id):$(json_path)`, where * `token_config_id` is the ID of the token configuration used in validating the @@ -97,7 +96,7 @@ export interface ConfigurationUpdateParams { */ auth_id_characteristics: Array< | ConfigurationUpdateParams.APIShieldAuthIDCharacteristic - | ConfigurationUpdateParams.APIShieldAuthIDCharacteristicJwtClaim + | ConfigurationUpdateParams.APIShieldAuthIDCharacteristicJWTClaim >; } @@ -120,7 +119,7 @@ export namespace ConfigurationUpdateParams { /** * Auth ID Characteristic extracted from JWT Token Claims */ - export interface APIShieldAuthIDCharacteristicJwtClaim { + export interface APIShieldAuthIDCharacteristicJWTClaim { /** * Claim location expressed as `$(token_config_id):$(json_path)`, where * `token_config_id` is the ID of the token configuration used in validating the @@ -151,9 +150,11 @@ export interface ConfigurationGetParams { properties?: Array<'auth_id_characteristics'>; } -export namespace Configurations { - export import Configuration = ConfigurationsAPI.Configuration; - export import ConfigurationUpdateResponse = ConfigurationsAPI.ConfigurationUpdateResponse; - export import ConfigurationUpdateParams = ConfigurationsAPI.ConfigurationUpdateParams; - export import ConfigurationGetParams = ConfigurationsAPI.ConfigurationGetParams; +export declare namespace Configurations { + export { + type Configuration as Configuration, + type ConfigurationUpdateResponse as ConfigurationUpdateResponse, + type ConfigurationUpdateParams as ConfigurationUpdateParams, + type ConfigurationGetParams as ConfigurationGetParams, + }; } diff --git a/src/resources/api-gateway/discovery/discovery.ts b/src/resources/api-gateway/discovery/discovery.ts index 192f1b7682..e0ec7b04b4 100644 --- a/src/resources/api-gateway/discovery/discovery.ts +++ b/src/resources/api-gateway/discovery/discovery.ts @@ -2,8 +2,15 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as DiscoveryAPI from './discovery'; import * as OperationsAPI from './operations'; +import { + OperationBulkEditParams, + OperationBulkEditResponse, + OperationEditParams, + OperationEditResponse, + OperationListParams, + Operations, +} from './operations'; import { V4PagePaginationArray } from '../../../pagination'; export class Discovery extends APIResource { @@ -103,12 +110,21 @@ export interface DiscoveryGetParams { zone_id: string; } -export namespace Discovery { - export import DiscoveryOperation = DiscoveryAPI.DiscoveryOperation; - export import DiscoveryGetResponse = DiscoveryAPI.DiscoveryGetResponse; - export import DiscoveryGetParams = DiscoveryAPI.DiscoveryGetParams; - export import Operations = OperationsAPI.Operations; - export import OperationEditResponse = OperationsAPI.OperationEditResponse; - export import OperationListParams = OperationsAPI.OperationListParams; - export import OperationEditParams = OperationsAPI.OperationEditParams; +Discovery.Operations = Operations; + +export declare namespace Discovery { + export { + type DiscoveryOperation as DiscoveryOperation, + type DiscoveryGetResponse as DiscoveryGetResponse, + type DiscoveryGetParams as DiscoveryGetParams, + }; + + export { + Operations as Operations, + type OperationBulkEditResponse as OperationBulkEditResponse, + type OperationEditResponse as OperationEditResponse, + type OperationListParams as OperationListParams, + type OperationBulkEditParams as OperationBulkEditParams, + type OperationEditParams as OperationEditParams, + }; } diff --git a/src/resources/api-gateway/discovery/index.ts b/src/resources/api-gateway/discovery/index.ts index 613cea3e21..a2a9fd29a6 100644 --- a/src/resources/api-gateway/discovery/index.ts +++ b/src/resources/api-gateway/discovery/index.ts @@ -1,10 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - DiscoveryOperation, - DiscoveryGetResponse, - DiscoveryGetParams, DiscoveryOperationsV4PagePaginationArray, Discovery, + type DiscoveryOperation, + type DiscoveryGetResponse, + type DiscoveryGetParams, } from './discovery'; -export { OperationEditResponse, OperationListParams, OperationEditParams, Operations } from './operations'; +export { + Operations, + type OperationBulkEditResponse, + type OperationEditResponse, + type OperationListParams, + type OperationBulkEditParams, + type OperationEditParams, +} from './operations'; diff --git a/src/resources/api-gateway/discovery/operations.ts b/src/resources/api-gateway/discovery/operations.ts index eceff512c3..bc92f8b5fe 100644 --- a/src/resources/api-gateway/discovery/operations.ts +++ b/src/resources/api-gateway/discovery/operations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as OperationsAPI from './operations'; import * as DiscoveryAPI from './discovery'; import { DiscoveryOperationsV4PagePaginationArray } from './discovery'; import { type V4PagePaginationArrayParams } from '../../../pagination'; @@ -23,6 +22,22 @@ export class Operations extends APIResource { ); } + /** + * Update the `state` on one or more discovered operations + */ + bulkEdit( + params: OperationBulkEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, body } = params; + return ( + this._client.patch(`/zones/${zone_id}/api_gateway/discovery/operations`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: OperationBulkEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + /** * Update the `state` on a discovered operation */ @@ -41,6 +56,23 @@ export class Operations extends APIResource { } } +export type OperationBulkEditResponse = Record; + +export namespace OperationBulkEditResponse { + /** + * Mappings of discovered operations (keys) to objects describing their state + */ + export interface item { + /** + * Mark state of operation in API Discovery + * + * - `review` - Mark operation as for review + * - `ignored` - Mark operation as ignored + */ + state?: 'review' | 'ignored'; + } +} + export interface OperationEditResponse { /** * State of operation in API Discovery @@ -112,6 +144,33 @@ export interface OperationListParams extends V4PagePaginationArrayParams { state?: 'review' | 'saved' | 'ignored'; } +export interface OperationBulkEditParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + body: Record; +} + +export namespace OperationBulkEditParams { + /** + * Mappings of discovered operations (keys) to objects describing their state + */ + export interface Body { + /** + * Mark state of operation in API Discovery + * + * - `review` - Mark operation as for review + * - `ignored` - Mark operation as ignored + */ + state?: 'review' | 'ignored'; + } +} + export interface OperationEditParams { /** * Path param: Identifier @@ -127,10 +186,14 @@ export interface OperationEditParams { state?: 'review' | 'ignored'; } -export namespace Operations { - export import OperationEditResponse = OperationsAPI.OperationEditResponse; - export import OperationListParams = OperationsAPI.OperationListParams; - export import OperationEditParams = OperationsAPI.OperationEditParams; +export declare namespace Operations { + export { + type OperationBulkEditResponse as OperationBulkEditResponse, + type OperationEditResponse as OperationEditResponse, + type OperationListParams as OperationListParams, + type OperationBulkEditParams as OperationBulkEditParams, + type OperationEditParams as OperationEditParams, + }; } export { DiscoveryOperationsV4PagePaginationArray }; diff --git a/src/resources/api-gateway/expression-template/expression-template.ts b/src/resources/api-gateway/expression-template/expression-template.ts new file mode 100644 index 0000000000..a6ae3b53fb --- /dev/null +++ b/src/resources/api-gateway/expression-template/expression-template.ts @@ -0,0 +1,19 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as FallthroughAPI from './fallthrough'; +import { Fallthrough, FallthroughCreateParams, FallthroughCreateResponse } from './fallthrough'; + +export class ExpressionTemplate extends APIResource { + fallthrough: FallthroughAPI.Fallthrough = new FallthroughAPI.Fallthrough(this._client); +} + +ExpressionTemplate.Fallthrough = Fallthrough; + +export declare namespace ExpressionTemplate { + export { + Fallthrough as Fallthrough, + type FallthroughCreateResponse as FallthroughCreateResponse, + type FallthroughCreateParams as FallthroughCreateParams, + }; +} diff --git a/src/resources/api-gateway/expression-template/fallthrough.ts b/src/resources/api-gateway/expression-template/fallthrough.ts new file mode 100644 index 0000000000..fde934fa74 --- /dev/null +++ b/src/resources/api-gateway/expression-template/fallthrough.ts @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Fallthrough extends APIResource { + /** + * Generate fallthrough WAF expression template from a set of API hosts + */ + create( + params: FallthroughCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/api_gateway/expression-template/fallthrough`, { + body, + ...options, + }) as Core.APIPromise<{ result: FallthroughCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface FallthroughCreateResponse { + /** + * WAF Expression for fallthrough + */ + expression: string; + + /** + * Title for the expression + */ + title: string; +} + +export interface FallthroughCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: List of hosts to be targeted in the expression + */ + hosts: Array; +} + +export declare namespace Fallthrough { + export { + type FallthroughCreateResponse as FallthroughCreateResponse, + type FallthroughCreateParams as FallthroughCreateParams, + }; +} diff --git a/src/resources/api-gateway/expression-template/index.ts b/src/resources/api-gateway/expression-template/index.ts new file mode 100644 index 0000000000..cc73a35d00 --- /dev/null +++ b/src/resources/api-gateway/expression-template/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { ExpressionTemplate } from './expression-template'; +export { Fallthrough, type FallthroughCreateResponse, type FallthroughCreateParams } from './fallthrough'; diff --git a/src/resources/api-gateway/index.ts b/src/resources/api-gateway/index.ts index 1d7cb1a5d1..d33e337bec 100644 --- a/src/resources/api-gateway/index.ts +++ b/src/resources/api-gateway/index.ts @@ -2,44 +2,49 @@ export { APIGateway } from './api-gateway'; export { - APIShield, - OperationCreateResponse, - OperationListResponse, - OperationDeleteResponse, - OperationGetResponse, - OperationCreateParams, - OperationListParams, - OperationDeleteParams, - OperationGetParams, - OperationListResponsesV4PagePaginationArray, - Operations, -} from './operations/index'; -export { - Configuration, - ConfigurationUpdateResponse, - ConfigurationUpdateParams, - ConfigurationGetParams, Configurations, + type Configuration, + type ConfigurationUpdateResponse, + type ConfigurationUpdateParams, + type ConfigurationGetParams, } from './configurations'; export { - DiscoveryOperation, - DiscoveryGetResponse, - DiscoveryGetParams, DiscoveryOperationsV4PagePaginationArray, Discovery, + type DiscoveryOperation, + type DiscoveryGetResponse, + type DiscoveryGetParams, } from './discovery/index'; +export { ExpressionTemplate } from './expression-template/index'; +export { + OperationListResponsesV4PagePaginationArray, + Operations, + type APIShield, + type OperationCreateResponse, + type OperationListResponse, + type OperationDeleteResponse, + type OperationBulkCreateResponse, + type OperationBulkDeleteResponse, + type OperationGetResponse, + type OperationCreateParams, + type OperationListParams, + type OperationDeleteParams, + type OperationBulkCreateParams, + type OperationBulkDeleteParams, + type OperationGetParams, +} from './operations/index'; export { - Message, - PublicSchema, - SchemaUpload, - UserSchemaDeleteResponse, - UserSchemaCreateParams, - UserSchemaListParams, - UserSchemaDeleteParams, - UserSchemaEditParams, - UserSchemaGetParams, PublicSchemasV4PagePaginationArray, UserSchemas, + type Message, + type PublicSchema, + type SchemaUpload, + type UserSchemaDeleteResponse, + type UserSchemaCreateParams, + type UserSchemaListParams, + type UserSchemaDeleteParams, + type UserSchemaEditParams, + type UserSchemaGetParams, } from './user-schemas/index'; -export { SchemaListResponse, SchemaListParams, Schemas } from './schemas'; +export { Schemas, type SchemaListResponse, type SchemaListParams } from './schemas'; export { Settings } from './settings/index'; diff --git a/src/resources/api-gateway/operations/index.ts b/src/resources/api-gateway/operations/index.ts index 97da31c431..d20282f578 100644 --- a/src/resources/api-gateway/operations/index.ts +++ b/src/resources/api-gateway/operations/index.ts @@ -1,24 +1,28 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - APIShield, - OperationCreateResponse, - OperationListResponse, - OperationDeleteResponse, - OperationGetResponse, - OperationCreateParams, - OperationListParams, - OperationDeleteParams, - OperationGetParams, OperationListResponsesV4PagePaginationArray, Operations, + type APIShield, + type OperationCreateResponse, + type OperationListResponse, + type OperationDeleteResponse, + type OperationBulkCreateResponse, + type OperationBulkDeleteResponse, + type OperationGetResponse, + type OperationCreateParams, + type OperationListParams, + type OperationDeleteParams, + type OperationBulkCreateParams, + type OperationBulkDeleteParams, + type OperationGetParams, } from './operations'; export { - SettingsMultipleRequest, - SchemaValidationUpdateResponse, - SchemaValidationGetResponse, - SchemaValidationUpdateParams, - SchemaValidationEditParams, - SchemaValidationGetParams, SchemaValidation, + type SettingsMultipleRequest, + type SchemaValidationUpdateResponse, + type SchemaValidationGetResponse, + type SchemaValidationUpdateParams, + type SchemaValidationEditParams, + type SchemaValidationGetParams, } from './schema-validation'; diff --git a/src/resources/api-gateway/operations/operations.ts b/src/resources/api-gateway/operations/operations.ts index 393fb265a8..de5fcb51fd 100644 --- a/src/resources/api-gateway/operations/operations.ts +++ b/src/resources/api-gateway/operations/operations.ts @@ -2,8 +2,16 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as OperationsAPI from './operations'; import * as SchemaValidationAPI from './schema-validation'; +import { + SchemaValidation, + SchemaValidationEditParams, + SchemaValidationGetParams, + SchemaValidationGetResponse, + SchemaValidationUpdateParams, + SchemaValidationUpdateResponse, + SettingsMultipleRequest, +} from './schema-validation'; import * as UserSchemasAPI from '../user-schemas/user-schemas'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; @@ -13,20 +21,20 @@ export class Operations extends APIResource { ); /** - * Add one or more operations to a zone. Endpoints can contain path variables. - * Host, method, endpoint will be normalized to a canoncial form when creating an - * operation and must be unique on the zone. Inserting an operation that matches an - * existing one will return the record of the already existing operation and update - * its last_updated date. + * Add one operation to a zone. Endpoints can contain path variables. Host, method, + * endpoint will be normalized to a canoncial form when creating an operation and + * must be unique on the zone. Inserting an operation that matches an existing one + * will return the record of the already existing operation and update its + * last_updated date. */ create( params: OperationCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { zone_id, body } = params; + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zone_id}/api_gateway/operations`, { - body: body, + this._client.post(`/zones/${zone_id}/api_gateway/operations/item`, { + body, ...options, }) as Core.APIPromise<{ result: OperationCreateResponse }> )._thenUnwrap((obj) => obj.result); @@ -59,6 +67,37 @@ export class Operations extends APIResource { return this._client.delete(`/zones/${zone_id}/api_gateway/operations/${operationId}`, options); } + /** + * Add one or more operations to a zone. Endpoints can contain path variables. + * Host, method, endpoint will be normalized to a canoncial form when creating an + * operation and must be unique on the zone. Inserting an operation that matches an + * existing one will return the record of the already existing operation and update + * its last_updated date. + */ + bulkCreate( + params: OperationBulkCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, body } = params; + return ( + this._client.post(`/zones/${zone_id}/api_gateway/operations`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: OperationBulkCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Delete multiple operations + */ + bulkDelete( + params: OperationBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return this._client.delete(`/zones/${zone_id}/api_gateway/operations`, options); + } + /** * Retrieve information about an operation */ @@ -104,16 +143,43 @@ export interface APIShield { * UUID */ operation_id: string; +} + +export interface OperationCreateResponse { + /** + * The endpoint which can contain path parameter templates in curly braces, each + * will be replaced from left to right with {varN}, starting with {var1}, during + * insertion. This will further be Cloudflare-normalized upon insertion. See: + * https://developers.cloudflare.com/rules/normalization/how-it-works/. + */ + endpoint: string; + + /** + * RFC3986-compliant host. + */ + host: string; + + last_updated: string; + + /** + * The HTTP method used to access the endpoint. + */ + method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; + + /** + * UUID + */ + operation_id: string; features?: - | APIShield.APIShieldOperationFeatureThresholds - | APIShield.APIShieldOperationFeatureParameterSchemas - | APIShield.APIShieldOperationFeatureAPIRouting - | APIShield.APIShieldOperationFeatureConfidenceIntervals - | APIShield.APIShieldOperationFeatureSchemaInfo; + | OperationCreateResponse.APIShieldOperationFeatureThresholds + | OperationCreateResponse.APIShieldOperationFeatureParameterSchemas + | OperationCreateResponse.APIShieldOperationFeatureAPIRouting + | OperationCreateResponse.APIShieldOperationFeatureConfidenceIntervals + | OperationCreateResponse.APIShieldOperationFeatureSchemaInfo; } -export namespace APIShield { +export namespace OperationCreateResponse { export interface APIShieldOperationFeatureThresholds { thresholds?: APIShieldOperationFeatureThresholds.Thresholds; } @@ -355,8 +421,6 @@ export namespace APIShield { } } -export type OperationCreateResponse = Array; - export interface OperationListResponse { /** * The endpoint which can contain path parameter templates in curly braces, each @@ -644,6 +708,297 @@ export interface OperationDeleteResponse { success: true; } +export type OperationBulkCreateResponse = Array; + +export namespace OperationBulkCreateResponse { + export interface OperationBulkCreateResponseItem { + /** + * The endpoint which can contain path parameter templates in curly braces, each + * will be replaced from left to right with {varN}, starting with {var1}, during + * insertion. This will further be Cloudflare-normalized upon insertion. See: + * https://developers.cloudflare.com/rules/normalization/how-it-works/. + */ + endpoint: string; + + /** + * RFC3986-compliant host. + */ + host: string; + + last_updated: string; + + /** + * The HTTP method used to access the endpoint. + */ + method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; + + /** + * UUID + */ + operation_id: string; + + features?: + | OperationBulkCreateResponseItem.APIShieldOperationFeatureThresholds + | OperationBulkCreateResponseItem.APIShieldOperationFeatureParameterSchemas + | OperationBulkCreateResponseItem.APIShieldOperationFeatureAPIRouting + | OperationBulkCreateResponseItem.APIShieldOperationFeatureConfidenceIntervals + | OperationBulkCreateResponseItem.APIShieldOperationFeatureSchemaInfo; + } + + export namespace OperationBulkCreateResponseItem { + export interface APIShieldOperationFeatureThresholds { + thresholds?: APIShieldOperationFeatureThresholds.Thresholds; + } + + export namespace APIShieldOperationFeatureThresholds { + export interface Thresholds { + /** + * The total number of auth-ids seen across this calculation. + */ + auth_id_tokens?: number; + + /** + * The number of data points used for the threshold suggestion calculation. + */ + data_points?: number; + + last_updated?: string; + + /** + * The p50 quantile of requests (in period_seconds). + */ + p50?: number; + + /** + * The p90 quantile of requests (in period_seconds). + */ + p90?: number; + + /** + * The p99 quantile of requests (in period_seconds). + */ + p99?: number; + + /** + * The period over which this threshold is suggested. + */ + period_seconds?: number; + + /** + * The estimated number of requests covered by these calculations. + */ + requests?: number; + + /** + * The suggested threshold in requests done by the same auth_id or period_seconds. + */ + suggested_threshold?: number; + } + } + + export interface APIShieldOperationFeatureParameterSchemas { + parameter_schemas: APIShieldOperationFeatureParameterSchemas.ParameterSchemas; + } + + export namespace APIShieldOperationFeatureParameterSchemas { + export interface ParameterSchemas { + last_updated?: string; + + /** + * An operation schema object containing a response. + */ + parameter_schemas?: ParameterSchemas.ParameterSchemas; + } + + export namespace ParameterSchemas { + /** + * An operation schema object containing a response. + */ + export interface ParameterSchemas { + /** + * An array containing the learned parameter schemas. + */ + parameters?: Array; + + /** + * An empty response object. This field is required to yield a valid operation + * schema. + */ + responses?: unknown | null; + } + } + } + + export interface APIShieldOperationFeatureAPIRouting { + /** + * API Routing settings on endpoint. + */ + api_routing?: APIShieldOperationFeatureAPIRouting.APIRouting; + } + + export namespace APIShieldOperationFeatureAPIRouting { + /** + * API Routing settings on endpoint. + */ + export interface APIRouting { + last_updated?: string; + + /** + * Target route. + */ + route?: string; + } + } + + export interface APIShieldOperationFeatureConfidenceIntervals { + confidence_intervals?: APIShieldOperationFeatureConfidenceIntervals.ConfidenceIntervals; + } + + export namespace APIShieldOperationFeatureConfidenceIntervals { + export interface ConfidenceIntervals { + last_updated?: string; + + suggested_threshold?: ConfidenceIntervals.SuggestedThreshold; + } + + export namespace ConfidenceIntervals { + export interface SuggestedThreshold { + confidence_intervals?: SuggestedThreshold.ConfidenceIntervals; + + /** + * Suggested threshold. + */ + mean?: number; + } + + export namespace SuggestedThreshold { + export interface ConfidenceIntervals { + /** + * Upper and lower bound for percentile estimate + */ + p90?: ConfidenceIntervals.P90; + + /** + * Upper and lower bound for percentile estimate + */ + p95?: ConfidenceIntervals.P95; + + /** + * Upper and lower bound for percentile estimate + */ + p99?: ConfidenceIntervals.P99; + } + + export namespace ConfidenceIntervals { + /** + * Upper and lower bound for percentile estimate + */ + export interface P90 { + /** + * Lower bound for percentile estimate + */ + lower?: number; + + /** + * Upper bound for percentile estimate + */ + upper?: number; + } + + /** + * Upper and lower bound for percentile estimate + */ + export interface P95 { + /** + * Lower bound for percentile estimate + */ + lower?: number; + + /** + * Upper bound for percentile estimate + */ + upper?: number; + } + + /** + * Upper and lower bound for percentile estimate + */ + export interface P99 { + /** + * Lower bound for percentile estimate + */ + lower?: number; + + /** + * Upper bound for percentile estimate + */ + upper?: number; + } + } + } + } + } + + export interface APIShieldOperationFeatureSchemaInfo { + schema_info?: APIShieldOperationFeatureSchemaInfo.SchemaInfo; + } + + export namespace APIShieldOperationFeatureSchemaInfo { + export interface SchemaInfo { + /** + * Schema active on endpoint. + */ + active_schema?: SchemaInfo.ActiveSchema; + + /** + * True if a Cloudflare-provided learned schema is available for this endpoint. + */ + learned_available?: boolean; + + /** + * Action taken on requests failing validation. + */ + mitigation_action?: 'none' | 'log' | 'block' | null; + } + + export namespace SchemaInfo { + /** + * Schema active on endpoint. + */ + export interface ActiveSchema { + /** + * UUID + */ + id?: string; + + created_at?: string; + + /** + * True if schema is Cloudflare-provided. + */ + is_learned?: boolean; + + /** + * Schema file name. + */ + name?: string; + } + } + } + } +} + +export interface OperationBulkDeleteResponse { + errors: UserSchemasAPI.Message; + + messages: UserSchemasAPI.Message; + + /** + * Whether the API call was successful + */ + success: true; +} + export interface OperationGetResponse { /** * The endpoint which can contain path parameter templates in curly braces, each @@ -927,31 +1282,23 @@ export interface OperationCreateParams { zone_id: string; /** - * Body param: + * Body param: The endpoint which can contain path parameter templates in curly + * braces, each will be replaced from left to right with {varN}, starting with + * {var1}, during insertion. This will further be Cloudflare-normalized upon + * insertion. See: + * https://developers.cloudflare.com/rules/normalization/how-it-works/. */ - body: Array; -} - -export namespace OperationCreateParams { - export interface Body { - /** - * The endpoint which can contain path parameter templates in curly braces, each - * will be replaced from left to right with {varN}, starting with {var1}, during - * insertion. This will further be Cloudflare-normalized upon insertion. See: - * https://developers.cloudflare.com/rules/normalization/how-it-works/. - */ - endpoint: string; + endpoint: string; - /** - * RFC3986-compliant host. - */ - host: string; + /** + * Body param: RFC3986-compliant host. + */ + host: string; - /** - * The HTTP method used to access the endpoint. - */ - method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; - } + /** + * Body param: The HTTP method used to access the endpoint. + */ + method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; } export interface OperationListParams extends V4PagePaginationArrayParams { @@ -1001,6 +1348,47 @@ export interface OperationDeleteParams { zone_id: string; } +export interface OperationBulkCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + body: Array; +} + +export namespace OperationBulkCreateParams { + export interface Body { + /** + * The endpoint which can contain path parameter templates in curly braces, each + * will be replaced from left to right with {varN}, starting with {var1}, during + * insertion. This will further be Cloudflare-normalized upon insertion. See: + * https://developers.cloudflare.com/rules/normalization/how-it-works/. + */ + endpoint: string; + + /** + * RFC3986-compliant host. + */ + host: string; + + /** + * The HTTP method used to access the endpoint. + */ + method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; + } +} + +export interface OperationBulkDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + export interface OperationGetParams { /** * Path param: Identifier @@ -1015,22 +1403,34 @@ export interface OperationGetParams { feature?: Array<'thresholds' | 'parameter_schemas' | 'schema_info'>; } -export namespace Operations { - export import APIShield = OperationsAPI.APIShield; - export import OperationCreateResponse = OperationsAPI.OperationCreateResponse; - export import OperationListResponse = OperationsAPI.OperationListResponse; - export import OperationDeleteResponse = OperationsAPI.OperationDeleteResponse; - export import OperationGetResponse = OperationsAPI.OperationGetResponse; - export import OperationListResponsesV4PagePaginationArray = OperationsAPI.OperationListResponsesV4PagePaginationArray; - export import OperationCreateParams = OperationsAPI.OperationCreateParams; - export import OperationListParams = OperationsAPI.OperationListParams; - export import OperationDeleteParams = OperationsAPI.OperationDeleteParams; - export import OperationGetParams = OperationsAPI.OperationGetParams; - export import SchemaValidation = SchemaValidationAPI.SchemaValidation; - export import SettingsMultipleRequest = SchemaValidationAPI.SettingsMultipleRequest; - export import SchemaValidationUpdateResponse = SchemaValidationAPI.SchemaValidationUpdateResponse; - export import SchemaValidationGetResponse = SchemaValidationAPI.SchemaValidationGetResponse; - export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams; - export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams; - export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams; +Operations.OperationListResponsesV4PagePaginationArray = OperationListResponsesV4PagePaginationArray; +Operations.SchemaValidation = SchemaValidation; + +export declare namespace Operations { + export { + type APIShield as APIShield, + type OperationCreateResponse as OperationCreateResponse, + type OperationListResponse as OperationListResponse, + type OperationDeleteResponse as OperationDeleteResponse, + type OperationBulkCreateResponse as OperationBulkCreateResponse, + type OperationBulkDeleteResponse as OperationBulkDeleteResponse, + type OperationGetResponse as OperationGetResponse, + OperationListResponsesV4PagePaginationArray as OperationListResponsesV4PagePaginationArray, + type OperationCreateParams as OperationCreateParams, + type OperationListParams as OperationListParams, + type OperationDeleteParams as OperationDeleteParams, + type OperationBulkCreateParams as OperationBulkCreateParams, + type OperationBulkDeleteParams as OperationBulkDeleteParams, + type OperationGetParams as OperationGetParams, + }; + + export { + SchemaValidation as SchemaValidation, + type SettingsMultipleRequest as SettingsMultipleRequest, + type SchemaValidationUpdateResponse as SchemaValidationUpdateResponse, + type SchemaValidationGetResponse as SchemaValidationGetResponse, + type SchemaValidationUpdateParams as SchemaValidationUpdateParams, + type SchemaValidationEditParams as SchemaValidationEditParams, + type SchemaValidationGetParams as SchemaValidationGetParams, + }; } diff --git a/src/resources/api-gateway/operations/schema-validation.ts b/src/resources/api-gateway/operations/schema-validation.ts index ba25ca9792..294137164f 100644 --- a/src/resources/api-gateway/operations/schema-validation.ts +++ b/src/resources/api-gateway/operations/schema-validation.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as SchemaValidationAPI from './schema-validation'; export class SchemaValidation extends APIResource { /** @@ -52,16 +51,13 @@ export class SchemaValidation extends APIResource { } } -export type SettingsMultipleRequest = Record< - string, - SettingsMultipleRequest.api_shield_operation_schema_validation_settings_multiple_request_entry ->; +export type SettingsMultipleRequest = Record; export namespace SettingsMultipleRequest { /** * Operation ID to mitigation action mappings */ - export interface api_shield_operation_schema_validation_settings_multiple_request_entry { + export interface item { /** * When set, this applies a mitigation action to this operation * @@ -76,16 +72,13 @@ export namespace SettingsMultipleRequest { } } -export type SettingsMultipleRequestParam = Record< - string, - SettingsMultipleRequestParam.api_shield_operation_schema_validation_settings_multiple_request_entry ->; +export type SettingsMultipleRequestParam = Record; export namespace SettingsMultipleRequestParam { /** * Operation ID to mitigation action mappings */ - export interface api_shield_operation_schema_validation_settings_multiple_request_entry { + export interface item { /** * When set, this applies a mitigation action to this operation * @@ -166,11 +159,13 @@ export interface SchemaValidationGetParams { zone_id: string; } -export namespace SchemaValidation { - export import SettingsMultipleRequest = SchemaValidationAPI.SettingsMultipleRequest; - export import SchemaValidationUpdateResponse = SchemaValidationAPI.SchemaValidationUpdateResponse; - export import SchemaValidationGetResponse = SchemaValidationAPI.SchemaValidationGetResponse; - export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams; - export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams; - export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams; +export declare namespace SchemaValidation { + export { + type SettingsMultipleRequest as SettingsMultipleRequest, + type SchemaValidationUpdateResponse as SchemaValidationUpdateResponse, + type SchemaValidationGetResponse as SchemaValidationGetResponse, + type SchemaValidationUpdateParams as SchemaValidationUpdateParams, + type SchemaValidationEditParams as SchemaValidationEditParams, + type SchemaValidationGetParams as SchemaValidationGetParams, + }; } diff --git a/src/resources/api-gateway/schemas.ts b/src/resources/api-gateway/schemas.ts index 8fbd8f167f..78078da8d1 100644 --- a/src/resources/api-gateway/schemas.ts +++ b/src/resources/api-gateway/schemas.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SchemasAPI from './schemas'; export class Schemas extends APIResource { /** @@ -43,7 +42,6 @@ export interface SchemaListParams { host?: Array; } -export namespace Schemas { - export import SchemaListResponse = SchemasAPI.SchemaListResponse; - export import SchemaListParams = SchemasAPI.SchemaListParams; +export declare namespace Schemas { + export { type SchemaListResponse as SchemaListResponse, type SchemaListParams as SchemaListParams }; } diff --git a/src/resources/api-gateway/settings/index.ts b/src/resources/api-gateway/settings/index.ts index d7a6691090..086f66ad01 100644 --- a/src/resources/api-gateway/settings/index.ts +++ b/src/resources/api-gateway/settings/index.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - SchemaValidationUpdateParams, - SchemaValidationEditParams, - SchemaValidationGetParams, SchemaValidation, + type SchemaValidationUpdateParams, + type SchemaValidationEditParams, + type SchemaValidationGetParams, } from './schema-validation'; export { Settings } from './settings'; diff --git a/src/resources/api-gateway/settings/schema-validation.ts b/src/resources/api-gateway/settings/schema-validation.ts index 526cc0d48d..ede2c08181 100644 --- a/src/resources/api-gateway/settings/schema-validation.ts +++ b/src/resources/api-gateway/settings/schema-validation.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as SchemaValidationAPI from './schema-validation'; import * as SettingsAPI from './settings'; export class SchemaValidation extends APIResource { @@ -115,8 +114,10 @@ export interface SchemaValidationGetParams { zone_id: string; } -export namespace SchemaValidation { - export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams; - export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams; - export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams; +export declare namespace SchemaValidation { + export { + type SchemaValidationUpdateParams as SchemaValidationUpdateParams, + type SchemaValidationEditParams as SchemaValidationEditParams, + type SchemaValidationGetParams as SchemaValidationGetParams, + }; } diff --git a/src/resources/api-gateway/settings/settings.ts b/src/resources/api-gateway/settings/settings.ts index 46c01c9f25..9c7236a309 100644 --- a/src/resources/api-gateway/settings/settings.ts +++ b/src/resources/api-gateway/settings/settings.ts @@ -1,8 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import * as SettingsAPI from './settings'; import * as SchemaValidationAPI from './schema-validation'; +import { + SchemaValidation, + SchemaValidationEditParams, + SchemaValidationGetParams, + SchemaValidationUpdateParams, +} from './schema-validation'; export class Settings extends APIResource { schemaValidation: SchemaValidationAPI.SchemaValidation = new SchemaValidationAPI.SchemaValidation( @@ -34,10 +39,15 @@ export interface Settings { validation_override_mitigation_action?: 'none' | null; } -export namespace Settings { - export import Settings = SettingsAPI.Settings; - export import SchemaValidation = SchemaValidationAPI.SchemaValidation; - export import SchemaValidationUpdateParams = SchemaValidationAPI.SchemaValidationUpdateParams; - export import SchemaValidationEditParams = SchemaValidationAPI.SchemaValidationEditParams; - export import SchemaValidationGetParams = SchemaValidationAPI.SchemaValidationGetParams; +Settings.SchemaValidation = SchemaValidation; + +export declare namespace Settings { + export { type Settings as Settings }; + + export { + SchemaValidation as SchemaValidation, + type SchemaValidationUpdateParams as SchemaValidationUpdateParams, + type SchemaValidationEditParams as SchemaValidationEditParams, + type SchemaValidationGetParams as SchemaValidationGetParams, + }; } diff --git a/src/resources/api-gateway/user-schemas/hosts.ts b/src/resources/api-gateway/user-schemas/hosts.ts new file mode 100644 index 0000000000..01d02af1ef --- /dev/null +++ b/src/resources/api-gateway/user-schemas/hosts.ts @@ -0,0 +1,60 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Hosts extends APIResource { + /** + * Retrieve schema hosts in a zone + */ + list( + params: HostListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id, ...query } = params; + return this._client.getAPIList( + `/zones/${zone_id}/api_gateway/user_schemas/hosts`, + HostListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } +} + +export class HostListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface HostListResponse { + created_at: string; + + /** + * Hosts serving the schema, e.g zone.host.com + */ + hosts: Array; + + /** + * Name of the schema + */ + name: string; + + /** + * UUID + */ + schema_id: string; +} + +export interface HostListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier + */ + zone_id: string; +} + +Hosts.HostListResponsesV4PagePaginationArray = HostListResponsesV4PagePaginationArray; + +export declare namespace Hosts { + export { + type HostListResponse as HostListResponse, + HostListResponsesV4PagePaginationArray as HostListResponsesV4PagePaginationArray, + type HostListParams as HostListParams, + }; +} diff --git a/src/resources/api-gateway/user-schemas/index.ts b/src/resources/api-gateway/user-schemas/index.ts index 2d22f3ec5e..867f9925f7 100644 --- a/src/resources/api-gateway/user-schemas/index.ts +++ b/src/resources/api-gateway/user-schemas/index.ts @@ -1,21 +1,27 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Message, - PublicSchema, - SchemaUpload, - UserSchemaDeleteResponse, - UserSchemaCreateParams, - UserSchemaListParams, - UserSchemaDeleteParams, - UserSchemaEditParams, - UserSchemaGetParams, - PublicSchemasV4PagePaginationArray, - UserSchemas, -} from './user-schemas'; + HostListResponsesV4PagePaginationArray, + Hosts, + type HostListResponse, + type HostListParams, +} from './hosts'; export { - OperationListResponse, - OperationListParams, OperationListResponsesV4PagePaginationArray, Operations, + type OperationListResponse, + type OperationListParams, } from './operations'; +export { + PublicSchemasV4PagePaginationArray, + UserSchemas, + type Message, + type PublicSchema, + type SchemaUpload, + type UserSchemaDeleteResponse, + type UserSchemaCreateParams, + type UserSchemaListParams, + type UserSchemaDeleteParams, + type UserSchemaEditParams, + type UserSchemaGetParams, +} from './user-schemas'; diff --git a/src/resources/api-gateway/user-schemas/operations.ts b/src/resources/api-gateway/user-schemas/operations.ts index 58fd6ad7a5..7f6ddd5f8e 100644 --- a/src/resources/api-gateway/user-schemas/operations.ts +++ b/src/resources/api-gateway/user-schemas/operations.ts @@ -2,8 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as UserSchemasOperationsAPI from './operations'; -import * as OperationsAPI from '../operations/operations'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; export class Operations extends APIResource { @@ -27,9 +25,287 @@ export class Operations extends APIResource { export class OperationListResponsesV4PagePaginationArray extends V4PagePaginationArray {} -export type OperationListResponse = OperationsAPI.APIShield | OperationListResponse.APIShieldBasicOperation; +export type OperationListResponse = + | OperationListResponse.APIShieldOperation + | OperationListResponse.APIShieldBasicOperation; export namespace OperationListResponse { + export interface APIShieldOperation { + /** + * The endpoint which can contain path parameter templates in curly braces, each + * will be replaced from left to right with {varN}, starting with {var1}, during + * insertion. This will further be Cloudflare-normalized upon insertion. See: + * https://developers.cloudflare.com/rules/normalization/how-it-works/. + */ + endpoint: string; + + /** + * RFC3986-compliant host. + */ + host: string; + + last_updated: string; + + /** + * The HTTP method used to access the endpoint. + */ + method: 'GET' | 'POST' | 'HEAD' | 'OPTIONS' | 'PUT' | 'DELETE' | 'CONNECT' | 'PATCH' | 'TRACE'; + + /** + * UUID + */ + operation_id: string; + + features?: + | APIShieldOperation.APIShieldOperationFeatureThresholds + | APIShieldOperation.APIShieldOperationFeatureParameterSchemas + | APIShieldOperation.APIShieldOperationFeatureAPIRouting + | APIShieldOperation.APIShieldOperationFeatureConfidenceIntervals + | APIShieldOperation.APIShieldOperationFeatureSchemaInfo; + } + + export namespace APIShieldOperation { + export interface APIShieldOperationFeatureThresholds { + thresholds?: APIShieldOperationFeatureThresholds.Thresholds; + } + + export namespace APIShieldOperationFeatureThresholds { + export interface Thresholds { + /** + * The total number of auth-ids seen across this calculation. + */ + auth_id_tokens?: number; + + /** + * The number of data points used for the threshold suggestion calculation. + */ + data_points?: number; + + last_updated?: string; + + /** + * The p50 quantile of requests (in period_seconds). + */ + p50?: number; + + /** + * The p90 quantile of requests (in period_seconds). + */ + p90?: number; + + /** + * The p99 quantile of requests (in period_seconds). + */ + p99?: number; + + /** + * The period over which this threshold is suggested. + */ + period_seconds?: number; + + /** + * The estimated number of requests covered by these calculations. + */ + requests?: number; + + /** + * The suggested threshold in requests done by the same auth_id or period_seconds. + */ + suggested_threshold?: number; + } + } + + export interface APIShieldOperationFeatureParameterSchemas { + parameter_schemas: APIShieldOperationFeatureParameterSchemas.ParameterSchemas; + } + + export namespace APIShieldOperationFeatureParameterSchemas { + export interface ParameterSchemas { + last_updated?: string; + + /** + * An operation schema object containing a response. + */ + parameter_schemas?: ParameterSchemas.ParameterSchemas; + } + + export namespace ParameterSchemas { + /** + * An operation schema object containing a response. + */ + export interface ParameterSchemas { + /** + * An array containing the learned parameter schemas. + */ + parameters?: Array; + + /** + * An empty response object. This field is required to yield a valid operation + * schema. + */ + responses?: unknown | null; + } + } + } + + export interface APIShieldOperationFeatureAPIRouting { + /** + * API Routing settings on endpoint. + */ + api_routing?: APIShieldOperationFeatureAPIRouting.APIRouting; + } + + export namespace APIShieldOperationFeatureAPIRouting { + /** + * API Routing settings on endpoint. + */ + export interface APIRouting { + last_updated?: string; + + /** + * Target route. + */ + route?: string; + } + } + + export interface APIShieldOperationFeatureConfidenceIntervals { + confidence_intervals?: APIShieldOperationFeatureConfidenceIntervals.ConfidenceIntervals; + } + + export namespace APIShieldOperationFeatureConfidenceIntervals { + export interface ConfidenceIntervals { + last_updated?: string; + + suggested_threshold?: ConfidenceIntervals.SuggestedThreshold; + } + + export namespace ConfidenceIntervals { + export interface SuggestedThreshold { + confidence_intervals?: SuggestedThreshold.ConfidenceIntervals; + + /** + * Suggested threshold. + */ + mean?: number; + } + + export namespace SuggestedThreshold { + export interface ConfidenceIntervals { + /** + * Upper and lower bound for percentile estimate + */ + p90?: ConfidenceIntervals.P90; + + /** + * Upper and lower bound for percentile estimate + */ + p95?: ConfidenceIntervals.P95; + + /** + * Upper and lower bound for percentile estimate + */ + p99?: ConfidenceIntervals.P99; + } + + export namespace ConfidenceIntervals { + /** + * Upper and lower bound for percentile estimate + */ + export interface P90 { + /** + * Lower bound for percentile estimate + */ + lower?: number; + + /** + * Upper bound for percentile estimate + */ + upper?: number; + } + + /** + * Upper and lower bound for percentile estimate + */ + export interface P95 { + /** + * Lower bound for percentile estimate + */ + lower?: number; + + /** + * Upper bound for percentile estimate + */ + upper?: number; + } + + /** + * Upper and lower bound for percentile estimate + */ + export interface P99 { + /** + * Lower bound for percentile estimate + */ + lower?: number; + + /** + * Upper bound for percentile estimate + */ + upper?: number; + } + } + } + } + } + + export interface APIShieldOperationFeatureSchemaInfo { + schema_info?: APIShieldOperationFeatureSchemaInfo.SchemaInfo; + } + + export namespace APIShieldOperationFeatureSchemaInfo { + export interface SchemaInfo { + /** + * Schema active on endpoint. + */ + active_schema?: SchemaInfo.ActiveSchema; + + /** + * True if a Cloudflare-provided learned schema is available for this endpoint. + */ + learned_available?: boolean; + + /** + * Action taken on requests failing validation. + */ + mitigation_action?: 'none' | 'log' | 'block' | null; + } + + export namespace SchemaInfo { + /** + * Schema active on endpoint. + */ + export interface ActiveSchema { + /** + * UUID + */ + id?: string; + + created_at?: string; + + /** + * True if schema is Cloudflare-provided. + */ + is_learned?: boolean; + + /** + * Schema file name. + */ + name?: string; + } + } + } + } + export interface APIShieldBasicOperation { /** * The endpoint which can contain path parameter templates in curly braces, each @@ -88,8 +364,12 @@ export interface OperationListParams extends V4PagePaginationArrayParams { operation_status?: 'new' | 'existing'; } -export namespace Operations { - export import OperationListResponse = UserSchemasOperationsAPI.OperationListResponse; - export import OperationListResponsesV4PagePaginationArray = UserSchemasOperationsAPI.OperationListResponsesV4PagePaginationArray; - export import OperationListParams = UserSchemasOperationsAPI.OperationListParams; +Operations.OperationListResponsesV4PagePaginationArray = OperationListResponsesV4PagePaginationArray; + +export declare namespace Operations { + export { + type OperationListResponse as OperationListResponse, + OperationListResponsesV4PagePaginationArray as OperationListResponsesV4PagePaginationArray, + type OperationListParams as OperationListParams, + }; } diff --git a/src/resources/api-gateway/user-schemas/user-schemas.ts b/src/resources/api-gateway/user-schemas/user-schemas.ts index 98ca4eea83..efec1bd24d 100644 --- a/src/resources/api-gateway/user-schemas/user-schemas.ts +++ b/src/resources/api-gateway/user-schemas/user-schemas.ts @@ -2,13 +2,21 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as UserSchemasAPI from './user-schemas'; import * as Shared from '../../shared'; +import * as HostsAPI from './hosts'; +import { HostListParams, HostListResponse, HostListResponsesV4PagePaginationArray, Hosts } from './hosts'; import * as OperationsAPI from './operations'; +import { + OperationListParams, + OperationListResponse, + OperationListResponsesV4PagePaginationArray, + Operations, +} from './operations'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; export class UserSchemas extends APIResource { operations: OperationsAPI.Operations = new OperationsAPI.Operations(this._client); + hosts: HostsAPI.Hosts = new HostsAPI.Hosts(this._client); /** * Upload a schema to a zone @@ -47,12 +55,7 @@ export class UserSchemas extends APIResource { options?: Core.RequestOptions, ): Core.APIPromise { const { zone_id } = params; - return ( - this._client.delete( - `/zones/${zone_id}/api_gateway/user_schemas/${schemaId}`, - options, - ) as Core.APIPromise<{ result: UserSchemaDeleteResponse }> - )._thenUnwrap((obj) => obj.result); + return this._client.delete(`/zones/${zone_id}/api_gateway/user_schemas/${schemaId}`, options); } /** @@ -160,7 +163,16 @@ export namespace SchemaUpload { } } -export type UserSchemaDeleteResponse = unknown | string; +export interface UserSchemaDeleteResponse { + errors: Message; + + messages: Message; + + /** + * Whether the API call was successful + */ + success: true; +} export interface UserSchemaCreateParams { /** @@ -237,19 +249,37 @@ export interface UserSchemaGetParams { omit_source?: boolean; } -export namespace UserSchemas { - export import Message = UserSchemasAPI.Message; - export import PublicSchema = UserSchemasAPI.PublicSchema; - export import SchemaUpload = UserSchemasAPI.SchemaUpload; - export import UserSchemaDeleteResponse = UserSchemasAPI.UserSchemaDeleteResponse; - export import PublicSchemasV4PagePaginationArray = UserSchemasAPI.PublicSchemasV4PagePaginationArray; - export import UserSchemaCreateParams = UserSchemasAPI.UserSchemaCreateParams; - export import UserSchemaListParams = UserSchemasAPI.UserSchemaListParams; - export import UserSchemaDeleteParams = UserSchemasAPI.UserSchemaDeleteParams; - export import UserSchemaEditParams = UserSchemasAPI.UserSchemaEditParams; - export import UserSchemaGetParams = UserSchemasAPI.UserSchemaGetParams; - export import Operations = OperationsAPI.Operations; - export import OperationListResponse = OperationsAPI.OperationListResponse; - export import OperationListResponsesV4PagePaginationArray = OperationsAPI.OperationListResponsesV4PagePaginationArray; - export import OperationListParams = OperationsAPI.OperationListParams; +UserSchemas.PublicSchemasV4PagePaginationArray = PublicSchemasV4PagePaginationArray; +UserSchemas.Operations = Operations; +UserSchemas.OperationListResponsesV4PagePaginationArray = OperationListResponsesV4PagePaginationArray; +UserSchemas.Hosts = Hosts; +UserSchemas.HostListResponsesV4PagePaginationArray = HostListResponsesV4PagePaginationArray; + +export declare namespace UserSchemas { + export { + type Message as Message, + type PublicSchema as PublicSchema, + type SchemaUpload as SchemaUpload, + type UserSchemaDeleteResponse as UserSchemaDeleteResponse, + PublicSchemasV4PagePaginationArray as PublicSchemasV4PagePaginationArray, + type UserSchemaCreateParams as UserSchemaCreateParams, + type UserSchemaListParams as UserSchemaListParams, + type UserSchemaDeleteParams as UserSchemaDeleteParams, + type UserSchemaEditParams as UserSchemaEditParams, + type UserSchemaGetParams as UserSchemaGetParams, + }; + + export { + Operations as Operations, + type OperationListResponse as OperationListResponse, + OperationListResponsesV4PagePaginationArray as OperationListResponsesV4PagePaginationArray, + type OperationListParams as OperationListParams, + }; + + export { + Hosts as Hosts, + type HostListResponse as HostListResponse, + HostListResponsesV4PagePaginationArray as HostListResponsesV4PagePaginationArray, + type HostListParams as HostListParams, + }; } diff --git a/src/resources/argo/argo.ts b/src/resources/argo/argo.ts index 3734991993..3de020a9ef 100644 --- a/src/resources/argo/argo.ts +++ b/src/resources/argo/argo.ts @@ -2,22 +2,44 @@ import { APIResource } from '../../resource'; import * as SmartRoutingAPI from './smart-routing'; +import { + SmartRouting, + SmartRoutingEditParams, + SmartRoutingEditResponse, + SmartRoutingGetParams, + SmartRoutingGetResponse, +} from './smart-routing'; import * as TieredCachingAPI from './tiered-caching'; +import { + TieredCaching, + TieredCachingEditParams, + TieredCachingEditResponse, + TieredCachingGetParams, + TieredCachingGetResponse, +} from './tiered-caching'; export class Argo extends APIResource { smartRouting: SmartRoutingAPI.SmartRouting = new SmartRoutingAPI.SmartRouting(this._client); tieredCaching: TieredCachingAPI.TieredCaching = new TieredCachingAPI.TieredCaching(this._client); } -export namespace Argo { - export import SmartRouting = SmartRoutingAPI.SmartRouting; - export import SmartRoutingEditResponse = SmartRoutingAPI.SmartRoutingEditResponse; - export import SmartRoutingGetResponse = SmartRoutingAPI.SmartRoutingGetResponse; - export import SmartRoutingEditParams = SmartRoutingAPI.SmartRoutingEditParams; - export import SmartRoutingGetParams = SmartRoutingAPI.SmartRoutingGetParams; - export import TieredCaching = TieredCachingAPI.TieredCaching; - export import TieredCachingEditResponse = TieredCachingAPI.TieredCachingEditResponse; - export import TieredCachingGetResponse = TieredCachingAPI.TieredCachingGetResponse; - export import TieredCachingEditParams = TieredCachingAPI.TieredCachingEditParams; - export import TieredCachingGetParams = TieredCachingAPI.TieredCachingGetParams; +Argo.SmartRouting = SmartRouting; +Argo.TieredCaching = TieredCaching; + +export declare namespace Argo { + export { + SmartRouting as SmartRouting, + type SmartRoutingEditResponse as SmartRoutingEditResponse, + type SmartRoutingGetResponse as SmartRoutingGetResponse, + type SmartRoutingEditParams as SmartRoutingEditParams, + type SmartRoutingGetParams as SmartRoutingGetParams, + }; + + export { + TieredCaching as TieredCaching, + type TieredCachingEditResponse as TieredCachingEditResponse, + type TieredCachingGetResponse as TieredCachingGetResponse, + type TieredCachingEditParams as TieredCachingEditParams, + type TieredCachingGetParams as TieredCachingGetParams, + }; } diff --git a/src/resources/argo/index.ts b/src/resources/argo/index.ts index 91f3cd9ee0..3666abc83a 100644 --- a/src/resources/argo/index.ts +++ b/src/resources/argo/index.ts @@ -2,16 +2,16 @@ export { Argo } from './argo'; export { - SmartRoutingEditResponse, - SmartRoutingGetResponse, - SmartRoutingEditParams, - SmartRoutingGetParams, SmartRouting, + type SmartRoutingEditResponse, + type SmartRoutingGetResponse, + type SmartRoutingEditParams, + type SmartRoutingGetParams, } from './smart-routing'; export { - TieredCachingEditResponse, - TieredCachingGetResponse, - TieredCachingEditParams, - TieredCachingGetParams, TieredCaching, + type TieredCachingEditResponse, + type TieredCachingGetResponse, + type TieredCachingEditParams, + type TieredCachingGetParams, } from './tiered-caching'; diff --git a/src/resources/argo/smart-routing.ts b/src/resources/argo/smart-routing.ts index 1e082c71d9..9ff360910b 100644 --- a/src/resources/argo/smart-routing.ts +++ b/src/resources/argo/smart-routing.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SmartRoutingAPI from './smart-routing'; export class SmartRouting extends APIResource { /** @@ -59,9 +58,11 @@ export interface SmartRoutingGetParams { zone_id: string; } -export namespace SmartRouting { - export import SmartRoutingEditResponse = SmartRoutingAPI.SmartRoutingEditResponse; - export import SmartRoutingGetResponse = SmartRoutingAPI.SmartRoutingGetResponse; - export import SmartRoutingEditParams = SmartRoutingAPI.SmartRoutingEditParams; - export import SmartRoutingGetParams = SmartRoutingAPI.SmartRoutingGetParams; +export declare namespace SmartRouting { + export { + type SmartRoutingEditResponse as SmartRoutingEditResponse, + type SmartRoutingGetResponse as SmartRoutingGetResponse, + type SmartRoutingEditParams as SmartRoutingEditParams, + type SmartRoutingGetParams as SmartRoutingGetParams, + }; } diff --git a/src/resources/argo/tiered-caching.ts b/src/resources/argo/tiered-caching.ts index e6453b10ce..180a5ab663 100644 --- a/src/resources/argo/tiered-caching.ts +++ b/src/resources/argo/tiered-caching.ts @@ -2,11 +2,20 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TieredCachingAPI from './tiered-caching'; export class TieredCaching extends APIResource { /** - * Updates enablement of Tiered Caching + * Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + * lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + * (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + * to see if it has the content. If the upper-tier does not have the content, only + * the upper-tier can ask the origin for content. This practice improves bandwidth + * efficiency by limiting the number of data centers that can ask the origin for + * content, which reduces origin load and makes websites more cost-effective to + * operate. Additionally, Tiered Cache concentrates connections to origin servers + * so they come from a small number of data centers rather than the full set of + * network locations. This results in fewer open connections using server + * resources. */ edit( params: TieredCachingEditParams, @@ -21,7 +30,17 @@ export class TieredCaching extends APIResource { } /** - * Get Tiered Caching setting + * Tiered Cache works by dividing Cloudflare's data centers into a hierarchy of + * lower-tiers and upper-tiers. If content is not cached in lower-tier data centers + * (generally the ones closest to a visitor), the lower-tier must ask an upper-tier + * to see if it has the content. If the upper-tier does not have the content, only + * the upper-tier can ask the origin for content. This practice improves bandwidth + * efficiency by limiting the number of data centers that can ask the origin for + * content, which reduces origin load and makes websites more cost-effective to + * operate. Additionally, Tiered Cache concentrates connections to origin servers + * so they come from a small number of data centers rather than the full set of + * network locations. This results in fewer open connections using server + * resources. */ get( params: TieredCachingGetParams, @@ -38,9 +57,9 @@ export class TieredCaching extends APIResource { export interface TieredCachingEditResponse { /** - * The identifier of the caching setting + * ID of the zone setting. */ - id: string; + id: 'tiered_caching'; /** * Whether the setting is editable @@ -48,21 +67,21 @@ export interface TieredCachingEditResponse { editable: boolean; /** - * The time when the setting was last modified + * The value of the feature */ - modified_on: string; + value: 'on' | 'off'; /** - * The status of the feature being on / off + * Last time this setting was modified. */ - value: 'on' | 'off'; + modified_on?: string | null; } export interface TieredCachingGetResponse { /** - * The identifier of the caching setting + * ID of the zone setting. */ - id: string; + id: 'tiered_caching'; /** * Whether the setting is editable @@ -70,14 +89,14 @@ export interface TieredCachingGetResponse { editable: boolean; /** - * The time when the setting was last modified + * The value of the feature */ - modified_on: string; + value: 'on' | 'off'; /** - * The status of the feature being on / off + * Last time this setting was modified. */ - value: 'on' | 'off'; + modified_on?: string | null; } export interface TieredCachingEditParams { @@ -99,9 +118,11 @@ export interface TieredCachingGetParams { zone_id: string; } -export namespace TieredCaching { - export import TieredCachingEditResponse = TieredCachingAPI.TieredCachingEditResponse; - export import TieredCachingGetResponse = TieredCachingAPI.TieredCachingGetResponse; - export import TieredCachingEditParams = TieredCachingAPI.TieredCachingEditParams; - export import TieredCachingGetParams = TieredCachingAPI.TieredCachingGetParams; +export declare namespace TieredCaching { + export { + type TieredCachingEditResponse as TieredCachingEditResponse, + type TieredCachingGetResponse as TieredCachingGetResponse, + type TieredCachingEditParams as TieredCachingEditParams, + type TieredCachingGetParams as TieredCachingGetParams, + }; } diff --git a/src/resources/audit-logs.ts b/src/resources/audit-logs.ts index 14bd253c83..8d4fdcc2a4 100644 --- a/src/resources/audit-logs.ts +++ b/src/resources/audit-logs.ts @@ -46,10 +46,9 @@ export interface AuditLogListParams extends V4PagePaginationArrayParams { /** * Query param: Limits the returned results to logs older than the specified date. - * This can be a date string `2019-04-30` or an absolute timestamp that conforms to - * RFC3339. + * A `full-date` that conforms to RFC3339. */ - before?: string; + before?: string | string; /** * Query param: Changes the direction of the chronological sorting. @@ -68,10 +67,9 @@ export interface AuditLogListParams extends V4PagePaginationArrayParams { /** * Query param: Limits the returned results to logs newer than the specified date. - * This can be a date string `2019-04-30` or an absolute timestamp that conforms to - * RFC3339. + * A `full-date` that conforms to RFC3339. */ - since?: string; + since?: string | string; /** * Query param: diff --git a/src/resources/billing/billing.ts b/src/resources/billing/billing.ts index 0ba1bf5aeb..0348709db6 100644 --- a/src/resources/billing/billing.ts +++ b/src/resources/billing/billing.ts @@ -2,12 +2,18 @@ import { APIResource } from '../../resource'; import * as ProfilesAPI from './profiles'; +import { ProfileGetParams, ProfileGetResponse, Profiles } from './profiles'; export class Billing extends APIResource { profiles: ProfilesAPI.Profiles = new ProfilesAPI.Profiles(this._client); } -export namespace Billing { - export import Profiles = ProfilesAPI.Profiles; - export import ProfileGetResponse = ProfilesAPI.ProfileGetResponse; +Billing.Profiles = Profiles; + +export declare namespace Billing { + export { + Profiles as Profiles, + type ProfileGetResponse as ProfileGetResponse, + type ProfileGetParams as ProfileGetParams, + }; } diff --git a/src/resources/billing/index.ts b/src/resources/billing/index.ts index 8ddaf23258..76f1a80afd 100644 --- a/src/resources/billing/index.ts +++ b/src/resources/billing/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Billing } from './billing'; -export { ProfileGetResponse, Profiles } from './profiles'; +export { Profiles, type ProfileGetResponse, type ProfileGetParams } from './profiles'; diff --git a/src/resources/billing/profiles.ts b/src/resources/billing/profiles.ts index 95b33be537..6638bb6e3c 100644 --- a/src/resources/billing/profiles.ts +++ b/src/resources/billing/profiles.ts @@ -2,23 +2,111 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ProfilesAPI from './profiles'; export class Profiles extends APIResource { /** * Gets the current billing profile for the account. */ - get(accountIdentifier: unknown, options?: Core.RequestOptions): Core.APIPromise { + get(params: ProfileGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; return ( - this._client.get(`/accounts/${accountIdentifier}/billing/profile`, options) as Core.APIPromise<{ + this._client.get(`/accounts/${account_id}/billing/profile`, options) as Core.APIPromise<{ result: ProfileGetResponse; }> )._thenUnwrap((obj) => obj.result); } } -export type ProfileGetResponse = unknown | string | null; +export interface ProfileGetResponse { + /** + * Billing item identifier tag. + */ + id?: string; + + account_type?: string; + + address?: string; + + address2?: string; + + balance?: string; + + card_expiry_month?: number; + + card_expiry_year?: number; + + card_number?: string; + + city?: string; + + company?: string; + + country?: string; + + created_on?: string; + + device_data?: string; + + edited_on?: string; + + enterprise_billing_email?: string; + + enterprise_primary_email?: string; + + first_name?: string; + + is_partner?: boolean; + + last_name?: string; + + next_bill_date?: string; + + payment_address?: string; + + payment_address2?: string; + + payment_city?: string; + + payment_country?: string; + + payment_email?: string; + + payment_first_name?: string; + + payment_gateway?: string; + + payment_last_name?: string; + + payment_nonce?: string; + + payment_state?: string; + + payment_zipcode?: string; + + primary_email?: string; + + state?: string; + + tax_id_type?: string; + + telephone?: string; + + use_legacy?: boolean; + + validation_code?: string; + + vat?: string; + + zipcode?: string; +} + +export interface ProfileGetParams { + /** + * Identifier + */ + account_id: string; +} -export namespace Profiles { - export import ProfileGetResponse = ProfilesAPI.ProfileGetResponse; +export declare namespace Profiles { + export { type ProfileGetResponse as ProfileGetResponse, type ProfileGetParams as ProfileGetParams }; } diff --git a/src/resources/bot-management.ts b/src/resources/bot-management.ts index 044471321b..7a6976dd47 100644 --- a/src/resources/bot-management.ts +++ b/src/resources/bot-management.ts @@ -14,7 +14,58 @@ export class BotManagement extends APIResource { * - **Bot Management for Enterprise** * * See [Bot Plans](https://developers.cloudflare.com/bots/plans/) for more - * information on the different plans + * information on the different plans \ + * If you recently upgraded or downgraded your plan, refer to the following examples + * to clean up old configurations. Copy and paste the example body to remove old zone + * configurations based on your current plan. + * + * #### Clean up configuration for Bot Fight Mode plan + * + * ```json + * { + * "sbfm_likely_automated": "allow", + * "sbfm_definitely_automated": "allow", + * "sbfm_verified_bots": "allow", + * "sbfm_static_resource_protection": false, + * "optimize_wordpress": false, + * "suppress_session_score": false + * } + * ``` + * + * #### Clean up configuration for SBFM Pro plan + * + * ```json + * { + * "sbfm_likely_automated": "allow", + * "fight_mode": false + * } + * ``` + * + * #### Clean up configuration for SBFM Biz plan + * + * ```json + * { + * "fight_mode": false + * } + * ``` + * + * #### Clean up configuration for BM Enterprise Subscription plan + * + * It is strongly recommended that you ensure you have + * [custom rules](https://developers.cloudflare.com/waf/custom-rules/) in place to + * protect your zone before disabling the SBFM rules. Without these protections, + * your zone is vulnerable to attacks. + * + * ```json + * { + * "sbfm_likely_automated": "allow", + * "sbfm_definitely_automated": "allow", + * "sbfm_verified_bots": "allow", + * "sbfm_static_resource_protection": false, + * "optimize_wordpress": false, + * "fight_mode": false + * } + * ``` */ update( params: BotManagementUpdateParams, @@ -45,6 +96,11 @@ export class BotManagement extends APIResource { } export interface BotFightModeConfiguration { + /** + * Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + /** * Use lightweight, invisible JavaScript detections to improve Bot Management. * [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -56,6 +112,12 @@ export interface BotFightModeConfiguration { */ fight_mode?: boolean; + /** + * A read-only field that shows which unauthorized settings are currently active on + * the zone. These settings typically result from upgrades or downgrades. + */ + stale_zone_configuration?: BotFightModeConfiguration.StaleZoneConfiguration; + /** * A read-only field that indicates whether the zone currently is running the * latest ML model. @@ -63,7 +125,70 @@ export interface BotFightModeConfiguration { using_latest_model?: boolean; } +export namespace BotFightModeConfiguration { + /** + * A read-only field that shows which unauthorized settings are currently active on + * the zone. These settings typically result from upgrades or downgrades. + */ + export interface StaleZoneConfiguration { + /** + * Indicates that the zone's wordpress optimization for SBFM is turned on. + */ + optimize_wordpress?: boolean; + + /** + * Indicates that the zone's definitely automated requests are being blocked or + * challenged. + */ + sbfm_definitely_automated?: string; + + /** + * Indicates that the zone's likely automated requests are being blocked or + * challenged. + */ + sbfm_likely_automated?: string; + + /** + * Indicates that the zone's static resource protection is turned on. + */ + sbfm_static_resource_protection?: string; + + /** + * Indicates that the zone's verified bot requests are being blocked. + */ + sbfm_verified_bots?: string; + + /** + * Indicates that the zone's session score tracking is disabled. + */ + suppress_session_score?: boolean; + } +} + +export interface BotFightModeConfigurationParam { + /** + * Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + + /** + * Use lightweight, invisible JavaScript detections to improve Bot Management. + * [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + */ + enable_js?: boolean; + + /** + * Whether to enable Bot Fight Mode. + */ + fight_mode?: boolean; +} + export interface SubscriptionConfiguration { + /** + * Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + /** * Automatically update to the newest bot detection models created by Cloudflare as * they are released. @@ -77,6 +202,12 @@ export interface SubscriptionConfiguration { */ enable_js?: boolean; + /** + * A read-only field that shows which unauthorized settings are currently active on + * the zone. These settings typically result from upgrades or downgrades. + */ + stale_zone_configuration?: SubscriptionConfiguration.StaleZoneConfiguration; + /** * Whether to disable tracking the highest bot score for a session in the Bot * Management cookie. @@ -90,7 +221,78 @@ export interface SubscriptionConfiguration { using_latest_model?: boolean; } +export namespace SubscriptionConfiguration { + /** + * A read-only field that shows which unauthorized settings are currently active on + * the zone. These settings typically result from upgrades or downgrades. + */ + export interface StaleZoneConfiguration { + /** + * Indicates that the zone's Bot Fight Mode is turned on. + */ + fight_mode?: boolean; + + /** + * Indicates that the zone's wordpress optimization for SBFM is turned on. + */ + optimize_wordpress?: boolean; + + /** + * Indicates that the zone's definitely automated requests are being blocked or + * challenged. + */ + sbfm_definitely_automated?: string; + + /** + * Indicates that the zone's likely automated requests are being blocked or + * challenged. + */ + sbfm_likely_automated?: string; + + /** + * Indicates that the zone's static resource protection is turned on. + */ + sbfm_static_resource_protection?: string; + + /** + * Indicates that the zone's verified bot requests are being blocked. + */ + sbfm_verified_bots?: string; + } +} + +export interface SubscriptionConfigurationParam { + /** + * Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + + /** + * 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) + */ + auto_update_model?: boolean; + + /** + * Use lightweight, invisible JavaScript detections to improve Bot Management. + * [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + */ + enable_js?: boolean; + + /** + * Whether to disable tracking the highest bot score for a session in the Bot + * Management cookie. + */ + suppress_session_score?: boolean; +} + export interface SuperBotFightModeDefinitelyConfiguration { + /** + * Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + /** * Use lightweight, invisible JavaScript detections to improve Bot Management. * [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -119,6 +321,12 @@ export interface SuperBotFightModeDefinitelyConfiguration { */ sbfm_verified_bots?: 'allow' | 'block'; + /** + * A read-only field that shows which unauthorized settings are currently active on + * the zone. These settings typically result from upgrades or downgrades. + */ + stale_zone_configuration?: SuperBotFightModeDefinitelyConfiguration.StaleZoneConfiguration; + /** * A read-only field that indicates whether the zone currently is running the * latest ML model. @@ -126,7 +334,66 @@ export interface SuperBotFightModeDefinitelyConfiguration { using_latest_model?: boolean; } +export namespace SuperBotFightModeDefinitelyConfiguration { + /** + * A read-only field that shows which unauthorized settings are currently active on + * the zone. These settings typically result from upgrades or downgrades. + */ + export interface StaleZoneConfiguration { + /** + * Indicates that the zone's Bot Fight Mode is turned on. + */ + fight_mode?: boolean; + + /** + * Indicates that the zone's likely automated requests are being blocked or + * challenged. + */ + sbfm_likely_automated?: string; + } +} + +export interface SuperBotFightModeDefinitelyConfigurationParam { + /** + * Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + + /** + * Use lightweight, invisible JavaScript detections to improve Bot Management. + * [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + */ + enable_js?: boolean; + + /** + * Whether to optimize Super Bot Fight Mode protections for Wordpress. + */ + optimize_wordpress?: boolean; + + /** + * Super Bot Fight Mode (SBFM) action to take on definitely automated requests. + */ + sbfm_definitely_automated?: 'allow' | 'block' | 'managed_challenge'; + + /** + * Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + * static resources on your application need bot protection. Note: Static resource + * protection can also result in legitimate traffic being blocked. + */ + sbfm_static_resource_protection?: boolean; + + /** + * Super Bot Fight Mode (SBFM) action to take on verified bots requests. + */ + sbfm_verified_bots?: 'allow' | 'block'; +} + export interface SuperBotFightModeLikelyConfiguration { + /** + * Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + /** * Use lightweight, invisible JavaScript detections to improve Bot Management. * [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). @@ -160,6 +427,12 @@ export interface SuperBotFightModeLikelyConfiguration { */ sbfm_verified_bots?: 'allow' | 'block'; + /** + * A read-only field that shows which unauthorized settings are currently active on + * the zone. These settings typically result from upgrades or downgrades. + */ + stale_zone_configuration?: SuperBotFightModeLikelyConfiguration.StaleZoneConfiguration; + /** * A read-only field that indicates whether the zone currently is running the * latest ML model. @@ -167,6 +440,59 @@ export interface SuperBotFightModeLikelyConfiguration { using_latest_model?: boolean; } +export namespace SuperBotFightModeLikelyConfiguration { + /** + * A read-only field that shows which unauthorized settings are currently active on + * the zone. These settings typically result from upgrades or downgrades. + */ + export interface StaleZoneConfiguration { + /** + * Indicates that the zone's Bot Fight Mode is turned on. + */ + fight_mode?: boolean; + } +} + +export interface SuperBotFightModeLikelyConfigurationParam { + /** + * Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + + /** + * Use lightweight, invisible JavaScript detections to improve Bot Management. + * [Learn more about JavaScript Detections](https://developers.cloudflare.com/bots/reference/javascript-detections/). + */ + enable_js?: boolean; + + /** + * Whether to optimize Super Bot Fight Mode protections for Wordpress. + */ + optimize_wordpress?: boolean; + + /** + * Super Bot Fight Mode (SBFM) action to take on definitely automated requests. + */ + sbfm_definitely_automated?: 'allow' | 'block' | 'managed_challenge'; + + /** + * Super Bot Fight Mode (SBFM) action to take on likely automated requests. + */ + sbfm_likely_automated?: 'allow' | 'block' | 'managed_challenge'; + + /** + * Super Bot Fight Mode (SBFM) to enable static resource protection. Enable if + * static resources on your application need bot protection. Note: Static resource + * protection can also result in legitimate traffic being blocked. + */ + sbfm_static_resource_protection?: boolean; + + /** + * Super Bot Fight Mode (SBFM) action to take on verified bots requests. + */ + sbfm_verified_bots?: 'allow' | 'block'; +} + export type BotManagementUpdateResponse = | BotFightModeConfiguration | SuperBotFightModeDefinitelyConfiguration @@ -185,13 +511,18 @@ export type BotManagementUpdateParams = | BotManagementUpdateParams.SuperBotFightModeLikelyConfiguration | BotManagementUpdateParams.SubscriptionConfiguration; -export namespace BotManagementUpdateParams { +export declare namespace BotManagementUpdateParams { export interface BotFightModeConfiguration { /** * Path param: Identifier */ zone_id: string; + /** + * Body param: Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + /** * Body param: Use lightweight, invisible JavaScript detections to improve Bot * Management. @@ -211,6 +542,11 @@ export namespace BotManagementUpdateParams { */ zone_id: string; + /** + * Body param: Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + /** * Body param: Use lightweight, invisible JavaScript detections to improve Bot * Management. @@ -249,6 +585,11 @@ export namespace BotManagementUpdateParams { */ zone_id: string; + /** + * Body param: Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + /** * Body param: Use lightweight, invisible JavaScript detections to improve Bot * Management. @@ -293,6 +634,11 @@ export namespace BotManagementUpdateParams { */ zone_id: string; + /** + * Body param: Enable rule to block AI Scrapers and Crawlers. + */ + ai_bots_protection?: 'block' | 'disabled'; + /** * Body param: Automatically update to the newest bot detection models created by * Cloudflare as they are released. diff --git a/src/resources/botnet-feed/asn.ts b/src/resources/botnet-feed/asn.ts new file mode 100755 index 0000000000..a34bca3c98 --- /dev/null +++ b/src/resources/botnet-feed/asn.ts @@ -0,0 +1,87 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class ASN extends APIResource { + /** + * Gets all the data the botnet tracking database has for a given ASN registered to + * user account for given date. If no date is given, it will return results for the + * previous day. + */ + dayReport( + asnId: number, + params: ASNDayReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/botnet_feed/asn/${asnId}/day_report`, { + query, + ...options, + }) as Core.APIPromise<{ result: ASNDayReportResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Gets all the data the botnet threat feed tracking database has for a given ASN + * registered to user account. + */ + fullReport( + asnId: number, + params: ASNFullReportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/botnet_feed/asn/${asnId}/full_report`, + options, + ) as Core.APIPromise<{ result: ASNFullReportResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ASNDayReportResponse { + cidr?: string; + + date?: string; + + offense_count?: number; +} + +export interface ASNFullReportResponse { + cidr?: string; + + date?: string; + + offense_count?: number; +} + +export interface ASNDayReportParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Query param: + */ + date?: string; +} + +export interface ASNFullReportParams { + /** + * Identifier + */ + account_id: string; +} + +export declare namespace ASN { + export { + type ASNDayReportResponse as ASNDayReportResponse, + type ASNFullReportResponse as ASNFullReportResponse, + type ASNDayReportParams as ASNDayReportParams, + type ASNFullReportParams as ASNFullReportParams, + }; +} diff --git a/src/resources/botnet-feed/botnet-feed.ts b/src/resources/botnet-feed/botnet-feed.ts new file mode 100755 index 0000000000..3bac90ca5f --- /dev/null +++ b/src/resources/botnet-feed/botnet-feed.ts @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as ASNAPI from './asn'; +import { + ASN, + ASNDayReportParams, + ASNDayReportResponse, + ASNFullReportParams, + ASNFullReportResponse, +} from './asn'; +import * as ConfigsAPI from './configs/configs'; +import { Configs } from './configs/configs'; + +export class BotnetFeed extends APIResource { + asn: ASNAPI.ASN = new ASNAPI.ASN(this._client); + configs: ConfigsAPI.Configs = new ConfigsAPI.Configs(this._client); +} + +BotnetFeed.ASN = ASN; +BotnetFeed.Configs = Configs; + +export declare namespace BotnetFeed { + export { + ASN as ASN, + type ASNDayReportResponse as ASNDayReportResponse, + type ASNFullReportResponse as ASNFullReportResponse, + type ASNDayReportParams as ASNDayReportParams, + type ASNFullReportParams as ASNFullReportParams, + }; + + export { Configs as Configs }; +} diff --git a/src/resources/botnet-feed/configs/asn.ts b/src/resources/botnet-feed/configs/asn.ts new file mode 100755 index 0000000000..9b1d42013d --- /dev/null +++ b/src/resources/botnet-feed/configs/asn.ts @@ -0,0 +1,66 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class ASN extends APIResource { + /** + * Delete an ASN from botnet threat feed for a given user. + */ + delete( + asnId: number, + params: ASNDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/botnet_feed/configs/asn/${asnId}`, + options, + ) as Core.APIPromise<{ result: ASNDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Gets a list of all ASNs registered for a user for the DDoS Botnet Feed API. + */ + get(params: ASNGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/botnet_feed/configs/asn`, options) as Core.APIPromise<{ + result: ASNGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ASNDeleteResponse { + asn?: number; +} + +export interface ASNGetResponse { + asn?: number; +} + +export interface ASNDeleteParams { + /** + * Identifier + */ + account_id: string; +} + +export interface ASNGetParams { + /** + * Identifier + */ + account_id: string; +} + +export declare namespace ASN { + export { + type ASNDeleteResponse as ASNDeleteResponse, + type ASNGetResponse as ASNGetResponse, + type ASNDeleteParams as ASNDeleteParams, + type ASNGetParams as ASNGetParams, + }; +} diff --git a/src/resources/botnet-feed/configs/configs.ts b/src/resources/botnet-feed/configs/configs.ts new file mode 100755 index 0000000000..8b7ecf787a --- /dev/null +++ b/src/resources/botnet-feed/configs/configs.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as ASNAPI from './asn'; +import { ASN, ASNDeleteParams, ASNDeleteResponse, ASNGetParams, ASNGetResponse } from './asn'; + +export class Configs extends APIResource { + asn: ASNAPI.ASN = new ASNAPI.ASN(this._client); +} + +Configs.ASN = ASN; + +export declare namespace Configs { + export { + ASN as ASN, + type ASNDeleteResponse as ASNDeleteResponse, + type ASNGetResponse as ASNGetResponse, + type ASNDeleteParams as ASNDeleteParams, + type ASNGetParams as ASNGetParams, + }; +} diff --git a/src/resources/botnet-feed/configs/index.ts b/src/resources/botnet-feed/configs/index.ts new file mode 100755 index 0000000000..b3a34edccd --- /dev/null +++ b/src/resources/botnet-feed/configs/index.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + ASN, + type ASNDeleteResponse, + type ASNGetResponse, + type ASNDeleteParams, + type ASNGetParams, +} from './asn'; +export { Configs } from './configs'; diff --git a/src/resources/botnet-feed/index.ts b/src/resources/botnet-feed/index.ts new file mode 100755 index 0000000000..1a78545f8c --- /dev/null +++ b/src/resources/botnet-feed/index.ts @@ -0,0 +1,11 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + ASN, + type ASNDayReportResponse, + type ASNFullReportResponse, + type ASNDayReportParams, + type ASNFullReportParams, +} from './asn'; +export { BotnetFeed } from './botnet-feed'; +export { Configs } from './configs/index'; diff --git a/src/resources/brand-protection.ts b/src/resources/brand-protection.ts index d7aa242a2a..c636eabe86 100644 --- a/src/resources/brand-protection.ts +++ b/src/resources/brand-protection.ts @@ -18,7 +18,7 @@ export class BrandProtection extends APIResource { } /** - * Get results for a URL scan + * Gets phishing details about a URL. */ urlInfo(params: BrandProtectionURLInfoParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...query } = params; @@ -212,21 +212,12 @@ export interface BrandProtectionURLInfoParams { account_id: string; /** - * Query param: + * Query param: Submission URL(s) to filter submission results by. */ - url?: string; + url?: Array; /** - * Query param: + * Query param: Submission ID(s) to filter submission results by. */ - url_id_param?: BrandProtectionURLInfoParams.URLIDParam; -} - -export namespace BrandProtectionURLInfoParams { - export interface URLIDParam { - /** - * Submission ID(s) to filter submission results by. - */ - url_id?: number; - } + url_id?: Array; } diff --git a/src/resources/cache/cache-reserve.ts b/src/resources/cache/cache-reserve.ts index fff2b92773..ae3f4bcae3 100644 --- a/src/resources/cache/cache-reserve.ts +++ b/src/resources/cache/cache-reserve.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as CacheReserveAPI from './cache-reserve'; export class CacheReserveResource extends APIResource { /** @@ -110,11 +109,6 @@ export interface CacheReserveClearResponse { */ id: CacheReserveClear; - /** - * last time this setting was modified. - */ - modified_on: string | null; - /** * The time that the latest Cache Reserve Clear operation started. */ @@ -129,16 +123,13 @@ export interface CacheReserveClearResponse { * The time that the latest Cache Reserve Clear operation completed. */ end_ts?: string; + + /** + * Last time this setting was modified. + */ + modified_on?: string | null; } -/** - * Increase cache lifetimes by automatically storing all cacheable files into - * Cloudflare's persistent object storage buckets. Requires Cache Reserve - * subscription. Note: using Tiered Cache with Cache Reserve is highly recommended - * to reduce Reserve operations costs. See the - * [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) - * for more information. - */ export interface CacheReserveEditResponse { /** * ID of the zone setting. @@ -146,24 +137,21 @@ export interface CacheReserveEditResponse { id: CacheReserve; /** - * last time this setting was modified. + * Whether the setting is editable */ - modified_on: string | null; + editable: boolean; /** - * Value of the Cache Reserve zone setting. + * The value of the feature */ value: 'on' | 'off'; + + /** + * Last time this setting was modified. + */ + modified_on?: string | null; } -/** - * Increase cache lifetimes by automatically storing all cacheable files into - * Cloudflare's persistent object storage buckets. Requires Cache Reserve - * subscription. Note: using Tiered Cache with Cache Reserve is highly recommended - * to reduce Reserve operations costs. See the - * [developer docs](https://developers.cloudflare.com/cache/about/cache-reserve) - * for more information. - */ export interface CacheReserveGetResponse { /** * ID of the zone setting. @@ -171,14 +159,19 @@ export interface CacheReserveGetResponse { id: CacheReserve; /** - * last time this setting was modified. + * Whether the setting is editable */ - modified_on: string | null; + editable: boolean; /** - * Value of the Cache Reserve zone setting. + * The value of the feature */ value: 'on' | 'off'; + + /** + * Last time this setting was modified. + */ + modified_on?: string | null; } /** @@ -193,11 +186,6 @@ export interface CacheReserveStatusResponse { */ id: CacheReserveClear; - /** - * last time this setting was modified. - */ - modified_on: string | null; - /** * The time that the latest Cache Reserve Clear operation started. */ @@ -212,6 +200,11 @@ export interface CacheReserveStatusResponse { * The time that the latest Cache Reserve Clear operation completed. */ end_ts?: string; + + /** + * Last time this setting was modified. + */ + modified_on?: string | null; } export interface CacheReserveClearParams { @@ -252,16 +245,18 @@ export interface CacheReserveStatusParams { zone_id: string; } -export namespace CacheReserveResource { - export import CacheReserve = CacheReserveAPI.CacheReserve; - export import CacheReserveClear = CacheReserveAPI.CacheReserveClear; - export import State = CacheReserveAPI.State; - export import CacheReserveClearResponse = CacheReserveAPI.CacheReserveClearResponse; - export import CacheReserveEditResponse = CacheReserveAPI.CacheReserveEditResponse; - export import CacheReserveGetResponse = CacheReserveAPI.CacheReserveGetResponse; - export import CacheReserveStatusResponse = CacheReserveAPI.CacheReserveStatusResponse; - export import CacheReserveClearParams = CacheReserveAPI.CacheReserveClearParams; - export import CacheReserveEditParams = CacheReserveAPI.CacheReserveEditParams; - export import CacheReserveGetParams = CacheReserveAPI.CacheReserveGetParams; - export import CacheReserveStatusParams = CacheReserveAPI.CacheReserveStatusParams; +export declare namespace CacheReserveResource { + export { + type CacheReserve as CacheReserve, + type CacheReserveClear as CacheReserveClear, + type State as State, + type CacheReserveClearResponse as CacheReserveClearResponse, + type CacheReserveEditResponse as CacheReserveEditResponse, + type CacheReserveGetResponse as CacheReserveGetResponse, + type CacheReserveStatusResponse as CacheReserveStatusResponse, + type CacheReserveClearParams as CacheReserveClearParams, + type CacheReserveEditParams as CacheReserveEditParams, + type CacheReserveGetParams as CacheReserveGetParams, + type CacheReserveStatusParams as CacheReserveStatusParams, + }; } diff --git a/src/resources/cache/cache.ts b/src/resources/cache/cache.ts index 352d26d5d7..caa6b78a62 100644 --- a/src/resources/cache/cache.ts +++ b/src/resources/cache/cache.ts @@ -3,9 +3,50 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as CacheReserveAPI from './cache-reserve'; +import { + CacheReserve, + CacheReserveClear, + CacheReserveClearParams, + CacheReserveClearResponse, + CacheReserveEditParams, + CacheReserveEditResponse, + CacheReserveGetParams, + CacheReserveGetResponse, + CacheReserveResource, + CacheReserveStatusParams, + CacheReserveStatusResponse, + State, +} from './cache-reserve'; import * as RegionalTieredCacheAPI from './regional-tiered-cache'; +import { + RegionalTieredCache, + RegionalTieredCacheEditParams, + RegionalTieredCacheEditResponse, + RegionalTieredCacheGetParams, + RegionalTieredCacheGetResponse, + RegionalTieredCacheResource, +} from './regional-tiered-cache'; import * as SmartTieredCacheAPI from './smart-tiered-cache'; +import { + SmartTieredCache, + SmartTieredCacheDeleteParams, + SmartTieredCacheDeleteResponse, + SmartTieredCacheEditParams, + SmartTieredCacheEditResponse, + SmartTieredCacheGetParams, + SmartTieredCacheGetResponse, +} from './smart-tiered-cache'; import * as VariantsAPI from './variants'; +import { + CacheVariant, + VariantDeleteParams, + VariantDeleteResponse, + VariantEditParams, + VariantEditResponse, + VariantGetParams, + VariantGetResponse, + Variants, +} from './variants'; export class Cache extends APIResource { cacheReserve: CacheReserveAPI.CacheReserveResource = new CacheReserveAPI.CacheReserveResource(this._client); @@ -109,7 +150,7 @@ export type CachePurgeParams = | CachePurgeParams.CachePurgeSingleFile | CachePurgeParams.CachePurgeSingleFileWithURLAndHeaders; -export namespace CachePurgeParams { +export declare namespace CachePurgeParams { export interface CachePurgeFlexPurgeByTags { /** * Path param: @@ -199,38 +240,54 @@ export namespace CachePurgeParams { } } -export namespace Cache { - export import CacheReserveResource = CacheReserveAPI.CacheReserveResource; - export import CacheReserve = CacheReserveAPI.CacheReserve; - export import CacheReserveClear = CacheReserveAPI.CacheReserveClear; - export import State = CacheReserveAPI.State; - export import CacheReserveClearResponse = CacheReserveAPI.CacheReserveClearResponse; - export import CacheReserveEditResponse = CacheReserveAPI.CacheReserveEditResponse; - export import CacheReserveGetResponse = CacheReserveAPI.CacheReserveGetResponse; - export import CacheReserveStatusResponse = CacheReserveAPI.CacheReserveStatusResponse; - export import CacheReserveClearParams = CacheReserveAPI.CacheReserveClearParams; - export import CacheReserveEditParams = CacheReserveAPI.CacheReserveEditParams; - export import CacheReserveGetParams = CacheReserveAPI.CacheReserveGetParams; - export import CacheReserveStatusParams = CacheReserveAPI.CacheReserveStatusParams; - export import SmartTieredCache = SmartTieredCacheAPI.SmartTieredCache; - export import SmartTieredCacheDeleteResponse = SmartTieredCacheAPI.SmartTieredCacheDeleteResponse; - export import SmartTieredCacheEditResponse = SmartTieredCacheAPI.SmartTieredCacheEditResponse; - export import SmartTieredCacheGetResponse = SmartTieredCacheAPI.SmartTieredCacheGetResponse; - export import SmartTieredCacheDeleteParams = SmartTieredCacheAPI.SmartTieredCacheDeleteParams; - export import SmartTieredCacheEditParams = SmartTieredCacheAPI.SmartTieredCacheEditParams; - export import SmartTieredCacheGetParams = SmartTieredCacheAPI.SmartTieredCacheGetParams; - export import Variants = VariantsAPI.Variants; - export import CacheVariant = VariantsAPI.CacheVariant; - export import CacheVariantIdentifier = VariantsAPI.CacheVariantIdentifier; - export import VariantEditResponse = VariantsAPI.VariantEditResponse; - export import VariantGetResponse = VariantsAPI.VariantGetResponse; - export import VariantDeleteParams = VariantsAPI.VariantDeleteParams; - export import VariantEditParams = VariantsAPI.VariantEditParams; - export import VariantGetParams = VariantsAPI.VariantGetParams; - export import RegionalTieredCacheResource = RegionalTieredCacheAPI.RegionalTieredCacheResource; - export import RegionalTieredCache = RegionalTieredCacheAPI.RegionalTieredCache; - export import RegionalTieredCacheEditResponse = RegionalTieredCacheAPI.RegionalTieredCacheEditResponse; - export import RegionalTieredCacheGetResponse = RegionalTieredCacheAPI.RegionalTieredCacheGetResponse; - export import RegionalTieredCacheEditParams = RegionalTieredCacheAPI.RegionalTieredCacheEditParams; - export import RegionalTieredCacheGetParams = RegionalTieredCacheAPI.RegionalTieredCacheGetParams; +Cache.CacheReserveResource = CacheReserveResource; +Cache.SmartTieredCache = SmartTieredCache; +Cache.Variants = Variants; +Cache.RegionalTieredCacheResource = RegionalTieredCacheResource; + +export declare namespace Cache { + export { + CacheReserveResource as CacheReserveResource, + type CacheReserve as CacheReserve, + type CacheReserveClear as CacheReserveClear, + type State as State, + type CacheReserveClearResponse as CacheReserveClearResponse, + type CacheReserveEditResponse as CacheReserveEditResponse, + type CacheReserveGetResponse as CacheReserveGetResponse, + type CacheReserveStatusResponse as CacheReserveStatusResponse, + type CacheReserveClearParams as CacheReserveClearParams, + type CacheReserveEditParams as CacheReserveEditParams, + type CacheReserveGetParams as CacheReserveGetParams, + type CacheReserveStatusParams as CacheReserveStatusParams, + }; + + export { + SmartTieredCache as SmartTieredCache, + type SmartTieredCacheDeleteResponse as SmartTieredCacheDeleteResponse, + type SmartTieredCacheEditResponse as SmartTieredCacheEditResponse, + type SmartTieredCacheGetResponse as SmartTieredCacheGetResponse, + type SmartTieredCacheDeleteParams as SmartTieredCacheDeleteParams, + type SmartTieredCacheEditParams as SmartTieredCacheEditParams, + type SmartTieredCacheGetParams as SmartTieredCacheGetParams, + }; + + export { + Variants as Variants, + type CacheVariant as CacheVariant, + type VariantDeleteResponse as VariantDeleteResponse, + type VariantEditResponse as VariantEditResponse, + type VariantGetResponse as VariantGetResponse, + type VariantDeleteParams as VariantDeleteParams, + type VariantEditParams as VariantEditParams, + type VariantGetParams as VariantGetParams, + }; + + export { + RegionalTieredCacheResource as RegionalTieredCacheResource, + type RegionalTieredCache as RegionalTieredCache, + type RegionalTieredCacheEditResponse as RegionalTieredCacheEditResponse, + type RegionalTieredCacheGetResponse as RegionalTieredCacheGetResponse, + type RegionalTieredCacheEditParams as RegionalTieredCacheEditParams, + type RegionalTieredCacheGetParams as RegionalTieredCacheGetParams, + }; } diff --git a/src/resources/cache/index.ts b/src/resources/cache/index.ts index bbe41510a5..b7e1d36940 100644 --- a/src/resources/cache/index.ts +++ b/src/resources/cache/index.ts @@ -2,43 +2,43 @@ export { Cache } from './cache'; export { - CacheReserve, - CacheReserveClear, - State, - CacheReserveClearResponse, - CacheReserveEditResponse, - CacheReserveGetResponse, - CacheReserveStatusResponse, - CacheReserveClearParams, - CacheReserveEditParams, - CacheReserveGetParams, - CacheReserveStatusParams, CacheReserveResource, + type CacheReserve, + type CacheReserveClear, + type State, + type CacheReserveClearResponse, + type CacheReserveEditResponse, + type CacheReserveGetResponse, + type CacheReserveStatusResponse, + type CacheReserveClearParams, + type CacheReserveEditParams, + type CacheReserveGetParams, + type CacheReserveStatusParams, } from './cache-reserve'; export { - CacheVariant, - CacheVariantIdentifier, - VariantEditResponse, - VariantGetResponse, - VariantDeleteParams, - VariantEditParams, - VariantGetParams, - Variants, -} from './variants'; -export { - RegionalTieredCache, - RegionalTieredCacheEditResponse, - RegionalTieredCacheGetResponse, - RegionalTieredCacheEditParams, - RegionalTieredCacheGetParams, RegionalTieredCacheResource, + type RegionalTieredCache, + type RegionalTieredCacheEditResponse, + type RegionalTieredCacheGetResponse, + type RegionalTieredCacheEditParams, + type RegionalTieredCacheGetParams, } from './regional-tiered-cache'; export { - SmartTieredCacheDeleteResponse, - SmartTieredCacheEditResponse, - SmartTieredCacheGetResponse, - SmartTieredCacheDeleteParams, - SmartTieredCacheEditParams, - SmartTieredCacheGetParams, SmartTieredCache, + type SmartTieredCacheDeleteResponse, + type SmartTieredCacheEditResponse, + type SmartTieredCacheGetResponse, + type SmartTieredCacheDeleteParams, + type SmartTieredCacheEditParams, + type SmartTieredCacheGetParams, } from './smart-tiered-cache'; +export { + Variants, + type CacheVariant, + type VariantDeleteResponse, + type VariantEditResponse, + type VariantGetResponse, + type VariantDeleteParams, + type VariantEditParams, + type VariantGetParams, +} from './variants'; diff --git a/src/resources/cache/regional-tiered-cache.ts b/src/resources/cache/regional-tiered-cache.ts index ca066fb04c..f0c491d4fd 100644 --- a/src/resources/cache/regional-tiered-cache.ts +++ b/src/resources/cache/regional-tiered-cache.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as RegionalTieredCacheAPI from './regional-tiered-cache'; export class RegionalTieredCacheResource extends APIResource { /** @@ -46,11 +45,6 @@ export class RegionalTieredCacheResource extends APIResource { */ export type RegionalTieredCache = 'tc_regional'; -/** - * Instructs Cloudflare to check a regional hub data center on the way to your - * upper tier. This can help improve performance for smart and custom tiered cache - * topologies. - */ export interface RegionalTieredCacheEditResponse { /** * ID of the zone setting. @@ -58,42 +52,21 @@ export interface RegionalTieredCacheEditResponse { id: RegionalTieredCache; /** - * last time this setting was modified. + * Whether the setting is editable */ - modified_on: string | null; + editable: boolean; /** - * Instructs Cloudflare to check a regional hub data center on the way to your - * upper tier. This can help improve performance for smart and custom tiered cache - * topologies. + * The value of the feature */ - value: RegionalTieredCacheEditResponse.Value; -} + value: 'on' | 'off'; -export namespace RegionalTieredCacheEditResponse { /** - * Instructs Cloudflare to check a regional hub data center on the way to your - * upper tier. This can help improve performance for smart and custom tiered cache - * topologies. + * Last time this setting was modified. */ - export interface Value { - /** - * ID of the zone setting. - */ - id: RegionalTieredCacheAPI.RegionalTieredCache; - - /** - * last time this setting was modified. - */ - modified_on: string | null; - } + modified_on?: string | null; } -/** - * Instructs Cloudflare to check a regional hub data center on the way to your - * upper tier. This can help improve performance for smart and custom tiered cache - * topologies. - */ export interface RegionalTieredCacheGetResponse { /** * ID of the zone setting. @@ -101,35 +74,19 @@ export interface RegionalTieredCacheGetResponse { id: RegionalTieredCache; /** - * last time this setting was modified. + * Whether the setting is editable */ - modified_on: string | null; + editable: boolean; /** - * Instructs Cloudflare to check a regional hub data center on the way to your - * upper tier. This can help improve performance for smart and custom tiered cache - * topologies. + * The value of the feature */ - value: RegionalTieredCacheGetResponse.Value; -} + value: 'on' | 'off'; -export namespace RegionalTieredCacheGetResponse { /** - * Instructs Cloudflare to check a regional hub data center on the way to your - * upper tier. This can help improve performance for smart and custom tiered cache - * topologies. + * Last time this setting was modified. */ - export interface Value { - /** - * ID of the zone setting. - */ - id: RegionalTieredCacheAPI.RegionalTieredCache; - - /** - * last time this setting was modified. - */ - modified_on: string | null; - } + modified_on?: string | null; } export interface RegionalTieredCacheEditParams { @@ -151,10 +108,12 @@ export interface RegionalTieredCacheGetParams { zone_id: string; } -export namespace RegionalTieredCacheResource { - export import RegionalTieredCache = RegionalTieredCacheAPI.RegionalTieredCache; - export import RegionalTieredCacheEditResponse = RegionalTieredCacheAPI.RegionalTieredCacheEditResponse; - export import RegionalTieredCacheGetResponse = RegionalTieredCacheAPI.RegionalTieredCacheGetResponse; - export import RegionalTieredCacheEditParams = RegionalTieredCacheAPI.RegionalTieredCacheEditParams; - export import RegionalTieredCacheGetParams = RegionalTieredCacheAPI.RegionalTieredCacheGetParams; +export declare namespace RegionalTieredCacheResource { + export { + type RegionalTieredCache as RegionalTieredCache, + type RegionalTieredCacheEditResponse as RegionalTieredCacheEditResponse, + type RegionalTieredCacheGetResponse as RegionalTieredCacheGetResponse, + type RegionalTieredCacheEditParams as RegionalTieredCacheEditParams, + type RegionalTieredCacheGetParams as RegionalTieredCacheGetParams, + }; } diff --git a/src/resources/cache/smart-tiered-cache.ts b/src/resources/cache/smart-tiered-cache.ts index 3f85c286e5..f8e63bd4f6 100644 --- a/src/resources/cache/smart-tiered-cache.ts +++ b/src/resources/cache/smart-tiered-cache.ts @@ -2,11 +2,15 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SmartTieredCacheAPI from './smart-tiered-cache'; export class SmartTieredCache extends APIResource { /** - * Remvoves enablement of Smart Tiered Cache + * Smart Tiered Cache dynamically selects the single closest upper tier for each of + * your website’s origins with no configuration required, using our in-house + * performance and routing data. Cloudflare collects latency data for each request + * to an origin, and uses the latency data to determine how well any upper-tier + * data center is connected with an origin. As a result, Cloudflare can select the + * data center with the lowest latency to be the upper-tier for an origin. */ delete( params: SmartTieredCacheDeleteParams, @@ -22,7 +26,12 @@ export class SmartTieredCache extends APIResource { } /** - * Updates enablement of Tiered Cache + * Smart Tiered Cache dynamically selects the single closest upper tier for each of + * your website’s origins with no configuration required, using our in-house + * performance and routing data. Cloudflare collects latency data for each request + * to an origin, and uses the latency data to determine how well any upper-tier + * data center is connected with an origin. As a result, Cloudflare can select the + * data center with the lowest latency to be the upper-tier for an origin. */ edit( params: SmartTieredCacheEditParams, @@ -38,7 +47,12 @@ export class SmartTieredCache extends APIResource { } /** - * Get Smart Tiered Cache setting + * Smart Tiered Cache dynamically selects the single closest upper tier for each of + * your website’s origins with no configuration required, using our in-house + * performance and routing data. Cloudflare collects latency data for each request + * to an origin, and uses the latency data to determine how well any upper-tier + * data center is connected with an origin. As a result, Cloudflare can select the + * data center with the lowest latency to be the upper-tier for an origin. */ get( params: SmartTieredCacheGetParams, @@ -56,9 +70,9 @@ export class SmartTieredCache extends APIResource { export interface SmartTieredCacheDeleteResponse { /** - * The identifier of the caching setting + * ID of the zone setting. */ - id: string; + id: 'tiered_cache_smart_topology_enable'; /** * Whether the setting is editable @@ -66,21 +80,16 @@ export interface SmartTieredCacheDeleteResponse { editable: boolean; /** - * The time when the setting was last modified + * Last time this setting was modified. */ - modified_on: string; - - /** - * The status of the feature being on / off - */ - value: 'on' | 'off'; + modified_on?: string | null; } export interface SmartTieredCacheEditResponse { /** - * The identifier of the caching setting + * ID of the zone setting. */ - id: string; + id: 'tiered_cache_smart_topology_enable'; /** * Whether the setting is editable @@ -88,21 +97,21 @@ export interface SmartTieredCacheEditResponse { editable: boolean; /** - * The time when the setting was last modified + * The value of the feature */ - modified_on: string; + value: 'on' | 'off'; /** - * The status of the feature being on / off + * Last time this setting was modified. */ - value: 'on' | 'off'; + modified_on?: string | null; } export interface SmartTieredCacheGetResponse { /** - * The identifier of the caching setting + * ID of the zone setting. */ - id: string; + id: 'tiered_cache_smart_topology_enable'; /** * Whether the setting is editable @@ -110,14 +119,14 @@ export interface SmartTieredCacheGetResponse { editable: boolean; /** - * The time when the setting was last modified + * The value of the feature */ - modified_on: string; + value: 'on' | 'off'; /** - * The status of the feature being on / off + * Last time this setting was modified. */ - value: 'on' | 'off'; + modified_on?: string | null; } export interface SmartTieredCacheDeleteParams { @@ -146,11 +155,13 @@ export interface SmartTieredCacheGetParams { zone_id: string; } -export namespace SmartTieredCache { - export import SmartTieredCacheDeleteResponse = SmartTieredCacheAPI.SmartTieredCacheDeleteResponse; - export import SmartTieredCacheEditResponse = SmartTieredCacheAPI.SmartTieredCacheEditResponse; - export import SmartTieredCacheGetResponse = SmartTieredCacheAPI.SmartTieredCacheGetResponse; - export import SmartTieredCacheDeleteParams = SmartTieredCacheAPI.SmartTieredCacheDeleteParams; - export import SmartTieredCacheEditParams = SmartTieredCacheAPI.SmartTieredCacheEditParams; - export import SmartTieredCacheGetParams = SmartTieredCacheAPI.SmartTieredCacheGetParams; +export declare namespace SmartTieredCache { + export { + type SmartTieredCacheDeleteResponse as SmartTieredCacheDeleteResponse, + type SmartTieredCacheEditResponse as SmartTieredCacheEditResponse, + type SmartTieredCacheGetResponse as SmartTieredCacheGetResponse, + type SmartTieredCacheDeleteParams as SmartTieredCacheDeleteParams, + type SmartTieredCacheEditParams as SmartTieredCacheEditParams, + type SmartTieredCacheGetParams as SmartTieredCacheGetParams, + }; } diff --git a/src/resources/cache/variants.ts b/src/resources/cache/variants.ts index eeb4c9b32a..eea3f392ee 100644 --- a/src/resources/cache/variants.ts +++ b/src/resources/cache/variants.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as VariantsAPI from './variants'; export class Variants extends APIResource { /** @@ -12,11 +11,11 @@ export class Variants extends APIResource { * does not serve the variant requested, the response will not be cached. This will * be indicated with BYPASS cache status in the response headers. */ - delete(params: VariantDeleteParams, options?: Core.RequestOptions): Core.APIPromise { + delete(params: VariantDeleteParams, options?: Core.RequestOptions): Core.APIPromise { const { zone_id } = params; return ( this._client.delete(`/zones/${zone_id}/cache/variants`, options) as Core.APIPromise<{ - result: CacheVariant; + result: VariantDeleteResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -65,211 +64,73 @@ export interface CacheVariant { /** * ID of the zone setting. */ - id: CacheVariantIdentifier; + id: 'variants'; /** - * last time this setting was modified. + * Last time this setting was modified. */ - modified_on: string | null; + modified_on?: string | null; } -/** - * ID of the zone setting. - */ -export type CacheVariantIdentifier = 'variants'; - -/** - * Variant support enables caching variants of images with certain file extensions - * in addition to the original. This only applies when the origin server sends the - * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but - * does not serve the variant requested, the response will not be cached. This will - * be indicated with BYPASS cache status in the response headers. - */ -export interface VariantEditResponse { +export interface VariantDeleteResponse { /** * ID of the zone setting. */ - id: CacheVariantIdentifier; + id: 'variants'; /** - * last time this setting was modified. + * Whether the setting is editable */ - modified_on: string | null; + editable: boolean; /** - * Value of the zone setting. + * Last time this setting was modified. */ - value: VariantEditResponse.Value; + modified_on?: string | null; } -export namespace VariantEditResponse { +export interface VariantEditResponse { /** - * Value of the zone setting. + * ID of the zone setting. */ - export interface Value { - /** - * List of strings with the MIME types of all the variants that should be served - * for avif. - */ - avif?: Array; + id: 'variants'; - /** - * List of strings with the MIME types of all the variants that should be served - * for bmp. - */ - bmp?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for gif. - */ - gif?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for jp2. - */ - jp2?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for jpeg. - */ - jpeg?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for jpg. - */ - jpg?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for jpg2. - */ - jpg2?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for png. - */ - png?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for tif. - */ - tif?: Array; + /** + * Whether the setting is editable + */ + editable: boolean; - /** - * List of strings with the MIME types of all the variants that should be served - * for tiff. - */ - tiff?: Array; + /** + * The value of the feature + */ + value: string; - /** - * List of strings with the MIME types of all the variants that should be served - * for webp. - */ - webp?: Array; - } + /** + * Last time this setting was modified. + */ + modified_on?: string | null; } -/** - * Variant support enables caching variants of images with certain file extensions - * in addition to the original. This only applies when the origin server sends the - * 'Vary: Accept' response header. If the origin server sends 'Vary: Accept' but - * does not serve the variant requested, the response will not be cached. This will - * be indicated with BYPASS cache status in the response headers. - */ export interface VariantGetResponse { /** * ID of the zone setting. */ - id: CacheVariantIdentifier; + id: 'variants'; /** - * last time this setting was modified. + * Whether the setting is editable */ - modified_on: string | null; + editable: boolean; /** - * Value of the zone setting. + * The value of the feature */ - value: VariantGetResponse.Value; -} + value: string; -export namespace VariantGetResponse { /** - * Value of the zone setting. + * Last time this setting was modified. */ - export interface Value { - /** - * List of strings with the MIME types of all the variants that should be served - * for avif. - */ - avif?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for bmp. - */ - bmp?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for gif. - */ - gif?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for jp2. - */ - jp2?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for jpeg. - */ - jpeg?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for jpg. - */ - jpg?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for jpg2. - */ - jpg2?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for png. - */ - png?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for tif. - */ - tif?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for tiff. - */ - tiff?: Array; - - /** - * List of strings with the MIME types of all the variants that should be served - * for webp. - */ - webp?: Array; - } + modified_on?: string | null; } export interface VariantDeleteParams { @@ -371,12 +232,14 @@ export interface VariantGetParams { zone_id: string; } -export namespace Variants { - export import CacheVariant = VariantsAPI.CacheVariant; - export import CacheVariantIdentifier = VariantsAPI.CacheVariantIdentifier; - export import VariantEditResponse = VariantsAPI.VariantEditResponse; - export import VariantGetResponse = VariantsAPI.VariantGetResponse; - export import VariantDeleteParams = VariantsAPI.VariantDeleteParams; - export import VariantEditParams = VariantsAPI.VariantEditParams; - export import VariantGetParams = VariantsAPI.VariantGetParams; +export declare namespace Variants { + export { + type CacheVariant as CacheVariant, + type VariantDeleteResponse as VariantDeleteResponse, + type VariantEditResponse as VariantEditResponse, + type VariantGetResponse as VariantGetResponse, + type VariantDeleteParams as VariantDeleteParams, + type VariantEditParams as VariantEditParams, + type VariantGetParams as VariantGetParams, + }; } diff --git a/src/resources/calls/calls.ts b/src/resources/calls/calls.ts index 73e71cd37f..3c9904d4f4 100644 --- a/src/resources/calls/calls.ts +++ b/src/resources/calls/calls.ts @@ -1,180 +1,75 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as TURNAPI from './turn/turn'; -import { SinglePage } from '../../pagination'; +import * as SFUAPI from './sfu'; +import { + SFU, + SFUCreateParams, + SFUCreateResponse, + SFUDeleteParams, + SFUDeleteResponse, + SFUGetParams, + SFUGetResponse, + SFUListParams, + SFUListResponse, + SFUListResponsesSinglePage, + SFUUpdateParams, + SFUUpdateResponse, +} from './sfu'; +import * as TURNAPI from './turn'; +import { + TURN, + TURNCreateParams, + TURNCreateResponse, + TURNDeleteParams, + TURNDeleteResponse, + TURNGetParams, + TURNGetResponse, + TURNListParams, + TURNListResponse, + TURNListResponsesSinglePage, + TURNUpdateParams, + TURNUpdateResponse, +} from './turn'; export class Calls extends APIResource { + sfu: SFUAPI.SFU = new SFUAPI.SFU(this._client); turn: TURNAPI.TURN = new TURNAPI.TURN(this._client); - - /** - * Creates a new Cloudflare calls app. An app is an unique enviroment where each - * Session can access all Tracks within the app. - */ - create(params: CallCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.post(`/accounts/${account_id}/calls/apps`, { body, ...options }) as Core.APIPromise<{ - result: CallsAppWithSecret; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Edit details for a single app. - */ - update(appId: string, params: CallUpdateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.put(`/accounts/${account_id}/calls/apps/${appId}`, { - body, - ...options, - }) as Core.APIPromise<{ result: CallsApp }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Lists all apps in the Cloudflare account - */ - list( - params: CallListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { - const { account_id } = params; - return this._client.getAPIList( - `/accounts/${account_id}/calls/apps`, - CallListResponsesSinglePage, - options, - ); - } - - /** - * Deletes an app from Cloudflare Calls - */ - delete(appId: string, params: CallDeleteParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; - return ( - this._client.delete(`/accounts/${account_id}/calls/apps/${appId}`, options) as Core.APIPromise<{ - result: CallsApp; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches details for a single Calls app. - */ - get(appId: string, params: CallGetParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get(`/accounts/${account_id}/calls/apps/${appId}`, options) as Core.APIPromise<{ - result: CallsApp; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class CallListResponsesSinglePage extends SinglePage {} - -export interface CallsApp { - /** - * The date and time the item was created. - */ - created?: string; - - /** - * The date and time the item was last modified. - */ - modified?: string; - - /** - * A short description of Calls app, not shown to end users. - */ - name?: string; - - /** - * A Cloudflare-generated unique identifier for a item. - */ - uid?: string; -} - -export interface CallsAppWithSecret { - /** - * The date and time the item was created. - */ - created?: string; - - /** - * The date and time the item was last modified. - */ - modified?: string; - - /** - * A short description of Calls app, not shown to end users. - */ - name?: string; - - /** - * Bearer token - */ - secret?: string; - - /** - * A Cloudflare-generated unique identifier for a item. - */ - uid?: string; -} - -/** - * Bearer token - */ -export type CallListResponse = string; - -export interface CallCreateParams { - /** - * Path param: The account identifier tag. - */ - account_id: string; - - /** - * Body param: A short description of Calls app, not shown to end users. - */ - name?: string; -} - -export interface CallUpdateParams { - /** - * Path param: The account identifier tag. - */ - account_id: string; - - /** - * Body param: A short description of Calls app, not shown to end users. - */ - name?: string; -} - -export interface CallListParams { - /** - * The account identifier tag. - */ - account_id: string; -} - -export interface CallDeleteParams { - /** - * The account identifier tag. - */ - account_id: string; -} - -export interface CallGetParams { - /** - * The account identifier tag. - */ - account_id: string; } -export namespace Calls { - export import TURN = TURNAPI.TURN; +Calls.SFU = SFU; +Calls.SFUListResponsesSinglePage = SFUListResponsesSinglePage; +Calls.TURN = TURN; +Calls.TURNListResponsesSinglePage = TURNListResponsesSinglePage; + +export declare namespace Calls { + export { + SFU as SFU, + type SFUCreateResponse as SFUCreateResponse, + type SFUUpdateResponse as SFUUpdateResponse, + type SFUListResponse as SFUListResponse, + type SFUDeleteResponse as SFUDeleteResponse, + type SFUGetResponse as SFUGetResponse, + SFUListResponsesSinglePage as SFUListResponsesSinglePage, + type SFUCreateParams as SFUCreateParams, + type SFUUpdateParams as SFUUpdateParams, + type SFUListParams as SFUListParams, + type SFUDeleteParams as SFUDeleteParams, + type SFUGetParams as SFUGetParams, + }; + + export { + TURN as TURN, + type TURNCreateResponse as TURNCreateResponse, + type TURNUpdateResponse as TURNUpdateResponse, + type TURNListResponse as TURNListResponse, + type TURNDeleteResponse as TURNDeleteResponse, + type TURNGetResponse as TURNGetResponse, + TURNListResponsesSinglePage as TURNListResponsesSinglePage, + type TURNCreateParams as TURNCreateParams, + type TURNUpdateParams as TURNUpdateParams, + type TURNListParams as TURNListParams, + type TURNDeleteParams as TURNDeleteParams, + type TURNGetParams as TURNGetParams, + }; } diff --git a/src/resources/calls/index.ts b/src/resources/calls/index.ts index 46899af8fa..faf86d9e28 100644 --- a/src/resources/calls/index.ts +++ b/src/resources/calls/index.ts @@ -1,4 +1,31 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Calls } from './calls'; -export { TURN } from './turn/index'; +export { + SFUListResponsesSinglePage, + SFU, + type SFUCreateResponse, + type SFUUpdateResponse, + type SFUListResponse, + type SFUDeleteResponse, + type SFUGetResponse, + type SFUCreateParams, + type SFUUpdateParams, + type SFUListParams, + type SFUDeleteParams, + type SFUGetParams, +} from './sfu'; +export { + TURNListResponsesSinglePage, + TURN, + type TURNCreateResponse, + type TURNUpdateResponse, + type TURNListResponse, + type TURNDeleteResponse, + type TURNGetResponse, + type TURNCreateParams, + type TURNUpdateParams, + type TURNListParams, + type TURNDeleteParams, + type TURNGetParams, +} from './turn'; diff --git a/src/resources/calls/sfu.ts b/src/resources/calls/sfu.ts new file mode 100644 index 0000000000..84a5b7f04a --- /dev/null +++ b/src/resources/calls/sfu.ts @@ -0,0 +1,256 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage } from '../../pagination'; + +export class SFU extends APIResource { + /** + * Creates a new Cloudflare calls app. An app is an unique enviroment where each + * Session can access all Tracks within the app. + */ + create(params: SFUCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/calls/apps`, { body, ...options }) as Core.APIPromise<{ + result: SFUCreateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Edit details for a single app. + */ + update( + appId: string, + params: SFUUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/calls/apps/${appId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: SFUUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Lists all apps in the Cloudflare account + */ + list( + params: SFUListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList(`/accounts/${account_id}/calls/apps`, SFUListResponsesSinglePage, options); + } + + /** + * Deletes an app from Cloudflare Calls + */ + delete( + appId: string, + params: SFUDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}/calls/apps/${appId}`, options) as Core.APIPromise<{ + result: SFUDeleteResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetches details for a single Calls app. + */ + get(appId: string, params: SFUGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/calls/apps/${appId}`, options) as Core.APIPromise<{ + result: SFUGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class SFUListResponsesSinglePage extends SinglePage {} + +export interface SFUCreateResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of Calls app, not shown to end users. + */ + name?: string; + + /** + * Bearer token + */ + secret?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface SFUUpdateResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of Calls app, not shown to end users. + */ + name?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface SFUListResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of Calls app, not shown to end users. + */ + name?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface SFUDeleteResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of Calls app, not shown to end users. + */ + name?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface SFUGetResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of Calls app, not shown to end users. + */ + name?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface SFUCreateParams { + /** + * Path param: The account identifier tag. + */ + account_id: string; + + /** + * Body param: A short description of Calls app, not shown to end users. + */ + name?: string; +} + +export interface SFUUpdateParams { + /** + * Path param: The account identifier tag. + */ + account_id: string; + + /** + * Body param: A short description of Calls app, not shown to end users. + */ + name?: string; +} + +export interface SFUListParams { + /** + * The account identifier tag. + */ + account_id: string; +} + +export interface SFUDeleteParams { + /** + * The account identifier tag. + */ + account_id: string; +} + +export interface SFUGetParams { + /** + * The account identifier tag. + */ + account_id: string; +} + +SFU.SFUListResponsesSinglePage = SFUListResponsesSinglePage; + +export declare namespace SFU { + export { + type SFUCreateResponse as SFUCreateResponse, + type SFUUpdateResponse as SFUUpdateResponse, + type SFUListResponse as SFUListResponse, + type SFUDeleteResponse as SFUDeleteResponse, + type SFUGetResponse as SFUGetResponse, + SFUListResponsesSinglePage as SFUListResponsesSinglePage, + type SFUCreateParams as SFUCreateParams, + type SFUUpdateParams as SFUUpdateParams, + type SFUListParams as SFUListParams, + type SFUDeleteParams as SFUDeleteParams, + type SFUGetParams as SFUGetParams, + }; +} diff --git a/src/resources/calls/turn.ts b/src/resources/calls/turn.ts new file mode 100644 index 0000000000..594b7b580f --- /dev/null +++ b/src/resources/calls/turn.ts @@ -0,0 +1,255 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage } from '../../pagination'; + +export class TURN extends APIResource { + /** + * Creates a new Cloudflare Calls TURN key. + */ + create(params: TURNCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return this._client.post(`/accounts/${account_id}/calls/turn_keys`, { body, ...options }); + } + + /** + * Edit details for a single TURN key. + */ + update( + keyId: string, + params: TURNUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/calls/turn_keys/${keyId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: TURNUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Lists all TURN keys in the Cloudflare account + */ + list( + params: TURNListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/calls/turn_keys`, + TURNListResponsesSinglePage, + options, + ); + } + + /** + * Deletes a TURN key from Cloudflare Calls + */ + delete( + keyId: string, + params: TURNDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}/calls/turn_keys/${keyId}`, options) as Core.APIPromise<{ + result: TURNDeleteResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetches details for a single TURN key. + */ + get(keyId: string, params: TURNGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/calls/turn_keys/${keyId}`, options) as Core.APIPromise<{ + result: TURNGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class TURNListResponsesSinglePage extends SinglePage {} + +export interface TURNCreateResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * Bearer token + */ + key?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of a TURN key, not shown to end users. + */ + name?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface TURNUpdateResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of Calls app, not shown to end users. + */ + name?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface TURNListResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of Calls app, not shown to end users. + */ + name?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface TURNDeleteResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of Calls app, not shown to end users. + */ + name?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface TURNGetResponse { + /** + * The date and time the item was created. + */ + created?: string; + + /** + * The date and time the item was last modified. + */ + modified?: string; + + /** + * A short description of Calls app, not shown to end users. + */ + name?: string; + + /** + * A Cloudflare-generated unique identifier for a item. + */ + uid?: string; +} + +export interface TURNCreateParams { + /** + * Path param: The account identifier tag. + */ + account_id: string; + + /** + * Body param: A short description of a TURN key, not shown to end users. + */ + name?: string; +} + +export interface TURNUpdateParams { + /** + * Path param: The account identifier tag. + */ + account_id: string; + + /** + * Body param: A short description of a TURN key, not shown to end users. + */ + name?: string; +} + +export interface TURNListParams { + /** + * The account identifier tag. + */ + account_id: string; +} + +export interface TURNDeleteParams { + /** + * The account identifier tag. + */ + account_id: string; +} + +export interface TURNGetParams { + /** + * The account identifier tag. + */ + account_id: string; +} + +TURN.TURNListResponsesSinglePage = TURNListResponsesSinglePage; + +export declare namespace TURN { + export { + type TURNCreateResponse as TURNCreateResponse, + type TURNUpdateResponse as TURNUpdateResponse, + type TURNListResponse as TURNListResponse, + type TURNDeleteResponse as TURNDeleteResponse, + type TURNGetResponse as TURNGetResponse, + TURNListResponsesSinglePage as TURNListResponsesSinglePage, + type TURNCreateParams as TURNCreateParams, + type TURNUpdateParams as TURNUpdateParams, + type TURNListParams as TURNListParams, + type TURNDeleteParams as TURNDeleteParams, + type TURNGetParams as TURNGetParams, + }; +} diff --git a/src/resources/calls/turn/index.ts b/src/resources/calls/turn/index.ts deleted file mode 100644 index 1f1fa45050..0000000000 --- a/src/resources/calls/turn/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { - KeyCreateResponse, - KeyUpdateResponse, - KeyListResponse, - KeyDeleteResponse, - KeyGetResponse, - KeyCreateParams, - KeyUpdateParams, - KeyListParams, - KeyDeleteParams, - KeyGetParams, - KeyListResponsesSinglePage, - Keys, -} from './keys'; -export { TURN } from './turn'; diff --git a/src/resources/calls/turn/keys.ts b/src/resources/calls/turn/keys.ts deleted file mode 100644 index 9c8d738449..0000000000 --- a/src/resources/calls/turn/keys.ts +++ /dev/null @@ -1,184 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as KeysAPI from './keys'; -import { SinglePage } from '../../../pagination'; - -export class Keys extends APIResource { - /** - * Creates a new Cloudflare Calls TURN key. - */ - create(params: KeyCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, ...body } = params; - return this._client.post(`/accounts/${account_id}/calls/turn_keys`, { body, ...options }); - } - - /** - * Edit details for a single TURN key. - */ - update( - keyId: string, - params: KeyUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.put(`/accounts/${account_id}/calls/turn_keys/${keyId}`, { - body, - ...options, - }) as Core.APIPromise<{ result: KeyUpdateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Lists all TURN keys in the Cloudflare account - */ - list( - params: KeyListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { - const { account_id } = params; - return this._client.getAPIList( - `/accounts/${account_id}/calls/turn_keys`, - KeyListResponsesSinglePage, - options, - ); - } - - /** - * Deletes a TURN key from Cloudflare Calls - */ - delete( - keyId: string, - params: KeyDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.delete(`/accounts/${account_id}/calls/turn_keys/${keyId}`, options) as Core.APIPromise<{ - result: KeyDeleteResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches details for a single TURN key. - */ - get(keyId: string, params: KeyGetParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get(`/accounts/${account_id}/calls/turn_keys/${keyId}`, options) as Core.APIPromise<{ - result: KeyGetResponse; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class KeyListResponsesSinglePage extends SinglePage {} - -export interface KeyCreateResponse { - /** - * The date and time the item was created. - */ - created?: string; - - /** - * Bearer token - */ - key?: string; - - /** - * The date and time the item was last modified. - */ - modified?: string; - - /** - * A short description of a TURN key, not shown to end users. - */ - name?: string; - - /** - * A Cloudflare-generated unique identifier for a item. - */ - uid?: string; -} - -/** - * Bearer token - */ -export type KeyUpdateResponse = string; - -/** - * Bearer token - */ -export type KeyListResponse = string; - -/** - * Bearer token - */ -export type KeyDeleteResponse = string; - -/** - * Bearer token - */ -export type KeyGetResponse = string; - -export interface KeyCreateParams { - /** - * Path param: The account identifier tag. - */ - account_id: string; - - /** - * Body param: A short description of a TURN key, not shown to end users. - */ - name?: string; -} - -export interface KeyUpdateParams { - /** - * Path param: The account identifier tag. - */ - account_id: string; - - /** - * Body param: A short description of a TURN key, not shown to end users. - */ - name?: string; -} - -export interface KeyListParams { - /** - * The account identifier tag. - */ - account_id: string; -} - -export interface KeyDeleteParams { - /** - * The account identifier tag. - */ - account_id: string; -} - -export interface KeyGetParams { - /** - * The account identifier tag. - */ - account_id: string; -} - -export namespace Keys { - export import KeyCreateResponse = KeysAPI.KeyCreateResponse; - export import KeyUpdateResponse = KeysAPI.KeyUpdateResponse; - export import KeyListResponse = KeysAPI.KeyListResponse; - export import KeyDeleteResponse = KeysAPI.KeyDeleteResponse; - export import KeyGetResponse = KeysAPI.KeyGetResponse; - export import KeyListResponsesSinglePage = KeysAPI.KeyListResponsesSinglePage; - export import KeyCreateParams = KeysAPI.KeyCreateParams; - export import KeyUpdateParams = KeysAPI.KeyUpdateParams; - export import KeyListParams = KeysAPI.KeyListParams; - export import KeyDeleteParams = KeysAPI.KeyDeleteParams; - export import KeyGetParams = KeysAPI.KeyGetParams; -} diff --git a/src/resources/calls/turn/turn.ts b/src/resources/calls/turn/turn.ts deleted file mode 100644 index 8eec8b39a0..0000000000 --- a/src/resources/calls/turn/turn.ts +++ /dev/null @@ -1,23 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as KeysAPI from './keys'; - -export class TURN extends APIResource { - keys: KeysAPI.Keys = new KeysAPI.Keys(this._client); -} - -export namespace TURN { - export import Keys = KeysAPI.Keys; - export import KeyCreateResponse = KeysAPI.KeyCreateResponse; - export import KeyUpdateResponse = KeysAPI.KeyUpdateResponse; - export import KeyListResponse = KeysAPI.KeyListResponse; - export import KeyDeleteResponse = KeysAPI.KeyDeleteResponse; - export import KeyGetResponse = KeysAPI.KeyGetResponse; - export import KeyListResponsesSinglePage = KeysAPI.KeyListResponsesSinglePage; - export import KeyCreateParams = KeysAPI.KeyCreateParams; - export import KeyUpdateParams = KeysAPI.KeyUpdateParams; - export import KeyListParams = KeysAPI.KeyListParams; - export import KeyDeleteParams = KeysAPI.KeyDeleteParams; - export import KeyGetParams = KeysAPI.KeyGetParams; -} diff --git a/src/resources/certificate-authorities/certificate-authorities.ts b/src/resources/certificate-authorities/certificate-authorities.ts index ab1cd1a2ab..0221d7ef09 100644 --- a/src/resources/certificate-authorities/certificate-authorities.ts +++ b/src/resources/certificate-authorities/certificate-authorities.ts @@ -2,18 +2,31 @@ import { APIResource } from '../../resource'; import * as HostnameAssociationsAPI from './hostname-associations'; +import { + HostnameAssociation, + HostnameAssociationGetParams, + HostnameAssociationGetResponse, + HostnameAssociationUpdateParams, + HostnameAssociationUpdateResponse, + HostnameAssociations, + TLSHostnameAssociation, +} from './hostname-associations'; export class CertificateAuthorities extends APIResource { hostnameAssociations: HostnameAssociationsAPI.HostnameAssociations = new HostnameAssociationsAPI.HostnameAssociations(this._client); } -export namespace CertificateAuthorities { - export import HostnameAssociations = HostnameAssociationsAPI.HostnameAssociations; - export import HostnameAssociation = HostnameAssociationsAPI.HostnameAssociation; - export import TLSHostnameAssociation = HostnameAssociationsAPI.TLSHostnameAssociation; - export import HostnameAssociationUpdateResponse = HostnameAssociationsAPI.HostnameAssociationUpdateResponse; - export import HostnameAssociationGetResponse = HostnameAssociationsAPI.HostnameAssociationGetResponse; - export import HostnameAssociationUpdateParams = HostnameAssociationsAPI.HostnameAssociationUpdateParams; - export import HostnameAssociationGetParams = HostnameAssociationsAPI.HostnameAssociationGetParams; +CertificateAuthorities.HostnameAssociations = HostnameAssociations; + +export declare namespace CertificateAuthorities { + export { + HostnameAssociations as HostnameAssociations, + type HostnameAssociation as HostnameAssociation, + type TLSHostnameAssociation as TLSHostnameAssociation, + type HostnameAssociationUpdateResponse as HostnameAssociationUpdateResponse, + type HostnameAssociationGetResponse as HostnameAssociationGetResponse, + type HostnameAssociationUpdateParams as HostnameAssociationUpdateParams, + type HostnameAssociationGetParams as HostnameAssociationGetParams, + }; } diff --git a/src/resources/certificate-authorities/hostname-associations.ts b/src/resources/certificate-authorities/hostname-associations.ts index 70e0990b31..b88250cede 100644 --- a/src/resources/certificate-authorities/hostname-associations.ts +++ b/src/resources/certificate-authorities/hostname-associations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as HostnameAssociationsAPI from './hostname-associations'; export class HostnameAssociations extends APIResource { /** @@ -95,11 +94,13 @@ export interface HostnameAssociationGetParams { mtls_certificate_id?: string; } -export namespace HostnameAssociations { - export import HostnameAssociation = HostnameAssociationsAPI.HostnameAssociation; - export import TLSHostnameAssociation = HostnameAssociationsAPI.TLSHostnameAssociation; - export import HostnameAssociationUpdateResponse = HostnameAssociationsAPI.HostnameAssociationUpdateResponse; - export import HostnameAssociationGetResponse = HostnameAssociationsAPI.HostnameAssociationGetResponse; - export import HostnameAssociationUpdateParams = HostnameAssociationsAPI.HostnameAssociationUpdateParams; - export import HostnameAssociationGetParams = HostnameAssociationsAPI.HostnameAssociationGetParams; +export declare namespace HostnameAssociations { + export { + type HostnameAssociation as HostnameAssociation, + type TLSHostnameAssociation as TLSHostnameAssociation, + type HostnameAssociationUpdateResponse as HostnameAssociationUpdateResponse, + type HostnameAssociationGetResponse as HostnameAssociationGetResponse, + type HostnameAssociationUpdateParams as HostnameAssociationUpdateParams, + type HostnameAssociationGetParams as HostnameAssociationGetParams, + }; } diff --git a/src/resources/certificate-authorities/index.ts b/src/resources/certificate-authorities/index.ts index e84e9da00c..5a057708e1 100644 --- a/src/resources/certificate-authorities/index.ts +++ b/src/resources/certificate-authorities/index.ts @@ -2,11 +2,11 @@ export { CertificateAuthorities } from './certificate-authorities'; export { - HostnameAssociation, - TLSHostnameAssociation, - HostnameAssociationUpdateResponse, - HostnameAssociationGetResponse, - HostnameAssociationUpdateParams, - HostnameAssociationGetParams, HostnameAssociations, + type HostnameAssociation, + type TLSHostnameAssociation, + type HostnameAssociationUpdateResponse, + type HostnameAssociationGetResponse, + type HostnameAssociationUpdateParams, + type HostnameAssociationGetParams, } from './hostname-associations'; diff --git a/src/resources/challenges/challenges.ts b/src/resources/challenges/challenges.ts deleted file mode 100644 index 6c4e7c2629..0000000000 --- a/src/resources/challenges/challenges.ts +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import * as WidgetsAPI from './widgets'; - -export class Challenges extends APIResource { - widgets: WidgetsAPI.Widgets = new WidgetsAPI.Widgets(this._client); -} - -export namespace Challenges { - export import Widgets = WidgetsAPI.Widgets; - export import Widget = WidgetsAPI.Widget; - export import WidgetDomain = WidgetsAPI.WidgetDomain; - export import WidgetListResponse = WidgetsAPI.WidgetListResponse; - export import WidgetListResponsesV4PagePaginationArray = WidgetsAPI.WidgetListResponsesV4PagePaginationArray; - export import WidgetCreateParams = WidgetsAPI.WidgetCreateParams; - export import WidgetUpdateParams = WidgetsAPI.WidgetUpdateParams; - export import WidgetListParams = WidgetsAPI.WidgetListParams; - export import WidgetDeleteParams = WidgetsAPI.WidgetDeleteParams; - export import WidgetGetParams = WidgetsAPI.WidgetGetParams; - export import WidgetRotateSecretParams = WidgetsAPI.WidgetRotateSecretParams; -} diff --git a/src/resources/challenges/index.ts b/src/resources/challenges/index.ts deleted file mode 100644 index 3b0bf982b7..0000000000 --- a/src/resources/challenges/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { Challenges } from './challenges'; -export { - Widget, - WidgetDomain, - WidgetListResponse, - WidgetCreateParams, - WidgetUpdateParams, - WidgetListParams, - WidgetDeleteParams, - WidgetGetParams, - WidgetRotateSecretParams, - WidgetListResponsesV4PagePaginationArray, - Widgets, -} from './widgets'; diff --git a/src/resources/cloud-connector/cloud-connector.ts b/src/resources/cloud-connector/cloud-connector.ts index a2c79bef89..ee73348527 100644 --- a/src/resources/cloud-connector/cloud-connector.ts +++ b/src/resources/cloud-connector/cloud-connector.ts @@ -2,16 +2,29 @@ import { APIResource } from '../../resource'; import * as RulesAPI from './rules'; +import { + RuleListParams, + RuleListResponse, + RuleListResponsesSinglePage, + RuleUpdateParams, + RuleUpdateResponse, + Rules, +} from './rules'; export class CloudConnector extends APIResource { rules: RulesAPI.Rules = new RulesAPI.Rules(this._client); } -export namespace CloudConnector { - export import Rules = RulesAPI.Rules; - export import RuleUpdateResponse = RulesAPI.RuleUpdateResponse; - export import RuleListResponse = RulesAPI.RuleListResponse; - export import RuleListResponsesSinglePage = RulesAPI.RuleListResponsesSinglePage; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; +CloudConnector.Rules = Rules; +CloudConnector.RuleListResponsesSinglePage = RuleListResponsesSinglePage; + +export declare namespace CloudConnector { + export { + Rules as Rules, + type RuleUpdateResponse as RuleUpdateResponse, + type RuleListResponse as RuleListResponse, + RuleListResponsesSinglePage as RuleListResponsesSinglePage, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + }; } diff --git a/src/resources/cloud-connector/index.ts b/src/resources/cloud-connector/index.ts index e9ab704b2a..adc14ea282 100644 --- a/src/resources/cloud-connector/index.ts +++ b/src/resources/cloud-connector/index.ts @@ -2,10 +2,10 @@ export { CloudConnector } from './cloud-connector'; export { - RuleUpdateResponse, - RuleListResponse, - RuleUpdateParams, - RuleListParams, RuleListResponsesSinglePage, Rules, + type RuleUpdateResponse, + type RuleListResponse, + type RuleUpdateParams, + type RuleListParams, } from './rules'; diff --git a/src/resources/cloud-connector/rules.ts b/src/resources/cloud-connector/rules.ts index 2b71047aaa..df5197425d 100644 --- a/src/resources/cloud-connector/rules.ts +++ b/src/resources/cloud-connector/rules.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as RulesAPI from './rules'; import { SinglePage } from '../../pagination'; export class Rules extends APIResource { @@ -10,10 +9,10 @@ export class Rules extends APIResource { * Put Rules */ update(params: RuleUpdateParams, options?: Core.RequestOptions): Core.APIPromise { - const { zone_id, body } = params; + const { zone_id, rules } = params; return ( this._client.put(`/zones/${zone_id}/cloud_connector/rules`, { - body: body, + body: rules, ...options, }) as Core.APIPromise<{ result: RuleUpdateResponse }> )._thenUnwrap((obj) => obj.result); @@ -117,11 +116,11 @@ export interface RuleUpdateParams { /** * Body param: List of Cloud Connector rules */ - body: Array; + rules: Array; } export namespace RuleUpdateParams { - export interface Body { + export interface Rule { id?: string; description?: string; @@ -133,7 +132,7 @@ export namespace RuleUpdateParams { /** * Parameters of Cloud Connector Rule */ - parameters?: Body.Parameters; + parameters?: Rule.Parameters; /** * Cloud Provider type @@ -141,7 +140,7 @@ export namespace RuleUpdateParams { provider?: 'aws_s3' | 'r2' | 'gcp_storage' | 'azure_storage'; } - export namespace Body { + export namespace Rule { /** * Parameters of Cloud Connector Rule */ @@ -161,10 +160,14 @@ export interface RuleListParams { zone_id: string; } -export namespace Rules { - export import RuleUpdateResponse = RulesAPI.RuleUpdateResponse; - export import RuleListResponse = RulesAPI.RuleListResponse; - export import RuleListResponsesSinglePage = RulesAPI.RuleListResponsesSinglePage; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; +Rules.RuleListResponsesSinglePage = RuleListResponsesSinglePage; + +export declare namespace Rules { + export { + type RuleUpdateResponse as RuleUpdateResponse, + type RuleListResponse as RuleListResponse, + RuleListResponsesSinglePage as RuleListResponsesSinglePage, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + }; } diff --git a/src/resources/cloudforce-one/cloudforce-one.ts b/src/resources/cloudforce-one/cloudforce-one.ts index 5323b87163..c7b91ee872 100644 --- a/src/resources/cloudforce-one/cloudforce-one.ts +++ b/src/resources/cloudforce-one/cloudforce-one.ts @@ -2,21 +2,39 @@ import { APIResource } from '../../resource'; import * as RequestsAPI from './requests/requests'; +import { + Item, + ListItem, + ListItemsV4PagePaginationArray, + Quota, + RequestConstants, + RequestCreateParams, + RequestDeleteResponse, + RequestListParams, + RequestTypes, + RequestUpdateParams, + Requests, +} from './requests/requests'; export class CloudforceOne extends APIResource { requests: RequestsAPI.Requests = new RequestsAPI.Requests(this._client); } -export namespace CloudforceOne { - export import Requests = RequestsAPI.Requests; - export import Item = RequestsAPI.Item; - export import ListItem = RequestsAPI.ListItem; - export import Quota = RequestsAPI.Quota; - export import RequestConstants = RequestsAPI.RequestConstants; - export import RequestTypes = RequestsAPI.RequestTypes; - export import RequestDeleteResponse = RequestsAPI.RequestDeleteResponse; - export import ListItemsV4PagePaginationArray = RequestsAPI.ListItemsV4PagePaginationArray; - export import RequestCreateParams = RequestsAPI.RequestCreateParams; - export import RequestUpdateParams = RequestsAPI.RequestUpdateParams; - export import RequestListParams = RequestsAPI.RequestListParams; +CloudforceOne.Requests = Requests; +CloudforceOne.ListItemsV4PagePaginationArray = ListItemsV4PagePaginationArray; + +export declare namespace CloudforceOne { + export { + Requests as Requests, + type Item as Item, + type ListItem as ListItem, + type Quota as Quota, + type RequestConstants as RequestConstants, + type RequestTypes as RequestTypes, + type RequestDeleteResponse as RequestDeleteResponse, + ListItemsV4PagePaginationArray as ListItemsV4PagePaginationArray, + type RequestCreateParams as RequestCreateParams, + type RequestUpdateParams as RequestUpdateParams, + type RequestListParams as RequestListParams, + }; } diff --git a/src/resources/cloudforce-one/index.ts b/src/resources/cloudforce-one/index.ts index ffe55bdb29..01e8a3dfc5 100644 --- a/src/resources/cloudforce-one/index.ts +++ b/src/resources/cloudforce-one/index.ts @@ -2,15 +2,15 @@ export { CloudforceOne } from './cloudforce-one'; export { - Item, - ListItem, - Quota, - RequestConstants, - RequestTypes, - RequestDeleteResponse, - RequestCreateParams, - RequestUpdateParams, - RequestListParams, ListItemsV4PagePaginationArray, Requests, + type Item, + type ListItem, + type Quota, + type RequestConstants, + type RequestTypes, + type RequestDeleteResponse, + type RequestCreateParams, + type RequestUpdateParams, + type RequestListParams, } from './requests/index'; diff --git a/src/resources/cloudforce-one/requests/assets.ts b/src/resources/cloudforce-one/requests/assets.ts new file mode 100644 index 0000000000..0069860938 --- /dev/null +++ b/src/resources/cloudforce-one/requests/assets.ts @@ -0,0 +1,204 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as Shared from '../../shared'; + +export class Assets extends APIResource { + /** + * List Request Assets + */ + create( + accountIdentifier: string, + requestIdentifier: string, + body: AssetCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return ( + this._client.post(`/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/asset`, { + body, + ...options, + }) as Core.APIPromise<{ result: AssetCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update a Request Asset + */ + update( + accountIdentifier: string, + requestIdentifier: string, + assetIdentifer: string, + body: AssetUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + return ( + this._client.put( + `/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/asset/${assetIdentifer}`, + { body, ...options }, + ) as Core.APIPromise<{ result: AssetUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Delete a Request Asset + */ + delete( + accountIdentifier: string, + requestIdentifier: string, + assetIdentifer: string, + options?: Core.RequestOptions, + ): Core.APIPromise { + return this._client.delete( + `/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/asset/${assetIdentifer}`, + options, + ); + } + + /** + * Get a Request Asset + */ + get( + accountIdentifier: string, + requestIdentifier: string, + assetIdentifer: string, + options?: Core.RequestOptions, + ): Core.APIPromise { + return ( + this._client.get( + `/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/asset/${assetIdentifer}`, + options, + ) as Core.APIPromise<{ result: AssetGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type AssetCreateResponse = Array; + +export namespace AssetCreateResponse { + export interface AssetCreateResponseItem { + /** + * Asset ID + */ + id: number; + + /** + * Asset name + */ + name: string; + + /** + * Asset creation time + */ + created?: string; + + /** + * Asset description + */ + description?: string; + + /** + * Asset file type + */ + file_type?: string; + } +} + +export interface AssetUpdateResponse { + /** + * Asset ID + */ + id: number; + + /** + * Asset name + */ + name: string; + + /** + * Asset creation time + */ + created?: string; + + /** + * Asset description + */ + description?: string; + + /** + * Asset file type + */ + file_type?: string; +} + +export interface AssetDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; +} + +export type AssetGetResponse = Array; + +export namespace AssetGetResponse { + export interface AssetGetResponseItem { + /** + * Asset ID + */ + id: number; + + /** + * Asset name + */ + name: string; + + /** + * Asset creation time + */ + created?: string; + + /** + * Asset description + */ + description?: string; + + /** + * Asset file type + */ + file_type?: string; + } +} + +export interface AssetCreateParams { + /** + * Page number of results + */ + page: number; + + /** + * Number of results per page + */ + per_page: number; +} + +export interface AssetUpdateParams { + /** + * Asset file to upload + */ + source?: string; +} + +export declare namespace Assets { + export { + type AssetCreateResponse as AssetCreateResponse, + type AssetUpdateResponse as AssetUpdateResponse, + type AssetDeleteResponse as AssetDeleteResponse, + type AssetGetResponse as AssetGetResponse, + type AssetCreateParams as AssetCreateParams, + type AssetUpdateParams as AssetUpdateParams, + }; +} diff --git a/src/resources/cloudforce-one/requests/index.ts b/src/resources/cloudforce-one/requests/index.ts index d1a1dac5d8..26ce06e7ea 100644 --- a/src/resources/cloudforce-one/requests/index.ts +++ b/src/resources/cloudforce-one/requests/index.ts @@ -1,33 +1,42 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Item, - ListItem, - Quota, - RequestConstants, - RequestTypes, - RequestDeleteResponse, - RequestCreateParams, - RequestUpdateParams, - RequestListParams, + Assets, + type AssetCreateResponse, + type AssetUpdateResponse, + type AssetDeleteResponse, + type AssetGetResponse, + type AssetCreateParams, + type AssetUpdateParams, +} from './assets'; +export { ListItemsV4PagePaginationArray, Requests, + type Item, + type ListItem, + type Quota, + type RequestConstants, + type RequestTypes, + type RequestDeleteResponse, + type RequestCreateParams, + type RequestUpdateParams, + type RequestListParams, } from './requests'; export { - Label, - Priority, - PriorityEdit, - PriorityDeleteResponse, - PriorityCreateParams, - PriorityUpdateParams, - PriorityResource, -} from './priority'; -export { - Message, - MessageDeleteResponse, - MessageGetResponse, - MessageCreateParams, - MessageUpdateParams, - MessageGetParams, MessageResource, + type Message, + type MessageDeleteResponse, + type MessageGetResponse, + type MessageCreateParams, + type MessageUpdateParams, + type MessageGetParams, } from './message'; +export { + PriorityResource, + type Label, + type Priority, + type PriorityEdit, + type PriorityDeleteResponse, + type PriorityCreateParams, + type PriorityUpdateParams, +} from './priority'; diff --git a/src/resources/cloudforce-one/requests/message.ts b/src/resources/cloudforce-one/requests/message.ts index 94e61b5923..f47705418f 100644 --- a/src/resources/cloudforce-one/requests/message.ts +++ b/src/resources/cloudforce-one/requests/message.ts @@ -2,14 +2,11 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as MessageAPI from './message'; import * as Shared from '../../shared'; export class MessageResource extends APIResource { /** - * Creating a request adds the request into the Cloudforce One queue for analysis. - * In addition to the content, a short title, type, priority, and releasability - * should be provided. If one is not provided a default will be assigned. + * Create a New Request Message */ create( accountIdentifier: string, @@ -93,7 +90,7 @@ export interface Message { content: string; /** - * Message is a follow-on request + * Whether the message is a follow-on request */ is_follow_on_request: boolean; @@ -130,29 +127,9 @@ export interface MessageCreateParams { export interface MessageUpdateParams { /** - * Request content + * Content of message */ content?: string; - - /** - * Priority for analyzing the request - */ - priority?: string; - - /** - * Requested information from request - */ - request_type?: string; - - /** - * Brief description of the request - */ - summary?: string; - - /** - * The CISA defined Traffic Light Protocol (TLP) - */ - tlp?: 'clear' | 'amber' | 'amber-strict' | 'green' | 'red'; } export interface MessageGetParams { @@ -187,11 +164,13 @@ export interface MessageGetParams { sort_order?: 'asc' | 'desc'; } -export namespace MessageResource { - export import Message = MessageAPI.Message; - export import MessageDeleteResponse = MessageAPI.MessageDeleteResponse; - export import MessageGetResponse = MessageAPI.MessageGetResponse; - export import MessageCreateParams = MessageAPI.MessageCreateParams; - export import MessageUpdateParams = MessageAPI.MessageUpdateParams; - export import MessageGetParams = MessageAPI.MessageGetParams; +export declare namespace MessageResource { + export { + type Message as Message, + type MessageDeleteResponse as MessageDeleteResponse, + type MessageGetResponse as MessageGetResponse, + type MessageCreateParams as MessageCreateParams, + type MessageUpdateParams as MessageUpdateParams, + type MessageGetParams as MessageGetParams, + }; } diff --git a/src/resources/cloudforce-one/requests/priority.ts b/src/resources/cloudforce-one/requests/priority.ts index 02418d77d1..23e56fb99d 100644 --- a/src/resources/cloudforce-one/requests/priority.ts +++ b/src/resources/cloudforce-one/requests/priority.ts @@ -2,13 +2,12 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as PriorityAPI from './priority'; import * as Shared from '../../shared'; import * as RequestsAPI from './requests'; export class PriorityResource extends APIResource { /** - * Create a New Priority Requirement + * Create a New Priority Intelligence Requirement */ create( accountIdentifier: string, @@ -41,7 +40,7 @@ export class PriorityResource extends APIResource { } /** - * Delete a Priority Intelligence Report + * Delete a Priority Intelligence Requirement */ delete( accountIdentifier: string, @@ -201,11 +200,13 @@ export interface PriorityUpdateParams { tlp: 'clear' | 'amber' | 'amber-strict' | 'green' | 'red'; } -export namespace PriorityResource { - export import Label = PriorityAPI.Label; - export import Priority = PriorityAPI.Priority; - export import PriorityEdit = PriorityAPI.PriorityEdit; - export import PriorityDeleteResponse = PriorityAPI.PriorityDeleteResponse; - export import PriorityCreateParams = PriorityAPI.PriorityCreateParams; - export import PriorityUpdateParams = PriorityAPI.PriorityUpdateParams; +export declare namespace PriorityResource { + export { + type Label as Label, + type Priority as Priority, + type PriorityEdit as PriorityEdit, + type PriorityDeleteResponse as PriorityDeleteResponse, + type PriorityCreateParams as PriorityCreateParams, + type PriorityUpdateParams as PriorityUpdateParams, + }; } diff --git a/src/resources/cloudforce-one/requests/requests.ts b/src/resources/cloudforce-one/requests/requests.ts index 27a49910fa..f7f4ed0cdf 100644 --- a/src/resources/cloudforce-one/requests/requests.ts +++ b/src/resources/cloudforce-one/requests/requests.ts @@ -2,20 +2,48 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as RequestsAPI from './requests'; import * as Shared from '../../shared'; +import * as AssetsAPI from './assets'; +import { + AssetCreateParams, + AssetCreateResponse, + AssetDeleteResponse, + AssetGetResponse, + AssetUpdateParams, + AssetUpdateResponse, + Assets, +} from './assets'; import * as MessageAPI from './message'; +import { + Message, + MessageCreateParams, + MessageDeleteResponse, + MessageGetParams, + MessageGetResponse, + MessageResource, + MessageUpdateParams, +} from './message'; import * as PriorityAPI from './priority'; +import { + Label, + Priority, + PriorityCreateParams, + PriorityDeleteResponse, + PriorityEdit, + PriorityResource, + PriorityUpdateParams, +} from './priority'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; export class Requests extends APIResource { message: MessageAPI.MessageResource = new MessageAPI.MessageResource(this._client); priority: PriorityAPI.PriorityResource = new PriorityAPI.PriorityResource(this._client); + assets: AssetsAPI.Assets = new AssetsAPI.Assets(this._client); /** * Creating a request adds the request into the Cloudforce One queue for analysis. * In addition to the content, a short title, type, priority, and releasability - * should be provided. If one is not provided a default will be assigned. + * should be provided. If one is not provided, a default will be assigned. */ create( accountIdentifier: string, @@ -33,7 +61,7 @@ export class Requests extends APIResource { /** * Updating a request alters the request in the Cloudforce One queue. This API may * be used to update any attributes of the request after the initial submission. - * Only fields that you choose to update need to be add to the request body + * Only fields that you choose to update need to be add to the request body. */ update( accountIdentifier: string, @@ -386,29 +414,52 @@ export interface RequestListParams extends V4PagePaginationArrayParams { status?: 'open' | 'accepted' | 'reported' | 'approved' | 'completed' | 'declined'; } -export namespace Requests { - export import Item = RequestsAPI.Item; - export import ListItem = RequestsAPI.ListItem; - export import Quota = RequestsAPI.Quota; - export import RequestConstants = RequestsAPI.RequestConstants; - export import RequestTypes = RequestsAPI.RequestTypes; - export import RequestDeleteResponse = RequestsAPI.RequestDeleteResponse; - export import ListItemsV4PagePaginationArray = RequestsAPI.ListItemsV4PagePaginationArray; - export import RequestCreateParams = RequestsAPI.RequestCreateParams; - export import RequestUpdateParams = RequestsAPI.RequestUpdateParams; - export import RequestListParams = RequestsAPI.RequestListParams; - export import MessageResource = MessageAPI.MessageResource; - export import Message = MessageAPI.Message; - export import MessageDeleteResponse = MessageAPI.MessageDeleteResponse; - export import MessageGetResponse = MessageAPI.MessageGetResponse; - export import MessageCreateParams = MessageAPI.MessageCreateParams; - export import MessageUpdateParams = MessageAPI.MessageUpdateParams; - export import MessageGetParams = MessageAPI.MessageGetParams; - export import PriorityResource = PriorityAPI.PriorityResource; - export import Label = PriorityAPI.Label; - export import Priority = PriorityAPI.Priority; - export import PriorityEdit = PriorityAPI.PriorityEdit; - export import PriorityDeleteResponse = PriorityAPI.PriorityDeleteResponse; - export import PriorityCreateParams = PriorityAPI.PriorityCreateParams; - export import PriorityUpdateParams = PriorityAPI.PriorityUpdateParams; +Requests.ListItemsV4PagePaginationArray = ListItemsV4PagePaginationArray; +Requests.MessageResource = MessageResource; +Requests.PriorityResource = PriorityResource; +Requests.Assets = Assets; + +export declare namespace Requests { + export { + type Item as Item, + type ListItem as ListItem, + type Quota as Quota, + type RequestConstants as RequestConstants, + type RequestTypes as RequestTypes, + type RequestDeleteResponse as RequestDeleteResponse, + ListItemsV4PagePaginationArray as ListItemsV4PagePaginationArray, + type RequestCreateParams as RequestCreateParams, + type RequestUpdateParams as RequestUpdateParams, + type RequestListParams as RequestListParams, + }; + + export { + MessageResource as MessageResource, + type Message as Message, + type MessageDeleteResponse as MessageDeleteResponse, + type MessageGetResponse as MessageGetResponse, + type MessageCreateParams as MessageCreateParams, + type MessageUpdateParams as MessageUpdateParams, + type MessageGetParams as MessageGetParams, + }; + + export { + PriorityResource as PriorityResource, + type Label as Label, + type Priority as Priority, + type PriorityEdit as PriorityEdit, + type PriorityDeleteResponse as PriorityDeleteResponse, + type PriorityCreateParams as PriorityCreateParams, + type PriorityUpdateParams as PriorityUpdateParams, + }; + + export { + Assets as Assets, + type AssetCreateResponse as AssetCreateResponse, + type AssetUpdateResponse as AssetUpdateResponse, + type AssetDeleteResponse as AssetDeleteResponse, + type AssetGetResponse as AssetGetResponse, + type AssetCreateParams as AssetCreateParams, + type AssetUpdateParams as AssetUpdateParams, + }; } diff --git a/src/resources/content-scanning/content-scanning.ts b/src/resources/content-scanning/content-scanning.ts new file mode 100644 index 0000000000..ed77e3e8a5 --- /dev/null +++ b/src/resources/content-scanning/content-scanning.ts @@ -0,0 +1,93 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as PayloadsAPI from './payloads'; +import { + PayloadCreateParams, + PayloadCreateResponse, + PayloadDeleteParams, + PayloadDeleteResponse, + PayloadListParams, + PayloadListResponse, + PayloadListResponsesSinglePage, + Payloads, +} from './payloads'; +import * as SettingsAPI from './settings'; +import { SettingGetParams, SettingGetResponse, Settings } from './settings'; + +export class ContentScanning extends APIResource { + payloads: PayloadsAPI.Payloads = new PayloadsAPI.Payloads(this._client); + settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); + + /** + * Disable Content Scanning + */ + disable( + params: ContentScanningDisableParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.post(`/zones/${zone_id}/content-upload-scan/disable`, options) as Core.APIPromise<{ + result: ContentScanningDisableResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Enable Content Scanning + */ + enable( + params: ContentScanningEnableParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.post(`/zones/${zone_id}/content-upload-scan/enable`, options) as Core.APIPromise<{ + result: ContentScanningEnableResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type ContentScanningDisableResponse = unknown; + +export type ContentScanningEnableResponse = unknown; + +export interface ContentScanningDisableParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface ContentScanningEnableParams { + /** + * Identifier + */ + zone_id: string; +} + +ContentScanning.Payloads = Payloads; +ContentScanning.PayloadListResponsesSinglePage = PayloadListResponsesSinglePage; +ContentScanning.Settings = Settings; + +export declare namespace ContentScanning { + export { + Payloads as Payloads, + type PayloadCreateResponse as PayloadCreateResponse, + type PayloadListResponse as PayloadListResponse, + type PayloadDeleteResponse as PayloadDeleteResponse, + PayloadListResponsesSinglePage as PayloadListResponsesSinglePage, + type PayloadCreateParams as PayloadCreateParams, + type PayloadListParams as PayloadListParams, + type PayloadDeleteParams as PayloadDeleteParams, + }; + + export { + Settings as Settings, + type SettingGetResponse as SettingGetResponse, + type SettingGetParams as SettingGetParams, + }; +} diff --git a/src/resources/content-scanning/index.ts b/src/resources/content-scanning/index.ts new file mode 100644 index 0000000000..3e6d703e66 --- /dev/null +++ b/src/resources/content-scanning/index.ts @@ -0,0 +1,14 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { ContentScanning } from './content-scanning'; +export { + PayloadListResponsesSinglePage, + Payloads, + type PayloadCreateResponse, + type PayloadListResponse, + type PayloadDeleteResponse, + type PayloadCreateParams, + type PayloadListParams, + type PayloadDeleteParams, +} from './payloads'; +export { Settings, type SettingGetResponse, type SettingGetParams } from './settings'; diff --git a/src/resources/content-scanning/payloads.ts b/src/resources/content-scanning/payloads.ts new file mode 100644 index 0000000000..6873efa686 --- /dev/null +++ b/src/resources/content-scanning/payloads.ts @@ -0,0 +1,159 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage } from '../../pagination'; + +export class Payloads extends APIResource { + /** + * Add custom scan expressions for Content Scanning + */ + create( + params: PayloadCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, body } = params; + return ( + this._client.post(`/zones/${zone_id}/content-upload-scan/payloads`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: PayloadCreateResponse | null }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a list of existing custom scan expressions for Content Scanning + */ + list( + params: PayloadListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id } = params; + return this._client.getAPIList( + `/zones/${zone_id}/content-upload-scan/payloads`, + PayloadListResponsesSinglePage, + options, + ); + } + + /** + * Delete a Content Scan Custom Expression + */ + delete( + expressionId: string, + params: PayloadDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.delete( + `/zones/${zone_id}/content-upload-scan/payloads/${expressionId}`, + options, + ) as Core.APIPromise<{ result: PayloadDeleteResponse | null }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class PayloadListResponsesSinglePage extends SinglePage {} + +export type PayloadCreateResponse = Array; + +export namespace PayloadCreateResponse { + /** + * A custom scan expression to match Content Scanning on + */ + export interface PayloadCreateResponseItem { + /** + * The unique ID for this custom scan expression + */ + id?: string; + + /** + * Ruleset expression to use in matching content objects + */ + payload?: string; + } +} + +/** + * A custom scan expression to match Content Scanning on + */ +export interface PayloadListResponse { + /** + * The unique ID for this custom scan expression + */ + id?: string; + + /** + * Ruleset expression to use in matching content objects + */ + payload?: string; +} + +export type PayloadDeleteResponse = Array; + +export namespace PayloadDeleteResponse { + /** + * A custom scan expression to match Content Scanning on + */ + export interface PayloadDeleteResponseItem { + /** + * The unique ID for this custom scan expression + */ + id?: string; + + /** + * Ruleset expression to use in matching content objects + */ + payload?: string; + } +} + +export interface PayloadCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + body: Array; +} + +export namespace PayloadCreateParams { + export interface Body { + /** + * Ruleset expression to use in matching content objects + */ + payload: string; + } +} + +export interface PayloadListParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface PayloadDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +Payloads.PayloadListResponsesSinglePage = PayloadListResponsesSinglePage; + +export declare namespace Payloads { + export { + type PayloadCreateResponse as PayloadCreateResponse, + type PayloadListResponse as PayloadListResponse, + type PayloadDeleteResponse as PayloadDeleteResponse, + PayloadListResponsesSinglePage as PayloadListResponsesSinglePage, + type PayloadCreateParams as PayloadCreateParams, + type PayloadListParams as PayloadListParams, + type PayloadDeleteParams as PayloadDeleteParams, + }; +} diff --git a/src/resources/content-scanning/settings.ts b/src/resources/content-scanning/settings.ts new file mode 100644 index 0000000000..d77a303517 --- /dev/null +++ b/src/resources/content-scanning/settings.ts @@ -0,0 +1,44 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class Settings extends APIResource { + /** + * Retrieve the current status of Content Scanning + */ + get(params: SettingGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/content-upload-scan/settings`, options) as Core.APIPromise<{ + result: SettingGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * The status for Content Scanning + */ +export interface SettingGetResponse { + /** + * Last modification date (ISO 8601) of the Content Scanning status + */ + modified?: string; + + /** + * Status of Content Scanning + */ + value?: string; +} + +export interface SettingGetParams { + /** + * Identifier + */ + zone_id: string; +} + +export declare namespace Settings { + export { type SettingGetResponse as SettingGetResponse, type SettingGetParams as SettingGetParams }; +} diff --git a/src/resources/custom-certificates/custom-certificates.ts b/src/resources/custom-certificates/custom-certificates.ts index 4764c5b0c6..8c3726efff 100644 --- a/src/resources/custom-certificates/custom-certificates.ts +++ b/src/resources/custom-certificates/custom-certificates.ts @@ -4,6 +4,7 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as KeylessCertificatesAPI from '../keyless-certificates'; import * as PrioritizeAPI from './prioritize'; +import { Prioritize, PrioritizeUpdateParams, PrioritizeUpdateResponse } from './prioritize'; import * as CustomHostnamesAPI from '../custom-hostnames/custom-hostnames'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; @@ -16,11 +17,11 @@ export class CustomCertificates extends APIResource { create( params: CustomCertificateCreateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.post(`/zones/${zone_id}/custom_certificates`, { body, ...options }) as Core.APIPromise<{ - result: CustomCertificateCreateResponse; + result: CustomCertificate; }> )._thenUnwrap((obj) => obj.result); } @@ -68,13 +69,13 @@ export class CustomCertificates extends APIResource { customCertificateId: string, params: CustomCertificateEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.patch(`/zones/${zone_id}/custom_certificates/${customCertificateId}`, { body, ...options, - }) as Core.APIPromise<{ result: CustomCertificateEditResponse }> + }) as Core.APIPromise<{ result: CustomCertificate }> )._thenUnwrap((obj) => obj.result); } @@ -85,13 +86,13 @@ export class CustomCertificates extends APIResource { customCertificateId: string, params: CustomCertificateGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id } = params; return ( this._client.get( `/zones/${zone_id}/custom_certificates/${customCertificateId}`, options, - ) as Core.APIPromise<{ result: CustomCertificateGetResponse }> + ) as Core.APIPromise<{ result: CustomCertificate }> )._thenUnwrap((obj) => obj.result); } } @@ -216,8 +217,6 @@ export interface GeoRestrictionsParam { */ export type Status = 'active' | 'pending_reactivation' | 'pending_revocation' | 'revoked'; -export type CustomCertificateCreateResponse = unknown | string | null; - export interface CustomCertificateDeleteResponse { /** * Identifier @@ -225,10 +224,6 @@ export interface CustomCertificateDeleteResponse { id?: string; } -export type CustomCertificateEditResponse = unknown | string | null; - -export type CustomCertificateGetResponse = unknown | string | null; - export interface CustomCertificateCreateParams { /** * Path param: Identifier @@ -364,8 +359,12 @@ export interface CustomCertificateGetParams { zone_id: string; } -export namespace CustomCertificates { - export import Prioritize = PrioritizeAPI.Prioritize; - export import PrioritizeUpdateResponse = PrioritizeAPI.PrioritizeUpdateResponse; - export import PrioritizeUpdateParams = PrioritizeAPI.PrioritizeUpdateParams; +CustomCertificates.Prioritize = Prioritize; + +export declare namespace CustomCertificates { + export { + Prioritize as Prioritize, + type PrioritizeUpdateResponse as PrioritizeUpdateResponse, + type PrioritizeUpdateParams as PrioritizeUpdateParams, + }; } diff --git a/src/resources/custom-certificates/index.ts b/src/resources/custom-certificates/index.ts index 28f1cc799c..fcc5d7cc58 100644 --- a/src/resources/custom-certificates/index.ts +++ b/src/resources/custom-certificates/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { CustomCertificates } from './custom-certificates'; -export { PrioritizeUpdateResponse, PrioritizeUpdateParams, Prioritize } from './prioritize'; +export { Prioritize, type PrioritizeUpdateResponse, type PrioritizeUpdateParams } from './prioritize'; diff --git a/src/resources/custom-certificates/prioritize.ts b/src/resources/custom-certificates/prioritize.ts index d439fbe01b..5dcb60c2e0 100644 --- a/src/resources/custom-certificates/prioritize.ts +++ b/src/resources/custom-certificates/prioritize.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PrioritizeAPI from './prioritize'; import * as CustomCertificatesAPI from './custom-certificates'; export class Prioritize extends APIResource { @@ -14,13 +13,13 @@ export class Prioritize extends APIResource { update( params: PrioritizeUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.put(`/zones/${zone_id}/custom_certificates/prioritize`, { body, ...options, - }) as Core.APIPromise<{ result: PrioritizeUpdateResponse | null }> + }) as Core.APIPromise<{ result: PrioritizeUpdateResponse }> )._thenUnwrap((obj) => obj.result); } } @@ -56,7 +55,9 @@ export namespace PrioritizeUpdateParams { } } -export namespace Prioritize { - export import PrioritizeUpdateResponse = PrioritizeAPI.PrioritizeUpdateResponse; - export import PrioritizeUpdateParams = PrioritizeAPI.PrioritizeUpdateParams; +export declare namespace Prioritize { + export { + type PrioritizeUpdateResponse as PrioritizeUpdateResponse, + type PrioritizeUpdateParams as PrioritizeUpdateParams, + }; } diff --git a/src/resources/custom-hostnames/custom-hostnames.ts b/src/resources/custom-hostnames/custom-hostnames.ts index 71e0ec7099..6d042c896f 100644 --- a/src/resources/custom-hostnames/custom-hostnames.ts +++ b/src/resources/custom-hostnames/custom-hostnames.ts @@ -5,6 +5,15 @@ import * as Core from '../../core'; import * as CustomHostnamesAPI from './custom-hostnames'; import * as Shared from '../shared'; import * as FallbackOriginAPI from './fallback-origin'; +import { + FallbackOrigin, + FallbackOriginDeleteParams, + FallbackOriginDeleteResponse, + FallbackOriginGetParams, + FallbackOriginGetResponse, + FallbackOriginUpdateParams, + FallbackOriginUpdateResponse, +} from './fallback-origin'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class CustomHostnames extends APIResource { @@ -124,9 +133,6 @@ export interface CustomHostname { */ hostname: string; - /** - * SSL properties for the custom hostname. - */ ssl: CustomHostname.SSL; /** @@ -135,9 +141,10 @@ export interface CustomHostname { created_at?: string; /** - * These are per-hostname (customer) settings. + * Unique key/value metadata for this hostname. These are per-hostname (customer) + * settings. */ - custom_metadata?: CustomHostname.CustomMetadata; + custom_metadata?: Record; /** * a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME @@ -189,13 +196,10 @@ export interface CustomHostname { /** * These are errors that were encountered while trying to activate a hostname. */ - verification_errors?: Array; + verification_errors?: Array; } export namespace CustomHostname { - /** - * SSL properties for the custom hostname. - */ export interface SSL { /** * Custom hostname SSL identifier tag. @@ -238,7 +242,7 @@ export namespace CustomHostname { /** * A list of Hostnames on a custom uploaded certificate. */ - hosts?: Array; + hosts?: Array; /** * The issuer on a custom uploaded certificate. @@ -255,9 +259,6 @@ export namespace CustomHostname { */ serial_number?: string; - /** - * SSL specific settings. - */ settings?: SSL.Settings; /** @@ -317,9 +318,6 @@ export namespace CustomHostname { } export namespace SSL { - /** - * SSL specific settings. - */ export interface Settings { /** * An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -355,15 +353,12 @@ export namespace CustomHostname { message?: string; } - /** - * Certificate's required validation record. - */ export interface ValidationRecord { /** * The set of email addresses that the certificate authority (CA) will use to * complete domain validation. */ - emails?: Array; + emails?: Array; /** * The content that the certificate authority (CA) will expect to find at the @@ -390,16 +385,6 @@ export namespace CustomHostname { } } - /** - * These are per-hostname (customer) settings. - */ - export interface CustomMetadata { - /** - * Unique metadata for this hostname. - */ - key?: string; - } - /** * This is a record which can be placed to activate a hostname. */ @@ -471,9 +456,6 @@ export interface CustomHostnameCreateResponse { */ hostname: string; - /** - * SSL properties for the custom hostname. - */ ssl: CustomHostnameCreateResponse.SSL; /** @@ -482,9 +464,10 @@ export interface CustomHostnameCreateResponse { created_at?: string; /** - * These are per-hostname (customer) settings. + * Unique key/value metadata for this hostname. These are per-hostname (customer) + * settings. */ - custom_metadata?: CustomHostnameCreateResponse.CustomMetadata; + custom_metadata?: Record; /** * a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME @@ -536,13 +519,10 @@ export interface CustomHostnameCreateResponse { /** * These are errors that were encountered while trying to activate a hostname. */ - verification_errors?: Array; + verification_errors?: Array; } export namespace CustomHostnameCreateResponse { - /** - * SSL properties for the custom hostname. - */ export interface SSL { /** * Custom hostname SSL identifier tag. @@ -585,7 +565,7 @@ export namespace CustomHostnameCreateResponse { /** * A list of Hostnames on a custom uploaded certificate. */ - hosts?: Array; + hosts?: Array; /** * The issuer on a custom uploaded certificate. @@ -602,9 +582,6 @@ export namespace CustomHostnameCreateResponse { */ serial_number?: string; - /** - * SSL specific settings. - */ settings?: SSL.Settings; /** @@ -664,9 +641,6 @@ export namespace CustomHostnameCreateResponse { } export namespace SSL { - /** - * SSL specific settings. - */ export interface Settings { /** * An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -702,15 +676,12 @@ export namespace CustomHostnameCreateResponse { message?: string; } - /** - * Certificate's required validation record. - */ export interface ValidationRecord { /** * The set of email addresses that the certificate authority (CA) will use to * complete domain validation. */ - emails?: Array; + emails?: Array; /** * The content that the certificate authority (CA) will expect to find at the @@ -737,16 +708,6 @@ export namespace CustomHostnameCreateResponse { } } - /** - * These are per-hostname (customer) settings. - */ - export interface CustomMetadata { - /** - * Unique metadata for this hostname. - */ - key?: string; - } - /** * This is a record which can be placed to activate a hostname. */ @@ -796,9 +757,6 @@ export interface CustomHostnameListResponse { */ hostname: string; - /** - * SSL properties for the custom hostname. - */ ssl: CustomHostnameListResponse.SSL; /** @@ -807,9 +765,10 @@ export interface CustomHostnameListResponse { created_at?: string; /** - * These are per-hostname (customer) settings. + * Unique key/value metadata for this hostname. These are per-hostname (customer) + * settings. */ - custom_metadata?: CustomHostnameListResponse.CustomMetadata; + custom_metadata?: Record; /** * a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME @@ -861,13 +820,10 @@ export interface CustomHostnameListResponse { /** * These are errors that were encountered while trying to activate a hostname. */ - verification_errors?: Array; + verification_errors?: Array; } export namespace CustomHostnameListResponse { - /** - * SSL properties for the custom hostname. - */ export interface SSL { /** * Custom hostname SSL identifier tag. @@ -910,7 +866,7 @@ export namespace CustomHostnameListResponse { /** * A list of Hostnames on a custom uploaded certificate. */ - hosts?: Array; + hosts?: Array; /** * The issuer on a custom uploaded certificate. @@ -927,9 +883,6 @@ export namespace CustomHostnameListResponse { */ serial_number?: string; - /** - * SSL specific settings. - */ settings?: SSL.Settings; /** @@ -989,9 +942,6 @@ export namespace CustomHostnameListResponse { } export namespace SSL { - /** - * SSL specific settings. - */ export interface Settings { /** * An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -1027,15 +977,12 @@ export namespace CustomHostnameListResponse { message?: string; } - /** - * Certificate's required validation record. - */ export interface ValidationRecord { /** * The set of email addresses that the certificate authority (CA) will use to * complete domain validation. */ - emails?: Array; + emails?: Array; /** * The content that the certificate authority (CA) will expect to find at the @@ -1062,16 +1009,6 @@ export namespace CustomHostnameListResponse { } } - /** - * These are per-hostname (customer) settings. - */ - export interface CustomMetadata { - /** - * Unique metadata for this hostname. - */ - key?: string; - } - /** * This is a record which can be placed to activate a hostname. */ @@ -1128,9 +1065,6 @@ export interface CustomHostnameEditResponse { */ hostname: string; - /** - * SSL properties for the custom hostname. - */ ssl: CustomHostnameEditResponse.SSL; /** @@ -1139,9 +1073,10 @@ export interface CustomHostnameEditResponse { created_at?: string; /** - * These are per-hostname (customer) settings. + * Unique key/value metadata for this hostname. These are per-hostname (customer) + * settings. */ - custom_metadata?: CustomHostnameEditResponse.CustomMetadata; + custom_metadata?: Record; /** * a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME @@ -1193,13 +1128,10 @@ export interface CustomHostnameEditResponse { /** * These are errors that were encountered while trying to activate a hostname. */ - verification_errors?: Array; + verification_errors?: Array; } export namespace CustomHostnameEditResponse { - /** - * SSL properties for the custom hostname. - */ export interface SSL { /** * Custom hostname SSL identifier tag. @@ -1242,7 +1174,7 @@ export namespace CustomHostnameEditResponse { /** * A list of Hostnames on a custom uploaded certificate. */ - hosts?: Array; + hosts?: Array; /** * The issuer on a custom uploaded certificate. @@ -1259,9 +1191,6 @@ export namespace CustomHostnameEditResponse { */ serial_number?: string; - /** - * SSL specific settings. - */ settings?: SSL.Settings; /** @@ -1321,9 +1250,6 @@ export namespace CustomHostnameEditResponse { } export namespace SSL { - /** - * SSL specific settings. - */ export interface Settings { /** * An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -1359,15 +1285,12 @@ export namespace CustomHostnameEditResponse { message?: string; } - /** - * Certificate's required validation record. - */ export interface ValidationRecord { /** * The set of email addresses that the certificate authority (CA) will use to * complete domain validation. */ - emails?: Array; + emails?: Array; /** * The content that the certificate authority (CA) will expect to find at the @@ -1394,16 +1317,6 @@ export namespace CustomHostnameEditResponse { } } - /** - * These are per-hostname (customer) settings. - */ - export interface CustomMetadata { - /** - * Unique metadata for this hostname. - */ - key?: string; - } - /** * This is a record which can be placed to activate a hostname. */ @@ -1453,9 +1366,6 @@ export interface CustomHostnameGetResponse { */ hostname: string; - /** - * SSL properties for the custom hostname. - */ ssl: CustomHostnameGetResponse.SSL; /** @@ -1464,9 +1374,10 @@ export interface CustomHostnameGetResponse { created_at?: string; /** - * These are per-hostname (customer) settings. + * Unique key/value metadata for this hostname. These are per-hostname (customer) + * settings. */ - custom_metadata?: CustomHostnameGetResponse.CustomMetadata; + custom_metadata?: Record; /** * a valid hostname that’s been added to your DNS zone as an A, AAAA, or CNAME @@ -1518,13 +1429,10 @@ export interface CustomHostnameGetResponse { /** * These are errors that were encountered while trying to activate a hostname. */ - verification_errors?: Array; + verification_errors?: Array; } export namespace CustomHostnameGetResponse { - /** - * SSL properties for the custom hostname. - */ export interface SSL { /** * Custom hostname SSL identifier tag. @@ -1567,7 +1475,7 @@ export namespace CustomHostnameGetResponse { /** * A list of Hostnames on a custom uploaded certificate. */ - hosts?: Array; + hosts?: Array; /** * The issuer on a custom uploaded certificate. @@ -1584,9 +1492,6 @@ export namespace CustomHostnameGetResponse { */ serial_number?: string; - /** - * SSL specific settings. - */ settings?: SSL.Settings; /** @@ -1646,9 +1551,6 @@ export namespace CustomHostnameGetResponse { } export namespace SSL { - /** - * SSL specific settings. - */ export interface Settings { /** * An allowlist of ciphers for TLS termination. These ciphers must be in the @@ -1684,15 +1586,12 @@ export namespace CustomHostnameGetResponse { message?: string; } - /** - * Certificate's required validation record. - */ export interface ValidationRecord { /** * The set of email addresses that the certificate authority (CA) will use to * complete domain validation. */ - emails?: Array; + emails?: Array; /** * The content that the certificate authority (CA) will expect to find at the @@ -1719,16 +1618,6 @@ export namespace CustomHostnameGetResponse { } } - /** - * These are per-hostname (customer) settings. - */ - export interface CustomMetadata { - /** - * Unique metadata for this hostname. - */ - key?: string; - } - /** * This is a record which can be placed to activate a hostname. */ @@ -1784,9 +1673,10 @@ export interface CustomHostnameCreateParams { ssl: CustomHostnameCreateParams.SSL; /** - * Body param: These are per-hostname (customer) settings. + * Body param: Unique key/value metadata for this hostname. These are per-hostname + * (customer) settings. */ - custom_metadata?: CustomHostnameCreateParams.CustomMetadata; + custom_metadata?: Record; } export namespace CustomHostnameCreateParams { @@ -1807,6 +1697,12 @@ export namespace CustomHostnameCreateParams { */ certificate_authority?: Shared.CertificateCAParam; + /** + * Whether or not to add Cloudflare Branding for the order. This will add a + * subdomain of sni.cloudflaressl.com as the Common Name if set to true + */ + cloudflare_branding?: boolean; + /** * If a custom uploaded certificate is used. */ @@ -1871,16 +1767,6 @@ export namespace CustomHostnameCreateParams { tls_1_3?: 'on' | 'off'; } } - - /** - * These are per-hostname (customer) settings. - */ - export interface CustomMetadata { - /** - * Unique metadata for this hostname. - */ - key?: string; - } } export interface CustomHostnameListParams extends V4PagePaginationArrayParams { @@ -1932,9 +1818,10 @@ export interface CustomHostnameEditParams { zone_id: string; /** - * Body param: These are per-hostname (customer) settings. + * Body param: Unique key/value metadata for this hostname. These are per-hostname + * (customer) settings. */ - custom_metadata?: CustomHostnameEditParams.CustomMetadata; + custom_metadata?: Record; /** * Body param: a valid hostname that’s been added to your DNS zone as an A, AAAA, @@ -1958,16 +1845,6 @@ export interface CustomHostnameEditParams { } export namespace CustomHostnameEditParams { - /** - * These are per-hostname (customer) settings. - */ - export interface CustomMetadata { - /** - * Unique metadata for this hostname. - */ - key?: string; - } - /** * SSL properties used when creating the custom hostname. */ @@ -1985,6 +1862,12 @@ export namespace CustomHostnameEditParams { */ certificate_authority?: Shared.CertificateCAParam; + /** + * Whether or not to add Cloudflare Branding for the order. This will add a + * subdomain of sni.cloudflaressl.com as the Common Name if set to true + */ + cloudflare_branding?: boolean; + /** * If a custom uploaded certificate is used. */ @@ -2058,12 +1941,16 @@ export interface CustomHostnameGetParams { zone_id: string; } -export namespace CustomHostnames { - export import FallbackOrigin = FallbackOriginAPI.FallbackOrigin; - export import FallbackOriginUpdateResponse = FallbackOriginAPI.FallbackOriginUpdateResponse; - export import FallbackOriginDeleteResponse = FallbackOriginAPI.FallbackOriginDeleteResponse; - export import FallbackOriginGetResponse = FallbackOriginAPI.FallbackOriginGetResponse; - export import FallbackOriginUpdateParams = FallbackOriginAPI.FallbackOriginUpdateParams; - export import FallbackOriginDeleteParams = FallbackOriginAPI.FallbackOriginDeleteParams; - export import FallbackOriginGetParams = FallbackOriginAPI.FallbackOriginGetParams; +CustomHostnames.FallbackOrigin = FallbackOrigin; + +export declare namespace CustomHostnames { + export { + FallbackOrigin as FallbackOrigin, + type FallbackOriginUpdateResponse as FallbackOriginUpdateResponse, + type FallbackOriginDeleteResponse as FallbackOriginDeleteResponse, + type FallbackOriginGetResponse as FallbackOriginGetResponse, + type FallbackOriginUpdateParams as FallbackOriginUpdateParams, + type FallbackOriginDeleteParams as FallbackOriginDeleteParams, + type FallbackOriginGetParams as FallbackOriginGetParams, + }; } diff --git a/src/resources/custom-hostnames/fallback-origin.ts b/src/resources/custom-hostnames/fallback-origin.ts index cd14d6926a..b87713c829 100644 --- a/src/resources/custom-hostnames/fallback-origin.ts +++ b/src/resources/custom-hostnames/fallback-origin.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as FallbackOriginAPI from './fallback-origin'; export class FallbackOrigin extends APIResource { /** @@ -52,11 +51,107 @@ export class FallbackOrigin extends APIResource { } } -export type FallbackOriginUpdateResponse = unknown | string | null; +export interface FallbackOriginUpdateResponse { + /** + * This is the time the fallback origin was created. + */ + created_at?: string; + + /** + * These are errors that were encountered while trying to activate a fallback + * origin. + */ + errors?: Array; + + /** + * Your origin hostname that requests to your custom hostnames will be sent to. + */ + origin?: string; + + /** + * Status of the fallback origin's activation. + */ + status?: + | 'initializing' + | 'pending_deployment' + | 'pending_deletion' + | 'active' + | 'deployment_timed_out' + | 'deletion_timed_out'; -export type FallbackOriginDeleteResponse = unknown | string | null; + /** + * This is the time the fallback origin was updated. + */ + updated_at?: string; +} + +export interface FallbackOriginDeleteResponse { + /** + * This is the time the fallback origin was created. + */ + created_at?: string; + + /** + * These are errors that were encountered while trying to activate a fallback + * origin. + */ + errors?: Array; + + /** + * Your origin hostname that requests to your custom hostnames will be sent to. + */ + origin?: string; -export type FallbackOriginGetResponse = unknown | string | null; + /** + * Status of the fallback origin's activation. + */ + status?: + | 'initializing' + | 'pending_deployment' + | 'pending_deletion' + | 'active' + | 'deployment_timed_out' + | 'deletion_timed_out'; + + /** + * This is the time the fallback origin was updated. + */ + updated_at?: string; +} + +export interface FallbackOriginGetResponse { + /** + * This is the time the fallback origin was created. + */ + created_at?: string; + + /** + * These are errors that were encountered while trying to activate a fallback + * origin. + */ + errors?: Array; + + /** + * Your origin hostname that requests to your custom hostnames will be sent to. + */ + origin?: string; + + /** + * Status of the fallback origin's activation. + */ + status?: + | 'initializing' + | 'pending_deployment' + | 'pending_deletion' + | 'active' + | 'deployment_timed_out' + | 'deletion_timed_out'; + + /** + * This is the time the fallback origin was updated. + */ + updated_at?: string; +} export interface FallbackOriginUpdateParams { /** @@ -85,11 +180,13 @@ export interface FallbackOriginGetParams { zone_id: string; } -export namespace FallbackOrigin { - export import FallbackOriginUpdateResponse = FallbackOriginAPI.FallbackOriginUpdateResponse; - export import FallbackOriginDeleteResponse = FallbackOriginAPI.FallbackOriginDeleteResponse; - export import FallbackOriginGetResponse = FallbackOriginAPI.FallbackOriginGetResponse; - export import FallbackOriginUpdateParams = FallbackOriginAPI.FallbackOriginUpdateParams; - export import FallbackOriginDeleteParams = FallbackOriginAPI.FallbackOriginDeleteParams; - export import FallbackOriginGetParams = FallbackOriginAPI.FallbackOriginGetParams; +export declare namespace FallbackOrigin { + export { + type FallbackOriginUpdateResponse as FallbackOriginUpdateResponse, + type FallbackOriginDeleteResponse as FallbackOriginDeleteResponse, + type FallbackOriginGetResponse as FallbackOriginGetResponse, + type FallbackOriginUpdateParams as FallbackOriginUpdateParams, + type FallbackOriginDeleteParams as FallbackOriginDeleteParams, + type FallbackOriginGetParams as FallbackOriginGetParams, + }; } diff --git a/src/resources/custom-hostnames/index.ts b/src/resources/custom-hostnames/index.ts index 08fd489112..8f3f456029 100644 --- a/src/resources/custom-hostnames/index.ts +++ b/src/resources/custom-hostnames/index.ts @@ -2,11 +2,11 @@ export { CustomHostnames } from './custom-hostnames'; export { - FallbackOriginUpdateResponse, - FallbackOriginDeleteResponse, - FallbackOriginGetResponse, - FallbackOriginUpdateParams, - FallbackOriginDeleteParams, - FallbackOriginGetParams, FallbackOrigin, + type FallbackOriginUpdateResponse, + type FallbackOriginDeleteResponse, + type FallbackOriginGetResponse, + type FallbackOriginUpdateParams, + type FallbackOriginDeleteParams, + type FallbackOriginGetParams, } from './fallback-origin'; diff --git a/src/resources/custom-nameservers.ts b/src/resources/custom-nameservers.ts index 73bf023a64..370745f3c7 100644 --- a/src/resources/custom-nameservers.ts +++ b/src/resources/custom-nameservers.ts @@ -26,11 +26,11 @@ export class CustomNameservers extends APIResource { customNSId: string, params: CustomNameserverDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.delete(`/accounts/${account_id}/custom_ns/${customNSId}`, options) as Core.APIPromise<{ - result: CustomNameserverDeleteResponse | null; + result: CustomNameserverDeleteResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -41,11 +41,11 @@ export class CustomNameservers extends APIResource { availabilty( params: CustomNameserverAvailabiltyParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get(`/accounts/${account_id}/custom_ns/availability`, options) as Core.APIPromise<{ - result: CustomNameserverAvailabiltyResponse | null; + result: CustomNameserverAvailabiltyResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -56,11 +56,11 @@ export class CustomNameservers extends APIResource { get( params: CustomNameserverGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get(`/accounts/${account_id}/custom_ns`, options) as Core.APIPromise<{ - result: CustomNameserverGetResponse | null; + result: CustomNameserverGetResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -110,7 +110,7 @@ export namespace CustomNameserver { } } -export type CustomNameserverDeleteResponse = Array; +export type CustomNameserverDeleteResponse = Array; export type CustomNameserverAvailabiltyResponse = Array; diff --git a/src/resources/d1/d1.ts b/src/resources/d1/d1.ts index b8f1fa2253..95c850e2af 100644 --- a/src/resources/d1/d1.ts +++ b/src/resources/d1/d1.ts @@ -2,6 +2,25 @@ import { APIResource } from '../../resource'; import * as DatabaseAPI from './database'; +import { + Database, + DatabaseCreateParams, + DatabaseDeleteParams, + DatabaseDeleteResponse, + DatabaseExportParams, + DatabaseExportResponse, + DatabaseGetParams, + DatabaseImportParams, + DatabaseImportResponse, + DatabaseListParams, + DatabaseListResponse, + DatabaseListResponsesV4PagePaginationArray, + DatabaseQueryParams, + DatabaseQueryResponse, + DatabaseRawParams, + DatabaseRawResponse, + QueryResult, +} from './database'; export class D1Resource extends APIResource { database: DatabaseAPI.Database = new DatabaseAPI.Database(this._client); @@ -27,19 +46,27 @@ export interface D1 { version?: string; } -export namespace D1Resource { - export import Database = DatabaseAPI.Database; - export import QueryResult = DatabaseAPI.QueryResult; - export import DatabaseCreateResponse = DatabaseAPI.DatabaseCreateResponse; - export import DatabaseListResponse = DatabaseAPI.DatabaseListResponse; - export import DatabaseDeleteResponse = DatabaseAPI.DatabaseDeleteResponse; - export import DatabaseQueryResponse = DatabaseAPI.DatabaseQueryResponse; - export import DatabaseRawResponse = DatabaseAPI.DatabaseRawResponse; - export import DatabaseListResponsesV4PagePaginationArray = DatabaseAPI.DatabaseListResponsesV4PagePaginationArray; - export import DatabaseCreateParams = DatabaseAPI.DatabaseCreateParams; - export import DatabaseListParams = DatabaseAPI.DatabaseListParams; - export import DatabaseDeleteParams = DatabaseAPI.DatabaseDeleteParams; - export import DatabaseGetParams = DatabaseAPI.DatabaseGetParams; - export import DatabaseQueryParams = DatabaseAPI.DatabaseQueryParams; - export import DatabaseRawParams = DatabaseAPI.DatabaseRawParams; +D1Resource.Database = Database; +D1Resource.DatabaseListResponsesV4PagePaginationArray = DatabaseListResponsesV4PagePaginationArray; + +export declare namespace D1Resource { + export { + Database as Database, + type QueryResult as QueryResult, + type DatabaseListResponse as DatabaseListResponse, + type DatabaseDeleteResponse as DatabaseDeleteResponse, + type DatabaseExportResponse as DatabaseExportResponse, + type DatabaseImportResponse as DatabaseImportResponse, + type DatabaseQueryResponse as DatabaseQueryResponse, + type DatabaseRawResponse as DatabaseRawResponse, + DatabaseListResponsesV4PagePaginationArray as DatabaseListResponsesV4PagePaginationArray, + type DatabaseCreateParams as DatabaseCreateParams, + type DatabaseListParams as DatabaseListParams, + type DatabaseDeleteParams as DatabaseDeleteParams, + type DatabaseExportParams as DatabaseExportParams, + type DatabaseGetParams as DatabaseGetParams, + type DatabaseImportParams as DatabaseImportParams, + type DatabaseQueryParams as DatabaseQueryParams, + type DatabaseRawParams as DatabaseRawParams, + }; } diff --git a/src/resources/d1/database.ts b/src/resources/d1/database.ts index f1be9d2ae7..f9c39fe386 100644 --- a/src/resources/d1/database.ts +++ b/src/resources/d1/database.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as DatabaseAPI from './database'; import * as D1API from './d1'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; @@ -10,14 +9,11 @@ export class Database extends APIResource { /** * Returns the created D1 database. */ - create( - params: DatabaseCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + create(params: DatabaseCreateParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/d1/database`, { body, ...options }) as Core.APIPromise<{ - result: DatabaseCreateResponse; + result: D1API.D1; }> )._thenUnwrap((obj) => obj.result); } @@ -44,15 +40,35 @@ export class Database extends APIResource { databaseId: string, params: DatabaseDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.delete(`/accounts/${account_id}/d1/database/${databaseId}`, options) as Core.APIPromise<{ - result: DatabaseDeleteResponse; + result: DatabaseDeleteResponse | null; }> )._thenUnwrap((obj) => obj.result); } + /** + * Returns a URL where the SQL contents of your D1 can be downloaded. Note: this + * process may take some time for larger DBs, during which your D1 will be + * unavailable to serve queries. To avoid blocking your DB unnecessarily, an + * in-progress export must be continually polled or will automatically cancel. + */ + export( + databaseId: string, + params: DatabaseExportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/d1/database/${databaseId}/export`, { + body, + ...options, + }) as Core.APIPromise<{ result: DatabaseExportResponse }> + )._thenUnwrap((obj) => obj.result); + } + /** * Returns the specified D1 database. */ @@ -69,6 +85,25 @@ export class Database extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Generates a temporary URL for uploading an SQL file to, then instructing the D1 + * to import it and polling it for status updates. Imports block the D1 for their + * duration. + */ + import( + databaseId: string, + params: DatabaseImportParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/d1/database/${databaseId}/import`, { + body, + ...options, + }) as Core.APIPromise<{ result: DatabaseImportResponse }> + )._thenUnwrap((obj) => obj.result); + } + /** * Returns the query result as an object. */ @@ -133,7 +168,7 @@ export namespace QueryResult { } } -export interface DatabaseCreateResponse { +export interface DatabaseListResponse { /** * Specifies the timestamp the resource was created as an ISO8601 string. */ @@ -146,20 +181,134 @@ export interface DatabaseCreateResponse { version?: string; } -export interface DatabaseListResponse { +export type DatabaseDeleteResponse = unknown; + +export interface DatabaseExportResponse { /** - * Specifies the timestamp the resource was created as an ISO8601 string. + * The current time-travel bookmark for your D1, used to poll for updates. Will not + * change for the duration of the export task. */ - created_at?: string; + at_bookmark?: string; - name?: string; + /** + * Only present when status = 'error'. Contains the error message. + */ + error?: string; - uuid?: string; + /** + * Logs since the last time you polled + */ + messages?: Array; - version?: string; + /** + * Only present when status = 'complete' + */ + result?: DatabaseExportResponse.Result; + + status?: 'complete' | 'error'; + + success?: boolean; + + type?: 'export'; } -export type DatabaseDeleteResponse = unknown | string | null; +export namespace DatabaseExportResponse { + /** + * Only present when status = 'complete' + */ + export interface Result { + /** + * The generated SQL filename. + */ + filename?: string; + + /** + * The URL to download the exported SQL. Available for one hour. + */ + signed_url?: string; + } +} + +export interface DatabaseImportResponse { + /** + * The current time-travel bookmark for your D1, used to poll for updates. Will not + * change for the duration of the import. Only returned if an import process is + * currently running or recently finished. + */ + at_bookmark?: string; + + /** + * Only present when status = 'error'. Contains the error message that prevented + * the import from succeeding. + */ + error?: string; + + /** + * Derived from the database ID and etag, to use in avoiding repeated uploads. Only + * returned when for the 'init' action. + */ + filename?: string; + + /** + * Logs since the last time you polled + */ + messages?: Array; + + /** + * Only present when status = 'complete' + */ + result?: DatabaseImportResponse.Result; + + status?: 'complete' | 'error'; + + success?: boolean; + + type?: 'import'; + + /** + * The R2 presigned URL to use for uploading. Only returned when for the 'init' + * action. + */ + upload_url?: string; +} + +export namespace DatabaseImportResponse { + /** + * Only present when status = 'complete' + */ + export interface Result { + /** + * The time-travel bookmark if you need restore your D1 to directly after the + * import succeeded. + */ + final_bookmark?: string; + + meta?: Result.Meta; + + /** + * The total number of queries that were executed during the import. + */ + num_queries?: number; + } + + export namespace Result { + export interface Meta { + changed_db?: boolean; + + changes?: number; + + duration?: number; + + last_row_id?: number; + + rows_read?: number; + + rows_written?: number; + + size_after?: number; + } + } +} export type DatabaseQueryResponse = Array; @@ -237,6 +386,50 @@ export interface DatabaseDeleteParams { account_id: string; } +export interface DatabaseExportParams { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: Specifies that you will poll this endpoint until the export + * completes + */ + output_format: 'polling'; + + /** + * Body param: To poll an in-progress export, provide the current bookmark + * (returned by your first polling response) + */ + current_bookmark?: string; + + /** + * Body param: + */ + dump_options?: DatabaseExportParams.DumpOptions; +} + +export namespace DatabaseExportParams { + export interface DumpOptions { + /** + * Export only the table definitions, not their contents + */ + no_data?: boolean; + + /** + * Export only each table's contents, not its definition + */ + no_schema?: boolean; + + /** + * Filter the export to just one or more tables. Passing an empty array is the same + * as not passing anything and means: export all tables. + */ + tables?: Array; + } +} + export interface DatabaseGetParams { /** * Account identifier tag. @@ -244,6 +437,74 @@ export interface DatabaseGetParams { account_id: string; } +export type DatabaseImportParams = + | DatabaseImportParams.Variant0 + | DatabaseImportParams.Variant1 + | DatabaseImportParams.Variant2; + +export declare namespace DatabaseImportParams { + export interface Variant0 { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: Indicates you have a new SQL file to upload. + */ + action: 'init'; + + /** + * Body param: Required when action is 'init' or 'ingest'. An md5 hash of the file + * you're uploading. Used to check if it already exists, and validate its contents + * before ingesting. + */ + etag: string; + } + + export interface Variant1 { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: Indicates you've finished uploading to tell the D1 to start + * consuming it + */ + action: 'ingest'; + + /** + * Body param: An md5 hash of the file you're uploading. Used to check if it + * already exists, and validate its contents before ingesting. + */ + etag: string; + + /** + * Body param: The filename you have successfully uploaded. + */ + filename: string; + } + + export interface Variant2 { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: Indicates you've finished uploading to tell the D1 to start + * consuming it + */ + action: 'poll'; + + /** + * Body param: This identifies the currently-running import, checking its status. + */ + current_bookmark: string; + } +} + export interface DatabaseQueryParams { /** * Path param: Account identifier tag. @@ -280,18 +541,25 @@ export interface DatabaseRawParams { params?: Array; } -export namespace Database { - export import QueryResult = DatabaseAPI.QueryResult; - export import DatabaseCreateResponse = DatabaseAPI.DatabaseCreateResponse; - export import DatabaseListResponse = DatabaseAPI.DatabaseListResponse; - export import DatabaseDeleteResponse = DatabaseAPI.DatabaseDeleteResponse; - export import DatabaseQueryResponse = DatabaseAPI.DatabaseQueryResponse; - export import DatabaseRawResponse = DatabaseAPI.DatabaseRawResponse; - export import DatabaseListResponsesV4PagePaginationArray = DatabaseAPI.DatabaseListResponsesV4PagePaginationArray; - export import DatabaseCreateParams = DatabaseAPI.DatabaseCreateParams; - export import DatabaseListParams = DatabaseAPI.DatabaseListParams; - export import DatabaseDeleteParams = DatabaseAPI.DatabaseDeleteParams; - export import DatabaseGetParams = DatabaseAPI.DatabaseGetParams; - export import DatabaseQueryParams = DatabaseAPI.DatabaseQueryParams; - export import DatabaseRawParams = DatabaseAPI.DatabaseRawParams; +Database.DatabaseListResponsesV4PagePaginationArray = DatabaseListResponsesV4PagePaginationArray; + +export declare namespace Database { + export { + type QueryResult as QueryResult, + type DatabaseListResponse as DatabaseListResponse, + type DatabaseDeleteResponse as DatabaseDeleteResponse, + type DatabaseExportResponse as DatabaseExportResponse, + type DatabaseImportResponse as DatabaseImportResponse, + type DatabaseQueryResponse as DatabaseQueryResponse, + type DatabaseRawResponse as DatabaseRawResponse, + DatabaseListResponsesV4PagePaginationArray as DatabaseListResponsesV4PagePaginationArray, + type DatabaseCreateParams as DatabaseCreateParams, + type DatabaseListParams as DatabaseListParams, + type DatabaseDeleteParams as DatabaseDeleteParams, + type DatabaseExportParams as DatabaseExportParams, + type DatabaseGetParams as DatabaseGetParams, + type DatabaseImportParams as DatabaseImportParams, + type DatabaseQueryParams as DatabaseQueryParams, + type DatabaseRawParams as DatabaseRawParams, + }; } diff --git a/src/resources/d1/index.ts b/src/resources/d1/index.ts index 90d4c26d23..a0d16c70fc 100644 --- a/src/resources/d1/index.ts +++ b/src/resources/d1/index.ts @@ -2,18 +2,21 @@ export { D1Resource } from './d1'; export { - QueryResult, - DatabaseCreateResponse, - DatabaseListResponse, - DatabaseDeleteResponse, - DatabaseQueryResponse, - DatabaseRawResponse, - DatabaseCreateParams, - DatabaseListParams, - DatabaseDeleteParams, - DatabaseGetParams, - DatabaseQueryParams, - DatabaseRawParams, DatabaseListResponsesV4PagePaginationArray, Database, + type QueryResult, + type DatabaseListResponse, + type DatabaseDeleteResponse, + type DatabaseExportResponse, + type DatabaseImportResponse, + type DatabaseQueryResponse, + type DatabaseRawResponse, + type DatabaseCreateParams, + type DatabaseListParams, + type DatabaseDeleteParams, + type DatabaseExportParams, + type DatabaseGetParams, + type DatabaseImportParams, + type DatabaseQueryParams, + type DatabaseRawParams, } from './database'; diff --git a/src/resources/diagnostics/diagnostics.ts b/src/resources/diagnostics/diagnostics.ts index a67592e655..8fb41593c3 100644 --- a/src/resources/diagnostics/diagnostics.ts +++ b/src/resources/diagnostics/diagnostics.ts @@ -2,14 +2,19 @@ import { APIResource } from '../../resource'; import * as TraceroutesAPI from './traceroutes'; +import { Traceroute, TracerouteCreateParams, TracerouteCreateResponse, Traceroutes } from './traceroutes'; export class Diagnostics extends APIResource { traceroutes: TraceroutesAPI.Traceroutes = new TraceroutesAPI.Traceroutes(this._client); } -export namespace Diagnostics { - export import Traceroutes = TraceroutesAPI.Traceroutes; - export import Traceroute = TraceroutesAPI.Traceroute; - export import TracerouteCreateResponse = TraceroutesAPI.TracerouteCreateResponse; - export import TracerouteCreateParams = TraceroutesAPI.TracerouteCreateParams; +Diagnostics.Traceroutes = Traceroutes; + +export declare namespace Diagnostics { + export { + Traceroutes as Traceroutes, + type Traceroute as Traceroute, + type TracerouteCreateResponse as TracerouteCreateResponse, + type TracerouteCreateParams as TracerouteCreateParams, + }; } diff --git a/src/resources/diagnostics/index.ts b/src/resources/diagnostics/index.ts index bf7990e06e..8b4d13a98d 100644 --- a/src/resources/diagnostics/index.ts +++ b/src/resources/diagnostics/index.ts @@ -1,4 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Diagnostics } from './diagnostics'; -export { Traceroute, TracerouteCreateResponse, TracerouteCreateParams, Traceroutes } from './traceroutes'; +export { + Traceroutes, + type Traceroute, + type TracerouteCreateResponse, + type TracerouteCreateParams, +} from './traceroutes'; diff --git a/src/resources/diagnostics/traceroutes.ts b/src/resources/diagnostics/traceroutes.ts index 4393a9f41e..7a729f3e83 100644 --- a/src/resources/diagnostics/traceroutes.ts +++ b/src/resources/diagnostics/traceroutes.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TraceroutesAPI from './traceroutes'; export class Traceroutes extends APIResource { /** @@ -202,8 +201,10 @@ export namespace TracerouteCreateParams { } } -export namespace Traceroutes { - export import Traceroute = TraceroutesAPI.Traceroute; - export import TracerouteCreateResponse = TraceroutesAPI.TracerouteCreateResponse; - export import TracerouteCreateParams = TraceroutesAPI.TracerouteCreateParams; +export declare namespace Traceroutes { + export { + type Traceroute as Traceroute, + type TracerouteCreateResponse as TracerouteCreateResponse, + type TracerouteCreateParams as TracerouteCreateParams, + }; } diff --git a/src/resources/dns-firewall/analytics/analytics.ts b/src/resources/dns-firewall/analytics/analytics.ts new file mode 100644 index 0000000000..7d9727909b --- /dev/null +++ b/src/resources/dns-firewall/analytics/analytics.ts @@ -0,0 +1,15 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as ReportsAPI from './reports/reports'; +import { ReportGetParams, Reports } from './reports/reports'; + +export class Analytics extends APIResource { + reports: ReportsAPI.Reports = new ReportsAPI.Reports(this._client); +} + +Analytics.Reports = Reports; + +export declare namespace Analytics { + export { Reports as Reports, type ReportGetParams as ReportGetParams }; +} diff --git a/src/resources/dns-firewall/analytics/index.ts b/src/resources/dns-firewall/analytics/index.ts new file mode 100644 index 0000000000..0be47a4055 --- /dev/null +++ b/src/resources/dns-firewall/analytics/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Analytics } from './analytics'; +export { Reports, type ReportGetParams } from './reports/index'; diff --git a/src/resources/dns/firewall/analytics/reports/bytimes.ts b/src/resources/dns-firewall/analytics/reports/bytimes.ts similarity index 76% rename from src/resources/dns/firewall/analytics/reports/bytimes.ts rename to src/resources/dns-firewall/analytics/reports/bytimes.ts index cd4d5ab9e1..7ca60e9dd8 100644 --- a/src/resources/dns/firewall/analytics/reports/bytimes.ts +++ b/src/resources/dns-firewall/analytics/reports/bytimes.ts @@ -1,10 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../../../resource'; -import * as Core from '../../../../../core'; -import * as ReportsBytimesAPI from './bytimes'; -import * as BytimesAPI from '../../../analytics/reports/bytimes'; -import * as AnalyticsAPI from '../analytics'; +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; +import * as ReportsBytimesAPI from '../../../dns/analytics/reports/bytimes'; export class Bytimes extends APIResource { /** @@ -18,13 +16,13 @@ export class Bytimes extends APIResource { dnsFirewallId: string, params: BytimeGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...query } = params; return ( this._client.get(`/accounts/${account_id}/dns_firewall/${dnsFirewallId}/dns_analytics/report/bytime`, { query, ...options, - }) as Core.APIPromise<{ result: BytimesAPI.ByTime }> + }) as Core.APIPromise<{ result: ReportsBytimesAPI.ByTime }> )._thenUnwrap((obj) => obj.result); } } @@ -69,7 +67,17 @@ export interface BytimeGetParams { /** * Query param: Unit of time to group data by. */ - time_delta?: AnalyticsAPI.DeltaParam; + time_delta?: + | 'all' + | 'auto' + | 'year' + | 'quarter' + | 'month' + | 'week' + | 'day' + | 'hour' + | 'dekaminute' + | 'minute'; /** * Query param: End date and time of requesting data period in ISO 8601 format. @@ -77,6 +85,6 @@ export interface BytimeGetParams { until?: string; } -export namespace Bytimes { - export import BytimeGetParams = ReportsBytimesAPI.BytimeGetParams; +export declare namespace Bytimes { + export { type BytimeGetParams as BytimeGetParams }; } diff --git a/src/resources/dns-firewall/analytics/reports/index.ts b/src/resources/dns-firewall/analytics/reports/index.ts new file mode 100644 index 0000000000..c2fce722e0 --- /dev/null +++ b/src/resources/dns-firewall/analytics/reports/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Bytimes, type BytimeGetParams } from './bytimes'; +export { Reports, type ReportGetParams } from './reports'; diff --git a/src/resources/dns/firewall/analytics/reports/reports.ts b/src/resources/dns-firewall/analytics/reports/reports.ts similarity index 76% rename from src/resources/dns/firewall/analytics/reports/reports.ts rename to src/resources/dns-firewall/analytics/reports/reports.ts index b14f7bfcb6..cd051b7d65 100644 --- a/src/resources/dns/firewall/analytics/reports/reports.ts +++ b/src/resources/dns-firewall/analytics/reports/reports.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../../../resource'; -import * as Core from '../../../../../core'; -import * as ReportsReportsAPI from './reports'; -import * as ReportsAPI from '../../../analytics/reports/reports'; +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; import * as BytimesAPI from './bytimes'; +import { BytimeGetParams, Bytimes } from './bytimes'; +import * as ReportsReportsAPI from '../../../dns/analytics/reports/reports'; export class Reports extends APIResource { bytimes: BytimesAPI.Bytimes = new BytimesAPI.Bytimes(this._client); @@ -20,13 +20,13 @@ export class Reports extends APIResource { dnsFirewallId: string, params: ReportGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...query } = params; return ( this._client.get(`/accounts/${account_id}/dns_firewall/${dnsFirewallId}/dns_analytics/report`, { query, ...options, - }) as Core.APIPromise<{ result: ReportsAPI.Report }> + }) as Core.APIPromise<{ result: ReportsReportsAPI.Report }> )._thenUnwrap((obj) => obj.result); } } @@ -74,8 +74,10 @@ export interface ReportGetParams { until?: string; } -export namespace Reports { - export import ReportGetParams = ReportsReportsAPI.ReportGetParams; - export import Bytimes = BytimesAPI.Bytimes; - export import BytimeGetParams = BytimesAPI.BytimeGetParams; +Reports.Bytimes = Bytimes; + +export declare namespace Reports { + export { type ReportGetParams as ReportGetParams }; + + export { Bytimes as Bytimes, type BytimeGetParams as BytimeGetParams }; } diff --git a/src/resources/dns-firewall/dns-firewall.ts b/src/resources/dns-firewall/dns-firewall.ts new file mode 100644 index 0000000000..820a2910ea --- /dev/null +++ b/src/resources/dns-firewall/dns-firewall.ts @@ -0,0 +1,594 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as ReverseDNSAPI from './reverse-dns'; +import { + ReverseDNS, + ReverseDNSEditParams, + ReverseDNSEditResponse, + ReverseDNSGetParams, + ReverseDNSGetResponse, +} from './reverse-dns'; +import * as AnalyticsAPI from './analytics/analytics'; +import { Analytics } from './analytics/analytics'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class DNSFirewall extends APIResource { + analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client); + reverseDNS: ReverseDNSAPI.ReverseDNS = new ReverseDNSAPI.ReverseDNS(this._client); + + /** + * Create a DNS Firewall cluster + */ + create( + params: DNSFirewallCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/dns_firewall`, { body, ...options }) as Core.APIPromise<{ + result: DNSFirewallCreateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List DNS Firewall clusters for an account + */ + list( + params: DNSFirewallListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/dns_firewall`, + DNSFirewallListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete a DNS Firewall cluster + */ + delete( + dnsFirewallId: string, + params: DNSFirewallDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/dns_firewall/${dnsFirewallId}`, + options, + ) as Core.APIPromise<{ result: DNSFirewallDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Modify the configuration of a DNS Firewall cluster + */ + edit( + dnsFirewallId: string, + params: DNSFirewallEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/dns_firewall/${dnsFirewallId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: DNSFirewallEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Show a single DNS Firewall cluster for an account + */ + get( + dnsFirewallId: string, + params: DNSFirewallGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/dns_firewall/${dnsFirewallId}`, options) as Core.APIPromise<{ + result: DNSFirewallGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class DNSFirewallListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +/** + * Attack mitigation settings + */ +export interface AttackMitigation { + /** + * When enabled, automatically mitigate random-prefix attacks to protect upstream + * DNS servers + */ + enabled?: boolean; + + /** + * Only mitigate attacks when upstream servers seem unhealthy + */ + only_when_upstream_unhealthy?: boolean; +} + +/** + * Attack mitigation settings + */ +export interface AttackMitigationParam { + /** + * When enabled, automatically mitigate random-prefix attacks to protect upstream + * DNS servers + */ + enabled?: boolean; + + /** + * Only mitigate attacks when upstream servers seem unhealthy + */ + only_when_upstream_unhealthy?: boolean; +} + +/** + * Cloudflare-assigned DNS IPv4 address + */ +export type FirewallIPs = string; + +/** + * Upstream DNS Server IPv4 address + */ +export type UpstreamIPs = string; + +/** + * Upstream DNS Server IPv4 address + */ +export type UpstreamIPsParam = string; + +export interface DNSFirewallCreateResponse { + /** + * Identifier + */ + id: string; + + /** + * Whether to refuse to answer queries for the ANY type + */ + deprecate_any_requests: boolean; + + dns_firewall_ips: Array; + + /** + * Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent + */ + ecs_fallback: boolean; + + /** + * Maximum DNS cache TTL This setting sets an upper bound on DNS TTLs for purposes + * of caching between DNS Firewall and the upstream servers. Higher TTLs will be + * decreased to the maximum defined here for caching purposes. + */ + maximum_cache_ttl: number; + + /** + * Minimum DNS cache TTL This setting sets a lower bound on DNS TTLs for purposes + * of caching between DNS Firewall and the upstream servers. Lower TTLs will be + * increased to the minimum defined here for caching purposes. + */ + minimum_cache_ttl: number; + + /** + * Last modification of DNS Firewall cluster + */ + modified_on: string; + + /** + * DNS Firewall cluster name + */ + name: string; + + /** + * Negative DNS cache TTL This setting controls how long DNS Firewall should cache + * negative responses (e.g., NXDOMAIN) from the upstream servers. + */ + negative_cache_ttl: number | null; + + /** + * Ratelimit in queries per second per datacenter (applies to DNS queries sent to + * the upstream nameservers configured on the cluster) + */ + ratelimit: number | null; + + /** + * Number of retries for fetching DNS responses from upstream nameservers (not + * counting the initial attempt) + */ + retries: number; + + upstream_ips: Array; + + /** + * Attack mitigation settings + */ + attack_mitigation?: AttackMitigation | null; +} + +export interface DNSFirewallListResponse { + /** + * Identifier + */ + id: string; + + /** + * Whether to refuse to answer queries for the ANY type + */ + deprecate_any_requests: boolean; + + dns_firewall_ips: Array; + + /** + * Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent + */ + ecs_fallback: boolean; + + /** + * Maximum DNS cache TTL This setting sets an upper bound on DNS TTLs for purposes + * of caching between DNS Firewall and the upstream servers. Higher TTLs will be + * decreased to the maximum defined here for caching purposes. + */ + maximum_cache_ttl: number; + + /** + * Minimum DNS cache TTL This setting sets a lower bound on DNS TTLs for purposes + * of caching between DNS Firewall and the upstream servers. Lower TTLs will be + * increased to the minimum defined here for caching purposes. + */ + minimum_cache_ttl: number; + + /** + * Last modification of DNS Firewall cluster + */ + modified_on: string; + + /** + * DNS Firewall cluster name + */ + name: string; + + /** + * Negative DNS cache TTL This setting controls how long DNS Firewall should cache + * negative responses (e.g., NXDOMAIN) from the upstream servers. + */ + negative_cache_ttl: number | null; + + /** + * Ratelimit in queries per second per datacenter (applies to DNS queries sent to + * the upstream nameservers configured on the cluster) + */ + ratelimit: number | null; + + /** + * Number of retries for fetching DNS responses from upstream nameservers (not + * counting the initial attempt) + */ + retries: number; + + upstream_ips: Array; + + /** + * Attack mitigation settings + */ + attack_mitigation?: AttackMitigation | null; +} + +export interface DNSFirewallDeleteResponse { + /** + * Identifier + */ + id?: string; +} + +export interface DNSFirewallEditResponse { + /** + * Identifier + */ + id: string; + + /** + * Whether to refuse to answer queries for the ANY type + */ + deprecate_any_requests: boolean; + + dns_firewall_ips: Array; + + /** + * Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent + */ + ecs_fallback: boolean; + + /** + * Maximum DNS cache TTL This setting sets an upper bound on DNS TTLs for purposes + * of caching between DNS Firewall and the upstream servers. Higher TTLs will be + * decreased to the maximum defined here for caching purposes. + */ + maximum_cache_ttl: number; + + /** + * Minimum DNS cache TTL This setting sets a lower bound on DNS TTLs for purposes + * of caching between DNS Firewall and the upstream servers. Lower TTLs will be + * increased to the minimum defined here for caching purposes. + */ + minimum_cache_ttl: number; + + /** + * Last modification of DNS Firewall cluster + */ + modified_on: string; + + /** + * DNS Firewall cluster name + */ + name: string; + + /** + * Negative DNS cache TTL This setting controls how long DNS Firewall should cache + * negative responses (e.g., NXDOMAIN) from the upstream servers. + */ + negative_cache_ttl: number | null; + + /** + * Ratelimit in queries per second per datacenter (applies to DNS queries sent to + * the upstream nameservers configured on the cluster) + */ + ratelimit: number | null; + + /** + * Number of retries for fetching DNS responses from upstream nameservers (not + * counting the initial attempt) + */ + retries: number; + + upstream_ips: Array; + + /** + * Attack mitigation settings + */ + attack_mitigation?: AttackMitigation | null; +} + +export interface DNSFirewallGetResponse { + /** + * Identifier + */ + id: string; + + /** + * Whether to refuse to answer queries for the ANY type + */ + deprecate_any_requests: boolean; + + dns_firewall_ips: Array; + + /** + * Whether to forward client IP (resolver) subnet if no EDNS Client Subnet is sent + */ + ecs_fallback: boolean; + + /** + * Maximum DNS cache TTL This setting sets an upper bound on DNS TTLs for purposes + * of caching between DNS Firewall and the upstream servers. Higher TTLs will be + * decreased to the maximum defined here for caching purposes. + */ + maximum_cache_ttl: number; + + /** + * Minimum DNS cache TTL This setting sets a lower bound on DNS TTLs for purposes + * of caching between DNS Firewall and the upstream servers. Lower TTLs will be + * increased to the minimum defined here for caching purposes. + */ + minimum_cache_ttl: number; + + /** + * Last modification of DNS Firewall cluster + */ + modified_on: string; + + /** + * DNS Firewall cluster name + */ + name: string; + + /** + * Negative DNS cache TTL This setting controls how long DNS Firewall should cache + * negative responses (e.g., NXDOMAIN) from the upstream servers. + */ + negative_cache_ttl: number | null; + + /** + * Ratelimit in queries per second per datacenter (applies to DNS queries sent to + * the upstream nameservers configured on the cluster) + */ + ratelimit: number | null; + + /** + * Number of retries for fetching DNS responses from upstream nameservers (not + * counting the initial attempt) + */ + retries: number; + + upstream_ips: Array; + + /** + * Attack mitigation settings + */ + attack_mitigation?: AttackMitigation | null; +} + +export interface DNSFirewallCreateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: Attack mitigation settings + */ + attack_mitigation?: AttackMitigationParam | null; + + /** + * Body param: Whether to refuse to answer queries for the ANY type + */ + deprecate_any_requests?: boolean; + + /** + * Body param: Whether to forward client IP (resolver) subnet if no EDNS Client + * Subnet is sent + */ + ecs_fallback?: boolean; + + /** + * Body param: Maximum DNS cache TTL This setting sets an upper bound on DNS TTLs + * for purposes of caching between DNS Firewall and the upstream servers. Higher + * TTLs will be decreased to the maximum defined here for caching purposes. + */ + maximum_cache_ttl?: number; + + /** + * Body param: Minimum DNS cache TTL This setting sets a lower bound on DNS TTLs + * for purposes of caching between DNS Firewall and the upstream servers. Lower + * TTLs will be increased to the minimum defined here for caching purposes. + */ + minimum_cache_ttl?: number; + + /** + * Body param: DNS Firewall cluster name + */ + name?: string; + + /** + * Body param: Negative DNS cache TTL This setting controls how long DNS Firewall + * should cache negative responses (e.g., NXDOMAIN) from the upstream servers. + */ + negative_cache_ttl?: number | null; + + /** + * Body param: Ratelimit in queries per second per datacenter (applies to DNS + * queries sent to the upstream nameservers configured on the cluster) + */ + ratelimit?: number | null; + + /** + * Body param: Number of retries for fetching DNS responses from upstream + * nameservers (not counting the initial attempt) + */ + retries?: number; + + /** + * Body param: + */ + upstream_ips?: Array; +} + +export interface DNSFirewallListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier + */ + account_id: string; +} + +export interface DNSFirewallDeleteParams { + /** + * Identifier + */ + account_id: string; +} + +export interface DNSFirewallEditParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: Attack mitigation settings + */ + attack_mitigation?: AttackMitigationParam | null; + + /** + * Body param: Whether to refuse to answer queries for the ANY type + */ + deprecate_any_requests?: boolean; + + /** + * Body param: Whether to forward client IP (resolver) subnet if no EDNS Client + * Subnet is sent + */ + ecs_fallback?: boolean; + + /** + * Body param: Maximum DNS cache TTL This setting sets an upper bound on DNS TTLs + * for purposes of caching between DNS Firewall and the upstream servers. Higher + * TTLs will be decreased to the maximum defined here for caching purposes. + */ + maximum_cache_ttl?: number; + + /** + * Body param: Minimum DNS cache TTL This setting sets a lower bound on DNS TTLs + * for purposes of caching between DNS Firewall and the upstream servers. Lower + * TTLs will be increased to the minimum defined here for caching purposes. + */ + minimum_cache_ttl?: number; + + /** + * Body param: DNS Firewall cluster name + */ + name?: string; + + /** + * Body param: Negative DNS cache TTL This setting controls how long DNS Firewall + * should cache negative responses (e.g., NXDOMAIN) from the upstream servers. + */ + negative_cache_ttl?: number | null; + + /** + * Body param: Ratelimit in queries per second per datacenter (applies to DNS + * queries sent to the upstream nameservers configured on the cluster) + */ + ratelimit?: number | null; + + /** + * Body param: Number of retries for fetching DNS responses from upstream + * nameservers (not counting the initial attempt) + */ + retries?: number; + + /** + * Body param: + */ + upstream_ips?: Array; +} + +export interface DNSFirewallGetParams { + /** + * Identifier + */ + account_id: string; +} + +DNSFirewall.Analytics = Analytics; +DNSFirewall.ReverseDNS = ReverseDNS; + +export declare namespace DNSFirewall { + export { Analytics as Analytics }; + + export { + ReverseDNS as ReverseDNS, + type ReverseDNSEditResponse as ReverseDNSEditResponse, + type ReverseDNSGetResponse as ReverseDNSGetResponse, + type ReverseDNSEditParams as ReverseDNSEditParams, + type ReverseDNSGetParams as ReverseDNSGetParams, + }; +} diff --git a/src/resources/dns-firewall/index.ts b/src/resources/dns-firewall/index.ts new file mode 100644 index 0000000000..71c3af8ddf --- /dev/null +++ b/src/resources/dns-firewall/index.ts @@ -0,0 +1,11 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Analytics } from './analytics/index'; +export { DNSFirewall } from './dns-firewall'; +export { + ReverseDNS, + type ReverseDNSEditResponse, + type ReverseDNSGetResponse, + type ReverseDNSEditParams, + type ReverseDNSGetParams, +} from './reverse-dns'; diff --git a/src/resources/dns-firewall/reverse-dns.ts b/src/resources/dns-firewall/reverse-dns.ts new file mode 100644 index 0000000000..9864357681 --- /dev/null +++ b/src/resources/dns-firewall/reverse-dns.ts @@ -0,0 +1,82 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class ReverseDNS extends APIResource { + /** + * Update reverse DNS configuration (PTR records) for a DNS Firewall cluster + */ + edit( + dnsFirewallId: string, + params: ReverseDNSEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/dns_firewall/${dnsFirewallId}/reverse_dns`, { + body, + ...options, + }) as Core.APIPromise<{ result: ReverseDNSEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Show reverse DNS configuration (PTR records) for a DNS Firewall cluster + */ + get( + dnsFirewallId: string, + params: ReverseDNSGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/dns_firewall/${dnsFirewallId}/reverse_dns`, + options, + ) as Core.APIPromise<{ result: ReverseDNSGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ReverseDNSEditResponse { + /** + * Map of cluster IP addresses to PTR record contents + */ + ptr?: Record; +} + +export interface ReverseDNSGetResponse { + /** + * Map of cluster IP addresses to PTR record contents + */ + ptr?: Record; +} + +export interface ReverseDNSEditParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: Map of cluster IP addresses to PTR record contents + */ + ptr?: Record; +} + +export interface ReverseDNSGetParams { + /** + * Identifier + */ + account_id: string; +} + +export declare namespace ReverseDNS { + export { + type ReverseDNSEditResponse as ReverseDNSEditResponse, + type ReverseDNSGetResponse as ReverseDNSGetResponse, + type ReverseDNSEditParams as ReverseDNSEditParams, + type ReverseDNSGetParams as ReverseDNSGetParams, + }; +} diff --git a/src/resources/dns/analytics/analytics.ts b/src/resources/dns/analytics/analytics.ts index 70e8a8b528..5d4aaff95b 100644 --- a/src/resources/dns/analytics/analytics.ts +++ b/src/resources/dns/analytics/analytics.ts @@ -2,13 +2,14 @@ import { APIResource } from '../../../resource'; import * as ReportsAPI from './reports/reports'; +import { Report, ReportGetParams, Reports } from './reports/reports'; export class Analytics extends APIResource { reports: ReportsAPI.Reports = new ReportsAPI.Reports(this._client); } -export namespace Analytics { - export import Reports = ReportsAPI.Reports; - export import Report = ReportsAPI.Report; - export import ReportGetParams = ReportsAPI.ReportGetParams; +Analytics.Reports = Reports; + +export declare namespace Analytics { + export { Reports as Reports, type Report as Report, type ReportGetParams as ReportGetParams }; } diff --git a/src/resources/dns/analytics/index.ts b/src/resources/dns/analytics/index.ts index cd8b9eb0a6..1db5a1b70e 100644 --- a/src/resources/dns/analytics/index.ts +++ b/src/resources/dns/analytics/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Analytics } from './analytics'; -export { Report, ReportGetParams, Reports } from './reports/index'; +export { Reports, type Report, type ReportGetParams } from './reports/index'; diff --git a/src/resources/dns/analytics/reports/bytimes.ts b/src/resources/dns/analytics/reports/bytimes.ts index 6637db2e89..f3e3b81c48 100644 --- a/src/resources/dns/analytics/reports/bytimes.ts +++ b/src/resources/dns/analytics/reports/bytimes.ts @@ -2,9 +2,7 @@ import { APIResource } from '../../../../resource'; import * as Core from '../../../../core'; -import * as BytimesAPI from './bytimes'; import * as DNSAPI from '../../dns'; -import * as AnalyticsAPI from '../../firewall/analytics/analytics'; export class Bytimes extends APIResource { /** @@ -125,7 +123,17 @@ export interface BytimeGetParams { /** * Query param: Unit of time to group data by. */ - time_delta?: AnalyticsAPI.DeltaParam; + time_delta?: + | 'all' + | 'auto' + | 'year' + | 'quarter' + | 'month' + | 'week' + | 'day' + | 'hour' + | 'dekaminute' + | 'minute'; /** * Query param: End date and time of requesting data period in ISO 8601 format. @@ -133,7 +141,6 @@ export interface BytimeGetParams { until?: string; } -export namespace Bytimes { - export import ByTime = BytimesAPI.ByTime; - export import BytimeGetParams = BytimesAPI.BytimeGetParams; +export declare namespace Bytimes { + export { type ByTime as ByTime, type BytimeGetParams as BytimeGetParams }; } diff --git a/src/resources/dns/analytics/reports/index.ts b/src/resources/dns/analytics/reports/index.ts index 7aedfa2ea9..e829e5d6ba 100644 --- a/src/resources/dns/analytics/reports/index.ts +++ b/src/resources/dns/analytics/reports/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { ByTime, BytimeGetParams, Bytimes } from './bytimes'; -export { Report, ReportGetParams, Reports } from './reports'; +export { Bytimes, type ByTime, type BytimeGetParams } from './bytimes'; +export { Reports, type Report, type ReportGetParams } from './reports'; diff --git a/src/resources/dns/analytics/reports/reports.ts b/src/resources/dns/analytics/reports/reports.ts index a0ac1dd1d4..5e497635d4 100644 --- a/src/resources/dns/analytics/reports/reports.ts +++ b/src/resources/dns/analytics/reports/reports.ts @@ -2,8 +2,8 @@ import { APIResource } from '../../../../resource'; import * as Core from '../../../../core'; -import * as ReportsAPI from './reports'; import * as BytimesAPI from './bytimes'; +import { ByTime, BytimeGetParams, Bytimes } from './bytimes'; export class Reports extends APIResource { bytimes: BytimesAPI.Bytimes = new BytimesAPI.Bytimes(this._client); @@ -159,10 +159,10 @@ export interface ReportGetParams { until?: string; } -export namespace Reports { - export import Report = ReportsAPI.Report; - export import ReportGetParams = ReportsAPI.ReportGetParams; - export import Bytimes = BytimesAPI.Bytimes; - export import ByTime = BytimesAPI.ByTime; - export import BytimeGetParams = BytimesAPI.BytimeGetParams; +Reports.Bytimes = Bytimes; + +export declare namespace Reports { + export { type Report as Report, type ReportGetParams as ReportGetParams }; + + export { Bytimes as Bytimes, type ByTime as ByTime, type BytimeGetParams as BytimeGetParams }; } diff --git a/src/resources/dns/dns.ts b/src/resources/dns/dns.ts index 727b7f505f..6558685db2 100644 --- a/src/resources/dns/dns.ts +++ b/src/resources/dns/dns.ts @@ -1,17 +1,81 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as DNSSECAPI from './dnssec'; +import { + DNSSEC, + DNSSECDeleteParams, + DNSSECDeleteResponse, + DNSSECEditParams, + DNSSECGetParams, + DNSSECResource, +} from './dnssec'; import * as RecordsAPI from './records'; -import * as SettingsAPI from './settings'; +import { + AAAARecord, + ARecord, + BatchPatch, + BatchPut, + CAARecord, + CERTRecord, + CNAMERecord, + DNSKEYRecord, + DSRecord, + HTTPSRecord, + LOCRecord, + MXRecord, + NAPTRRecord, + NSRecord, + PTRRecord, + Record, + RecordBatchParams, + RecordBatchResponse, + RecordCreateParams, + RecordDeleteParams, + RecordDeleteResponse, + RecordEditParams, + RecordExportParams, + RecordExportResponse, + RecordGetParams, + RecordImportParams, + RecordImportResponse, + RecordListParams, + RecordResponse, + RecordResponsesV4PagePaginationArray, + RecordScanParams, + RecordScanResponse, + RecordTags, + RecordUpdateParams, + Records, + SMIMEARecord, + SRVRecord, + SSHFPRecord, + SVCBRecord, + TLSARecord, + TTL, + TXTRecord, + URIRecord, +} from './records'; import * as AnalyticsAPI from './analytics/analytics'; -import * as FirewallAPI from './firewall/firewall'; -import * as AnalyticsAnalyticsAPI from './firewall/analytics/analytics'; +import { Analytics } from './analytics/analytics'; +import * as SettingsAPI from './settings/settings'; +import { + DNSSetting, + SettingEditParams, + SettingEditResponse, + SettingGetParams, + SettingGetResponse, + Settings, +} from './settings/settings'; +import * as ZoneTransfersAPI from './zone-transfers/zone-transfers'; +import { ZoneTransfers } from './zone-transfers/zone-transfers'; export class DNS extends APIResource { + dnssec: DNSSECAPI.DNSSECResource = new DNSSECAPI.DNSSECResource(this._client); records: RecordsAPI.Records = new RecordsAPI.Records(this._client); settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client); - firewall: FirewallAPI.FirewallResource = new FirewallAPI.FirewallResource(this._client); + zoneTransfers: ZoneTransfersAPI.ZoneTransfers = new ZoneTransfersAPI.ZoneTransfers(this._client); } /** @@ -43,7 +107,17 @@ export interface DNSAnalyticsQuery { /** * Unit of time to group data by. */ - time_delta: AnalyticsAnalyticsAPI.Delta; + time_delta: + | 'all' + | 'auto' + | 'year' + | 'quarter' + | 'month' + | 'week' + | 'day' + | 'hour' + | 'dekaminute' + | 'minute'; /** * End date and time of requesting data period in ISO 8601 format. @@ -62,65 +136,79 @@ export interface DNSAnalyticsQuery { sort?: Array; } -export namespace DNS { - export import Records = RecordsAPI.Records; - export import ARecord = RecordsAPI.ARecord; - export import AAAARecord = RecordsAPI.AAAARecord; - export import CAARecord = RecordsAPI.CAARecord; - export import CERTRecord = RecordsAPI.CERTRecord; - export import CNAMERecord = RecordsAPI.CNAMERecord; - export import DNSKEYRecord = RecordsAPI.DNSKEYRecord; - export import DSRecord = RecordsAPI.DSRecord; - export import HTTPSRecord = RecordsAPI.HTTPSRecord; - export import LOCRecord = RecordsAPI.LOCRecord; - export import MXRecord = RecordsAPI.MXRecord; - export import NAPTRRecord = RecordsAPI.NAPTRRecord; - export import NSRecord = RecordsAPI.NSRecord; - export import PTRRecord = RecordsAPI.PTRRecord; - export import Record = RecordsAPI.Record; - export import RecordMetadata = RecordsAPI.RecordMetadata; - export import RecordProcessTiming = RecordsAPI.RecordProcessTiming; - export import RecordTags = RecordsAPI.RecordTags; - export import SMIMEARecord = RecordsAPI.SMIMEARecord; - export import SRVRecord = RecordsAPI.SRVRecord; - export import SSHFPRecord = RecordsAPI.SSHFPRecord; - export import SVCBRecord = RecordsAPI.SVCBRecord; - export import TLSARecord = RecordsAPI.TLSARecord; - export import TTL = RecordsAPI.TTL; - export import TXTRecord = RecordsAPI.TXTRecord; - export import URIRecord = RecordsAPI.URIRecord; - export import RecordDeleteResponse = RecordsAPI.RecordDeleteResponse; - export import RecordExportResponse = RecordsAPI.RecordExportResponse; - export import RecordImportResponse = RecordsAPI.RecordImportResponse; - export import RecordScanResponse = RecordsAPI.RecordScanResponse; - export import RecordsV4PagePaginationArray = RecordsAPI.RecordsV4PagePaginationArray; - export import RecordCreateParams = RecordsAPI.RecordCreateParams; - export import RecordUpdateParams = RecordsAPI.RecordUpdateParams; - export import RecordListParams = RecordsAPI.RecordListParams; - export import RecordDeleteParams = RecordsAPI.RecordDeleteParams; - export import RecordEditParams = RecordsAPI.RecordEditParams; - export import RecordExportParams = RecordsAPI.RecordExportParams; - export import RecordGetParams = RecordsAPI.RecordGetParams; - export import RecordImportParams = RecordsAPI.RecordImportParams; - export import RecordScanParams = RecordsAPI.RecordScanParams; - export import Settings = SettingsAPI.Settings; - export import DNSSetting = SettingsAPI.DNSSetting; - export import Nameserver = SettingsAPI.Nameserver; - export import SettingEditResponse = SettingsAPI.SettingEditResponse; - export import SettingGetResponse = SettingsAPI.SettingGetResponse; - export import SettingEditParams = SettingsAPI.SettingEditParams; - export import SettingGetParams = SettingsAPI.SettingGetParams; - export import Analytics = AnalyticsAPI.Analytics; - export import FirewallResource = FirewallAPI.FirewallResource; - export import AttackMitigation = FirewallAPI.AttackMitigation; - export import Firewall = FirewallAPI.Firewall; - export import FirewallIPs = FirewallAPI.FirewallIPs; - export import UpstreamIPs = FirewallAPI.UpstreamIPs; - export import FirewallDeleteResponse = FirewallAPI.FirewallDeleteResponse; - export import FirewallsV4PagePaginationArray = FirewallAPI.FirewallsV4PagePaginationArray; - export import FirewallCreateParams = FirewallAPI.FirewallCreateParams; - export import FirewallListParams = FirewallAPI.FirewallListParams; - export import FirewallDeleteParams = FirewallAPI.FirewallDeleteParams; - export import FirewallEditParams = FirewallAPI.FirewallEditParams; - export import FirewallGetParams = FirewallAPI.FirewallGetParams; +DNS.DNSSECResource = DNSSECResource; +DNS.Records = Records; +DNS.RecordResponsesV4PagePaginationArray = RecordResponsesV4PagePaginationArray; +DNS.Settings = Settings; +DNS.Analytics = Analytics; +DNS.ZoneTransfers = ZoneTransfers; + +export declare namespace DNS { + export { + DNSSECResource as DNSSECResource, + type DNSSEC as DNSSEC, + type DNSSECDeleteResponse as DNSSECDeleteResponse, + type DNSSECDeleteParams as DNSSECDeleteParams, + type DNSSECEditParams as DNSSECEditParams, + type DNSSECGetParams as DNSSECGetParams, + }; + + export { + Records as Records, + type ARecord as ARecord, + type AAAARecord as AAAARecord, + type BatchPatch as BatchPatch, + type BatchPut as BatchPut, + type CAARecord as CAARecord, + type CERTRecord as CERTRecord, + type CNAMERecord as CNAMERecord, + type DNSKEYRecord as DNSKEYRecord, + type DSRecord as DSRecord, + type HTTPSRecord as HTTPSRecord, + type LOCRecord as LOCRecord, + type MXRecord as MXRecord, + type NAPTRRecord as NAPTRRecord, + type NSRecord as NSRecord, + type PTRRecord as PTRRecord, + type Record as Record, + type RecordResponse as RecordResponse, + type RecordTags as RecordTags, + type SMIMEARecord as SMIMEARecord, + type SRVRecord as SRVRecord, + type SSHFPRecord as SSHFPRecord, + type SVCBRecord as SVCBRecord, + type TLSARecord as TLSARecord, + type TTL as TTL, + type TXTRecord as TXTRecord, + type URIRecord as URIRecord, + type RecordDeleteResponse as RecordDeleteResponse, + type RecordBatchResponse as RecordBatchResponse, + type RecordExportResponse as RecordExportResponse, + type RecordImportResponse as RecordImportResponse, + type RecordScanResponse as RecordScanResponse, + RecordResponsesV4PagePaginationArray as RecordResponsesV4PagePaginationArray, + type RecordCreateParams as RecordCreateParams, + type RecordUpdateParams as RecordUpdateParams, + type RecordListParams as RecordListParams, + type RecordDeleteParams as RecordDeleteParams, + type RecordBatchParams as RecordBatchParams, + type RecordEditParams as RecordEditParams, + type RecordExportParams as RecordExportParams, + type RecordGetParams as RecordGetParams, + type RecordImportParams as RecordImportParams, + type RecordScanParams as RecordScanParams, + }; + + export { + Settings as Settings, + type DNSSetting as DNSSetting, + type SettingEditResponse as SettingEditResponse, + type SettingGetResponse as SettingGetResponse, + type SettingEditParams as SettingEditParams, + type SettingGetParams as SettingGetParams, + }; + + export { Analytics as Analytics }; + + export { ZoneTransfers as ZoneTransfers }; } diff --git a/src/resources/dnssec.ts b/src/resources/dns/dnssec.ts similarity index 91% rename from src/resources/dnssec.ts rename to src/resources/dns/dnssec.ts index bba283120c..f89fe503ae 100644 --- a/src/resources/dnssec.ts +++ b/src/resources/dns/dnssec.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../resource'; -import * as Core from '../core'; +import { APIResource } from '../../resource'; +import * as Core from '../../core'; export class DNSSECResource extends APIResource { /** @@ -119,7 +119,7 @@ export interface DNSSEC { status?: 'active' | 'pending' | 'disabled' | 'pending-disabled' | 'error'; } -export type DNSSECDeleteResponse = unknown | string; +export type DNSSECDeleteResponse = string; export interface DNSSECDeleteParams { /** @@ -170,3 +170,13 @@ export interface DNSSECGetParams { */ zone_id: string; } + +export declare namespace DNSSECResource { + export { + type DNSSEC as DNSSEC, + type DNSSECDeleteResponse as DNSSECDeleteResponse, + type DNSSECDeleteParams as DNSSECDeleteParams, + type DNSSECEditParams as DNSSECEditParams, + type DNSSECGetParams as DNSSECGetParams, + }; +} diff --git a/src/resources/dns/firewall/analytics/analytics.ts b/src/resources/dns/firewall/analytics/analytics.ts deleted file mode 100644 index 0e4f718672..0000000000 --- a/src/resources/dns/firewall/analytics/analytics.ts +++ /dev/null @@ -1,45 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../../resource'; -import * as AnalyticsAPI from './analytics'; -import * as ReportsAPI from './reports/reports'; - -export class Analytics extends APIResource { - reports: ReportsAPI.Reports = new ReportsAPI.Reports(this._client); -} - -/** - * Unit of time to group data by. - */ -export type Delta = - | 'all' - | 'auto' - | 'year' - | 'quarter' - | 'month' - | 'week' - | 'day' - | 'hour' - | 'dekaminute' - | 'minute'; - -/** - * Unit of time to group data by. - */ -export type DeltaParam = - | 'all' - | 'auto' - | 'year' - | 'quarter' - | 'month' - | 'week' - | 'day' - | 'hour' - | 'dekaminute' - | 'minute'; - -export namespace Analytics { - export import Delta = AnalyticsAPI.Delta; - export import Reports = ReportsAPI.Reports; - export import ReportGetParams = ReportsAPI.ReportGetParams; -} diff --git a/src/resources/dns/firewall/analytics/index.ts b/src/resources/dns/firewall/analytics/index.ts deleted file mode 100644 index e841178c20..0000000000 --- a/src/resources/dns/firewall/analytics/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { Delta, Analytics } from './analytics'; -export { ReportGetParams, Reports } from './reports/index'; diff --git a/src/resources/dns/firewall/analytics/reports/index.ts b/src/resources/dns/firewall/analytics/reports/index.ts deleted file mode 100644 index afad8ed204..0000000000 --- a/src/resources/dns/firewall/analytics/reports/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { BytimeGetParams, Bytimes } from './bytimes'; -export { ReportGetParams, Reports } from './reports'; diff --git a/src/resources/dns/firewall/firewall.ts b/src/resources/dns/firewall/firewall.ts deleted file mode 100644 index 4ac769a30f..0000000000 --- a/src/resources/dns/firewall/firewall.ts +++ /dev/null @@ -1,393 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as FirewallAPI from './firewall'; -import * as AnalyticsAPI from './analytics/analytics'; -import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; - -export class FirewallResource extends APIResource { - analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client); - - /** - * Create a configured DNS Firewall Cluster. - */ - create(params: FirewallCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.post(`/accounts/${account_id}/dns_firewall`, { body, ...options }) as Core.APIPromise<{ - result: Firewall; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * List configured DNS Firewall clusters for an account. - */ - list( - params: FirewallListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { - const { account_id, ...query } = params; - return this._client.getAPIList(`/accounts/${account_id}/dns_firewall`, FirewallsV4PagePaginationArray, { - query, - ...options, - }); - } - - /** - * Delete a configured DNS Firewall Cluster. - */ - delete( - dnsFirewallId: string, - params: FirewallDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/dns_firewall/${dnsFirewallId}`, - options, - ) as Core.APIPromise<{ result: FirewallDeleteResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Modify a DNS Firewall Cluster configuration. - */ - edit( - dnsFirewallId: string, - params: FirewallEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.patch(`/accounts/${account_id}/dns_firewall/${dnsFirewallId}`, { - body, - ...options, - }) as Core.APIPromise<{ result: Firewall }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Show a single configured DNS Firewall cluster for an account. - */ - get( - dnsFirewallId: string, - params: FirewallGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get(`/accounts/${account_id}/dns_firewall/${dnsFirewallId}`, options) as Core.APIPromise<{ - result: Firewall; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class FirewallsV4PagePaginationArray extends V4PagePaginationArray {} - -/** - * Attack mitigation settings. - */ -export interface AttackMitigation { - /** - * When enabled, random-prefix attacks are automatically mitigated and the upstream - * DNS servers protected. - */ - enabled?: boolean; - - /** - * Only mitigate attacks when upstream servers seem unhealthy. - */ - only_when_upstream_unhealthy?: boolean; -} - -/** - * Attack mitigation settings. - */ -export interface AttackMitigationParam { - /** - * When enabled, random-prefix attacks are automatically mitigated and the upstream - * DNS servers protected. - */ - enabled?: boolean; - - /** - * Only mitigate attacks when upstream servers seem unhealthy. - */ - only_when_upstream_unhealthy?: boolean; -} - -export interface Firewall { - /** - * Identifier - */ - id: string; - - /** - * Deprecate the response to ANY requests. - */ - deprecate_any_requests: boolean; - - dns_firewall_ips: Array; - - /** - * Forward client IP (resolver) subnet if no EDNS Client Subnet is sent. - */ - ecs_fallback: boolean; - - /** - * Maximum DNS cache TTL. This setting sets an upper bound on DNS TTLs for purposes - * of caching between DNS Firewall and the upstream servers. Higher TTLs will be - * decreased to the maximum defined here for caching purposes. - */ - maximum_cache_ttl: number; - - /** - * Minimum DNS cache TTL. This setting sets a lower bound on DNS TTLs for purposes - * of caching between DNS Firewall and the upstream servers. Lower TTLs will be - * increased to the minimum defined here for caching purposes. - */ - minimum_cache_ttl: number; - - /** - * Last modification of DNS Firewall cluster. - */ - modified_on: string; - - /** - * DNS Firewall Cluster Name. - */ - name: string; - - upstream_ips: Array; - - /** - * Attack mitigation settings. - */ - attack_mitigation?: AttackMitigation | null; - - /** - * Negative DNS cache TTL. This setting controls how long DNS Firewall should cache - * negative responses (e.g., NXDOMAIN) from the upstream servers. - */ - negative_cache_ttl?: number | null; - - /** - * Ratelimit in queries per second per datacenter (applies to DNS queries sent to - * the upstream nameservers configured on the cluster). - */ - ratelimit?: number | null; - - /** - * Number of retries for fetching DNS responses from upstream nameservers (not - * counting the initial attempt). - */ - retries?: number; -} - -/** - * Cloudflare-assigned DNS IPv4 Address. - */ -export type FirewallIPs = string | string; - -/** - * Cloudflare-assigned DNS IPv4 Address. - */ -export type FirewallIPsParam = string | string; - -/** - * Upstream DNS Server IPv4 Address. - */ -export type UpstreamIPs = string | string; - -/** - * Upstream DNS Server IPv4 Address. - */ -export type UpstreamIPsParam = string | string; - -export interface FirewallDeleteResponse { - /** - * Identifier - */ - id?: string; -} - -export interface FirewallCreateParams { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: DNS Firewall Cluster Name. - */ - name: string; - - /** - * Body param: - */ - upstream_ips: Array; - - /** - * Body param: Attack mitigation settings. - */ - attack_mitigation?: AttackMitigationParam | null; - - /** - * Body param: Deprecate the response to ANY requests. - */ - deprecate_any_requests?: boolean; - - /** - * Body param: Forward client IP (resolver) subnet if no EDNS Client Subnet is - * sent. - */ - ecs_fallback?: boolean; - - /** - * Body param: Maximum DNS cache TTL. This setting sets an upper bound on DNS TTLs - * for purposes of caching between DNS Firewall and the upstream servers. Higher - * TTLs will be decreased to the maximum defined here for caching purposes. - */ - maximum_cache_ttl?: number; - - /** - * Body param: Minimum DNS cache TTL. This setting sets a lower bound on DNS TTLs - * for purposes of caching between DNS Firewall and the upstream servers. Lower - * TTLs will be increased to the minimum defined here for caching purposes. - */ - minimum_cache_ttl?: number; - - /** - * Body param: Negative DNS cache TTL. This setting controls how long DNS Firewall - * should cache negative responses (e.g., NXDOMAIN) from the upstream servers. - */ - negative_cache_ttl?: number | null; - - /** - * Body param: Ratelimit in queries per second per datacenter (applies to DNS - * queries sent to the upstream nameservers configured on the cluster). - */ - ratelimit?: number | null; - - /** - * Body param: Number of retries for fetching DNS responses from upstream - * nameservers (not counting the initial attempt). - */ - retries?: number; -} - -export interface FirewallListParams extends V4PagePaginationArrayParams { - /** - * Path param: Identifier - */ - account_id: string; -} - -export interface FirewallDeleteParams { - /** - * Identifier - */ - account_id: string; -} - -export interface FirewallEditParams { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: Identifier - */ - id: string; - - /** - * Body param: Deprecate the response to ANY requests. - */ - deprecate_any_requests: boolean; - - /** - * Body param: - */ - dns_firewall_ips: Array; - - /** - * Body param: Forward client IP (resolver) subnet if no EDNS Client Subnet is - * sent. - */ - ecs_fallback: boolean; - - /** - * Body param: Maximum DNS cache TTL. This setting sets an upper bound on DNS TTLs - * for purposes of caching between DNS Firewall and the upstream servers. Higher - * TTLs will be decreased to the maximum defined here for caching purposes. - */ - maximum_cache_ttl: number; - - /** - * Body param: Minimum DNS cache TTL. This setting sets a lower bound on DNS TTLs - * for purposes of caching between DNS Firewall and the upstream servers. Lower - * TTLs will be increased to the minimum defined here for caching purposes. - */ - minimum_cache_ttl: number; - - /** - * Body param: DNS Firewall Cluster Name. - */ - name: string; - - /** - * Body param: - */ - upstream_ips: Array; - - /** - * Body param: Attack mitigation settings. - */ - attack_mitigation?: AttackMitigationParam | null; - - /** - * Body param: Negative DNS cache TTL. This setting controls how long DNS Firewall - * should cache negative responses (e.g., NXDOMAIN) from the upstream servers. - */ - negative_cache_ttl?: number | null; - - /** - * Body param: Ratelimit in queries per second per datacenter (applies to DNS - * queries sent to the upstream nameservers configured on the cluster). - */ - ratelimit?: number | null; - - /** - * Body param: Number of retries for fetching DNS responses from upstream - * nameservers (not counting the initial attempt). - */ - retries?: number; -} - -export interface FirewallGetParams { - /** - * Identifier - */ - account_id: string; -} - -export namespace FirewallResource { - export import AttackMitigation = FirewallAPI.AttackMitigation; - export import Firewall = FirewallAPI.Firewall; - export import FirewallIPs = FirewallAPI.FirewallIPs; - export import UpstreamIPs = FirewallAPI.UpstreamIPs; - export import FirewallDeleteResponse = FirewallAPI.FirewallDeleteResponse; - export import FirewallsV4PagePaginationArray = FirewallAPI.FirewallsV4PagePaginationArray; - export import FirewallCreateParams = FirewallAPI.FirewallCreateParams; - export import FirewallListParams = FirewallAPI.FirewallListParams; - export import FirewallDeleteParams = FirewallAPI.FirewallDeleteParams; - export import FirewallEditParams = FirewallAPI.FirewallEditParams; - export import FirewallGetParams = FirewallAPI.FirewallGetParams; - export import Analytics = AnalyticsAPI.Analytics; - export import Delta = AnalyticsAPI.Delta; -} diff --git a/src/resources/dns/firewall/index.ts b/src/resources/dns/firewall/index.ts deleted file mode 100644 index fe9a3e3998..0000000000 --- a/src/resources/dns/firewall/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { - AttackMitigation, - Firewall, - FirewallIPs, - UpstreamIPs, - FirewallDeleteResponse, - FirewallCreateParams, - FirewallListParams, - FirewallDeleteParams, - FirewallEditParams, - FirewallGetParams, - FirewallsV4PagePaginationArray, - FirewallResource, -} from './firewall'; -export { Delta, Analytics } from './analytics/index'; diff --git a/src/resources/dns/index.ts b/src/resources/dns/index.ts index 1081c10eb5..de70333072 100644 --- a/src/resources/dns/index.ts +++ b/src/resources/dns/index.ts @@ -1,69 +1,66 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Analytics } from './analytics/index'; +export { DNS } from './dns'; +export { + DNSSECResource, + type DNSSEC, + type DNSSECDeleteResponse, + type DNSSECDeleteParams, + type DNSSECEditParams, + type DNSSECGetParams, +} from './dnssec'; export { - ARecord, - AAAARecord, - CAARecord, - CERTRecord, - CNAMERecord, - DNSKEYRecord, - DSRecord, - HTTPSRecord, - LOCRecord, - MXRecord, - NAPTRRecord, - NSRecord, - PTRRecord, - Record, - RecordMetadata, - RecordProcessTiming, - RecordTags, - SMIMEARecord, - SRVRecord, - SSHFPRecord, - SVCBRecord, - TLSARecord, - TTL, - TXTRecord, - URIRecord, - RecordDeleteResponse, - RecordExportResponse, - RecordImportResponse, - RecordScanResponse, - RecordCreateParams, - RecordUpdateParams, - RecordListParams, - RecordDeleteParams, - RecordEditParams, - RecordExportParams, - RecordGetParams, - RecordImportParams, - RecordScanParams, - RecordsV4PagePaginationArray, + RecordResponsesV4PagePaginationArray, Records, + type ARecord, + type AAAARecord, + type BatchPatch, + type BatchPut, + type CAARecord, + type CERTRecord, + type CNAMERecord, + type DNSKEYRecord, + type DSRecord, + type HTTPSRecord, + type LOCRecord, + type MXRecord, + type NAPTRRecord, + type NSRecord, + type PTRRecord, + type Record, + type RecordResponse, + type RecordTags, + type SMIMEARecord, + type SRVRecord, + type SSHFPRecord, + type SVCBRecord, + type TLSARecord, + type TTL, + type TXTRecord, + type URIRecord, + type RecordDeleteResponse, + type RecordBatchResponse, + type RecordExportResponse, + type RecordImportResponse, + type RecordScanResponse, + type RecordCreateParams, + type RecordUpdateParams, + type RecordListParams, + type RecordDeleteParams, + type RecordBatchParams, + type RecordEditParams, + type RecordExportParams, + type RecordGetParams, + type RecordImportParams, + type RecordScanParams, } from './records'; -export { Analytics } from './analytics/index'; -export { - AttackMitigation, - Firewall, - FirewallIPs, - UpstreamIPs, - FirewallDeleteResponse, - FirewallCreateParams, - FirewallListParams, - FirewallDeleteParams, - FirewallEditParams, - FirewallGetParams, - FirewallsV4PagePaginationArray, - FirewallResource, -} from './firewall/index'; -export { DNS } from './dns'; export { - DNSSetting, - Nameserver, - SettingEditResponse, - SettingGetResponse, - SettingEditParams, - SettingGetParams, Settings, -} from './settings'; + type DNSSetting, + type SettingEditResponse, + type SettingGetResponse, + type SettingEditParams, + type SettingGetParams, +} from './settings/index'; +export { ZoneTransfers } from './zone-transfers/index'; diff --git a/src/resources/dns/records.ts b/src/resources/dns/records.ts index 6351007a91..e4d19e06d3 100644 --- a/src/resources/dns/records.ts +++ b/src/resources/dns/records.ts @@ -17,17 +17,19 @@ export class Records extends APIResource { * - Domain names are always represented in Punycode, even if Unicode characters * were used when creating the record. */ - create(params: RecordCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(params: RecordCreateParams, options?: Core.RequestOptions): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.post(`/zones/${zone_id}/dns_records`, { body, ...options }) as Core.APIPromise<{ - result: Record; + result: RecordResponse; }> )._thenUnwrap((obj) => obj.result); } /** - * Overwrite an existing DNS record. Notes: + * Overwrite an existing DNS record. + * + * Notes: * * - A/AAAA records cannot exist on the same name as CNAME records. * - NS records cannot exist on the same name as any other record type. @@ -38,13 +40,13 @@ export class Records extends APIResource { dnsRecordId: string, params: RecordUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.put(`/zones/${zone_id}/dns_records/${dnsRecordId}`, { body, ...options, - }) as Core.APIPromise<{ result: Record }> + }) as Core.APIPromise<{ result: RecordResponse }> )._thenUnwrap((obj) => obj.result); } @@ -54,9 +56,9 @@ export class Records extends APIResource { list( params: RecordListParams, options?: Core.RequestOptions, - ): Core.PagePromise { + ): Core.PagePromise { const { zone_id, ...query } = params; - return this._client.getAPIList(`/zones/${zone_id}/dns_records`, RecordsV4PagePaginationArray, { + return this._client.getAPIList(`/zones/${zone_id}/dns_records`, RecordResponsesV4PagePaginationArray, { query, ...options, }); @@ -79,7 +81,37 @@ export class Records extends APIResource { } /** - * Update an existing DNS record. Notes: + * Send a Batch of DNS Record API calls to be executed together. + * + * Notes: + * + * - Although Cloudflare will execute the batched operations in a single database + * transaction, Cloudflare's distributed KV store must treat each record change + * as a single key-value pair. This means that the propagation of changes is not + * atomic. See + * [the documentation](https://developers.cloudflare.com/dns/manage-dns-records/how-to/batch-record-changes/ "Batch DNS records") + * for more information. + * - The operations you specify within the /batch request body are always executed + * in the following order: + * + * - Deletes + * - Patches + * - Puts + * - Posts + */ + batch(params: RecordBatchParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/dns_records/batch`, { body, ...options }) as Core.APIPromise<{ + result: RecordBatchResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update an existing DNS record. + * + * Notes: * * - A/AAAA records cannot exist on the same name as CNAME records. * - NS records cannot exist on the same name as any other record type. @@ -90,13 +122,13 @@ export class Records extends APIResource { dnsRecordId: string, params: RecordEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.patch(`/zones/${zone_id}/dns_records/${dnsRecordId}`, { body, ...options, - }) as Core.APIPromise<{ result: Record }> + }) as Core.APIPromise<{ result: RecordResponse }> )._thenUnwrap((obj) => obj.result); } @@ -120,11 +152,15 @@ export class Records extends APIResource { /** * DNS Record Details */ - get(dnsRecordId: string, params: RecordGetParams, options?: Core.RequestOptions): Core.APIPromise { + get( + dnsRecordId: string, + params: RecordGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { const { zone_id } = params; return ( this._client.get(`/zones/${zone_id}/dns_records/${dnsRecordId}`, options) as Core.APIPromise<{ - result: Record; + result: RecordResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -163,29 +199,9 @@ export class Records extends APIResource { } } -export class RecordsV4PagePaginationArray extends V4PagePaginationArray {} +export class RecordResponsesV4PagePaginationArray extends V4PagePaginationArray {} export interface ARecord { - /** - * A valid IPv4 address. - */ - content: string; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - - /** - * Record type. - */ - type: 'A'; - - /** - * Identifier - */ - id?: string; - /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -193,24 +209,14 @@ export interface ARecord { comment?: string; /** - * When the record was created. - */ - created_on?: string; - - /** - * Extra Cloudflare-specific information about the record. - */ - meta?: RecordMetadata; - - /** - * When the record was last modified. + * A valid IPv4 address. */ - modified_on?: string; + content?: string; /** - * Whether the record can be proxied by Cloudflare or not. + * DNS record name (or @ for the zone apex) in Punycode. */ - proxiable?: boolean; + name?: string; /** * Whether the record is receiving the performance and security benefits of @@ -218,6 +224,11 @@ export interface ARecord { */ proxied?: boolean; + /** + * Settings for the DNS record. + */ + settings?: ARecord.Settings; + /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ @@ -229,29 +240,37 @@ export interface ARecord { * Enterprise zones. */ ttl?: TTL; -} - -export interface AAAARecord { - /** - * A valid IPv6 address. - */ - content: string; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; /** * Record type. */ - type: 'AAAA'; + type?: 'A'; +} +export namespace ARecord { /** - * Identifier + * Settings for the DNS record. */ - id?: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface ARecordParam { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -259,24 +278,14 @@ export interface AAAARecord { comment?: string; /** - * When the record was created. - */ - created_on?: string; - - /** - * Extra Cloudflare-specific information about the record. - */ - meta?: RecordMetadata; - - /** - * When the record was last modified. + * A valid IPv4 address. */ - modified_on?: string; + content?: string; /** - * Whether the record can be proxied by Cloudflare or not. + * DNS record name (or @ for the zone apex) in Punycode. */ - proxiable?: boolean; + name?: string; /** * Whether the record is receiving the performance and security benefits of @@ -284,40 +293,53 @@ export interface AAAARecord { */ proxied?: boolean; + /** + * Settings for the DNS record. + */ + settings?: ARecordParam.Settings; + /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ - tags?: Array; + tags?: Array; /** * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. * Value must be between 60 and 86400, with the minimum reduced to 30 for * Enterprise zones. */ - ttl?: TTL; -} - -export interface CAARecord { - /** - * Components of a CAA record. - */ - data: CAARecord.Data; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; + ttl?: TTLParam; /** * Record type. */ - type: 'CAA'; + type?: 'A'; +} +export namespace ARecordParam { /** - * Identifier + * Settings for the DNS record. */ - id?: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface AAAARecord { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -325,29 +347,25 @@ export interface CAARecord { comment?: string; /** - * Formatted CAA content. See 'data' to set CAA properties. + * A valid IPv6 address. */ content?: string; /** - * When the record was created. - */ - created_on?: string; - - /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: AAAARecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. @@ -360,51 +378,37 @@ export interface CAARecord { * Enterprise zones. */ ttl?: TTL; -} -export namespace CAARecord { /** - * Components of a CAA record. + * Record type. */ - export interface Data { - /** - * Flags for the CAA record. - */ - flags?: number; + type?: 'AAAA'; +} +export namespace AAAARecord { + /** + * Settings for the DNS record. + */ + export interface Settings { /** - * Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - tag?: string; + ipv4_only?: boolean; /** - * Value of the record. This field's semantics depend on the chosen tag. + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - value?: string; + ipv6_only?: boolean; } } -export interface CERTRecord { - /** - * Components of a CERT record. - */ - data: CERTRecord.Data; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - - /** - * Record type. - */ - type: 'CERT'; - - /** - * Identifier - */ - id?: string; - +export interface AAAARecordParam { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -412,428 +416,4104 @@ export interface CERTRecord { comment?: string; /** - * Formatted CERT content. See 'data' to set CERT properties. + * A valid IPv6 address. */ content?: string; /** - * When the record was created. - */ - created_on?: string; - - /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: AAAARecordParam.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ - tags?: Array; + tags?: Array; /** * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. * Value must be between 60 and 86400, with the minimum reduced to 30 for * Enterprise zones. */ - ttl?: TTL; + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'AAAA'; } -export namespace CERTRecord { +export namespace AAAARecordParam { /** - * Components of a CERT record. + * Settings for the DNS record. */ - export interface Data { + export interface Settings { /** - * Algorithm. + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - algorithm?: number; + ipv4_only?: boolean; /** - * Certificate. + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - certificate?: string; + ipv6_only?: boolean; + } +} + +export type BatchPatch = + | BatchPatch.ARecord + | BatchPatch.AAAARecord + | BatchPatch.CAARecord + | BatchPatch.CERTRecord + | BatchPatch.CNAMERecord + | BatchPatch.DNSKEYRecord + | BatchPatch.DSRecord + | BatchPatch.HTTPSRecord + | BatchPatch.LOCRecord + | BatchPatch.MXRecord + | BatchPatch.NAPTRRecord + | BatchPatch.NSRecord + | BatchPatch.Openpgpkey + | BatchPatch.PTRRecord + | BatchPatch.SMIMEARecord + | BatchPatch.SRVRecord + | BatchPatch.SSHFPRecord + | BatchPatch.SVCBRecord + | BatchPatch.TLSARecord + | BatchPatch.TXTRecord + | BatchPatch.URIRecord; + +export namespace BatchPatch { + export interface ARecord extends RecordsAPI.ARecord { + /** + * Identifier + */ + id: string; + } + export interface AAAARecord extends RecordsAPI.AAAARecord { /** - * Key Tag. + * Identifier */ - key_tag?: number; + id: string; + } + export interface CAARecord extends RecordsAPI.CAARecord { /** - * Type. + * Identifier */ - type?: number; + id: string; } -} -export interface CNAMERecord { - /** - * A valid hostname. Must not match the record's name. - */ - content: unknown; + export interface CERTRecord extends RecordsAPI.CERTRecord { + /** + * Identifier + */ + id: string; + } - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; + export interface CNAMERecord extends RecordsAPI.CNAMERecord { + /** + * Identifier + */ + id: string; + } - /** - * Record type. - */ - type: 'CNAME'; + export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecord { + /** + * Identifier + */ + id: string; + } - /** - * Identifier - */ - id?: string; + export interface DSRecord extends RecordsAPI.DSRecord { + /** + * Identifier + */ + id: string; + } - /** - * Comments or notes about the DNS record. This field has no effect on DNS - * responses. - */ - comment?: string; + export interface HTTPSRecord extends RecordsAPI.HTTPSRecord { + /** + * Identifier + */ + id: string; + } - /** - * When the record was created. - */ - created_on?: string; + export interface LOCRecord extends RecordsAPI.LOCRecord { + /** + * Identifier + */ + id: string; + } - /** - * Extra Cloudflare-specific information about the record. - */ - meta?: RecordMetadata; + export interface MXRecord extends RecordsAPI.MXRecord { + /** + * Identifier + */ + id: string; + } - /** - * When the record was last modified. - */ - modified_on?: string; + export interface NAPTRRecord extends RecordsAPI.NAPTRRecord { + /** + * Identifier + */ + id: string; + } - /** - * Whether the record can be proxied by Cloudflare or not. - */ - proxiable?: boolean; + export interface NSRecord extends RecordsAPI.NSRecord { + /** + * Identifier + */ + id: string; + } - /** - * Whether the record is receiving the performance and security benefits of - * Cloudflare. - */ - proxied?: boolean; + export interface Openpgpkey { + /** + * Identifier + */ + id: string; - /** - * Custom tags for the DNS record. This field has no effect on DNS responses. - */ - tags?: Array; + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; - /** - * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. - * Value must be between 60 and 86400, with the minimum reduced to 30 for - * Enterprise zones. - */ - ttl?: TTL; + /** + * A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1) + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: Openpgpkey.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: RecordsAPI.TTL; + + /** + * Record type. + */ + type?: 'OPENPGPKEY'; + } + + export namespace Openpgpkey { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + + export interface PTRRecord extends RecordsAPI.PTRRecord { + /** + * Identifier + */ + id: string; + } + + export interface SMIMEARecord extends RecordsAPI.SMIMEARecord { + /** + * Identifier + */ + id: string; + } + + export interface SRVRecord extends RecordsAPI.SRVRecord { + /** + * Identifier + */ + id: string; + } + + export interface SSHFPRecord extends RecordsAPI.SSHFPRecord { + /** + * Identifier + */ + id: string; + } + + export interface SVCBRecord extends RecordsAPI.SVCBRecord { + /** + * Identifier + */ + id: string; + } + + export interface TLSARecord extends RecordsAPI.TLSARecord { + /** + * Identifier + */ + id: string; + } + + export interface TXTRecord extends RecordsAPI.TXTRecord { + /** + * Identifier + */ + id: string; + } + + export interface URIRecord extends RecordsAPI.URIRecord { + /** + * Identifier + */ + id: string; + } } -export interface DNSKEYRecord { - /** - * Components of a DNSKEY record. - */ - data: DNSKEYRecord.Data; +export type BatchPatchParam = + | BatchPatchParam.ARecord + | BatchPatchParam.AAAARecord + | BatchPatchParam.CAARecord + | BatchPatchParam.CERTRecord + | BatchPatchParam.CNAMERecord + | BatchPatchParam.DNSKEYRecord + | BatchPatchParam.DSRecord + | BatchPatchParam.HTTPSRecord + | BatchPatchParam.LOCRecord + | BatchPatchParam.MXRecord + | BatchPatchParam.NAPTRRecord + | BatchPatchParam.NSRecord + | BatchPatchParam.Openpgpkey + | BatchPatchParam.PTRRecord + | BatchPatchParam.SMIMEARecord + | BatchPatchParam.SRVRecord + | BatchPatchParam.SSHFPRecord + | BatchPatchParam.SVCBRecord + | BatchPatchParam.TLSARecord + | BatchPatchParam.TXTRecord + | BatchPatchParam.URIRecord; + +export namespace BatchPatchParam { + export interface ARecord extends RecordsAPI.ARecordParam { + /** + * Identifier + */ + id: string; + } - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; + export interface AAAARecord extends RecordsAPI.AAAARecordParam { + /** + * Identifier + */ + id: string; + } - /** - * Record type. - */ - type: 'DNSKEY'; + export interface CAARecord extends RecordsAPI.CAARecordParam { + /** + * Identifier + */ + id: string; + } - /** - * Identifier - */ - id?: string; + export interface CERTRecord extends RecordsAPI.CERTRecordParam { + /** + * Identifier + */ + id: string; + } - /** - * Comments or notes about the DNS record. This field has no effect on DNS - * responses. - */ - comment?: string; + export interface CNAMERecord extends RecordsAPI.CNAMERecordParam { + /** + * Identifier + */ + id: string; + } - /** - * Formatted DNSKEY content. See 'data' to set DNSKEY properties. - */ - content?: string; + export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecordParam { + /** + * Identifier + */ + id: string; + } - /** - * When the record was created. - */ - created_on?: string; + export interface DSRecord extends RecordsAPI.DSRecordParam { + /** + * Identifier + */ + id: string; + } - /** - * Extra Cloudflare-specific information about the record. - */ - meta?: RecordMetadata; + export interface HTTPSRecord extends RecordsAPI.HTTPSRecordParam { + /** + * Identifier + */ + id: string; + } - /** - * When the record was last modified. - */ - modified_on?: string; + export interface LOCRecord extends RecordsAPI.LOCRecordParam { + /** + * Identifier + */ + id: string; + } - /** - * Whether the record can be proxied by Cloudflare or not. - */ - proxiable?: boolean; + export interface MXRecord extends RecordsAPI.MXRecordParam { + /** + * Identifier + */ + id: string; + } - /** - * Custom tags for the DNS record. This field has no effect on DNS responses. - */ - tags?: Array; + export interface NAPTRRecord extends RecordsAPI.NAPTRRecordParam { + /** + * Identifier + */ + id: string; + } - /** - * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. - * Value must be between 60 and 86400, with the minimum reduced to 30 for - * Enterprise zones. - */ - ttl?: TTL; + export interface NSRecord extends RecordsAPI.NSRecordParam { + /** + * Identifier + */ + id: string; + } + + export interface Openpgpkey { + /** + * Identifier + */ + id: string; + + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1) + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: Openpgpkey.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: RecordsAPI.TTLParam; + + /** + * Record type. + */ + type?: 'OPENPGPKEY'; + } + + export namespace Openpgpkey { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + + export interface PTRRecord extends RecordsAPI.PTRRecordParam { + /** + * Identifier + */ + id: string; + } + + export interface SMIMEARecord extends RecordsAPI.SMIMEARecordParam { + /** + * Identifier + */ + id: string; + } + + export interface SRVRecord extends RecordsAPI.SRVRecordParam { + /** + * Identifier + */ + id: string; + } + + export interface SSHFPRecord extends RecordsAPI.SSHFPRecordParam { + /** + * Identifier + */ + id: string; + } + + export interface SVCBRecord extends RecordsAPI.SVCBRecordParam { + /** + * Identifier + */ + id: string; + } + + export interface TLSARecord extends RecordsAPI.TLSARecordParam { + /** + * Identifier + */ + id: string; + } + + export interface TXTRecord extends RecordsAPI.TXTRecordParam { + /** + * Identifier + */ + id: string; + } + + export interface URIRecord extends RecordsAPI.URIRecordParam { + /** + * Identifier + */ + id: string; + } } -export namespace DNSKEYRecord { - /** - * Components of a DNSKEY record. - */ - export interface Data { +export type BatchPut = + | BatchPut.ARecord + | BatchPut.AAAARecord + | BatchPut.CAARecord + | BatchPut.CERTRecord + | BatchPut.CNAMERecord + | BatchPut.DNSKEYRecord + | BatchPut.DSRecord + | BatchPut.HTTPSRecord + | BatchPut.LOCRecord + | BatchPut.MXRecord + | BatchPut.NAPTRRecord + | BatchPut.NSRecord + | BatchPut.Openpgpkey + | BatchPut.PTRRecord + | BatchPut.SMIMEARecord + | BatchPut.SRVRecord + | BatchPut.SSHFPRecord + | BatchPut.SVCBRecord + | BatchPut.TLSARecord + | BatchPut.TXTRecord + | BatchPut.URIRecord; + +export namespace BatchPut { + export interface ARecord extends RecordsAPI.ARecord { + /** + * Identifier + */ + id?: string; + } + + export interface AAAARecord extends RecordsAPI.AAAARecord { /** - * Algorithm. + * Identifier */ - algorithm?: number; + id?: string; + } + export interface CAARecord extends RecordsAPI.CAARecord { /** - * Flags. + * Identifier */ - flags?: number; + id?: string; + } + + export interface CERTRecord extends RecordsAPI.CERTRecord { + /** + * Identifier + */ + id?: string; + } + + export interface CNAMERecord extends RecordsAPI.CNAMERecord { + /** + * Identifier + */ + id?: string; + } + + export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecord { + /** + * Identifier + */ + id?: string; + } + + export interface DSRecord extends RecordsAPI.DSRecord { + /** + * Identifier + */ + id?: string; + } + + export interface HTTPSRecord extends RecordsAPI.HTTPSRecord { + /** + * Identifier + */ + id?: string; + } + + export interface LOCRecord extends RecordsAPI.LOCRecord { + /** + * Identifier + */ + id?: string; + } + + export interface MXRecord extends RecordsAPI.MXRecord { + /** + * Identifier + */ + id?: string; + } + + export interface NAPTRRecord extends RecordsAPI.NAPTRRecord { + /** + * Identifier + */ + id?: string; + } + + export interface NSRecord extends RecordsAPI.NSRecord { + /** + * Identifier + */ + id?: string; + } + + export interface Openpgpkey { + /** + * A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1) + */ + content: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name: string; + + /** + * Record type. + */ + type: 'OPENPGPKEY'; + + /** + * Identifier + */ + id?: string; + + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: Openpgpkey.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: RecordsAPI.TTL; + } + + export namespace Openpgpkey { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + + export interface PTRRecord extends RecordsAPI.PTRRecord { + /** + * Identifier + */ + id?: string; + } + + export interface SMIMEARecord extends RecordsAPI.SMIMEARecord { + /** + * Identifier + */ + id?: string; + } + + export interface SRVRecord extends RecordsAPI.SRVRecord { + /** + * Identifier + */ + id?: string; + } + + export interface SSHFPRecord extends RecordsAPI.SSHFPRecord { + /** + * Identifier + */ + id?: string; + } + + export interface SVCBRecord extends RecordsAPI.SVCBRecord { + /** + * Identifier + */ + id?: string; + } + + export interface TLSARecord extends RecordsAPI.TLSARecord { + /** + * Identifier + */ + id?: string; + } + + export interface TXTRecord extends RecordsAPI.TXTRecord { + /** + * Identifier + */ + id?: string; + } + + export interface URIRecord extends RecordsAPI.URIRecord { + /** + * Identifier + */ + id?: string; + } +} + +export type BatchPutParam = + | BatchPutParam.ARecord + | BatchPutParam.AAAARecord + | BatchPutParam.CAARecord + | BatchPutParam.CERTRecord + | BatchPutParam.CNAMERecord + | BatchPutParam.DNSKEYRecord + | BatchPutParam.DSRecord + | BatchPutParam.HTTPSRecord + | BatchPutParam.LOCRecord + | BatchPutParam.MXRecord + | BatchPutParam.NAPTRRecord + | BatchPutParam.NSRecord + | BatchPutParam.Openpgpkey + | BatchPutParam.PTRRecord + | BatchPutParam.SMIMEARecord + | BatchPutParam.SRVRecord + | BatchPutParam.SSHFPRecord + | BatchPutParam.SVCBRecord + | BatchPutParam.TLSARecord + | BatchPutParam.TXTRecord + | BatchPutParam.URIRecord; + +export namespace BatchPutParam { + export interface ARecord extends RecordsAPI.ARecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface AAAARecord extends RecordsAPI.AAAARecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface CAARecord extends RecordsAPI.CAARecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface CERTRecord extends RecordsAPI.CERTRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface CNAMERecord extends RecordsAPI.CNAMERecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface DSRecord extends RecordsAPI.DSRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface HTTPSRecord extends RecordsAPI.HTTPSRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface LOCRecord extends RecordsAPI.LOCRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface MXRecord extends RecordsAPI.MXRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface NAPTRRecord extends RecordsAPI.NAPTRRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface NSRecord extends RecordsAPI.NSRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface Openpgpkey { + /** + * A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1) + */ + content: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name: string; + + /** + * Record type. + */ + type: 'OPENPGPKEY'; + + /** + * Identifier + */ + id?: string; + + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: Openpgpkey.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: RecordsAPI.TTLParam; + } + + export namespace Openpgpkey { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + + export interface PTRRecord extends RecordsAPI.PTRRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface SMIMEARecord extends RecordsAPI.SMIMEARecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface SRVRecord extends RecordsAPI.SRVRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface SSHFPRecord extends RecordsAPI.SSHFPRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface SVCBRecord extends RecordsAPI.SVCBRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface TLSARecord extends RecordsAPI.TLSARecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface TXTRecord extends RecordsAPI.TXTRecordParam { + /** + * Identifier + */ + id?: string; + } + + export interface URIRecord extends RecordsAPI.URIRecordParam { + /** + * Identifier + */ + id?: string; + } +} + +export interface CAARecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Formatted CAA content. See 'data' to set CAA properties. + */ + content?: string; + + /** + * Components of a CAA record. + */ + data?: CAARecord.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: CAARecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'CAA'; +} + +export namespace CAARecord { + /** + * Components of a CAA record. + */ + export interface Data { + /** + * Flags for the CAA record. + */ + flags?: number; + + /** + * Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + */ + tag?: string; + + /** + * Value of the record. This field's semantics depend on the chosen tag. + */ + value?: string; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface CAARecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Components of a CAA record. + */ + data?: CAARecordParam.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: CAARecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'CAA'; +} + +export namespace CAARecordParam { + /** + * Components of a CAA record. + */ + export interface Data { + /** + * Flags for the CAA record. + */ + flags?: number; + + /** + * Name of the property controlled by this record (e.g.: issue, issuewild, iodef). + */ + tag?: string; + + /** + * Value of the record. This field's semantics depend on the chosen tag. + */ + value?: string; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface CERTRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Formatted CERT content. See 'data' to set CERT properties. + */ + content?: string; + + /** + * Components of a CERT record. + */ + data?: CERTRecord.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: CERTRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'CERT'; +} + +export namespace CERTRecord { + /** + * Components of a CERT record. + */ + export interface Data { + /** + * Algorithm. + */ + algorithm?: number; + + /** + * Certificate. + */ + certificate?: string; + + /** + * Key Tag. + */ + key_tag?: number; + + /** + * Type. + */ + type?: number; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface CERTRecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Components of a CERT record. + */ + data?: CERTRecordParam.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: CERTRecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'CERT'; +} + +export namespace CERTRecordParam { + /** + * Components of a CERT record. + */ + export interface Data { + /** + * Algorithm. + */ + algorithm?: number; + + /** + * Certificate. + */ + certificate?: string; + + /** + * Key Tag. + */ + key_tag?: number; + + /** + * Type. + */ + type?: number; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface CNAMERecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * A valid hostname. Must not match the record's name. + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: CNAMERecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'CNAME'; +} + +export namespace CNAMERecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * If enabled, causes the CNAME record to be resolved externally and the resulting + * address records (e.g., A and AAAA) to be returned instead of the CNAME record + * itself. This setting is unavailable for proxied records, since they are always + * flattened. + */ + flatten_cname?: boolean; + + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface CNAMERecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * A valid hostname. Must not match the record's name. + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: CNAMERecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'CNAME'; +} + +export namespace CNAMERecordParam { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * If enabled, causes the CNAME record to be resolved externally and the resulting + * address records (e.g., A and AAAA) to be returned instead of the CNAME record + * itself. This setting is unavailable for proxied records, since they are always + * flattened. + */ + flatten_cname?: boolean; + + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface DNSKEYRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Formatted DNSKEY content. See 'data' to set DNSKEY properties. + */ + content?: string; + + /** + * Components of a DNSKEY record. + */ + data?: DNSKEYRecord.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: DNSKEYRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'DNSKEY'; +} + +export namespace DNSKEYRecord { + /** + * Components of a DNSKEY record. + */ + export interface Data { + /** + * Algorithm. + */ + algorithm?: number; + + /** + * Flags. + */ + flags?: number; + + /** + * Protocol. + */ + protocol?: number; + + /** + * Public Key. + */ + public_key?: string; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface DNSKEYRecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Components of a DNSKEY record. + */ + data?: DNSKEYRecordParam.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: DNSKEYRecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'DNSKEY'; +} + +export namespace DNSKEYRecordParam { + /** + * Components of a DNSKEY record. + */ + export interface Data { + /** + * Algorithm. + */ + algorithm?: number; + + /** + * Flags. + */ + flags?: number; + + /** + * Protocol. + */ + protocol?: number; + + /** + * Public Key. + */ + public_key?: string; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface DSRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Formatted DS content. See 'data' to set DS properties. + */ + content?: string; + + /** + * Components of a DS record. + */ + data?: DSRecord.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: DSRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'DS'; +} + +export namespace DSRecord { + /** + * Components of a DS record. + */ + export interface Data { + /** + * Algorithm. + */ + algorithm?: number; + + /** + * Digest. + */ + digest?: string; + + /** + * Digest Type. + */ + digest_type?: number; + + /** + * Key Tag. + */ + key_tag?: number; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface DSRecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Components of a DS record. + */ + data?: DSRecordParam.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: DSRecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'DS'; +} + +export namespace DSRecordParam { + /** + * Components of a DS record. + */ + export interface Data { + /** + * Algorithm. + */ + algorithm?: number; + + /** + * Digest. + */ + digest?: string; + + /** + * Digest Type. + */ + digest_type?: number; + + /** + * Key Tag. + */ + key_tag?: number; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface HTTPSRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Formatted HTTPS content. See 'data' to set HTTPS properties. + */ + content?: string; + + /** + * Components of a HTTPS record. + */ + data?: HTTPSRecord.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: HTTPSRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'HTTPS'; +} + +export namespace HTTPSRecord { + /** + * Components of a HTTPS record. + */ + export interface Data { + /** + * priority. + */ + priority?: number; + + /** + * target. + */ + target?: string; + + /** + * value. + */ + value?: string; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface HTTPSRecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Components of a HTTPS record. + */ + data?: HTTPSRecordParam.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: HTTPSRecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'HTTPS'; +} + +export namespace HTTPSRecordParam { + /** + * Components of a HTTPS record. + */ + export interface Data { + /** + * priority. + */ + priority?: number; + + /** + * target. + */ + target?: string; + + /** + * value. + */ + value?: string; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface LOCRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Formatted LOC content. See 'data' to set LOC properties. + */ + content?: string; + + /** + * Components of a LOC record. + */ + data?: LOCRecord.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: LOCRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'LOC'; +} + +export namespace LOCRecord { + /** + * Components of a LOC record. + */ + export interface Data { + /** + * Altitude of location in meters. + */ + altitude?: number; + + /** + * Degrees of latitude. + */ + lat_degrees?: number; + + /** + * Latitude direction. + */ + lat_direction?: 'N' | 'S'; + + /** + * Minutes of latitude. + */ + lat_minutes?: number; + + /** + * Seconds of latitude. + */ + lat_seconds?: number; + + /** + * Degrees of longitude. + */ + long_degrees?: number; + + /** + * Longitude direction. + */ + long_direction?: 'E' | 'W'; + + /** + * Minutes of longitude. + */ + long_minutes?: number; + + /** + * Seconds of longitude. + */ + long_seconds?: number; + + /** + * Horizontal precision of location. + */ + precision_horz?: number; + + /** + * Vertical precision of location. + */ + precision_vert?: number; + + /** + * Size of location in meters. + */ + size?: number; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface LOCRecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Components of a LOC record. + */ + data?: LOCRecordParam.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: LOCRecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'LOC'; +} + +export namespace LOCRecordParam { + /** + * Components of a LOC record. + */ + export interface Data { + /** + * Altitude of location in meters. + */ + altitude?: number; + + /** + * Degrees of latitude. + */ + lat_degrees?: number; + + /** + * Latitude direction. + */ + lat_direction?: 'N' | 'S'; + + /** + * Minutes of latitude. + */ + lat_minutes?: number; + + /** + * Seconds of latitude. + */ + lat_seconds?: number; + + /** + * Degrees of longitude. + */ + long_degrees?: number; + + /** + * Longitude direction. + */ + long_direction?: 'E' | 'W'; + + /** + * Minutes of longitude. + */ + long_minutes?: number; + + /** + * Seconds of longitude. + */ + long_seconds?: number; + + /** + * Horizontal precision of location. + */ + precision_horz?: number; + + /** + * Vertical precision of location. + */ + precision_vert?: number; + + /** + * Size of location in meters. + */ + size?: number; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface MXRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * A valid mail server hostname. + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Required for MX, SRV and URI records; unused by other record types. Records with + * lower priorities are preferred. + */ + priority?: number; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: MXRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'MX'; +} + +export namespace MXRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface MXRecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * A valid mail server hostname. + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Required for MX, SRV and URI records; unused by other record types. Records with + * lower priorities are preferred. + */ + priority?: number; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: MXRecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'MX'; +} + +export namespace MXRecordParam { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface NAPTRRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Formatted NAPTR content. See 'data' to set NAPTR properties. + */ + content?: string; + + /** + * Components of a NAPTR record. + */ + data?: NAPTRRecord.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: NAPTRRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'NAPTR'; +} + +export namespace NAPTRRecord { + /** + * Components of a NAPTR record. + */ + export interface Data { + /** + * Flags. + */ + flags?: string; + + /** + * Order. + */ + order?: number; + + /** + * Preference. + */ + preference?: number; + + /** + * Regex. + */ + regex?: string; + + /** + * Replacement. + */ + replacement?: string; + + /** + * Service. + */ + service?: string; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface NAPTRRecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Components of a NAPTR record. + */ + data?: NAPTRRecordParam.Data; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: NAPTRRecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'NAPTR'; +} + +export namespace NAPTRRecordParam { + /** + * Components of a NAPTR record. + */ + export interface Data { + /** + * Flags. + */ + flags?: string; + + /** + * Order. + */ + order?: number; + + /** + * Preference. + */ + preference?: number; + + /** + * Regex. + */ + regex?: string; + + /** + * Replacement. + */ + replacement?: string; + + /** + * Service. + */ + service?: string; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface NSRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * A valid name server host name. + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: NSRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'NS'; +} + +export namespace NSRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface NSRecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * A valid name server host name. + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: NSRecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'NS'; +} + +export namespace NSRecordParam { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface PTRRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Domain name pointing to the address. + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: PTRRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; + + /** + * Record type. + */ + type?: 'PTR'; +} + +export namespace PTRRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface PTRRecordParam { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Domain name pointing to the address. + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: PTRRecordParam.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'PTR'; +} + +export namespace PTRRecordParam { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export type Record = + | ARecord + | AAAARecord + | CAARecord + | CERTRecord + | CNAMERecord + | DNSKEYRecord + | DSRecord + | HTTPSRecord + | LOCRecord + | MXRecord + | NAPTRRecord + | NSRecord + | Record.Openpgpkey + | PTRRecord + | SMIMEARecord + | SRVRecord + | SSHFPRecord + | SVCBRecord + | TLSARecord + | TXTRecord + | URIRecord; + +export namespace Record { + export interface Openpgpkey { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1) + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: Openpgpkey.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: RecordsAPI.TTL; + + /** + * Record type. + */ + type?: 'OPENPGPKEY'; + } + + export namespace Openpgpkey { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } +} + +export type RecordParam = + | ARecordParam + | AAAARecordParam + | CAARecordParam + | CERTRecordParam + | CNAMERecordParam + | DNSKEYRecordParam + | DSRecordParam + | HTTPSRecordParam + | LOCRecordParam + | MXRecordParam + | NAPTRRecordParam + | NSRecordParam + | RecordParam.Openpgpkey + | PTRRecordParam + | SMIMEARecordParam + | SRVRecordParam + | SSHFPRecordParam + | SVCBRecordParam + | TLSARecordParam + | TXTRecordParam + | URIRecordParam; + +export namespace RecordParam { + export interface Openpgpkey { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1) + */ + content?: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: Openpgpkey.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: RecordsAPI.TTLParam; + + /** + * Record type. + */ + type?: 'OPENPGPKEY'; + } + + export namespace Openpgpkey { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } +} + +export type RecordResponse = + | RecordResponse.ARecord + | RecordResponse.AAAARecord + | RecordResponse.CAARecord + | RecordResponse.CERTRecord + | RecordResponse.CNAMERecord + | RecordResponse.DNSKEYRecord + | RecordResponse.DSRecord + | RecordResponse.HTTPSRecord + | RecordResponse.LOCRecord + | RecordResponse.MXRecord + | RecordResponse.NAPTRRecord + | RecordResponse.NSRecord + | RecordResponse.Openpgpkey + | RecordResponse.PTRRecord + | RecordResponse.SMIMEARecord + | RecordResponse.SRVRecord + | RecordResponse.SSHFPRecord + | RecordResponse.SVCBRecord + | RecordResponse.TLSARecord + | RecordResponse.TXTRecord + | RecordResponse.URIRecord; + +export namespace RecordResponse { + export interface ARecord extends RecordsAPI.ARecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface AAAARecord extends RecordsAPI.AAAARecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface CAARecord extends RecordsAPI.CAARecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface CERTRecord extends RecordsAPI.CERTRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface CNAMERecord extends RecordsAPI.CNAMERecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface DNSKEYRecord extends RecordsAPI.DNSKEYRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface DSRecord extends RecordsAPI.DSRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface HTTPSRecord extends RecordsAPI.HTTPSRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface LOCRecord extends RecordsAPI.LOCRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface MXRecord extends RecordsAPI.MXRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface NAPTRRecord extends RecordsAPI.NAPTRRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface NSRecord extends RecordsAPI.NSRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface Openpgpkey { + /** + * Identifier + */ + id: string; + + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment: string; + + /** + * A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 Section 11.1) + */ + content: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * DNS record name (or @ for the zone apex) in Punycode. + */ + name: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied: boolean; + + /** + * Settings for the DNS record. + */ + settings: Openpgpkey.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl: RecordsAPI.TTL; + + /** + * Record type. + */ + type: 'OPENPGPKEY'; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export namespace Openpgpkey { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + + export interface PTRRecord extends RecordsAPI.PTRRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface SMIMEARecord extends RecordsAPI.SMIMEARecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface SRVRecord extends RecordsAPI.SRVRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; + + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; + + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } + + export interface SSHFPRecord extends RecordsAPI.SSHFPRecord { + /** + * Identifier + */ + id: string; + + /** + * When the record was created. + */ + created_on: string; + + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; + + /** + * When the record was last modified. + */ + modified_on: string; + + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; /** - * Protocol. + * When the record comment was last modified. Omitted if there is no comment. */ - protocol?: number; + comment_modified_on?: string; /** - * Public Key. + * When the record tags were last modified. Omitted if there are no tags. */ - public_key?: string; + tags_modified_on?: string; } -} - -export interface DSRecord { - /** - * Components of a DS record. - */ - data: DSRecord.Data; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - /** - * Record type. - */ - type: 'DS'; + export interface SVCBRecord extends RecordsAPI.SVCBRecord { + /** + * Identifier + */ + id: string; - /** - * Identifier - */ - id?: string; + /** + * When the record was created. + */ + created_on: string; - /** - * Comments or notes about the DNS record. This field has no effect on DNS - * responses. - */ - comment?: string; + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; - /** - * Formatted DS content. See 'data' to set DS properties. - */ - content?: string; + /** + * When the record was last modified. + */ + modified_on: string; - /** - * When the record was created. - */ - created_on?: string; + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; - /** - * Extra Cloudflare-specific information about the record. - */ - meta?: RecordMetadata; + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; - /** - * When the record was last modified. - */ - modified_on?: string; + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } - /** - * Whether the record can be proxied by Cloudflare or not. - */ - proxiable?: boolean; + export interface TLSARecord extends RecordsAPI.TLSARecord { + /** + * Identifier + */ + id: string; - /** - * Custom tags for the DNS record. This field has no effect on DNS responses. - */ - tags?: Array; + /** + * When the record was created. + */ + created_on: string; - /** - * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. - * Value must be between 60 and 86400, with the minimum reduced to 30 for - * Enterprise zones. - */ - ttl?: TTL; -} + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; -export namespace DSRecord { - /** - * Components of a DS record. - */ - export interface Data { /** - * Algorithm. + * When the record was last modified. */ - algorithm?: number; + modified_on: string; /** - * Digest. + * Whether the record can be proxied by Cloudflare or not. */ - digest?: string; + proxiable: boolean; /** - * Digest Type. + * When the record comment was last modified. Omitted if there is no comment. */ - digest_type?: number; + comment_modified_on?: string; /** - * Key Tag. + * When the record tags were last modified. Omitted if there are no tags. */ - key_tag?: number; + tags_modified_on?: string; } -} - -export interface HTTPSRecord { - /** - * Components of a HTTPS record. - */ - data: HTTPSRecord.Data; - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; + export interface TXTRecord extends RecordsAPI.TXTRecord { + /** + * Identifier + */ + id: string; - /** - * Record type. - */ - type: 'HTTPS'; + /** + * When the record was created. + */ + created_on: string; - /** - * Identifier - */ - id?: string; + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; - /** - * Comments or notes about the DNS record. This field has no effect on DNS - * responses. - */ - comment?: string; + /** + * When the record was last modified. + */ + modified_on: string; - /** - * Formatted HTTPS content. See 'data' to set HTTPS properties. - */ - content?: string; + /** + * Whether the record can be proxied by Cloudflare or not. + */ + proxiable: boolean; - /** - * When the record was created. - */ - created_on?: string; + /** + * When the record comment was last modified. Omitted if there is no comment. + */ + comment_modified_on?: string; - /** - * Extra Cloudflare-specific information about the record. - */ - meta?: RecordMetadata; + /** + * When the record tags were last modified. Omitted if there are no tags. + */ + tags_modified_on?: string; + } - /** - * When the record was last modified. - */ - modified_on?: string; + export interface URIRecord extends RecordsAPI.URIRecord { + /** + * Identifier + */ + id: string; - /** - * Whether the record can be proxied by Cloudflare or not. - */ - proxiable?: boolean; + /** + * When the record was created. + */ + created_on: string; - /** - * Custom tags for the DNS record. This field has no effect on DNS responses. - */ - tags?: Array; + /** + * Extra Cloudflare-specific information about the record. + */ + meta: unknown; - /** - * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. - * Value must be between 60 and 86400, with the minimum reduced to 30 for - * Enterprise zones. - */ - ttl?: TTL; -} + /** + * When the record was last modified. + */ + modified_on: string; -export namespace HTTPSRecord { - /** - * Components of a HTTPS record. - */ - export interface Data { /** - * priority. + * Whether the record can be proxied by Cloudflare or not. */ - priority?: number; + proxiable: boolean; /** - * target. + * When the record comment was last modified. Omitted if there is no comment. */ - target?: string; + comment_modified_on?: string; /** - * value. + * When the record tags were last modified. Omitted if there are no tags. */ - value?: string; + tags_modified_on?: string; } } -export interface LOCRecord { - /** - * Components of a LOC record. - */ - data: LOCRecord.Data; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - - /** - * Record type. - */ - type: 'LOC'; +/** + * Individual tag of the form name:value (the name must consist of only letters, + * numbers, underscores and hyphens) + */ +export type RecordTags = string; - /** - * Identifier - */ - id?: string; +/** + * Individual tag of the form name:value (the name must consist of only letters, + * numbers, underscores and hyphens) + */ +export type RecordTagsParam = string; +export interface SMIMEARecord { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -841,29 +4521,30 @@ export interface LOCRecord { comment?: string; /** - * Formatted LOC content. See 'data' to set LOC properties. + * Formatted SMIMEA content. See 'data' to set SMIMEA properties. */ content?: string; /** - * When the record was created. + * Components of a SMIMEA record. */ - created_on?: string; + data?: SMIMEARecord.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: SMIMEARecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. @@ -876,102 +4557,62 @@ export interface LOCRecord { * Enterprise zones. */ ttl?: TTL; + + /** + * Record type. + */ + type?: 'SMIMEA'; } -export namespace LOCRecord { +export namespace SMIMEARecord { /** - * Components of a LOC record. + * Components of a SMIMEA record. */ export interface Data { /** - * Altitude of location in meters. - */ - altitude?: number; - - /** - * Degrees of latitude. - */ - lat_degrees?: number; - - /** - * Latitude direction. - */ - lat_direction?: 'N' | 'S'; - - /** - * Minutes of latitude. - */ - lat_minutes?: number; - - /** - * Seconds of latitude. - */ - lat_seconds?: number; - - /** - * Degrees of longitude. - */ - long_degrees?: number; - - /** - * Longitude direction. - */ - long_direction?: 'E' | 'W'; - - /** - * Minutes of longitude. - */ - long_minutes?: number; - - /** - * Seconds of longitude. + * Certificate. */ - long_seconds?: number; + certificate?: string; /** - * Horizontal precision of location. + * Matching Type. */ - precision_horz?: number; + matching_type?: number; /** - * Vertical precision of location. + * Selector. */ - precision_vert?: number; + selector?: number; /** - * Size of location in meters. + * Usage. */ - size?: number; + usage?: number; } -} - -export interface MXRecord { - /** - * A valid mail server hostname. - */ - content: string; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - - /** - * Required for MX, SRV and URI records; unused by other record types. Records with - * lower priorities are preferred. - */ - priority: number; /** - * Record type. + * Settings for the DNS record. */ - type: 'MX'; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; - /** - * Identifier - */ - id?: string; + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface SMIMEARecordParam { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -979,59 +4620,93 @@ export interface MXRecord { comment?: string; /** - * When the record was created. + * Components of a SMIMEA record. */ - created_on?: string; + data?: SMIMEARecordParam.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: SMIMEARecordParam.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ - tags?: Array; + tags?: Array; /** * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. * Value must be between 60 and 86400, with the minimum reduced to 30 for * Enterprise zones. */ - ttl?: TTL; -} + ttl?: TTLParam; -export interface NAPTRRecord { /** - * Components of a NAPTR record. + * Record type. */ - data: NAPTRRecord.Data; + type?: 'SMIMEA'; +} +export namespace SMIMEARecordParam { /** - * DNS record name (or @ for the zone apex) in Punycode. + * Components of a SMIMEA record. */ - name: string; + export interface Data { + /** + * Certificate. + */ + certificate?: string; - /** - * Record type. - */ - type: 'NAPTR'; + /** + * Matching Type. + */ + matching_type?: number; + + /** + * Selector. + */ + selector?: number; + + /** + * Usage. + */ + usage?: number; + } /** - * Identifier + * Settings for the DNS record. */ - id?: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} + +export interface SRVRecord { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -1039,29 +4714,31 @@ export interface NAPTRRecord { comment?: string; /** - * Formatted NAPTR content. See 'data' to set NAPTR properties. + * Priority, weight, port, and SRV target. See 'data' for setting the individual + * component values. */ content?: string; /** - * When the record was created. + * Components of a SRV record. */ - created_on?: string; + data?: SRVRecord.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: SRVRecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. @@ -1074,66 +4751,63 @@ export interface NAPTRRecord { * Enterprise zones. */ ttl?: TTL; + + /** + * Record type. + */ + type?: 'SRV'; } -export namespace NAPTRRecord { +export namespace SRVRecord { /** - * Components of a NAPTR record. + * Components of a SRV record. */ export interface Data { /** - * Flags. + * The port of the service. */ - flags?: string; + port?: number; /** - * Order. + * Required for MX, SRV and URI records; unused by other record types. Records with + * lower priorities are preferred. */ - order?: number; + priority?: number; /** - * Preference. + * A valid hostname. */ - preference?: number; + target?: string; /** - * Regex. + * The record weight. */ - regex?: string; + weight?: number; + } + /** + * Settings for the DNS record. + */ + export interface Settings { /** - * Replacement. + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - replacement?: string; + ipv4_only?: boolean; /** - * Service. + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - service?: string; + ipv6_only?: boolean; } } -export interface NSRecord { - /** - * A valid name server host name. - */ - content: string; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - - /** - * Record type. - */ - type: 'NS'; - - /** - * Identifier - */ - id?: string; - +export interface SRVRecordParam { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -1141,59 +4815,94 @@ export interface NSRecord { comment?: string; /** - * When the record was created. + * Components of a SRV record. */ - created_on?: string; + data?: SRVRecordParam.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: SRVRecordParam.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ - tags?: Array; + tags?: Array; /** * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. * Value must be between 60 and 86400, with the minimum reduced to 30 for * Enterprise zones. */ - ttl?: TTL; -} + ttl?: TTLParam; -export interface PTRRecord { /** - * Domain name pointing to the address. + * Record type. */ - content: string; + type?: 'SRV'; +} +export namespace SRVRecordParam { /** - * DNS record name (or @ for the zone apex) in Punycode. + * Components of a SRV record. */ - name: string; + export interface Data { + /** + * The port of the service. + */ + port?: number; - /** - * Record type. - */ - type: 'PTR'; + /** + * Required for MX, SRV and URI records; unused by other record types. Records with + * lower priorities are preferred. + */ + priority?: number; + + /** + * A valid hostname. + */ + target?: string; + + /** + * The record weight. + */ + weight?: number; + } /** - * Identifier + * Settings for the DNS record. */ - id?: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface SSHFPRecord { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -1201,24 +4910,30 @@ export interface PTRRecord { comment?: string; /** - * When the record was created. + * Formatted SSHFP content. See 'data' to set SSHFP properties. + */ + content?: string; + + /** + * Components of a SSHFP record. */ - created_on?: string; + data?: SSHFPRecord.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: SSHFPRecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. @@ -1231,96 +4946,57 @@ export interface PTRRecord { * Enterprise zones. */ ttl?: TTL; -} - -export type Record = - | ARecord - | AAAARecord - | CAARecord - | CERTRecord - | CNAMERecord - | DNSKEYRecord - | DSRecord - | HTTPSRecord - | LOCRecord - | MXRecord - | NAPTRRecord - | NSRecord - | PTRRecord - | SMIMEARecord - | SRVRecord - | SSHFPRecord - | SVCBRecord - | TLSARecord - | TXTRecord - | URIRecord; - -/** - * Extra Cloudflare-specific information about the record. - */ -export interface RecordMetadata { - /** - * Will exist if Cloudflare automatically added this DNS record during initial - * setup. - */ - auto_added?: boolean; - - /** - * Where the record originated from. - */ - source?: string; -} - -export interface RecordProcessTiming { - /** - * When the file parsing ended. - */ - end_time?: string; /** - * Processing time of the file in seconds. - */ - process_time?: number; - - /** - * When the file parsing started. + * Record type. */ - start_time?: string; + type?: 'SSHFP'; } -/** - * Individual tag of the form name:value (the name must consist of only letters, - * numbers, underscores and hyphens) - */ -export type RecordTags = string; - -/** - * Individual tag of the form name:value (the name must consist of only letters, - * numbers, underscores and hyphens) - */ -export type RecordTagsParam = string; - -export interface SMIMEARecord { +export namespace SSHFPRecord { /** - * Components of a SMIMEA record. + * Components of a SSHFP record. */ - data: SMIMEARecord.Data; + export interface Data { + /** + * algorithm. + */ + algorithm?: number; - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; + /** + * fingerprint. + */ + fingerprint?: string; - /** - * Record type. - */ - type: 'SMIMEA'; + /** + * type. + */ + type?: number; + } /** - * Identifier + * Settings for the DNS record. */ - id?: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface SSHFPRecordParam { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -1328,93 +5004,88 @@ export interface SMIMEARecord { comment?: string; /** - * Formatted SMIMEA content. See 'data' to set SMIMEA properties. - */ - content?: string; - - /** - * When the record was created. + * Components of a SSHFP record. */ - created_on?: string; + data?: SSHFPRecordParam.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: SSHFPRecordParam.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ - tags?: Array; + tags?: Array; /** * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. * Value must be between 60 and 86400, with the minimum reduced to 30 for * Enterprise zones. */ - ttl?: TTL; + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'SSHFP'; } -export namespace SMIMEARecord { +export namespace SSHFPRecordParam { /** - * Components of a SMIMEA record. + * Components of a SSHFP record. */ export interface Data { /** - * Certificate. - */ - certificate?: string; - - /** - * Matching Type. + * algorithm. */ - matching_type?: number; + algorithm?: number; /** - * Selector. + * fingerprint. */ - selector?: number; + fingerprint?: string; /** - * Usage. + * type. */ - usage?: number; + type?: number; } -} - -export interface SRVRecord { - /** - * Components of a SRV record. - */ - data: SRVRecord.Data; /** - * DNS record name (or @ for the zone apex) in Punycode. For SRV records, the first - * label is normally a service and the second a protocol name, each starting with - * an underscore. - */ - name: string; - - /** - * Record type. + * Settings for the DNS record. */ - type: 'SRV'; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; - /** - * Identifier - */ - id?: string; + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface SVCBRecord { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -1422,30 +5093,30 @@ export interface SRVRecord { comment?: string; /** - * Priority, weight, port, and SRV target. See 'data' for setting the individual - * component values. + * Formatted SVCB content. See 'data' to set SVCB properties. */ content?: string; /** - * When the record was created. + * Components of a SVCB record. */ - created_on?: string; + data?: SVCBRecord.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: SVCBRecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. @@ -1458,78 +5129,57 @@ export interface SRVRecord { * Enterprise zones. */ ttl?: TTL; + + /** + * Record type. + */ + type?: 'SVCB'; } -export namespace SRVRecord { +export namespace SVCBRecord { /** - * Components of a SRV record. + * Components of a SVCB record. */ export interface Data { /** - * @deprecated: A valid hostname. Deprecated in favor of the regular 'name' outside - * the data map. This data map field represents the remainder of the full 'name' - * after the service and protocol. - */ - name?: string; - - /** - * The port of the service. - */ - port?: number; - - /** - * Required for MX, SRV and URI records; unused by other record types. Records with - * lower priorities are preferred. + * priority. */ priority?: number; /** - * @deprecated: A valid protocol, prefixed with an underscore. Deprecated in favor - * of the regular 'name' outside the data map. This data map field normally - * represents the second label of that 'name'. + * target. */ - proto?: string; + target?: string; /** - * @deprecated: A service type, prefixed with an underscore. Deprecated in favor of - * the regular 'name' outside the data map. This data map field normally represents - * the first label of that 'name'. + * value. */ - service?: string; + value?: string; + } + /** + * Settings for the DNS record. + */ + export interface Settings { /** - * A valid hostname. + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - target?: string; + ipv4_only?: boolean; /** - * The record weight. + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - weight?: number; + ipv6_only?: boolean; } } -export interface SSHFPRecord { - /** - * Components of a SSHFP record. - */ - data: SSHFPRecord.Data; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - - /** - * Record type. - */ - type: 'SSHFP'; - - /** - * Identifier - */ - id?: string; - +export interface SVCBRecordParam { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -1537,86 +5187,88 @@ export interface SSHFPRecord { comment?: string; /** - * Formatted SSHFP content. See 'data' to set SSHFP properties. - */ - content?: string; - - /** - * When the record was created. + * Components of a SVCB record. */ - created_on?: string; + data?: SVCBRecordParam.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: SVCBRecordParam.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ - tags?: Array; + tags?: Array; /** * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. * Value must be between 60 and 86400, with the minimum reduced to 30 for * Enterprise zones. */ - ttl?: TTL; + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'SVCB'; } -export namespace SSHFPRecord { +export namespace SVCBRecordParam { /** - * Components of a SSHFP record. + * Components of a SVCB record. */ export interface Data { /** - * algorithm. + * priority. */ - algorithm?: number; + priority?: number; /** - * fingerprint. + * target. */ - fingerprint?: string; + target?: string; /** - * type. + * value. */ - type?: number; + value?: string; } -} - -export interface SVCBRecord { - /** - * Components of a SVCB record. - */ - data: SVCBRecord.Data; - - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; /** - * Record type. + * Settings for the DNS record. */ - type: 'SVCB'; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; - /** - * Identifier - */ - id?: string; + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface TLSARecord { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -1624,29 +5276,30 @@ export interface SVCBRecord { comment?: string; /** - * Formatted SVCB content. See 'data' to set SVCB properties. + * Formatted TLSA content. See 'data' to set TLSA properties. */ content?: string; /** - * When the record was created. + * Components of a TLSA record. */ - created_on?: string; + data?: TLSARecord.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: TLSARecord.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. @@ -1659,96 +5312,108 @@ export interface SVCBRecord { * Enterprise zones. */ ttl?: TTL; + + /** + * Record type. + */ + type?: 'TLSA'; } -export namespace SVCBRecord { +export namespace TLSARecord { /** - * Components of a SVCB record. + * Components of a TLSA record. */ export interface Data { /** - * priority. + * certificate. */ - priority?: number; + certificate?: string; /** - * target. + * Matching Type. */ - target?: string; + matching_type?: number; /** - * value. + * Selector. */ - value?: string; - } -} - -export interface TLSARecord { - /** - * Components of a TLSA record. - */ - data: TLSARecord.Data; + selector?: number; - /** - * DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; + /** + * Usage. + */ + usage?: number; + } /** - * Record type. + * Settings for the DNS record. */ - type: 'TLSA'; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; - /** - * Identifier - */ - id?: string; + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface TLSARecordParam { /** * Comments or notes about the DNS record. This field has no effect on DNS - * responses. - */ - comment?: string; - - /** - * Formatted TLSA content. See 'data' to set TLSA properties. + * responses. */ - content?: string; + comment?: string; /** - * When the record was created. + * Components of a TLSA record. */ - created_on?: string; + data?: TLSARecordParam.Data; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: TLSARecordParam.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ - tags?: Array; + tags?: Array; /** * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. * Value must be between 60 and 86400, with the minimum reduced to 30 for * Enterprise zones. */ - ttl?: TTL; + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'TLSA'; } -export namespace TLSARecord { +export namespace TLSARecordParam { /** * Components of a TLSA record. */ @@ -1773,6 +5438,27 @@ export namespace TLSARecord { */ usage?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } /** @@ -1791,25 +5477,79 @@ export type TTLParam = number | 1; export interface TXTRecord { /** - * Text content for the record. + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Text content for the record. The content must consist of quoted "character + * strings" (RFC 1035), each with a length of up to 255 bytes. Strings exceeding + * this allowed maximum length are automatically split. + * + * Learn more at + * . */ - content: string; + content?: string; /** * DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: TXTRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; /** * Record type. */ - type: 'TXT'; + type?: 'TXT'; +} +export namespace TXTRecord { /** - * Identifier + * Settings for the DNS record. */ - id?: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface TXTRecordParam { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -1817,65 +5557,168 @@ export interface TXTRecord { comment?: string; /** - * When the record was created. + * Text content for the record. The content must consist of quoted "character + * strings" (RFC 1035), each with a length of up to 255 bytes. Strings exceeding + * this allowed maximum length are automatically split. + * + * Learn more at + * . */ - created_on?: string; + content?: string; /** - * Extra Cloudflare-specific information about the record. + * DNS record name (or @ for the zone apex) in Punycode. */ - meta?: RecordMetadata; + name?: string; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: TXTRecordParam.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ - tags?: Array; + tags?: Array; /** * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. * Value must be between 60 and 86400, with the minimum reduced to 30 for * Enterprise zones. */ - ttl?: TTL; + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'TXT'; +} + +export namespace TXTRecordParam { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface URIRecord { + /** + * Comments or notes about the DNS record. This field has no effect on DNS + * responses. + */ + comment?: string; + + /** + * Formatted URI content. See 'data' to set URI properties. + */ + content?: string; + /** * Components of a URI record. */ - data: URIRecord.Data; + data?: URIRecord.Data; /** * DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; /** * Required for MX, SRV and URI records; unused by other record types. Records with * lower priorities are preferred. */ - priority: number; + priority?: number; + + /** + * Whether the record is receiving the performance and security benefits of + * Cloudflare. + */ + proxied?: boolean; + + /** + * Settings for the DNS record. + */ + settings?: URIRecord.Settings; + + /** + * Custom tags for the DNS record. This field has no effect on DNS responses. + */ + tags?: Array; + + /** + * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. + * Value must be between 60 and 86400, with the minimum reduced to 30 for + * Enterprise zones. + */ + ttl?: TTL; /** * Record type. */ - type: 'URI'; + type?: 'URI'; +} +export namespace URIRecord { /** - * Identifier + * Components of a URI record. */ - id?: string; + export interface Data { + /** + * The record content. + */ + target?: string; + + /** + * The record weight. + */ + weight?: number; + } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } +} +export interface URIRecordParam { /** * Comments or notes about the DNS record. This field has no effect on DNS * responses. @@ -1883,44 +5726,51 @@ export interface URIRecord { comment?: string; /** - * Formatted URI content. See 'data' to set URI properties. + * Components of a URI record. */ - content?: string; + data?: URIRecordParam.Data; /** - * When the record was created. + * DNS record name (or @ for the zone apex) in Punycode. */ - created_on?: string; + name?: string; /** - * Extra Cloudflare-specific information about the record. + * Required for MX, SRV and URI records; unused by other record types. Records with + * lower priorities are preferred. */ - meta?: RecordMetadata; + priority?: number; /** - * When the record was last modified. + * Whether the record is receiving the performance and security benefits of + * Cloudflare. */ - modified_on?: string; + proxied?: boolean; /** - * Whether the record can be proxied by Cloudflare or not. + * Settings for the DNS record. */ - proxiable?: boolean; + settings?: URIRecordParam.Settings; /** * Custom tags for the DNS record. This field has no effect on DNS responses. */ - tags?: Array; + tags?: Array; /** * Time To Live (TTL) of the DNS record in seconds. Setting to 1 means 'automatic'. * Value must be between 60 and 86400, with the minimum reduced to 30 for * Enterprise zones. */ - ttl?: TTL; + ttl?: TTLParam; + + /** + * Record type. + */ + type?: 'URI'; } -export namespace URIRecord { +export namespace URIRecordParam { /** * Components of a URI record. */ @@ -1935,6 +5785,27 @@ export namespace URIRecord { */ weight?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface RecordDeleteResponse { @@ -1944,6 +5815,16 @@ export interface RecordDeleteResponse { id?: string; } +export interface RecordBatchResponse { + deletes?: Array; + + patches?: Array; + + posts?: Array; + + puts?: Array; +} + /** * Exported BIND zone file. */ @@ -1986,6 +5867,7 @@ export type RecordCreateParams = | RecordCreateParams.MXRecord | RecordCreateParams.NAPTRRecord | RecordCreateParams.NSRecord + | RecordCreateParams.DNSRecordsOpenpgpkeyRecord | RecordCreateParams.PTRRecord | RecordCreateParams.SMIMEARecord | RecordCreateParams.SRVRecord @@ -1995,7 +5877,7 @@ export type RecordCreateParams = | RecordCreateParams.TXTRecord | RecordCreateParams.URIRecord; -export namespace RecordCreateParams { +export declare namespace RecordCreateParams { export interface ARecord { /** * Path param: Identifier @@ -2003,30 +5885,20 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: A valid IPv4 address. - */ - content: string; - - /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - - /** - * Body param: Record type. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - type: 'A'; + comment?: string; /** - * Body param: Identifier + * Body param: A valid IPv4 address. */ - id?: string; + content?: string; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - comment?: string; + name?: string; /** * Body param: Whether the record is receiving the performance and security @@ -2034,6 +5906,11 @@ export namespace RecordCreateParams { */ proxied?: boolean; + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordCreateParams.ARecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -2046,39 +5923,57 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; - } - export interface AAAARecord { /** - * Path param: Identifier + * Body param: Record type. */ - zone_id: string; + type?: 'A'; + } + export namespace ARecord { /** - * Body param: A valid IPv6 address. + * Settings for the DNS record. */ - content: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + export interface AAAARecord { /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Path param: Identifier */ - name: string; + zone_id: string; /** - * Body param: Record type. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - type: 'AAAA'; + comment?: string; /** - * Body param: Identifier + * Body param: A valid IPv6 address. */ - id?: string; + content?: string; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - comment?: string; + name?: string; /** * Body param: Whether the record is receiving the performance and security @@ -2086,6 +5981,11 @@ export namespace RecordCreateParams { */ proxied?: boolean; + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordCreateParams.AAAARecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -2098,6 +5998,34 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'AAAA'; + } + + export namespace AAAARecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface CAARecord { @@ -2107,30 +6035,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a CAA record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.CAARecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a CAA record. */ - name: string; + data?: RecordCreateParams.CAARecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'CAA'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.CAARecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2144,6 +6073,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'CAA'; } export namespace CAARecord { @@ -2166,6 +6100,27 @@ export namespace RecordCreateParams { */ value?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface CERTRecord { @@ -2175,30 +6130,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a CERT record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.CERTRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a CERT record. */ - name: string; + data?: RecordCreateParams.CERTRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'CERT'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.CERTRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2212,6 +6168,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'CERT'; } export namespace CERTRecord { @@ -2239,39 +6200,50 @@ export namespace RecordCreateParams { */ type?: number; } - } - export interface CNAMERecord { /** - * Path param: Identifier + * Settings for the DNS record. */ - zone_id: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; - /** - * Body param: A valid hostname. Must not match the record's name. - */ - content: unknown; + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + export interface CNAMERecord { /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Path param: Identifier */ - name: string; + zone_id: string; /** - * Body param: Record type. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - type: 'CNAME'; + comment?: string; /** - * Body param: Identifier + * Body param: A valid hostname. Must not match the record's name. */ - id?: string; + content?: string; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - comment?: string; + name?: string; /** * Body param: Whether the record is receiving the performance and security @@ -2279,6 +6251,11 @@ export namespace RecordCreateParams { */ proxied?: boolean; + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordCreateParams.CNAMERecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -2291,6 +6268,42 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'CNAME'; + } + + export namespace CNAMERecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * If enabled, causes the CNAME record to be resolved externally and the resulting + * address records (e.g., A and AAAA) to be returned instead of the CNAME record + * itself. This setting is unavailable for proxied records, since they are always + * flattened. + */ + flatten_cname?: boolean; + + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface DNSKEYRecord { @@ -2300,30 +6313,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a DNSKEY record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.DNSKEYRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a DNSKEY record. */ - name: string; + data?: RecordCreateParams.DNSKEYRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'DNSKEY'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.DNSKEYRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2337,6 +6351,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'DNSKEY'; } export namespace DNSKEYRecord { @@ -2364,6 +6383,27 @@ export namespace RecordCreateParams { */ public_key?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface DSRecord { @@ -2373,30 +6413,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a DS record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.DSRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a DS record. */ - name: string; + data?: RecordCreateParams.DSRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'DS'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.DSRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2410,6 +6451,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'DS'; } export namespace DSRecord { @@ -2437,6 +6483,27 @@ export namespace RecordCreateParams { */ key_tag?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface HTTPSRecord { @@ -2446,30 +6513,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a HTTPS record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.HTTPSRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a HTTPS record. */ - name: string; + data?: RecordCreateParams.HTTPSRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'HTTPS'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.HTTPSRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2483,6 +6551,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'HTTPS'; } export namespace HTTPSRecord { @@ -2505,6 +6578,27 @@ export namespace RecordCreateParams { */ value?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface LOCRecord { @@ -2514,30 +6608,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a LOC record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.LOCRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a LOC record. */ - name: string; + data?: RecordCreateParams.LOCRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'LOC'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.LOCRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2551,6 +6646,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'LOC'; } export namespace LOCRecord { @@ -2618,6 +6718,27 @@ export namespace RecordCreateParams { */ size?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface MXRecord { @@ -2626,37 +6747,38 @@ export namespace RecordCreateParams { */ zone_id: string; + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; + /** * Body param: A valid mail server hostname. */ - content: string; + content?: string; /** * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; /** * Body param: Required for MX, SRV and URI records; unused by other record types. * Records with lower priorities are preferred. */ - priority: number; - - /** - * Body param: Record type. - */ - type: 'MX'; + priority?: number; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.MXRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2670,6 +6792,34 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'MX'; + } + + export namespace MXRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface NAPTRRecord { @@ -2679,30 +6829,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a NAPTR record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.NAPTRRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a NAPTR record. */ - name: string; + data?: RecordCreateParams.NAPTRRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'NAPTR'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.NAPTRRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2716,6 +6867,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'NAPTR'; } export namespace NAPTRRecord { @@ -2753,6 +6909,27 @@ export namespace RecordCreateParams { */ service?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface NSRecord { @@ -2761,25 +6938,80 @@ export namespace RecordCreateParams { */ zone_id: string; + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; + /** * Body param: A valid name server host name. */ - content: string; + content?: string; /** * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; + + /** + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. + */ + proxied?: boolean; + + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordCreateParams.NSRecord.Settings; + + /** + * Body param: Custom tags for the DNS record. This field has no effect on DNS + * responses. + */ + tags?: Array; + + /** + * Body param: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means + * 'automatic'. Value must be between 60 and 86400, with the minimum reduced to 30 + * for Enterprise zones. + */ + ttl?: TTLParam; /** * Body param: Record type. */ - type: 'NS'; + type?: 'NS'; + } + export namespace NSRecord { /** - * Body param: Identifier + * Settings for the DNS record. */ - id?: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + + export interface DNSRecordsOpenpgpkeyRecord { + /** + * Path param: Identifier + */ + zone_id: string; /** * Body param: Comments or notes about the DNS record. This field has no effect on @@ -2787,6 +7019,28 @@ export namespace RecordCreateParams { */ comment?: string; + /** + * Body param: A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 + * Section 11.1) + */ + content?: string; + + /** + * Body param: DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. + */ + proxied?: boolean; + + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordCreateParams.DNSRecordsOpenpgpkeyRecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -2799,6 +7053,34 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'OPENPGPKEY'; + } + + export namespace DNSRecordsOpenpgpkeyRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface PTRRecord { @@ -2808,30 +7090,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Domain name pointing to the address. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - content: string; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Domain name pointing to the address. */ - name: string; + content?: string; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'PTR'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.PTRRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2845,6 +7128,34 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'PTR'; + } + + export namespace PTRRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface SMIMEARecord { @@ -2854,30 +7165,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a SMIMEA record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.SMIMEARecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a SMIMEA record. */ - name: string; + data?: RecordCreateParams.SMIMEARecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SMIMEA'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.SMIMEARecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2891,6 +7203,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SMIMEA'; } export namespace SMIMEARecord { @@ -2918,6 +7235,27 @@ export namespace RecordCreateParams { */ usage?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface SRVRecord { @@ -2927,32 +7265,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a SRV record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.SRVRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. For SRV - * records, the first label is normally a service and the second a protocol name, - * each starting with an underscore. + * Body param: Components of a SRV record. */ - name: string; + data?: RecordCreateParams.SRVRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SRV'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.SRVRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -2966,6 +7303,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SRV'; } export namespace SRVRecord { @@ -2973,13 +7315,6 @@ export namespace RecordCreateParams { * Components of a SRV record. */ export interface Data { - /** - * @deprecated: A valid hostname. Deprecated in favor of the regular 'name' outside - * the data map. This data map field represents the remainder of the full 'name' - * after the service and protocol. - */ - name?: string; - /** * The port of the service. */ @@ -2992,28 +7327,35 @@ export namespace RecordCreateParams { priority?: number; /** - * @deprecated: A valid protocol, prefixed with an underscore. Deprecated in favor - * of the regular 'name' outside the data map. This data map field normally - * represents the second label of that 'name'. + * A valid hostname. */ - proto?: string; + target?: string; /** - * @deprecated: A service type, prefixed with an underscore. Deprecated in favor of - * the regular 'name' outside the data map. This data map field normally represents - * the first label of that 'name'. + * The record weight. */ - service?: string; + weight?: number; + } + /** + * Settings for the DNS record. + */ + export interface Settings { /** - * A valid hostname. + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - target?: string; + ipv4_only?: boolean; /** - * The record weight. + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - weight?: number; + ipv6_only?: boolean; } } @@ -3024,30 +7366,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a SSHFP record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.SSHFPRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a SSHFP record. */ - name: string; + data?: RecordCreateParams.SSHFPRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SSHFP'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.SSHFPRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3061,6 +7404,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SSHFP'; } export namespace SSHFPRecord { @@ -3083,6 +7431,27 @@ export namespace RecordCreateParams { */ type?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface SVCBRecord { @@ -3092,30 +7461,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a SVCB record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.SVCBRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a SVCB record. */ - name: string; + data?: RecordCreateParams.SVCBRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SVCB'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.SVCBRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3129,6 +7499,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SVCB'; } export namespace SVCBRecord { @@ -3151,6 +7526,27 @@ export namespace RecordCreateParams { */ value?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface TLSARecord { @@ -3160,30 +7556,31 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Components of a TLSA record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordCreateParams.TLSARecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a TLSA record. */ - name: string; + data?: RecordCreateParams.TLSARecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'TLSA'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.TLSARecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3197,6 +7594,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'TLSA'; } export namespace TLSARecord { @@ -3224,6 +7626,27 @@ export namespace RecordCreateParams { */ usage?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface TXTRecord { @@ -3233,30 +7656,36 @@ export namespace RecordCreateParams { zone_id: string; /** - * Body param: Text content for the record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - content: string; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Text content for the record. The content must consist of quoted + * "character strings" (RFC 1035), each with a length of up to 255 bytes. Strings + * exceeding this allowed maximum length are automatically split. + * + * Learn more at + * . */ - name: string; + content?: string; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'TXT'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.TXTRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3270,6 +7699,34 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'TXT'; + } + + export namespace TXTRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface URIRecord { @@ -3278,37 +7735,38 @@ export namespace RecordCreateParams { */ zone_id: string; + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; + /** * Body param: Components of a URI record. */ - data: RecordCreateParams.URIRecord.Data; + data?: RecordCreateParams.URIRecord.Data; /** * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; /** * Body param: Required for MX, SRV and URI records; unused by other record types. * Records with lower priorities are preferred. */ - priority: number; - - /** - * Body param: Record type. - */ - type: 'URI'; + priority?: number; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordCreateParams.URIRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3322,6 +7780,11 @@ export namespace RecordCreateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'URI'; } export namespace URIRecord { @@ -3339,6 +7802,27 @@ export namespace RecordCreateParams { */ weight?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } } @@ -3355,6 +7839,7 @@ export type RecordUpdateParams = | RecordUpdateParams.MXRecord | RecordUpdateParams.NAPTRRecord | RecordUpdateParams.NSRecord + | RecordUpdateParams.DNSRecordsOpenpgpkeyRecord | RecordUpdateParams.PTRRecord | RecordUpdateParams.SMIMEARecord | RecordUpdateParams.SRVRecord @@ -3364,7 +7849,7 @@ export type RecordUpdateParams = | RecordUpdateParams.TXTRecord | RecordUpdateParams.URIRecord; -export namespace RecordUpdateParams { +export declare namespace RecordUpdateParams { export interface ARecord { /** * Path param: Identifier @@ -3372,30 +7857,20 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: A valid IPv4 address. - */ - content: string; - - /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - - /** - * Body param: Record type. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - type: 'A'; + comment?: string; /** - * Body param: Identifier + * Body param: A valid IPv4 address. */ - id?: string; + content?: string; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - comment?: string; + name?: string; /** * Body param: Whether the record is receiving the performance and security @@ -3403,6 +7878,11 @@ export namespace RecordUpdateParams { */ proxied?: boolean; + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordUpdateParams.ARecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -3415,39 +7895,57 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; - } - export interface AAAARecord { /** - * Path param: Identifier + * Body param: Record type. */ - zone_id: string; + type?: 'A'; + } + export namespace ARecord { /** - * Body param: A valid IPv6 address. + * Settings for the DNS record. */ - content: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + export interface AAAARecord { /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Path param: Identifier */ - name: string; + zone_id: string; /** - * Body param: Record type. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - type: 'AAAA'; + comment?: string; /** - * Body param: Identifier + * Body param: A valid IPv6 address. */ - id?: string; + content?: string; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - comment?: string; + name?: string; /** * Body param: Whether the record is receiving the performance and security @@ -3455,6 +7953,11 @@ export namespace RecordUpdateParams { */ proxied?: boolean; + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordUpdateParams.AAAARecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -3467,6 +7970,34 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'AAAA'; + } + + export namespace AAAARecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface CAARecord { @@ -3476,30 +8007,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a CAA record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.CAARecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a CAA record. */ - name: string; + data?: RecordUpdateParams.CAARecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'CAA'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.CAARecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3513,6 +8045,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'CAA'; } export namespace CAARecord { @@ -3535,6 +8072,27 @@ export namespace RecordUpdateParams { */ value?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface CERTRecord { @@ -3544,30 +8102,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a CERT record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.CERTRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a CERT record. */ - name: string; + data?: RecordUpdateParams.CERTRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'CERT'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.CERTRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3581,6 +8140,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'CERT'; } export namespace CERTRecord { @@ -3608,39 +8172,50 @@ export namespace RecordUpdateParams { */ type?: number; } - } - export interface CNAMERecord { /** - * Path param: Identifier + * Settings for the DNS record. */ - zone_id: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; - /** - * Body param: A valid hostname. Must not match the record's name. - */ - content: unknown; + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + export interface CNAMERecord { /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Path param: Identifier */ - name: string; + zone_id: string; /** - * Body param: Record type. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - type: 'CNAME'; + comment?: string; /** - * Body param: Identifier + * Body param: A valid hostname. Must not match the record's name. */ - id?: string; + content?: string; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - comment?: string; + name?: string; /** * Body param: Whether the record is receiving the performance and security @@ -3648,6 +8223,11 @@ export namespace RecordUpdateParams { */ proxied?: boolean; + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordUpdateParams.CNAMERecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -3659,7 +8239,43 @@ export namespace RecordUpdateParams { * 'automatic'. Value must be between 60 and 86400, with the minimum reduced to 30 * for Enterprise zones. */ - ttl?: TTLParam; + ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'CNAME'; + } + + export namespace CNAMERecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * If enabled, causes the CNAME record to be resolved externally and the resulting + * address records (e.g., A and AAAA) to be returned instead of the CNAME record + * itself. This setting is unavailable for proxied records, since they are always + * flattened. + */ + flatten_cname?: boolean; + + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface DNSKEYRecord { @@ -3669,30 +8285,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a DNSKEY record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.DNSKEYRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a DNSKEY record. */ - name: string; + data?: RecordUpdateParams.DNSKEYRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'DNSKEY'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.DNSKEYRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3706,6 +8323,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'DNSKEY'; } export namespace DNSKEYRecord { @@ -3733,6 +8355,27 @@ export namespace RecordUpdateParams { */ public_key?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface DSRecord { @@ -3742,30 +8385,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a DS record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.DSRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a DS record. */ - name: string; + data?: RecordUpdateParams.DSRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'DS'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.DSRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3779,6 +8423,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'DS'; } export namespace DSRecord { @@ -3806,6 +8455,27 @@ export namespace RecordUpdateParams { */ key_tag?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface HTTPSRecord { @@ -3815,30 +8485,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a HTTPS record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.HTTPSRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a HTTPS record. */ - name: string; + data?: RecordUpdateParams.HTTPSRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'HTTPS'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.HTTPSRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3852,6 +8523,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'HTTPS'; } export namespace HTTPSRecord { @@ -3874,6 +8550,27 @@ export namespace RecordUpdateParams { */ value?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface LOCRecord { @@ -3883,30 +8580,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a LOC record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.LOCRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a LOC record. */ - name: string; + data?: RecordUpdateParams.LOCRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'LOC'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.LOCRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -3920,6 +8618,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'LOC'; } export namespace LOCRecord { @@ -3987,6 +8690,27 @@ export namespace RecordUpdateParams { */ size?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface MXRecord { @@ -3995,37 +8719,38 @@ export namespace RecordUpdateParams { */ zone_id: string; + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; + /** * Body param: A valid mail server hostname. */ - content: string; + content?: string; /** * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; /** * Body param: Required for MX, SRV and URI records; unused by other record types. * Records with lower priorities are preferred. */ - priority: number; - - /** - * Body param: Record type. - */ - type: 'MX'; + priority?: number; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.MXRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4039,6 +8764,34 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'MX'; + } + + export namespace MXRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface NAPTRRecord { @@ -4048,30 +8801,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a NAPTR record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.NAPTRRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a NAPTR record. */ - name: string; + data?: RecordUpdateParams.NAPTRRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'NAPTR'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.NAPTRRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4085,6 +8839,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'NAPTR'; } export namespace NAPTRRecord { @@ -4122,6 +8881,27 @@ export namespace RecordUpdateParams { */ service?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface NSRecord { @@ -4130,31 +8910,108 @@ export namespace RecordUpdateParams { */ zone_id: string; + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; + /** * Body param: A valid name server host name. */ - content: string; + content?: string; + + /** + * Body param: DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. + */ + proxied?: boolean; + + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordUpdateParams.NSRecord.Settings; + + /** + * Body param: Custom tags for the DNS record. This field has no effect on DNS + * responses. + */ + tags?: Array; + + /** + * Body param: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means + * 'automatic'. Value must be between 60 and 86400, with the minimum reduced to 30 + * for Enterprise zones. + */ + ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'NS'; + } + + export namespace NSRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + + export interface DNSRecordsOpenpgpkeyRecord { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 + * Section 11.1) */ - name: string; + content?: string; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'NS'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.DNSRecordsOpenpgpkeyRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4168,6 +9025,34 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'OPENPGPKEY'; + } + + export namespace DNSRecordsOpenpgpkeyRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface PTRRecord { @@ -4177,30 +9062,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Domain name pointing to the address. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - content: string; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Domain name pointing to the address. */ - name: string; + content?: string; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'PTR'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.PTRRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4214,6 +9100,34 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'PTR'; + } + + export namespace PTRRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface SMIMEARecord { @@ -4223,30 +9137,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a SMIMEA record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.SMIMEARecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a SMIMEA record. */ - name: string; + data?: RecordUpdateParams.SMIMEARecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SMIMEA'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.SMIMEARecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4260,6 +9175,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SMIMEA'; } export namespace SMIMEARecord { @@ -4287,6 +9207,27 @@ export namespace RecordUpdateParams { */ usage?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface SRVRecord { @@ -4296,32 +9237,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a SRV record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.SRVRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. For SRV - * records, the first label is normally a service and the second a protocol name, - * each starting with an underscore. + * Body param: Components of a SRV record. */ - name: string; + data?: RecordUpdateParams.SRVRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SRV'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.SRVRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4335,6 +9275,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SRV'; } export namespace SRVRecord { @@ -4342,13 +9287,6 @@ export namespace RecordUpdateParams { * Components of a SRV record. */ export interface Data { - /** - * @deprecated: A valid hostname. Deprecated in favor of the regular 'name' outside - * the data map. This data map field represents the remainder of the full 'name' - * after the service and protocol. - */ - name?: string; - /** * The port of the service. */ @@ -4361,28 +9299,35 @@ export namespace RecordUpdateParams { priority?: number; /** - * @deprecated: A valid protocol, prefixed with an underscore. Deprecated in favor - * of the regular 'name' outside the data map. This data map field normally - * represents the second label of that 'name'. + * A valid hostname. */ - proto?: string; + target?: string; /** - * @deprecated: A service type, prefixed with an underscore. Deprecated in favor of - * the regular 'name' outside the data map. This data map field normally represents - * the first label of that 'name'. + * The record weight. */ - service?: string; + weight?: number; + } + /** + * Settings for the DNS record. + */ + export interface Settings { /** - * A valid hostname. + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - target?: string; + ipv4_only?: boolean; /** - * The record weight. + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - weight?: number; + ipv6_only?: boolean; } } @@ -4393,30 +9338,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a SSHFP record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.SSHFPRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a SSHFP record. */ - name: string; + data?: RecordUpdateParams.SSHFPRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SSHFP'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.SSHFPRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4430,6 +9376,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SSHFP'; } export namespace SSHFPRecord { @@ -4452,6 +9403,27 @@ export namespace RecordUpdateParams { */ type?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface SVCBRecord { @@ -4461,30 +9433,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a SVCB record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.SVCBRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a SVCB record. */ - name: string; + data?: RecordUpdateParams.SVCBRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SVCB'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.SVCBRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4498,6 +9471,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SVCB'; } export namespace SVCBRecord { @@ -4520,6 +9498,27 @@ export namespace RecordUpdateParams { */ value?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface TLSARecord { @@ -4529,30 +9528,31 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Components of a TLSA record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordUpdateParams.TLSARecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a TLSA record. */ - name: string; + data?: RecordUpdateParams.TLSARecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'TLSA'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.TLSARecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4566,6 +9566,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'TLSA'; } export namespace TLSARecord { @@ -4593,6 +9598,27 @@ export namespace RecordUpdateParams { */ usage?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface TXTRecord { @@ -4602,30 +9628,36 @@ export namespace RecordUpdateParams { zone_id: string; /** - * Body param: Text content for the record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - content: string; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Text content for the record. The content must consist of quoted + * "character strings" (RFC 1035), each with a length of up to 255 bytes. Strings + * exceeding this allowed maximum length are automatically split. + * + * Learn more at + * . */ - name: string; + content?: string; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'TXT'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.TXTRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4639,6 +9671,34 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'TXT'; + } + + export namespace TXTRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface URIRecord { @@ -4647,37 +9707,38 @@ export namespace RecordUpdateParams { */ zone_id: string; + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; + /** * Body param: Components of a URI record. */ - data: RecordUpdateParams.URIRecord.Data; + data?: RecordUpdateParams.URIRecord.Data; /** * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; /** * Body param: Required for MX, SRV and URI records; unused by other record types. * Records with lower priorities are preferred. */ - priority: number; - - /** - * Body param: Record type. - */ - type: 'URI'; + priority?: number; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordUpdateParams.URIRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -4691,6 +9752,11 @@ export namespace RecordUpdateParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'URI'; } export namespace URIRecord { @@ -4708,6 +9774,27 @@ export namespace RecordUpdateParams { */ weight?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } } @@ -4723,9 +9810,9 @@ export interface RecordListParams extends V4PagePaginationArrayParams { comment?: RecordListParams.Comment; /** - * Query param: DNS record content. + * Query param: */ - content?: string; + content?: RecordListParams.Content; /** * Query param: Direction to order DNS records in. @@ -4741,9 +9828,9 @@ export interface RecordListParams extends V4PagePaginationArrayParams { match?: 'any' | 'all'; /** - * Query param: DNS record name (or @ for the zone apex) in Punycode. + * Query param: */ - name?: string; + name?: RecordListParams.Name; /** * Query param: Field to order DNS records by. @@ -4795,6 +9882,7 @@ export interface RecordListParams extends V4PagePaginationArrayParams { | 'MX' | 'NAPTR' | 'NS' + | 'OPENPGPKEY' | 'PTR' | 'SMIMEA' | 'SRV' @@ -4838,6 +9926,50 @@ export namespace RecordListParams { startswith?: string; } + export interface Content { + /** + * Substring of the DNS record content. Content filters are case-insensitive. + */ + contains?: string; + + /** + * Suffix of the DNS record content. Content filters are case-insensitive. + */ + endswith?: string; + + /** + * Exact value of the DNS record content. Content filters are case-insensitive. + */ + exact?: string; + + /** + * Prefix of the DNS record content. Content filters are case-insensitive. + */ + startswith?: string; + } + + export interface Name { + /** + * Substring of the DNS record name. Name filters are case-insensitive. + */ + contains?: string; + + /** + * Suffix of the DNS record name. Name filters are case-insensitive. + */ + endswith?: string; + + /** + * Exact value of the DNS record name. Name filters are case-insensitive. + */ + exact?: string; + + /** + * Prefix of the DNS record name. Name filters are case-insensitive. + */ + startswith?: string; + } + export interface Tag { /** * Name of a tag which must _not_ be present on the DNS record. Tag filters are @@ -4888,6 +10020,42 @@ export interface RecordDeleteParams { zone_id: string; } +export interface RecordBatchParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + deletes?: Array; + + /** + * Body param: + */ + patches?: Array; + + /** + * Body param: + */ + posts?: Array; + + /** + * Body param: + */ + puts?: Array; +} + +export namespace RecordBatchParams { + export interface Delete { + /** + * Identifier + */ + id: string; + } +} + export type RecordEditParams = | RecordEditParams.ARecord | RecordEditParams.AAAARecord @@ -4901,6 +10069,7 @@ export type RecordEditParams = | RecordEditParams.MXRecord | RecordEditParams.NAPTRRecord | RecordEditParams.NSRecord + | RecordEditParams.DNSRecordsOpenpgpkeyRecord | RecordEditParams.PTRRecord | RecordEditParams.SMIMEARecord | RecordEditParams.SRVRecord @@ -4910,7 +10079,7 @@ export type RecordEditParams = | RecordEditParams.TXTRecord | RecordEditParams.URIRecord; -export namespace RecordEditParams { +export declare namespace RecordEditParams { export interface ARecord { /** * Path param: Identifier @@ -4918,30 +10087,20 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: A valid IPv4 address. - */ - content: string; - - /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. - */ - name: string; - - /** - * Body param: Record type. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - type: 'A'; + comment?: string; /** - * Body param: Identifier + * Body param: A valid IPv4 address. */ - id?: string; + content?: string; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - comment?: string; + name?: string; /** * Body param: Whether the record is receiving the performance and security @@ -4949,6 +10108,11 @@ export namespace RecordEditParams { */ proxied?: boolean; + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordEditParams.ARecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -4961,39 +10125,57 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; - } - export interface AAAARecord { /** - * Path param: Identifier + * Body param: Record type. */ - zone_id: string; + type?: 'A'; + } + export namespace ARecord { /** - * Body param: A valid IPv6 address. + * Settings for the DNS record. */ - content: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + export interface AAAARecord { /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Path param: Identifier */ - name: string; + zone_id: string; /** - * Body param: Record type. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - type: 'AAAA'; + comment?: string; /** - * Body param: Identifier + * Body param: A valid IPv6 address. */ - id?: string; + content?: string; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - comment?: string; + name?: string; /** * Body param: Whether the record is receiving the performance and security @@ -5001,6 +10183,11 @@ export namespace RecordEditParams { */ proxied?: boolean; + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordEditParams.AAAARecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -5013,6 +10200,34 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'AAAA'; + } + + export namespace AAAARecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface CAARecord { @@ -5022,30 +10237,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a CAA record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.CAARecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a CAA record. */ - name: string; + data?: RecordEditParams.CAARecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'CAA'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.CAARecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5059,6 +10275,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'CAA'; } export namespace CAARecord { @@ -5081,6 +10302,27 @@ export namespace RecordEditParams { */ value?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface CERTRecord { @@ -5090,30 +10332,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a CERT record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.CERTRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a CERT record. */ - name: string; + data?: RecordEditParams.CERTRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'CERT'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.CERTRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5127,6 +10370,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'CERT'; } export namespace CERTRecord { @@ -5154,39 +10402,50 @@ export namespace RecordEditParams { */ type?: number; } - } - export interface CNAMERecord { /** - * Path param: Identifier + * Settings for the DNS record. */ - zone_id: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; - /** - * Body param: A valid hostname. Must not match the record's name. - */ - content: unknown; + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + export interface CNAMERecord { /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Path param: Identifier */ - name: string; + zone_id: string; /** - * Body param: Record type. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - type: 'CNAME'; + comment?: string; /** - * Body param: Identifier + * Body param: A valid hostname. Must not match the record's name. */ - id?: string; + content?: string; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - comment?: string; + name?: string; /** * Body param: Whether the record is receiving the performance and security @@ -5194,6 +10453,11 @@ export namespace RecordEditParams { */ proxied?: boolean; + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordEditParams.CNAMERecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -5206,6 +10470,42 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'CNAME'; + } + + export namespace CNAMERecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * If enabled, causes the CNAME record to be resolved externally and the resulting + * address records (e.g., A and AAAA) to be returned instead of the CNAME record + * itself. This setting is unavailable for proxied records, since they are always + * flattened. + */ + flatten_cname?: boolean; + + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface DNSKEYRecord { @@ -5215,30 +10515,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a DNSKEY record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.DNSKEYRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a DNSKEY record. */ - name: string; + data?: RecordEditParams.DNSKEYRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'DNSKEY'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.DNSKEYRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5252,6 +10553,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'DNSKEY'; } export namespace DNSKEYRecord { @@ -5279,6 +10585,27 @@ export namespace RecordEditParams { */ public_key?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface DSRecord { @@ -5288,30 +10615,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a DS record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.DSRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a DS record. */ - name: string; + data?: RecordEditParams.DSRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'DS'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.DSRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5325,6 +10653,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'DS'; } export namespace DSRecord { @@ -5352,6 +10685,27 @@ export namespace RecordEditParams { */ key_tag?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface HTTPSRecord { @@ -5361,30 +10715,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a HTTPS record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.HTTPSRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a HTTPS record. */ - name: string; + data?: RecordEditParams.HTTPSRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'HTTPS'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.HTTPSRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5398,6 +10753,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'HTTPS'; } export namespace HTTPSRecord { @@ -5420,6 +10780,27 @@ export namespace RecordEditParams { */ value?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface LOCRecord { @@ -5429,30 +10810,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a LOC record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.LOCRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a LOC record. */ - name: string; + data?: RecordEditParams.LOCRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'LOC'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.LOCRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5466,6 +10848,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'LOC'; } export namespace LOCRecord { @@ -5533,6 +10920,27 @@ export namespace RecordEditParams { */ size?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface MXRecord { @@ -5541,37 +10949,38 @@ export namespace RecordEditParams { */ zone_id: string; + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; + /** * Body param: A valid mail server hostname. */ - content: string; + content?: string; /** * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; /** * Body param: Required for MX, SRV and URI records; unused by other record types. * Records with lower priorities are preferred. */ - priority: number; - - /** - * Body param: Record type. - */ - type: 'MX'; + priority?: number; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.MXRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5585,6 +10994,34 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'MX'; + } + + export namespace MXRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface NAPTRRecord { @@ -5594,30 +11031,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a NAPTR record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.NAPTRRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a NAPTR record. */ - name: string; + data?: RecordEditParams.NAPTRRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'NAPTR'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.NAPTRRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5631,6 +11069,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'NAPTR'; } export namespace NAPTRRecord { @@ -5668,6 +11111,27 @@ export namespace RecordEditParams { */ service?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface NSRecord { @@ -5676,25 +11140,80 @@ export namespace RecordEditParams { */ zone_id: string; + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; + /** * Body param: A valid name server host name. */ - content: string; + content?: string; /** * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; + + /** + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. + */ + proxied?: boolean; + + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordEditParams.NSRecord.Settings; + + /** + * Body param: Custom tags for the DNS record. This field has no effect on DNS + * responses. + */ + tags?: Array; + + /** + * Body param: Time To Live (TTL) of the DNS record in seconds. Setting to 1 means + * 'automatic'. Value must be between 60 and 86400, with the minimum reduced to 30 + * for Enterprise zones. + */ + ttl?: TTLParam; /** * Body param: Record type. */ - type: 'NS'; + type?: 'NS'; + } + export namespace NSRecord { /** - * Body param: Identifier + * Settings for the DNS record. */ - id?: string; + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } + } + + export interface DNSRecordsOpenpgpkeyRecord { + /** + * Path param: Identifier + */ + zone_id: string; /** * Body param: Comments or notes about the DNS record. This field has no effect on @@ -5702,6 +11221,28 @@ export namespace RecordEditParams { */ comment?: string; + /** + * Body param: A single Base64-encoded OpenPGP Transferable Public Key (RFC 4880 + * Section 11.1) + */ + content?: string; + + /** + * Body param: DNS record name (or @ for the zone apex) in Punycode. + */ + name?: string; + + /** + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. + */ + proxied?: boolean; + + /** + * Body param: Settings for the DNS record. + */ + settings?: RecordEditParams.DNSRecordsOpenpgpkeyRecord.Settings; + /** * Body param: Custom tags for the DNS record. This field has no effect on DNS * responses. @@ -5714,6 +11255,34 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'OPENPGPKEY'; + } + + export namespace DNSRecordsOpenpgpkeyRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface PTRRecord { @@ -5723,30 +11292,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Domain name pointing to the address. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - content: string; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Domain name pointing to the address. */ - name: string; + content?: string; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'PTR'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.PTRRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5760,6 +11330,34 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'PTR'; + } + + export namespace PTRRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface SMIMEARecord { @@ -5769,30 +11367,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a SMIMEA record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.SMIMEARecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a SMIMEA record. */ - name: string; + data?: RecordEditParams.SMIMEARecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SMIMEA'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.SMIMEARecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5806,6 +11405,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SMIMEA'; } export namespace SMIMEARecord { @@ -5833,6 +11437,27 @@ export namespace RecordEditParams { */ usage?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface SRVRecord { @@ -5842,32 +11467,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a SRV record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.SRVRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. For SRV - * records, the first label is normally a service and the second a protocol name, - * each starting with an underscore. + * Body param: Components of a SRV record. */ - name: string; + data?: RecordEditParams.SRVRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SRV'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.SRVRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5881,6 +11505,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SRV'; } export namespace SRVRecord { @@ -5888,13 +11517,6 @@ export namespace RecordEditParams { * Components of a SRV record. */ export interface Data { - /** - * @deprecated: A valid hostname. Deprecated in favor of the regular 'name' outside - * the data map. This data map field represents the remainder of the full 'name' - * after the service and protocol. - */ - name?: string; - /** * The port of the service. */ @@ -5907,28 +11529,35 @@ export namespace RecordEditParams { priority?: number; /** - * @deprecated: A valid protocol, prefixed with an underscore. Deprecated in favor - * of the regular 'name' outside the data map. This data map field normally - * represents the second label of that 'name'. + * A valid hostname. */ - proto?: string; + target?: string; /** - * @deprecated: A service type, prefixed with an underscore. Deprecated in favor of - * the regular 'name' outside the data map. This data map field normally represents - * the first label of that 'name'. + * The record weight. */ - service?: string; + weight?: number; + } + /** + * Settings for the DNS record. + */ + export interface Settings { /** - * A valid hostname. + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - target?: string; + ipv4_only?: boolean; /** - * The record weight. + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. */ - weight?: number; + ipv6_only?: boolean; } } @@ -5939,30 +11568,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a SSHFP record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.SSHFPRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a SSHFP record. */ - name: string; + data?: RecordEditParams.SSHFPRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SSHFP'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.SSHFPRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -5976,6 +11606,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SSHFP'; } export namespace SSHFPRecord { @@ -5998,6 +11633,27 @@ export namespace RecordEditParams { */ type?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface SVCBRecord { @@ -6007,30 +11663,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a SVCB record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.SVCBRecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a SVCB record. */ - name: string; + data?: RecordEditParams.SVCBRecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'SVCB'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.SVCBRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -6044,6 +11701,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'SVCB'; } export namespace SVCBRecord { @@ -6066,6 +11728,27 @@ export namespace RecordEditParams { */ value?: string; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface TLSARecord { @@ -6075,30 +11758,31 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Components of a TLSA record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - data: RecordEditParams.TLSARecord.Data; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Components of a TLSA record. */ - name: string; + data?: RecordEditParams.TLSARecord.Data; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'TLSA'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.TLSARecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -6112,6 +11796,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'TLSA'; } export namespace TLSARecord { @@ -6139,6 +11828,27 @@ export namespace RecordEditParams { */ usage?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface TXTRecord { @@ -6148,30 +11858,36 @@ export namespace RecordEditParams { zone_id: string; /** - * Body param: Text content for the record. + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. */ - content: string; + comment?: string; /** - * Body param: DNS record name (or @ for the zone apex) in Punycode. + * Body param: Text content for the record. The content must consist of quoted + * "character strings" (RFC 1035), each with a length of up to 255 bytes. Strings + * exceeding this allowed maximum length are automatically split. + * + * Learn more at + * . */ - name: string; + content?: string; /** - * Body param: Record type. + * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - type: 'TXT'; + name?: string; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.TXTRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -6185,6 +11901,34 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'TXT'; + } + + export namespace TXTRecord { + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } export interface URIRecord { @@ -6193,37 +11937,38 @@ export namespace RecordEditParams { */ zone_id: string; + /** + * Body param: Comments or notes about the DNS record. This field has no effect on + * DNS responses. + */ + comment?: string; + /** * Body param: Components of a URI record. */ - data: RecordEditParams.URIRecord.Data; + data?: RecordEditParams.URIRecord.Data; /** * Body param: DNS record name (or @ for the zone apex) in Punycode. */ - name: string; + name?: string; /** * Body param: Required for MX, SRV and URI records; unused by other record types. * Records with lower priorities are preferred. */ - priority: number; - - /** - * Body param: Record type. - */ - type: 'URI'; + priority?: number; /** - * Body param: Identifier + * Body param: Whether the record is receiving the performance and security + * benefits of Cloudflare. */ - id?: string; + proxied?: boolean; /** - * Body param: Comments or notes about the DNS record. This field has no effect on - * DNS responses. + * Body param: Settings for the DNS record. */ - comment?: string; + settings?: RecordEditParams.URIRecord.Settings; /** * Body param: Custom tags for the DNS record. This field has no effect on DNS @@ -6237,6 +11982,11 @@ export namespace RecordEditParams { * for Enterprise zones. */ ttl?: TTLParam; + + /** + * Body param: Record type. + */ + type?: 'URI'; } export namespace URIRecord { @@ -6254,6 +12004,27 @@ export namespace RecordEditParams { */ weight?: number; } + + /** + * Settings for the DNS record. + */ + export interface Settings { + /** + * When enabled, only A records will be generated, and AAAA records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv4_only?: boolean; + + /** + * When enabled, only AAAA records will be generated, and A records will not be + * created. This setting is intended for exceptional cases. Note that this option + * only applies to proxied records and it has no effect on whether Cloudflare + * communicates with the origin using IPv4 or IPv6. + */ + ipv6_only?: boolean; + } } } @@ -6306,44 +12077,51 @@ export interface RecordScanParams { body: unknown; } -export namespace Records { - export import ARecord = RecordsAPI.ARecord; - export import AAAARecord = RecordsAPI.AAAARecord; - export import CAARecord = RecordsAPI.CAARecord; - export import CERTRecord = RecordsAPI.CERTRecord; - export import CNAMERecord = RecordsAPI.CNAMERecord; - export import DNSKEYRecord = RecordsAPI.DNSKEYRecord; - export import DSRecord = RecordsAPI.DSRecord; - export import HTTPSRecord = RecordsAPI.HTTPSRecord; - export import LOCRecord = RecordsAPI.LOCRecord; - export import MXRecord = RecordsAPI.MXRecord; - export import NAPTRRecord = RecordsAPI.NAPTRRecord; - export import NSRecord = RecordsAPI.NSRecord; - export import PTRRecord = RecordsAPI.PTRRecord; - export import Record = RecordsAPI.Record; - export import RecordMetadata = RecordsAPI.RecordMetadata; - export import RecordProcessTiming = RecordsAPI.RecordProcessTiming; - export import RecordTags = RecordsAPI.RecordTags; - export import SMIMEARecord = RecordsAPI.SMIMEARecord; - export import SRVRecord = RecordsAPI.SRVRecord; - export import SSHFPRecord = RecordsAPI.SSHFPRecord; - export import SVCBRecord = RecordsAPI.SVCBRecord; - export import TLSARecord = RecordsAPI.TLSARecord; - export import TTL = RecordsAPI.TTL; - export import TXTRecord = RecordsAPI.TXTRecord; - export import URIRecord = RecordsAPI.URIRecord; - export import RecordDeleteResponse = RecordsAPI.RecordDeleteResponse; - export import RecordExportResponse = RecordsAPI.RecordExportResponse; - export import RecordImportResponse = RecordsAPI.RecordImportResponse; - export import RecordScanResponse = RecordsAPI.RecordScanResponse; - export import RecordsV4PagePaginationArray = RecordsAPI.RecordsV4PagePaginationArray; - export import RecordCreateParams = RecordsAPI.RecordCreateParams; - export import RecordUpdateParams = RecordsAPI.RecordUpdateParams; - export import RecordListParams = RecordsAPI.RecordListParams; - export import RecordDeleteParams = RecordsAPI.RecordDeleteParams; - export import RecordEditParams = RecordsAPI.RecordEditParams; - export import RecordExportParams = RecordsAPI.RecordExportParams; - export import RecordGetParams = RecordsAPI.RecordGetParams; - export import RecordImportParams = RecordsAPI.RecordImportParams; - export import RecordScanParams = RecordsAPI.RecordScanParams; +Records.RecordResponsesV4PagePaginationArray = RecordResponsesV4PagePaginationArray; + +export declare namespace Records { + export { + type ARecord as ARecord, + type AAAARecord as AAAARecord, + type BatchPatch as BatchPatch, + type BatchPut as BatchPut, + type CAARecord as CAARecord, + type CERTRecord as CERTRecord, + type CNAMERecord as CNAMERecord, + type DNSKEYRecord as DNSKEYRecord, + type DSRecord as DSRecord, + type HTTPSRecord as HTTPSRecord, + type LOCRecord as LOCRecord, + type MXRecord as MXRecord, + type NAPTRRecord as NAPTRRecord, + type NSRecord as NSRecord, + type PTRRecord as PTRRecord, + type Record as Record, + type RecordResponse as RecordResponse, + type RecordTags as RecordTags, + type SMIMEARecord as SMIMEARecord, + type SRVRecord as SRVRecord, + type SSHFPRecord as SSHFPRecord, + type SVCBRecord as SVCBRecord, + type TLSARecord as TLSARecord, + type TTL as TTL, + type TXTRecord as TXTRecord, + type URIRecord as URIRecord, + type RecordDeleteResponse as RecordDeleteResponse, + type RecordBatchResponse as RecordBatchResponse, + type RecordExportResponse as RecordExportResponse, + type RecordImportResponse as RecordImportResponse, + type RecordScanResponse as RecordScanResponse, + RecordResponsesV4PagePaginationArray as RecordResponsesV4PagePaginationArray, + type RecordCreateParams as RecordCreateParams, + type RecordUpdateParams as RecordUpdateParams, + type RecordListParams as RecordListParams, + type RecordDeleteParams as RecordDeleteParams, + type RecordBatchParams as RecordBatchParams, + type RecordEditParams as RecordEditParams, + type RecordExportParams as RecordExportParams, + type RecordGetParams as RecordGetParams, + type RecordImportParams as RecordImportParams, + type RecordScanParams as RecordScanParams, + }; } diff --git a/src/resources/dns/settings.ts b/src/resources/dns/settings.ts deleted file mode 100644 index c9c2ff6ec5..0000000000 --- a/src/resources/dns/settings.ts +++ /dev/null @@ -1,314 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; -import * as Core from '../../core'; -import { CloudflareError } from '../../error'; -import * as SettingsAPI from './settings'; - -export class Settings extends APIResource { - /** - * Update DNS settings for an account or zone - */ - edit(params: SettingEditParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, zone_id, ...body } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.patch(`/${accountOrZone}/${accountOrZoneId}/dns_settings`, { - body, - ...options, - }) as Core.APIPromise<{ result: SettingEditResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Show DNS settings for an account or zone - */ - get(params?: SettingGetParams, options?: Core.RequestOptions): Core.APIPromise; - get(options?: Core.RequestOptions): Core.APIPromise; - get( - params: SettingGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(params)) { - return this.get({}, params); - } - const { account_id, zone_id } = params; - if (!account_id && !zone_id) { - throw new CloudflareError('You must provide either account_id or zone_id.'); - } - if (account_id && zone_id) { - throw new CloudflareError('You cannot provide both account_id and zone_id.'); - } - const { accountOrZone, accountOrZoneId } = - account_id ? - { - accountOrZone: 'accounts', - accountOrZoneId: account_id, - } - : { - accountOrZone: 'zones', - accountOrZoneId: zone_id, - }; - return ( - this._client.get(`/${accountOrZone}/${accountOrZoneId}/dns_settings`, options) as Core.APIPromise<{ - result: SettingGetResponse; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export interface DNSSetting { - /** - * Whether to enable Foundation DNS Advanced Nameservers on the zone. - */ - foundation_dns?: boolean; - - /** - * Whether to enable multi-provider DNS, which causes Cloudflare to activate the - * zone even when non-Cloudflare NS records exist, and to respect NS records at the - * zone apex during outbound zone transfers. - */ - multi_provider?: boolean; - - /** - * Settings determining the nameservers through which the zone should be available. - */ - nameservers?: Nameserver; - - /** - * The time to live (TTL) of the zone's nameserver (NS) records. - */ - ns_ttl?: number; - - /** - * Allows a Secondary DNS zone to use (proxied) override records and CNAME - * flattening at the zone apex. - */ - secondary_overrides?: boolean; - - /** - * Components of the zone's SOA record. - */ - soa?: DNSSetting.SOA; - - /** - * Whether the zone mode is a regular or CDN/DNS only zone. - */ - zone_mode?: 'standard' | 'cdn_only' | 'dns_only'; -} - -export namespace DNSSetting { - /** - * Components of the zone's SOA record. - */ - export interface SOA { - /** - * Time in seconds of being unable to query the primary server after which - * secondary servers should stop serving the zone. - */ - expire: number; - - /** - * The time to live (TTL) for negative caching of records within the zone. - */ - min_ttl: number; - - /** - * The primary nameserver, which may be used for outbound zone transfers. - */ - mname: string; - - /** - * Time in seconds after which secondary servers should re-check the SOA record to - * see if the zone has been updated. - */ - refresh: number; - - /** - * Time in seconds after which secondary servers should retry queries after the - * primary server was unresponsive. - */ - retry: number; - - /** - * The email address of the zone administrator, with the first label representing - * the local part of the email address. - */ - rname: string; - - /** - * The time to live (TTL) of the SOA record itself. - */ - ttl: number; - } -} - -export interface DNSSettingParam { - /** - * Whether to enable Foundation DNS Advanced Nameservers on the zone. - */ - foundation_dns?: boolean; - - /** - * Whether to enable multi-provider DNS, which causes Cloudflare to activate the - * zone even when non-Cloudflare NS records exist, and to respect NS records at the - * zone apex during outbound zone transfers. - */ - multi_provider?: boolean; - - /** - * Settings determining the nameservers through which the zone should be available. - */ - nameservers?: NameserverParam; - - /** - * The time to live (TTL) of the zone's nameserver (NS) records. - */ - ns_ttl?: number; - - /** - * Allows a Secondary DNS zone to use (proxied) override records and CNAME - * flattening at the zone apex. - */ - secondary_overrides?: boolean; - - /** - * Components of the zone's SOA record. - */ - soa?: DNSSettingParam.SOA; - - /** - * Whether the zone mode is a regular or CDN/DNS only zone. - */ - zone_mode?: 'standard' | 'cdn_only' | 'dns_only'; -} - -export namespace DNSSettingParam { - /** - * Components of the zone's SOA record. - */ - export interface SOA { - /** - * Time in seconds of being unable to query the primary server after which - * secondary servers should stop serving the zone. - */ - expire: number; - - /** - * The time to live (TTL) for negative caching of records within the zone. - */ - min_ttl: number; - - /** - * The primary nameserver, which may be used for outbound zone transfers. - */ - mname: string; - - /** - * Time in seconds after which secondary servers should re-check the SOA record to - * see if the zone has been updated. - */ - refresh: number; - - /** - * Time in seconds after which secondary servers should retry queries after the - * primary server was unresponsive. - */ - retry: number; - - /** - * The email address of the zone administrator, with the first label representing - * the local part of the email address. - */ - rname: string; - - /** - * The time to live (TTL) of the SOA record itself. - */ - ttl: number; - } -} - -/** - * Settings determining the nameservers through which the zone should be available. - */ -export interface Nameserver { - /** - * Nameserver type - */ - type: 'cloudflare.standard'; -} - -/** - * Settings determining the nameservers through which the zone should be available. - */ -export interface NameserverParam { - /** - * Nameserver type - */ - type: 'cloudflare.standard'; -} - -export interface SettingEditResponse { - zone_defaults?: DNSSetting; -} - -export interface SettingGetResponse { - zone_defaults?: DNSSetting; -} - -export interface SettingEditParams { - /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. - */ - account_id?: string; - - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; - - /** - * Body param: - */ - zone_defaults?: DNSSettingParam; -} - -export interface SettingGetParams { - /** - * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. - */ - account_id?: string; - - /** - * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. - */ - zone_id?: string; -} - -export namespace Settings { - export import DNSSetting = SettingsAPI.DNSSetting; - export import Nameserver = SettingsAPI.Nameserver; - export import SettingEditResponse = SettingsAPI.SettingEditResponse; - export import SettingGetResponse = SettingsAPI.SettingGetResponse; - export import SettingEditParams = SettingsAPI.SettingEditParams; - export import SettingGetParams = SettingsAPI.SettingGetParams; -} diff --git a/src/resources/dns/settings/index.ts b/src/resources/dns/settings/index.ts new file mode 100644 index 0000000000..2cd53dbf09 --- /dev/null +++ b/src/resources/dns/settings/index.ts @@ -0,0 +1,24 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Settings, + type DNSSetting, + type SettingEditResponse, + type SettingGetResponse, + type SettingEditParams, + type SettingGetParams, +} from './settings'; +export { + ViewListResponsesV4PagePaginationArray, + Views, + type ViewCreateResponse, + type ViewListResponse, + type ViewDeleteResponse, + type ViewEditResponse, + type ViewGetResponse, + type ViewCreateParams, + type ViewListParams, + type ViewDeleteParams, + type ViewEditParams, + type ViewGetParams, +} from './views'; diff --git a/src/resources/dns/settings/settings.ts b/src/resources/dns/settings/settings.ts new file mode 100644 index 0000000000..d9460abb7e --- /dev/null +++ b/src/resources/dns/settings/settings.ts @@ -0,0 +1,556 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import * as Core from '../../../core'; +import { CloudflareError } from 'cloudflare/error'; +import * as ViewsAPI from './views'; +import { + ViewCreateParams, + ViewCreateResponse, + ViewDeleteParams, + ViewDeleteResponse, + ViewEditParams, + ViewEditResponse, + ViewGetParams, + ViewGetResponse, + ViewListParams, + ViewListResponse, + ViewListResponsesV4PagePaginationArray, + Views, +} from './views'; + +export class Settings extends APIResource { + views: ViewsAPI.Views = new ViewsAPI.Views(this._client); + + /** + * Update DNS settings for an account or zone + */ + edit(params: SettingEditParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, zone_id, ...body } = params; + if (!account_id && !zone_id) { + throw new CloudflareError('You must provide either account_id or zone_id.'); + } + if (account_id && zone_id) { + throw new CloudflareError('You cannot provide both account_id and zone_id.'); + } + const { accountOrZone, accountOrZoneId } = + account_id ? + { + accountOrZone: 'accounts', + accountOrZoneId: account_id, + } + : { + accountOrZone: 'zones', + accountOrZoneId: zone_id, + }; + return ( + this._client.patch(`/${accountOrZone}/${accountOrZoneId}/dns_settings`, { + body, + ...options, + }) as Core.APIPromise<{ result: SettingEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Show DNS settings for an account or zone + */ + get(params?: SettingGetParams, options?: Core.RequestOptions): Core.APIPromise; + get(options?: Core.RequestOptions): Core.APIPromise; + get( + params: SettingGetParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(params)) { + return this.get({}, params); + } + const { account_id, zone_id } = params; + if (!account_id && !zone_id) { + throw new CloudflareError('You must provide either account_id or zone_id.'); + } + if (account_id && zone_id) { + throw new CloudflareError('You cannot provide both account_id and zone_id.'); + } + const { accountOrZone, accountOrZoneId } = + account_id ? + { + accountOrZone: 'accounts', + accountOrZoneId: account_id, + } + : { + accountOrZone: 'zones', + accountOrZoneId: zone_id, + }; + return ( + this._client.get(`/${accountOrZone}/${accountOrZoneId}/dns_settings`, options) as Core.APIPromise<{ + result: SettingGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface DNSSetting { + /** + * Whether to flatten all CNAME records in the zone. Note that, due to DNS + * limitations, a CNAME record at the zone apex will always be flattened. + */ + flatten_all_cnames?: boolean; + + /** + * Whether to enable Foundation DNS Advanced Nameservers on the zone. + */ + foundation_dns?: boolean; + + /** + * Whether to enable multi-provider DNS, which causes Cloudflare to activate the + * zone even when non-Cloudflare NS records exist, and to respect NS records at the + * zone apex during outbound zone transfers. + */ + multi_provider?: boolean; + + /** + * The time to live (TTL) of the zone's nameserver (NS) records. + */ + ns_ttl?: number; + + /** + * Allows a Secondary DNS zone to use (proxied) override records and CNAME + * flattening at the zone apex. + */ + secondary_overrides?: boolean; + + /** + * Components of the zone's SOA record. + */ + soa?: DNSSetting.SOA; + + /** + * Whether the zone mode is a regular or CDN/DNS only zone. + */ + zone_mode?: 'standard' | 'cdn_only' | 'dns_only'; +} + +export namespace DNSSetting { + /** + * Components of the zone's SOA record. + */ + export interface SOA { + /** + * Time in seconds of being unable to query the primary server after which + * secondary servers should stop serving the zone. + */ + expire: number; + + /** + * The time to live (TTL) for negative caching of records within the zone. + */ + min_ttl: number; + + /** + * The primary nameserver, which may be used for outbound zone transfers. + */ + mname: string; + + /** + * Time in seconds after which secondary servers should re-check the SOA record to + * see if the zone has been updated. + */ + refresh: number; + + /** + * Time in seconds after which secondary servers should retry queries after the + * primary server was unresponsive. + */ + retry: number; + + /** + * The email address of the zone administrator, with the first label representing + * the local part of the email address. + */ + rname: string; + + /** + * The time to live (TTL) of the SOA record itself. + */ + ttl: number; + } +} + +export interface SettingEditResponse { + zone_defaults?: SettingEditResponse.ZoneDefaults; +} + +export namespace SettingEditResponse { + export interface ZoneDefaults { + /** + * Whether to flatten all CNAME records in the zone. Note that, due to DNS + * limitations, a CNAME record at the zone apex will always be flattened. + */ + flatten_all_cnames?: boolean; + + /** + * Whether to enable Foundation DNS Advanced Nameservers on the zone. + */ + foundation_dns?: boolean; + + /** + * Whether to enable multi-provider DNS, which causes Cloudflare to activate the + * zone even when non-Cloudflare NS records exist, and to respect NS records at the + * zone apex during outbound zone transfers. + */ + multi_provider?: boolean; + + /** + * Settings determining the nameservers through which the zone should be available. + */ + nameservers?: ZoneDefaults.Nameservers; + + /** + * The time to live (TTL) of the zone's nameserver (NS) records. + */ + ns_ttl?: number; + + /** + * Allows a Secondary DNS zone to use (proxied) override records and CNAME + * flattening at the zone apex. + */ + secondary_overrides?: boolean; + + /** + * Components of the zone's SOA record. + */ + soa?: ZoneDefaults.SOA; + + /** + * Whether the zone mode is a regular or CDN/DNS only zone. + */ + zone_mode?: 'standard' | 'cdn_only' | 'dns_only'; + } + + export namespace ZoneDefaults { + /** + * Settings determining the nameservers through which the zone should be available. + */ + export interface Nameservers { + /** + * Nameserver type + */ + type: 'cloudflare.standard' | 'cloudflare.standard.random' | 'custom.account' | 'custom.tenant'; + } + + /** + * Components of the zone's SOA record. + */ + export interface SOA { + /** + * Time in seconds of being unable to query the primary server after which + * secondary servers should stop serving the zone. + */ + expire: number; + + /** + * The time to live (TTL) for negative caching of records within the zone. + */ + min_ttl: number; + + /** + * The primary nameserver, which may be used for outbound zone transfers. + */ + mname: string; + + /** + * Time in seconds after which secondary servers should re-check the SOA record to + * see if the zone has been updated. + */ + refresh: number; + + /** + * Time in seconds after which secondary servers should retry queries after the + * primary server was unresponsive. + */ + retry: number; + + /** + * The email address of the zone administrator, with the first label representing + * the local part of the email address. + */ + rname: string; + + /** + * The time to live (TTL) of the SOA record itself. + */ + ttl: number; + } + } +} + +export interface SettingGetResponse { + zone_defaults?: SettingGetResponse.ZoneDefaults; +} + +export namespace SettingGetResponse { + export interface ZoneDefaults { + /** + * Whether to flatten all CNAME records in the zone. Note that, due to DNS + * limitations, a CNAME record at the zone apex will always be flattened. + */ + flatten_all_cnames?: boolean; + + /** + * Whether to enable Foundation DNS Advanced Nameservers on the zone. + */ + foundation_dns?: boolean; + + /** + * Whether to enable multi-provider DNS, which causes Cloudflare to activate the + * zone even when non-Cloudflare NS records exist, and to respect NS records at the + * zone apex during outbound zone transfers. + */ + multi_provider?: boolean; + + /** + * Settings determining the nameservers through which the zone should be available. + */ + nameservers?: ZoneDefaults.Nameservers; + + /** + * The time to live (TTL) of the zone's nameserver (NS) records. + */ + ns_ttl?: number; + + /** + * Allows a Secondary DNS zone to use (proxied) override records and CNAME + * flattening at the zone apex. + */ + secondary_overrides?: boolean; + + /** + * Components of the zone's SOA record. + */ + soa?: ZoneDefaults.SOA; + + /** + * Whether the zone mode is a regular or CDN/DNS only zone. + */ + zone_mode?: 'standard' | 'cdn_only' | 'dns_only'; + } + + export namespace ZoneDefaults { + /** + * Settings determining the nameservers through which the zone should be available. + */ + export interface Nameservers { + /** + * Nameserver type + */ + type: 'cloudflare.standard' | 'cloudflare.standard.random' | 'custom.account' | 'custom.tenant'; + } + + /** + * Components of the zone's SOA record. + */ + export interface SOA { + /** + * Time in seconds of being unable to query the primary server after which + * secondary servers should stop serving the zone. + */ + expire: number; + + /** + * The time to live (TTL) for negative caching of records within the zone. + */ + min_ttl: number; + + /** + * The primary nameserver, which may be used for outbound zone transfers. + */ + mname: string; + + /** + * Time in seconds after which secondary servers should re-check the SOA record to + * see if the zone has been updated. + */ + refresh: number; + + /** + * Time in seconds after which secondary servers should retry queries after the + * primary server was unresponsive. + */ + retry: number; + + /** + * The email address of the zone administrator, with the first label representing + * the local part of the email address. + */ + rname: string; + + /** + * The time to live (TTL) of the SOA record itself. + */ + ttl: number; + } + } +} + +export interface SettingEditParams { + /** + * Path param: The Account ID to use for this endpoint. Mutually exclusive with the + * Zone ID. + */ + account_id?: string; + + /** + * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the + * Account ID. + */ + zone_id?: string; + + /** + * Body param: + */ + zone_defaults?: SettingEditParams.ZoneDefaults; +} + +export namespace SettingEditParams { + export interface ZoneDefaults { + /** + * Whether to flatten all CNAME records in the zone. Note that, due to DNS + * limitations, a CNAME record at the zone apex will always be flattened. + */ + flatten_all_cnames?: boolean; + + /** + * Whether to enable Foundation DNS Advanced Nameservers on the zone. + */ + foundation_dns?: boolean; + + /** + * Whether to enable multi-provider DNS, which causes Cloudflare to activate the + * zone even when non-Cloudflare NS records exist, and to respect NS records at the + * zone apex during outbound zone transfers. + */ + multi_provider?: boolean; + + /** + * Settings determining the nameservers through which the zone should be available. + */ + nameservers?: ZoneDefaults.Nameservers; + + /** + * The time to live (TTL) of the zone's nameserver (NS) records. + */ + ns_ttl?: number; + + /** + * Allows a Secondary DNS zone to use (proxied) override records and CNAME + * flattening at the zone apex. + */ + secondary_overrides?: boolean; + + /** + * Components of the zone's SOA record. + */ + soa?: ZoneDefaults.SOA; + + /** + * Whether the zone mode is a regular or CDN/DNS only zone. + */ + zone_mode?: 'standard' | 'cdn_only' | 'dns_only'; + } + + export namespace ZoneDefaults { + /** + * Settings determining the nameservers through which the zone should be available. + */ + export interface Nameservers { + /** + * Nameserver type + */ + type: 'cloudflare.standard' | 'cloudflare.standard.random' | 'custom.account' | 'custom.tenant'; + } + + /** + * Components of the zone's SOA record. + */ + export interface SOA { + /** + * Time in seconds of being unable to query the primary server after which + * secondary servers should stop serving the zone. + */ + expire: number; + + /** + * The time to live (TTL) for negative caching of records within the zone. + */ + min_ttl: number; + + /** + * The primary nameserver, which may be used for outbound zone transfers. + */ + mname: string; + + /** + * Time in seconds after which secondary servers should re-check the SOA record to + * see if the zone has been updated. + */ + refresh: number; + + /** + * Time in seconds after which secondary servers should retry queries after the + * primary server was unresponsive. + */ + retry: number; + + /** + * The email address of the zone administrator, with the first label representing + * the local part of the email address. + */ + rname: string; + + /** + * The time to live (TTL) of the SOA record itself. + */ + ttl: number; + } + } +} + +export interface SettingGetParams { + /** + * The Account ID to use for this endpoint. Mutually exclusive with the Zone ID. + */ + account_id?: string; + + /** + * The Zone ID to use for this endpoint. Mutually exclusive with the Account ID. + */ + zone_id?: string; +} + +Settings.Views = Views; +Settings.ViewListResponsesV4PagePaginationArray = ViewListResponsesV4PagePaginationArray; + +export declare namespace Settings { + export { + type DNSSetting as DNSSetting, + type SettingEditResponse as SettingEditResponse, + type SettingGetResponse as SettingGetResponse, + type SettingEditParams as SettingEditParams, + type SettingGetParams as SettingGetParams, + }; + + export { + Views as Views, + type ViewCreateResponse as ViewCreateResponse, + type ViewListResponse as ViewListResponse, + type ViewDeleteResponse as ViewDeleteResponse, + type ViewEditResponse as ViewEditResponse, + type ViewGetResponse as ViewGetResponse, + ViewListResponsesV4PagePaginationArray as ViewListResponsesV4PagePaginationArray, + type ViewCreateParams as ViewCreateParams, + type ViewListParams as ViewListParams, + type ViewDeleteParams as ViewDeleteParams, + type ViewEditParams as ViewEditParams, + type ViewGetParams as ViewGetParams, + }; +} diff --git a/src/resources/dns/settings/views.ts b/src/resources/dns/settings/views.ts new file mode 100644 index 0000000000..a6cf88d7a8 --- /dev/null +++ b/src/resources/dns/settings/views.ts @@ -0,0 +1,331 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Views extends APIResource { + /** + * Create Internal DNS View for an account + */ + create(params: ViewCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/dns_settings/views`, { + body, + ...options, + }) as Core.APIPromise<{ result: ViewCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List DNS Internal Views for an Account + */ + list( + params: ViewListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/dns_settings/views`, + ViewListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete an existing Internal DNS View + */ + delete( + viewId: string, + params: ViewDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/dns_settings/views/${viewId}`, + options, + ) as Core.APIPromise<{ result: ViewDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update an existing Internal DNS View + */ + edit( + viewId: string, + params: ViewEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/dns_settings/views/${viewId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: ViewEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get DNS Internal View + */ + get( + viewId: string, + params: ViewGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/dns_settings/views/${viewId}`, options) as Core.APIPromise<{ + result: ViewGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class ViewListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface ViewCreateResponse { + /** + * Identifier + */ + id: string; + + /** + * When the view was created. + */ + created_time: string; + + /** + * When the view was last modified. + */ + modified_time: string; + + /** + * The name of the view. + */ + name: string; + + /** + * The list of zones linked to this view. + */ + zones: Array; +} + +export interface ViewListResponse { + /** + * Identifier + */ + id: string; + + /** + * When the view was created. + */ + created_time: string; + + /** + * When the view was last modified. + */ + modified_time: string; + + /** + * The name of the view. + */ + name: string; + + /** + * The list of zones linked to this view. + */ + zones: Array; +} + +export interface ViewDeleteResponse { + /** + * Identifier + */ + id?: string; +} + +export interface ViewEditResponse { + /** + * Identifier + */ + id: string; + + /** + * When the view was created. + */ + created_time: string; + + /** + * When the view was last modified. + */ + modified_time: string; + + /** + * The name of the view. + */ + name: string; + + /** + * The list of zones linked to this view. + */ + zones: Array; +} + +export interface ViewGetResponse { + /** + * Identifier + */ + id: string; + + /** + * When the view was created. + */ + created_time: string; + + /** + * When the view was last modified. + */ + modified_time: string; + + /** + * The name of the view. + */ + name: string; + + /** + * The list of zones linked to this view. + */ + zones: Array; +} + +export interface ViewCreateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: The name of the view. + */ + name?: string; + + /** + * Body param: The list of zones linked to this view. + */ + zones?: Array; +} + +export interface ViewListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Query param: Direction to order DNS views in. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: Whether to match all search requirements or at least one (any). If + * set to `all`, acts like a logical AND between filters. If set to `any`, acts + * like a logical OR instead. + */ + match?: 'any' | 'all'; + + /** + * Query param: + */ + name?: ViewListParams.Name; + + /** + * Query param: Field to order DNS views by. + */ + order?: 'name' | 'created_on' | 'modified_on'; + + /** + * Query param: A zone ID that exists in the zones list for the view. + */ + zone_id?: string; + + /** + * Query param: A zone name that exists in the zones list for the view. + */ + zone_name?: string; +} + +export namespace ViewListParams { + export interface Name { + /** + * Substring of the DNS view name. + */ + contains?: string; + + /** + * Suffix of the DNS view name. + */ + endswith?: string; + + /** + * Exact value of the DNS view name. + */ + exact?: string; + + /** + * Prefix of the DNS view name. + */ + startswith?: string; + } +} + +export interface ViewDeleteParams { + /** + * Identifier + */ + account_id: string; +} + +export interface ViewEditParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: The name of the view. + */ + name?: string; + + /** + * Body param: The list of zones linked to this view. + */ + zones?: Array; +} + +export interface ViewGetParams { + /** + * Identifier + */ + account_id: string; +} + +Views.ViewListResponsesV4PagePaginationArray = ViewListResponsesV4PagePaginationArray; + +export declare namespace Views { + export { + type ViewCreateResponse as ViewCreateResponse, + type ViewListResponse as ViewListResponse, + type ViewDeleteResponse as ViewDeleteResponse, + type ViewEditResponse as ViewEditResponse, + type ViewGetResponse as ViewGetResponse, + ViewListResponsesV4PagePaginationArray as ViewListResponsesV4PagePaginationArray, + type ViewCreateParams as ViewCreateParams, + type ViewListParams as ViewListParams, + type ViewDeleteParams as ViewDeleteParams, + type ViewEditParams as ViewEditParams, + type ViewGetParams as ViewGetParams, + }; +} diff --git a/src/resources/secondary-dns/acls.ts b/src/resources/dns/zone-transfers/acls.ts similarity index 75% rename from src/resources/secondary-dns/acls.ts rename to src/resources/dns/zone-transfers/acls.ts index 9cc90149b8..95ffb2e64a 100644 --- a/src/resources/secondary-dns/acls.ts +++ b/src/resources/dns/zone-transfers/acls.ts @@ -1,19 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as ACLsAPI from './acls'; -import { SinglePage } from '../../pagination'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { SinglePage } from '../../../pagination'; export class ACLs extends APIResource { /** * Create ACL. */ create(params: ACLCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/secondary_dns/acls`, { - body: body, + body, ...options, }) as Core.APIPromise<{ result: ACL }> )._thenUnwrap((obj) => obj.result); @@ -100,9 +99,18 @@ export interface ACLCreateParams { account_id: string; /** - * Body param: + * Body param: Allowed IPv4/IPv6 address range of primary or secondary nameservers. + * This will be applied for the entire account. The IP range is used to allow + * additional NOTIFY IPs for secondary zones and IPs Cloudflare allows AXFR/IXFR + * requests from for primary zones. CIDRs are limited to a maximum of /24 for IPv4 + * and /64 for IPv6 respectively. */ - body: unknown; + ip_range: string; + + /** + * Body param: The name of the acl. + */ + name: string; } export interface ACLUpdateParams { @@ -138,13 +146,17 @@ export interface ACLGetParams { account_id: string; } -export namespace ACLs { - export import ACL = ACLsAPI.ACL; - export import ACLDeleteResponse = ACLsAPI.ACLDeleteResponse; - export import ACLsSinglePage = ACLsAPI.ACLsSinglePage; - export import ACLCreateParams = ACLsAPI.ACLCreateParams; - export import ACLUpdateParams = ACLsAPI.ACLUpdateParams; - export import ACLListParams = ACLsAPI.ACLListParams; - export import ACLDeleteParams = ACLsAPI.ACLDeleteParams; - export import ACLGetParams = ACLsAPI.ACLGetParams; +ACLs.ACLsSinglePage = ACLsSinglePage; + +export declare namespace ACLs { + export { + type ACL as ACL, + type ACLDeleteResponse as ACLDeleteResponse, + ACLsSinglePage as ACLsSinglePage, + type ACLCreateParams as ACLCreateParams, + type ACLUpdateParams as ACLUpdateParams, + type ACLListParams as ACLListParams, + type ACLDeleteParams as ACLDeleteParams, + type ACLGetParams as ACLGetParams, + }; } diff --git a/src/resources/secondary-dns/force-axfr.ts b/src/resources/dns/zone-transfers/force-axfr.ts similarity index 74% rename from src/resources/secondary-dns/force-axfr.ts rename to src/resources/dns/zone-transfers/force-axfr.ts index e44c8c0ff5..95ed1788b6 100644 --- a/src/resources/secondary-dns/force-axfr.ts +++ b/src/resources/dns/zone-transfers/force-axfr.ts @@ -1,8 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as ForceAXFRAPI from './force-axfr'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; export class ForceAXFRResource extends APIResource { /** @@ -36,7 +35,6 @@ export interface ForceAXFRCreateParams { body: unknown; } -export namespace ForceAXFRResource { - export import ForceAXFR = ForceAXFRAPI.ForceAXFR; - export import ForceAXFRCreateParams = ForceAXFRAPI.ForceAXFRCreateParams; +export declare namespace ForceAXFRResource { + export { type ForceAXFR as ForceAXFR, type ForceAXFRCreateParams as ForceAXFRCreateParams }; } diff --git a/src/resources/secondary-dns/incoming.ts b/src/resources/dns/zone-transfers/incoming.ts similarity index 84% rename from src/resources/secondary-dns/incoming.ts rename to src/resources/dns/zone-transfers/incoming.ts index 322d2615eb..505b692b2a 100644 --- a/src/resources/secondary-dns/incoming.ts +++ b/src/resources/dns/zone-transfers/incoming.ts @@ -1,8 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as IncomingAPI from './incoming'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; export class IncomingResource extends APIResource { /** @@ -95,7 +94,7 @@ export interface Incoming { /** * A list of peer tags. */ - peers?: Array; + peers?: Array; /** * The serial number of the SOA for the given zone. @@ -135,7 +134,7 @@ export interface IncomingCreateResponse { /** * A list of peer tags. */ - peers?: Array; + peers?: Array; /** * The serial number of the SOA for the given zone. @@ -175,7 +174,7 @@ export interface IncomingUpdateResponse { /** * A list of peer tags. */ - peers?: Array; + peers?: Array; /** * The serial number of the SOA for the given zone. @@ -219,7 +218,7 @@ export interface IncomingGetResponse { /** * A list of peer tags. */ - peers?: Array; + peers?: Array; /** * The serial number of the SOA for the given zone. @@ -247,7 +246,7 @@ export interface IncomingCreateParams { /** * Body param: A list of peer tags. */ - peers: Array; + peers: Array; } export interface IncomingUpdateParams { @@ -270,7 +269,7 @@ export interface IncomingUpdateParams { /** * Body param: A list of peer tags. */ - peers: Array; + peers: Array; } export interface IncomingDeleteParams { @@ -281,14 +280,16 @@ export interface IncomingGetParams { zone_id: string; } -export namespace IncomingResource { - export import Incoming = IncomingAPI.Incoming; - export import IncomingCreateResponse = IncomingAPI.IncomingCreateResponse; - export import IncomingUpdateResponse = IncomingAPI.IncomingUpdateResponse; - export import IncomingDeleteResponse = IncomingAPI.IncomingDeleteResponse; - export import IncomingGetResponse = IncomingAPI.IncomingGetResponse; - export import IncomingCreateParams = IncomingAPI.IncomingCreateParams; - export import IncomingUpdateParams = IncomingAPI.IncomingUpdateParams; - export import IncomingDeleteParams = IncomingAPI.IncomingDeleteParams; - export import IncomingGetParams = IncomingAPI.IncomingGetParams; +export declare namespace IncomingResource { + export { + type Incoming as Incoming, + type IncomingCreateResponse as IncomingCreateResponse, + type IncomingUpdateResponse as IncomingUpdateResponse, + type IncomingDeleteResponse as IncomingDeleteResponse, + type IncomingGetResponse as IncomingGetResponse, + type IncomingCreateParams as IncomingCreateParams, + type IncomingUpdateParams as IncomingUpdateParams, + type IncomingDeleteParams as IncomingDeleteParams, + type IncomingGetParams as IncomingGetParams, + }; } diff --git a/src/resources/dns/zone-transfers/index.ts b/src/resources/dns/zone-transfers/index.ts new file mode 100644 index 0000000000..eaabf60acb --- /dev/null +++ b/src/resources/dns/zone-transfers/index.ts @@ -0,0 +1,68 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + ACLsSinglePage, + ACLs, + type ACL, + type ACLDeleteResponse, + type ACLCreateParams, + type ACLUpdateParams, + type ACLListParams, + type ACLDeleteParams, + type ACLGetParams, +} from './acls'; +export { ForceAXFRResource, type ForceAXFR, type ForceAXFRCreateParams } from './force-axfr'; +export { + IncomingResource, + type Incoming, + type IncomingCreateResponse, + type IncomingUpdateResponse, + type IncomingDeleteResponse, + type IncomingGetResponse, + type IncomingCreateParams, + type IncomingUpdateParams, + type IncomingDeleteParams, + type IncomingGetParams, +} from './incoming'; +export { + OutgoingResource, + type DisableTransfer, + type EnableTransfer, + type Outgoing, + type OutgoingStatus, + type OutgoingCreateResponse, + type OutgoingUpdateResponse, + type OutgoingDeleteResponse, + type OutgoingForceNotifyResponse, + type OutgoingGetResponse, + type OutgoingCreateParams, + type OutgoingUpdateParams, + type OutgoingDeleteParams, + type OutgoingDisableParams, + type OutgoingEnableParams, + type OutgoingForceNotifyParams, + type OutgoingGetParams, +} from './outgoing/index'; +export { + PeersSinglePage, + Peers, + type Peer, + type PeerDeleteResponse, + type PeerCreateParams, + type PeerUpdateParams, + type PeerListParams, + type PeerDeleteParams, + type PeerGetParams, +} from './peers'; +export { + TSIGsSinglePage, + TSIGs, + type TSIG, + type TSIGDeleteResponse, + type TSIGCreateParams, + type TSIGUpdateParams, + type TSIGListParams, + type TSIGDeleteParams, + type TSIGGetParams, +} from './tsigs'; +export { ZoneTransfers } from './zone-transfers'; diff --git a/src/resources/dns/zone-transfers/outgoing/index.ts b/src/resources/dns/zone-transfers/outgoing/index.ts new file mode 100644 index 0000000000..0cd49edd64 --- /dev/null +++ b/src/resources/dns/zone-transfers/outgoing/index.ts @@ -0,0 +1,22 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + OutgoingResource, + type DisableTransfer, + type EnableTransfer, + type Outgoing, + type OutgoingStatus, + type OutgoingCreateResponse, + type OutgoingUpdateResponse, + type OutgoingDeleteResponse, + type OutgoingForceNotifyResponse, + type OutgoingGetResponse, + type OutgoingCreateParams, + type OutgoingUpdateParams, + type OutgoingDeleteParams, + type OutgoingDisableParams, + type OutgoingEnableParams, + type OutgoingForceNotifyParams, + type OutgoingGetParams, +} from './outgoing'; +export { Status, type StatusGetParams } from './status'; diff --git a/src/resources/secondary-dns/outgoing/outgoing.ts b/src/resources/dns/zone-transfers/outgoing/outgoing.ts similarity index 81% rename from src/resources/secondary-dns/outgoing/outgoing.ts rename to src/resources/dns/zone-transfers/outgoing/outgoing.ts index 9a6b616ba0..a7dd05a120 100644 --- a/src/resources/secondary-dns/outgoing/outgoing.ts +++ b/src/resources/dns/zone-transfers/outgoing/outgoing.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as OutgoingAPI from './outgoing'; +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; import * as StatusAPI from './status'; +import { Status, StatusGetParams } from './status'; export class OutgoingResource extends APIResource { status: StatusAPI.Status = new StatusAPI.Status(this._client); @@ -145,7 +145,7 @@ export interface Outgoing { /** * A list of peer tags. */ - peers?: Array; + peers?: Array; /** * The serial number of the SOA for the given zone. @@ -184,7 +184,7 @@ export interface OutgoingCreateResponse { /** * A list of peer tags. */ - peers?: Array; + peers?: Array; /** * The serial number of the SOA for the given zone. @@ -218,7 +218,7 @@ export interface OutgoingUpdateResponse { /** * A list of peer tags. */ - peers?: Array; + peers?: Array; /** * The serial number of the SOA for the given zone. @@ -262,7 +262,7 @@ export interface OutgoingGetResponse { /** * A list of peer tags. */ - peers?: Array; + peers?: Array; /** * The serial number of the SOA for the given zone. @@ -284,7 +284,7 @@ export interface OutgoingCreateParams { /** * Body param: A list of peer tags. */ - peers: Array; + peers: Array; } export interface OutgoingUpdateParams { @@ -301,7 +301,7 @@ export interface OutgoingUpdateParams { /** * Body param: A list of peer tags. */ - peers: Array; + peers: Array; } export interface OutgoingDeleteParams { @@ -348,23 +348,27 @@ export interface OutgoingGetParams { zone_id: string; } -export namespace OutgoingResource { - export import DisableTransfer = OutgoingAPI.DisableTransfer; - export import EnableTransfer = OutgoingAPI.EnableTransfer; - export import Outgoing = OutgoingAPI.Outgoing; - export import OutgoingStatus = OutgoingAPI.OutgoingStatus; - export import OutgoingCreateResponse = OutgoingAPI.OutgoingCreateResponse; - export import OutgoingUpdateResponse = OutgoingAPI.OutgoingUpdateResponse; - export import OutgoingDeleteResponse = OutgoingAPI.OutgoingDeleteResponse; - export import OutgoingForceNotifyResponse = OutgoingAPI.OutgoingForceNotifyResponse; - export import OutgoingGetResponse = OutgoingAPI.OutgoingGetResponse; - export import OutgoingCreateParams = OutgoingAPI.OutgoingCreateParams; - export import OutgoingUpdateParams = OutgoingAPI.OutgoingUpdateParams; - export import OutgoingDeleteParams = OutgoingAPI.OutgoingDeleteParams; - export import OutgoingDisableParams = OutgoingAPI.OutgoingDisableParams; - export import OutgoingEnableParams = OutgoingAPI.OutgoingEnableParams; - export import OutgoingForceNotifyParams = OutgoingAPI.OutgoingForceNotifyParams; - export import OutgoingGetParams = OutgoingAPI.OutgoingGetParams; - export import Status = StatusAPI.Status; - export import StatusGetParams = StatusAPI.StatusGetParams; +OutgoingResource.Status = Status; + +export declare namespace OutgoingResource { + export { + type DisableTransfer as DisableTransfer, + type EnableTransfer as EnableTransfer, + type Outgoing as Outgoing, + type OutgoingStatus as OutgoingStatus, + type OutgoingCreateResponse as OutgoingCreateResponse, + type OutgoingUpdateResponse as OutgoingUpdateResponse, + type OutgoingDeleteResponse as OutgoingDeleteResponse, + type OutgoingForceNotifyResponse as OutgoingForceNotifyResponse, + type OutgoingGetResponse as OutgoingGetResponse, + type OutgoingCreateParams as OutgoingCreateParams, + type OutgoingUpdateParams as OutgoingUpdateParams, + type OutgoingDeleteParams as OutgoingDeleteParams, + type OutgoingDisableParams as OutgoingDisableParams, + type OutgoingEnableParams as OutgoingEnableParams, + type OutgoingForceNotifyParams as OutgoingForceNotifyParams, + type OutgoingGetParams as OutgoingGetParams, + }; + + export { Status as Status, type StatusGetParams as StatusGetParams }; } diff --git a/src/resources/secondary-dns/outgoing/status.ts b/src/resources/dns/zone-transfers/outgoing/status.ts similarity index 75% rename from src/resources/secondary-dns/outgoing/status.ts rename to src/resources/dns/zone-transfers/outgoing/status.ts index e244b7945a..e47bc7df5c 100644 --- a/src/resources/secondary-dns/outgoing/status.ts +++ b/src/resources/dns/zone-transfers/outgoing/status.ts @@ -1,8 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as StatusAPI from './status'; +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; import * as OutgoingAPI from './outgoing'; export class Status extends APIResource { @@ -23,6 +22,6 @@ export interface StatusGetParams { zone_id: string; } -export namespace Status { - export import StatusGetParams = StatusAPI.StatusGetParams; +export declare namespace Status { + export { type StatusGetParams as StatusGetParams }; } diff --git a/src/resources/secondary-dns/peers.ts b/src/resources/dns/zone-transfers/peers.ts similarity index 84% rename from src/resources/secondary-dns/peers.ts rename to src/resources/dns/zone-transfers/peers.ts index 46be80df78..2370f0e27d 100644 --- a/src/resources/secondary-dns/peers.ts +++ b/src/resources/dns/zone-transfers/peers.ts @@ -1,19 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as PeersAPI from './peers'; -import { SinglePage } from '../../pagination'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { SinglePage } from '../../../pagination'; export class Peers extends APIResource { /** * Create Peer. */ create(params: PeerCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/secondary_dns/peers`, { - body: body, + body, ...options, }) as Core.APIPromise<{ result: Peer }> )._thenUnwrap((obj) => obj.result); @@ -118,9 +117,9 @@ export interface PeerCreateParams { account_id: string; /** - * Body param: + * Body param: The name of the peer. */ - body: unknown; + name: string; } export interface PeerUpdateParams { @@ -173,13 +172,17 @@ export interface PeerGetParams { account_id: string; } -export namespace Peers { - export import Peer = PeersAPI.Peer; - export import PeerDeleteResponse = PeersAPI.PeerDeleteResponse; - export import PeersSinglePage = PeersAPI.PeersSinglePage; - export import PeerCreateParams = PeersAPI.PeerCreateParams; - export import PeerUpdateParams = PeersAPI.PeerUpdateParams; - export import PeerListParams = PeersAPI.PeerListParams; - export import PeerDeleteParams = PeersAPI.PeerDeleteParams; - export import PeerGetParams = PeersAPI.PeerGetParams; +Peers.PeersSinglePage = PeersSinglePage; + +export declare namespace Peers { + export { + type Peer as Peer, + type PeerDeleteResponse as PeerDeleteResponse, + PeersSinglePage as PeersSinglePage, + type PeerCreateParams as PeerCreateParams, + type PeerUpdateParams as PeerUpdateParams, + type PeerListParams as PeerListParams, + type PeerDeleteParams as PeerDeleteParams, + type PeerGetParams as PeerGetParams, + }; } diff --git a/src/resources/secondary-dns/tsigs.ts b/src/resources/dns/zone-transfers/tsigs.ts similarity index 82% rename from src/resources/secondary-dns/tsigs.ts rename to src/resources/dns/zone-transfers/tsigs.ts index 203112c56e..889afad783 100644 --- a/src/resources/secondary-dns/tsigs.ts +++ b/src/resources/dns/zone-transfers/tsigs.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as TSIGsAPI from './tsigs'; -import { SinglePage } from '../../pagination'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { SinglePage } from '../../../pagination'; export class TSIGs extends APIResource { /** @@ -151,13 +150,17 @@ export interface TSIGGetParams { account_id: string; } -export namespace TSIGs { - export import TSIG = TSIGsAPI.TSIG; - export import TSIGDeleteResponse = TSIGsAPI.TSIGDeleteResponse; - export import TSIGsSinglePage = TSIGsAPI.TSIGsSinglePage; - export import TSIGCreateParams = TSIGsAPI.TSIGCreateParams; - export import TSIGUpdateParams = TSIGsAPI.TSIGUpdateParams; - export import TSIGListParams = TSIGsAPI.TSIGListParams; - export import TSIGDeleteParams = TSIGsAPI.TSIGDeleteParams; - export import TSIGGetParams = TSIGsAPI.TSIGGetParams; +TSIGs.TSIGsSinglePage = TSIGsSinglePage; + +export declare namespace TSIGs { + export { + type TSIG as TSIG, + type TSIGDeleteResponse as TSIGDeleteResponse, + TSIGsSinglePage as TSIGsSinglePage, + type TSIGCreateParams as TSIGCreateParams, + type TSIGUpdateParams as TSIGUpdateParams, + type TSIGListParams as TSIGListParams, + type TSIGDeleteParams as TSIGDeleteParams, + type TSIGGetParams as TSIGGetParams, + }; } diff --git a/src/resources/dns/zone-transfers/zone-transfers.ts b/src/resources/dns/zone-transfers/zone-transfers.ts new file mode 100644 index 0000000000..32e4c523b6 --- /dev/null +++ b/src/resources/dns/zone-transfers/zone-transfers.ts @@ -0,0 +1,170 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as ACLsAPI from './acls'; +import { + ACL, + ACLCreateParams, + ACLDeleteParams, + ACLDeleteResponse, + ACLGetParams, + ACLListParams, + ACLUpdateParams, + ACLs, + ACLsSinglePage, +} from './acls'; +import * as ForceAXFRAPI from './force-axfr'; +import { ForceAXFR, ForceAXFRCreateParams, ForceAXFRResource } from './force-axfr'; +import * as IncomingAPI from './incoming'; +import { + Incoming, + IncomingCreateParams, + IncomingCreateResponse, + IncomingDeleteParams, + IncomingDeleteResponse, + IncomingGetParams, + IncomingGetResponse, + IncomingResource, + IncomingUpdateParams, + IncomingUpdateResponse, +} from './incoming'; +import * as PeersAPI from './peers'; +import { + Peer, + PeerCreateParams, + PeerDeleteParams, + PeerDeleteResponse, + PeerGetParams, + PeerListParams, + PeerUpdateParams, + Peers, + PeersSinglePage, +} from './peers'; +import * as TSIGsAPI from './tsigs'; +import { + TSIG, + TSIGCreateParams, + TSIGDeleteParams, + TSIGDeleteResponse, + TSIGGetParams, + TSIGListParams, + TSIGUpdateParams, + TSIGs, + TSIGsSinglePage, +} from './tsigs'; +import * as OutgoingAPI from './outgoing/outgoing'; +import { + DisableTransfer, + EnableTransfer, + Outgoing, + OutgoingCreateParams, + OutgoingCreateResponse, + OutgoingDeleteParams, + OutgoingDeleteResponse, + OutgoingDisableParams, + OutgoingEnableParams, + OutgoingForceNotifyParams, + OutgoingForceNotifyResponse, + OutgoingGetParams, + OutgoingGetResponse, + OutgoingResource, + OutgoingStatus, + OutgoingUpdateParams, + OutgoingUpdateResponse, +} from './outgoing/outgoing'; + +export class ZoneTransfers extends APIResource { + forceAXFR: ForceAXFRAPI.ForceAXFRResource = new ForceAXFRAPI.ForceAXFRResource(this._client); + incoming: IncomingAPI.IncomingResource = new IncomingAPI.IncomingResource(this._client); + outgoing: OutgoingAPI.OutgoingResource = new OutgoingAPI.OutgoingResource(this._client); + acls: ACLsAPI.ACLs = new ACLsAPI.ACLs(this._client); + peers: PeersAPI.Peers = new PeersAPI.Peers(this._client); + tsigs: TSIGsAPI.TSIGs = new TSIGsAPI.TSIGs(this._client); +} + +ZoneTransfers.ForceAXFRResource = ForceAXFRResource; +ZoneTransfers.IncomingResource = IncomingResource; +ZoneTransfers.OutgoingResource = OutgoingResource; +ZoneTransfers.ACLs = ACLs; +ZoneTransfers.ACLsSinglePage = ACLsSinglePage; +ZoneTransfers.Peers = Peers; +ZoneTransfers.PeersSinglePage = PeersSinglePage; +ZoneTransfers.TSIGs = TSIGs; +ZoneTransfers.TSIGsSinglePage = TSIGsSinglePage; + +export declare namespace ZoneTransfers { + export { + ForceAXFRResource as ForceAXFRResource, + type ForceAXFR as ForceAXFR, + type ForceAXFRCreateParams as ForceAXFRCreateParams, + }; + + export { + IncomingResource as IncomingResource, + type Incoming as Incoming, + type IncomingCreateResponse as IncomingCreateResponse, + type IncomingUpdateResponse as IncomingUpdateResponse, + type IncomingDeleteResponse as IncomingDeleteResponse, + type IncomingGetResponse as IncomingGetResponse, + type IncomingCreateParams as IncomingCreateParams, + type IncomingUpdateParams as IncomingUpdateParams, + type IncomingDeleteParams as IncomingDeleteParams, + type IncomingGetParams as IncomingGetParams, + }; + + export { + OutgoingResource as OutgoingResource, + type DisableTransfer as DisableTransfer, + type EnableTransfer as EnableTransfer, + type Outgoing as Outgoing, + type OutgoingStatus as OutgoingStatus, + type OutgoingCreateResponse as OutgoingCreateResponse, + type OutgoingUpdateResponse as OutgoingUpdateResponse, + type OutgoingDeleteResponse as OutgoingDeleteResponse, + type OutgoingForceNotifyResponse as OutgoingForceNotifyResponse, + type OutgoingGetResponse as OutgoingGetResponse, + type OutgoingCreateParams as OutgoingCreateParams, + type OutgoingUpdateParams as OutgoingUpdateParams, + type OutgoingDeleteParams as OutgoingDeleteParams, + type OutgoingDisableParams as OutgoingDisableParams, + type OutgoingEnableParams as OutgoingEnableParams, + type OutgoingForceNotifyParams as OutgoingForceNotifyParams, + type OutgoingGetParams as OutgoingGetParams, + }; + + export { + ACLs as ACLs, + type ACL as ACL, + type ACLDeleteResponse as ACLDeleteResponse, + ACLsSinglePage as ACLsSinglePage, + type ACLCreateParams as ACLCreateParams, + type ACLUpdateParams as ACLUpdateParams, + type ACLListParams as ACLListParams, + type ACLDeleteParams as ACLDeleteParams, + type ACLGetParams as ACLGetParams, + }; + + export { + Peers as Peers, + type Peer as Peer, + type PeerDeleteResponse as PeerDeleteResponse, + PeersSinglePage as PeersSinglePage, + type PeerCreateParams as PeerCreateParams, + type PeerUpdateParams as PeerUpdateParams, + type PeerListParams as PeerListParams, + type PeerDeleteParams as PeerDeleteParams, + type PeerGetParams as PeerGetParams, + }; + + export { + TSIGs as TSIGs, + type TSIG as TSIG, + type TSIGDeleteResponse as TSIGDeleteResponse, + TSIGsSinglePage as TSIGsSinglePage, + type TSIGCreateParams as TSIGCreateParams, + type TSIGUpdateParams as TSIGUpdateParams, + type TSIGListParams as TSIGListParams, + type TSIGDeleteParams as TSIGDeleteParams, + type TSIGGetParams as TSIGGetParams, + }; +} diff --git a/src/resources/durable-objects/durable-objects.ts b/src/resources/durable-objects/durable-objects.ts index a79041c6f0..0fb700ec65 100644 --- a/src/resources/durable-objects/durable-objects.ts +++ b/src/resources/durable-objects/durable-objects.ts @@ -2,14 +2,20 @@ import { APIResource } from '../../resource'; import * as NamespacesAPI from './namespaces/namespaces'; +import { Namespace, NamespaceListParams, Namespaces, NamespacesSinglePage } from './namespaces/namespaces'; export class DurableObjects extends APIResource { namespaces: NamespacesAPI.Namespaces = new NamespacesAPI.Namespaces(this._client); } -export namespace DurableObjects { - export import Namespaces = NamespacesAPI.Namespaces; - export import Namespace = NamespacesAPI.Namespace; - export import NamespacesSinglePage = NamespacesAPI.NamespacesSinglePage; - export import NamespaceListParams = NamespacesAPI.NamespaceListParams; +DurableObjects.Namespaces = Namespaces; +DurableObjects.NamespacesSinglePage = NamespacesSinglePage; + +export declare namespace DurableObjects { + export { + Namespaces as Namespaces, + type Namespace as Namespace, + NamespacesSinglePage as NamespacesSinglePage, + type NamespaceListParams as NamespaceListParams, + }; } diff --git a/src/resources/durable-objects/index.ts b/src/resources/durable-objects/index.ts index bbf88b4e01..9ad42425bf 100644 --- a/src/resources/durable-objects/index.ts +++ b/src/resources/durable-objects/index.ts @@ -1,4 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { DurableObjects } from './durable-objects'; -export { Namespace, NamespaceListParams, NamespacesSinglePage, Namespaces } from './namespaces/index'; +export { + NamespacesSinglePage, + Namespaces, + type Namespace, + type NamespaceListParams, +} from './namespaces/index'; diff --git a/src/resources/durable-objects/namespaces/index.ts b/src/resources/durable-objects/namespaces/index.ts index 456b5e106c..eb373cf46d 100644 --- a/src/resources/durable-objects/namespaces/index.ts +++ b/src/resources/durable-objects/namespaces/index.ts @@ -1,4 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { DurableObject, ObjectListParams, DurableObjectsCursorLimitPagination, Objects } from './objects'; -export { Namespace, NamespaceListParams, NamespacesSinglePage, Namespaces } from './namespaces'; +export { + DurableObjectsCursorLimitPagination, + Objects, + type DurableObject, + type ObjectListParams, +} from './objects'; +export { NamespacesSinglePage, Namespaces, type Namespace, type NamespaceListParams } from './namespaces'; diff --git a/src/resources/durable-objects/namespaces/namespaces.ts b/src/resources/durable-objects/namespaces/namespaces.ts index d5f37ea204..ca1cf78b5a 100644 --- a/src/resources/durable-objects/namespaces/namespaces.ts +++ b/src/resources/durable-objects/namespaces/namespaces.ts @@ -2,8 +2,8 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as NamespacesAPI from './namespaces'; import * as ObjectsAPI from './objects'; +import { DurableObject, DurableObjectsCursorLimitPagination, ObjectListParams, Objects } from './objects'; import { SinglePage } from '../../../pagination'; export class Namespaces extends APIResource { @@ -28,13 +28,15 @@ export class Namespaces extends APIResource { export class NamespacesSinglePage extends SinglePage {} export interface Namespace { - id?: unknown; + id?: string; - class?: unknown; + class?: string; - name?: unknown; + name?: string; - script?: unknown; + script?: string; + + use_sqlite?: boolean; } export interface NamespaceListParams { @@ -44,12 +46,21 @@ export interface NamespaceListParams { account_id: string; } -export namespace Namespaces { - export import Namespace = NamespacesAPI.Namespace; - export import NamespacesSinglePage = NamespacesAPI.NamespacesSinglePage; - export import NamespaceListParams = NamespacesAPI.NamespaceListParams; - export import Objects = ObjectsAPI.Objects; - export import DurableObject = ObjectsAPI.DurableObject; - export import DurableObjectsCursorLimitPagination = ObjectsAPI.DurableObjectsCursorLimitPagination; - export import ObjectListParams = ObjectsAPI.ObjectListParams; +Namespaces.NamespacesSinglePage = NamespacesSinglePage; +Namespaces.Objects = Objects; +Namespaces.DurableObjectsCursorLimitPagination = DurableObjectsCursorLimitPagination; + +export declare namespace Namespaces { + export { + type Namespace as Namespace, + NamespacesSinglePage as NamespacesSinglePage, + type NamespaceListParams as NamespaceListParams, + }; + + export { + Objects as Objects, + type DurableObject as DurableObject, + DurableObjectsCursorLimitPagination as DurableObjectsCursorLimitPagination, + type ObjectListParams as ObjectListParams, + }; } diff --git a/src/resources/durable-objects/namespaces/objects.ts b/src/resources/durable-objects/namespaces/objects.ts index 98ac0fa7c4..ef4d1b0659 100644 --- a/src/resources/durable-objects/namespaces/objects.ts +++ b/src/resources/durable-objects/namespaces/objects.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ObjectsAPI from './objects'; import { CursorLimitPagination, type CursorLimitPaginationParams } from '../../../pagination'; export class Objects extends APIResource { @@ -44,8 +43,12 @@ export interface ObjectListParams extends CursorLimitPaginationParams { account_id: string; } -export namespace Objects { - export import DurableObject = ObjectsAPI.DurableObject; - export import DurableObjectsCursorLimitPagination = ObjectsAPI.DurableObjectsCursorLimitPagination; - export import ObjectListParams = ObjectsAPI.ObjectListParams; +Objects.DurableObjectsCursorLimitPagination = DurableObjectsCursorLimitPagination; + +export declare namespace Objects { + export { + type DurableObject as DurableObject, + DurableObjectsCursorLimitPagination as DurableObjectsCursorLimitPagination, + type ObjectListParams as ObjectListParams, + }; } diff --git a/src/resources/email-routing/addresses.ts b/src/resources/email-routing/addresses.ts index f939d15e54..06e4291c0f 100644 --- a/src/resources/email-routing/addresses.ts +++ b/src/resources/email-routing/addresses.ts @@ -1,9 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as AddressesAPI from './addresses'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class Addresses extends APIResource { @@ -11,13 +9,10 @@ export class Addresses extends APIResource { * Create a destination address to forward your emails to. Destination addresses * need to be verified before they can be used. */ - create( - accountIdentifier: string, - body: AddressCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise
{ + create(params: AddressCreateParams, options?: Core.RequestOptions): Core.APIPromise
{ + const { account_id, ...body } = params; return ( - this._client.post(`/accounts/${accountIdentifier}/email/routing/addresses`, { + this._client.post(`/accounts/${account_id}/email/routing/addresses`, { body, ...options, }) as Core.APIPromise<{ result: Address }> @@ -28,24 +23,12 @@ export class Addresses extends APIResource { * Lists existing destination addresses. */ list( - accountIdentifier: string, - query?: AddressListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - accountIdentifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - accountIdentifier: string, - query: AddressListParams | Core.RequestOptions = {}, + params: AddressListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(accountIdentifier, {}, query); - } + const { account_id, ...query } = params; return this._client.getAPIList( - `/accounts/${accountIdentifier}/email/routing/addresses`, + `/accounts/${account_id}/email/routing/addresses`, AddressesV4PagePaginationArray, { query, ...options }, ); @@ -55,13 +38,14 @@ export class Addresses extends APIResource { * Deletes a specific destination address. */ delete( - accountIdentifier: string, destinationAddressIdentifier: string, + params: AddressDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise
{ + const { account_id } = params; return ( this._client.delete( - `/accounts/${accountIdentifier}/email/routing/addresses/${destinationAddressIdentifier}`, + `/accounts/${account_id}/email/routing/addresses/${destinationAddressIdentifier}`, options, ) as Core.APIPromise<{ result: Address }> )._thenUnwrap((obj) => obj.result); @@ -71,13 +55,14 @@ export class Addresses extends APIResource { * Gets information for a specific destination email already created. */ get( - accountIdentifier: string, destinationAddressIdentifier: string, + params: AddressGetParams, options?: Core.RequestOptions, ): Core.APIPromise
{ + const { account_id } = params; return ( this._client.get( - `/accounts/${accountIdentifier}/email/routing/addresses/${destinationAddressIdentifier}`, + `/accounts/${account_id}/email/routing/addresses/${destinationAddressIdentifier}`, options, ) as Core.APIPromise<{ result: Address }> )._thenUnwrap((obj) => obj.result); @@ -122,26 +107,56 @@ export interface Address { export interface AddressCreateParams { /** - * The contact email address of the user. + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: The contact email address of the user. */ email: string; } export interface AddressListParams extends V4PagePaginationArrayParams { /** - * Sorts results in an ascending or descending order. + * Path param: Identifier + */ + account_id: string; + + /** + * Query param: Sorts results in an ascending or descending order. */ direction?: 'asc' | 'desc'; /** - * Filter by verified destination addresses. + * Query param: Filter by verified destination addresses. */ verified?: true | false; } -export namespace Addresses { - export import Address = AddressesAPI.Address; - export import AddressesV4PagePaginationArray = AddressesAPI.AddressesV4PagePaginationArray; - export import AddressCreateParams = AddressesAPI.AddressCreateParams; - export import AddressListParams = AddressesAPI.AddressListParams; +export interface AddressDeleteParams { + /** + * Identifier + */ + account_id: string; +} + +export interface AddressGetParams { + /** + * Identifier + */ + account_id: string; +} + +Addresses.AddressesV4PagePaginationArray = AddressesV4PagePaginationArray; + +export declare namespace Addresses { + export { + type Address as Address, + AddressesV4PagePaginationArray as AddressesV4PagePaginationArray, + type AddressCreateParams as AddressCreateParams, + type AddressListParams as AddressListParams, + type AddressDeleteParams as AddressDeleteParams, + type AddressGetParams as AddressGetParams, + }; } diff --git a/src/resources/email-routing/dns.ts b/src/resources/email-routing/dns.ts index 3f0ad71534..216ae952fe 100644 --- a/src/resources/email-routing/dns.ts +++ b/src/resources/email-routing/dns.ts @@ -3,18 +3,50 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as DNSAPI from './dns'; +import * as Shared from '../shared'; +import * as EmailRoutingAPI from './email-routing'; export class DNS extends APIResource { /** - * Show the DNS records needed to configure your Email Routing zone. + * Enable you Email Routing zone. Add and lock the necessary MX and SPF records. + */ + create(params: DNSCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/email/routing/dns`, { body, ...options }) as Core.APIPromise<{ + result: EmailRoutingAPI.Settings; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Disable your Email Routing zone. Also removes additional MX records previously + * required for Email Routing to work. + */ + delete(params: DNSDeleteParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return this._client.delete(`/zones/${zone_id}/email/routing/dns`, options); + } + + /** + * Unlock MX Records previously locked by Email Routing. */ - get(zoneIdentifier: string, options?: Core.RequestOptions): Core.APIPromise { + edit(params: DNSEditParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/email/routing/dns`, options) as Core.APIPromise<{ - result: DNSGetResponse | null; + this._client.patch(`/zones/${zone_id}/email/routing/dns`, { body, ...options }) as Core.APIPromise<{ + result: EmailRoutingAPI.Settings; }> )._thenUnwrap((obj) => obj.result); } + + /** + * Show the DNS records needed to configure your Email Routing zone. + */ + get(params: DNSGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...query } = params; + return this._client.get(`/zones/${zone_id}/email/routing/dns`, { query, ...options }); + } } /** @@ -67,9 +99,214 @@ export interface DNSRecord { | 'URI'; } -export type DNSGetResponse = Array; +export type DNSDeleteResponse = + | DNSDeleteResponse.EmailAPIResponseCommon + | DNSDeleteResponse.EmailDNSSettingsResponseCollection; + +export namespace DNSDeleteResponse { + export interface EmailAPIResponseCommon { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + } + + export interface EmailDNSSettingsResponseCollection { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result?: Array; + + result_info?: EmailDNSSettingsResponseCollection.ResultInfo; + } + + export namespace EmailDNSSettingsResponseCollection { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } + } +} + +export type DNSGetResponse = + | DNSGetResponse.EmailEmailRoutingDNSQueryResponse + | DNSGetResponse.EmailDNSSettingsResponseCollection; + +export namespace DNSGetResponse { + export interface EmailEmailRoutingDNSQueryResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result?: EmailEmailRoutingDNSQueryResponse.Result; + + result_info?: EmailEmailRoutingDNSQueryResponse.ResultInfo; + } + + export namespace EmailEmailRoutingDNSQueryResponse { + export interface Result { + errors?: Array; + + record?: Array; + } + + export namespace Result { + export interface Error { + code?: string; + + /** + * List of records needed to enable an Email Routing zone. + */ + missing?: DNSAPI.DNSRecord; + } + } + + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } + } + + export interface EmailDNSSettingsResponseCollection { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; + + result?: Array; + + result_info?: EmailDNSSettingsResponseCollection.ResultInfo; + } + + export namespace EmailDNSSettingsResponseCollection { + export interface ResultInfo { + /** + * Total number of results for the requested service + */ + count?: number; + + /** + * Current page within paginated list of results + */ + page?: number; + + /** + * Number of results per page of results + */ + per_page?: number; + + /** + * Total results available without any search parameters + */ + total_count?: number; + } + } +} + +export interface DNSCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Domain of your zone. + */ + name: string; +} + +export interface DNSDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface DNSEditParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Domain of your zone. + */ + name: string; +} + +export interface DNSGetParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Domain of your zone. + */ + subdomain?: string; +} -export namespace DNS { - export import DNSRecord = DNSAPI.DNSRecord; - export import DNSGetResponse = DNSAPI.DNSGetResponse; +export declare namespace DNS { + export { + type DNSRecord as DNSRecord, + type DNSDeleteResponse as DNSDeleteResponse, + type DNSGetResponse as DNSGetResponse, + type DNSCreateParams as DNSCreateParams, + type DNSDeleteParams as DNSDeleteParams, + type DNSEditParams as DNSEditParams, + type DNSGetParams as DNSGetParams, + }; } diff --git a/src/resources/email-routing/email-routing.ts b/src/resources/email-routing/email-routing.ts index c537495118..b42b67f0b9 100644 --- a/src/resources/email-routing/email-routing.ts +++ b/src/resources/email-routing/email-routing.ts @@ -3,8 +3,39 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as AddressesAPI from './addresses'; +import { + Address, + AddressCreateParams, + AddressDeleteParams, + AddressGetParams, + AddressListParams, + Addresses, + AddressesV4PagePaginationArray, +} from './addresses'; import * as DNSAPI from './dns'; +import { + DNS, + DNSCreateParams, + DNSDeleteParams, + DNSDeleteResponse, + DNSEditParams, + DNSGetParams, + DNSGetResponse, + DNSRecord, +} from './dns'; import * as RulesAPI from './rules/rules'; +import { + Action, + EmailRoutingRule, + EmailRoutingRulesV4PagePaginationArray, + Matcher, + RuleCreateParams, + RuleDeleteParams, + RuleGetParams, + RuleListParams, + RuleUpdateParams, + Rules, +} from './rules/rules'; export class EmailRouting extends APIResource { dns: DNSAPI.DNS = new DNSAPI.DNS(this._client); @@ -15,14 +46,11 @@ export class EmailRouting extends APIResource { * Disable your Email Routing zone. Also removes additional MX records previously * required for Email Routing to work. */ - disable( - zoneIdentifier: string, - body: EmailRoutingDisableParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + disable(params: EmailRoutingDisableParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/email/routing/disable`, { - body, + this._client.post(`/zones/${zone_id}/email/routing/disable`, { + body: body, ...options, }) as Core.APIPromise<{ result: Settings }> )._thenUnwrap((obj) => obj.result); @@ -31,14 +59,11 @@ export class EmailRouting extends APIResource { /** * Enable you Email Routing zone. Add and lock the necessary MX and SPF records. */ - enable( - zoneIdentifier: string, - body: EmailRoutingEnableParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + enable(params: EmailRoutingEnableParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/email/routing/enable`, { - body, + this._client.post(`/zones/${zone_id}/email/routing/enable`, { + body: body, ...options, }) as Core.APIPromise<{ result: Settings }> )._thenUnwrap((obj) => obj.result); @@ -47,11 +72,10 @@ export class EmailRouting extends APIResource { /** * Get information about the settings for your Email Routing zone. */ - get(zoneIdentifier: string, options?: Core.RequestOptions): Core.APIPromise { + get(params: EmailRoutingGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/email/routing`, options) as Core.APIPromise<{ - result: Settings; - }> + this._client.get(`/zones/${zone_id}/email/routing`, options) as Core.APIPromise<{ result: Settings }> )._thenUnwrap((obj) => obj.result); } } @@ -60,27 +84,27 @@ export interface Settings { /** * Email Routing settings identifier. */ - id?: string; + id: string; /** - * The date and time the settings have been created. + * State of the zone settings for Email Routing. */ - created?: string; + enabled: true | false; /** - * State of the zone settings for Email Routing. + * Domain of your zone. */ - enabled?: true | false; + name: string; /** - * The date and time the settings have been modified. + * The date and time the settings have been created. */ - modified?: string; + created?: string; /** - * Domain of your zone. + * The date and time the settings have been modified. */ - name?: string; + modified?: string; /** * Flag to check if the user skipped the configuration wizard. @@ -99,25 +123,75 @@ export interface Settings { tag?: string; } -export type EmailRoutingDisableParams = unknown; - -export type EmailRoutingEnableParams = unknown; - -export namespace EmailRouting { - export import DNS = DNSAPI.DNS; - export import DNSRecord = DNSAPI.DNSRecord; - export import DNSGetResponse = DNSAPI.DNSGetResponse; - export import Rules = RulesAPI.Rules; - export import Action = RulesAPI.Action; - export import EmailRoutingRule = RulesAPI.EmailRoutingRule; - export import Matcher = RulesAPI.Matcher; - export import EmailRoutingRulesV4PagePaginationArray = RulesAPI.EmailRoutingRulesV4PagePaginationArray; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; - export import Addresses = AddressesAPI.Addresses; - export import Address = AddressesAPI.Address; - export import AddressesV4PagePaginationArray = AddressesAPI.AddressesV4PagePaginationArray; - export import AddressCreateParams = AddressesAPI.AddressCreateParams; - export import AddressListParams = AddressesAPI.AddressListParams; +export interface EmailRoutingDisableParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + body: unknown; +} + +export interface EmailRoutingEnableParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + body: unknown; +} + +export interface EmailRoutingGetParams { + /** + * Identifier + */ + zone_id: string; +} + +EmailRouting.DNS = DNS; +EmailRouting.Rules = Rules; +EmailRouting.EmailRoutingRulesV4PagePaginationArray = EmailRoutingRulesV4PagePaginationArray; +EmailRouting.Addresses = Addresses; +EmailRouting.AddressesV4PagePaginationArray = AddressesV4PagePaginationArray; + +export declare namespace EmailRouting { + export { + DNS as DNS, + type DNSRecord as DNSRecord, + type DNSDeleteResponse as DNSDeleteResponse, + type DNSGetResponse as DNSGetResponse, + type DNSCreateParams as DNSCreateParams, + type DNSDeleteParams as DNSDeleteParams, + type DNSEditParams as DNSEditParams, + type DNSGetParams as DNSGetParams, + }; + + export { + Rules as Rules, + type Action as Action, + type EmailRoutingRule as EmailRoutingRule, + type Matcher as Matcher, + EmailRoutingRulesV4PagePaginationArray as EmailRoutingRulesV4PagePaginationArray, + type RuleCreateParams as RuleCreateParams, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleGetParams as RuleGetParams, + }; + + export { + Addresses as Addresses, + type Address as Address, + AddressesV4PagePaginationArray as AddressesV4PagePaginationArray, + type AddressCreateParams as AddressCreateParams, + type AddressListParams as AddressListParams, + type AddressDeleteParams as AddressDeleteParams, + type AddressGetParams as AddressGetParams, + }; } diff --git a/src/resources/email-routing/index.ts b/src/resources/email-routing/index.ts index 52bc9a59a3..4d05479877 100644 --- a/src/resources/email-routing/index.ts +++ b/src/resources/email-routing/index.ts @@ -1,21 +1,34 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Action, - EmailRoutingRule, - Matcher, - RuleCreateParams, - RuleUpdateParams, - RuleListParams, - EmailRoutingRulesV4PagePaginationArray, - Rules, -} from './rules/index'; -export { - Address, - AddressCreateParams, - AddressListParams, AddressesV4PagePaginationArray, Addresses, + type Address, + type AddressCreateParams, + type AddressListParams, + type AddressDeleteParams, + type AddressGetParams, } from './addresses'; -export { DNSRecord, DNSGetResponse, DNS } from './dns'; +export { + DNS, + type DNSRecord, + type DNSDeleteResponse, + type DNSGetResponse, + type DNSCreateParams, + type DNSDeleteParams, + type DNSEditParams, + type DNSGetParams, +} from './dns'; export { EmailRouting } from './email-routing'; +export { + EmailRoutingRulesV4PagePaginationArray, + Rules, + type Action, + type EmailRoutingRule, + type Matcher, + type RuleCreateParams, + type RuleUpdateParams, + type RuleListParams, + type RuleDeleteParams, + type RuleGetParams, +} from './rules/index'; diff --git a/src/resources/email-routing/rules/catch-alls.ts b/src/resources/email-routing/rules/catch-alls.ts index 2b7e328c2b..288d4ff0b2 100644 --- a/src/resources/email-routing/rules/catch-alls.ts +++ b/src/resources/email-routing/rules/catch-alls.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as CatchAllsAPI from './catch-alls'; export class CatchAlls extends APIResource { /** @@ -10,12 +9,12 @@ export class CatchAlls extends APIResource { * specific destination address. */ update( - zoneIdentifier: string, - body: CatchAllUpdateParams, + params: CatchAllUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.put(`/zones/${zoneIdentifier}/email/routing/rules/catch_all`, { + this._client.put(`/zones/${zone_id}/email/routing/rules/catch_all`, { body, ...options, }) as Core.APIPromise<{ result: CatchAllUpdateResponse }> @@ -25,9 +24,10 @@ export class CatchAlls extends APIResource { /** * Get information on the default catch-all routing rule. */ - get(zoneIdentifier: string, options?: Core.RequestOptions): Core.APIPromise { + get(params: CatchAllGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/email/routing/rules/catch_all`, options) as Core.APIPromise<{ + this._client.get(`/zones/${zone_id}/email/routing/rules/catch_all`, options) as Core.APIPromise<{ result: CatchAllGetResponse; }> )._thenUnwrap((obj) => obj.result); @@ -144,30 +144,45 @@ export interface CatchAllGetResponse { export interface CatchAllUpdateParams { /** - * List actions for the catch-all routing rule. + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: List actions for the catch-all routing rule. */ actions: Array; /** - * List of matchers for the catch-all routing rule. + * Body param: List of matchers for the catch-all routing rule. */ matchers: Array; /** - * Routing rule status. + * Body param: Routing rule status. */ enabled?: true | false; /** - * Routing rule name. + * Body param: Routing rule name. */ name?: string; } -export namespace CatchAlls { - export import CatchAllAction = CatchAllsAPI.CatchAllAction; - export import CatchAllMatcher = CatchAllsAPI.CatchAllMatcher; - export import CatchAllUpdateResponse = CatchAllsAPI.CatchAllUpdateResponse; - export import CatchAllGetResponse = CatchAllsAPI.CatchAllGetResponse; - export import CatchAllUpdateParams = CatchAllsAPI.CatchAllUpdateParams; +export interface CatchAllGetParams { + /** + * Identifier + */ + zone_id: string; +} + +export declare namespace CatchAlls { + export { + type CatchAllAction as CatchAllAction, + type CatchAllMatcher as CatchAllMatcher, + type CatchAllUpdateResponse as CatchAllUpdateResponse, + type CatchAllGetResponse as CatchAllGetResponse, + type CatchAllUpdateParams as CatchAllUpdateParams, + type CatchAllGetParams as CatchAllGetParams, + }; } diff --git a/src/resources/email-routing/rules/index.ts b/src/resources/email-routing/rules/index.ts index 5229ecd72e..a3d3d0d738 100644 --- a/src/resources/email-routing/rules/index.ts +++ b/src/resources/email-routing/rules/index.ts @@ -1,20 +1,23 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Action, - EmailRoutingRule, - Matcher, - RuleCreateParams, - RuleUpdateParams, - RuleListParams, + CatchAlls, + type CatchAllAction, + type CatchAllMatcher, + type CatchAllUpdateResponse, + type CatchAllGetResponse, + type CatchAllUpdateParams, + type CatchAllGetParams, +} from './catch-alls'; +export { EmailRoutingRulesV4PagePaginationArray, Rules, + type Action, + type EmailRoutingRule, + type Matcher, + type RuleCreateParams, + type RuleUpdateParams, + type RuleListParams, + type RuleDeleteParams, + type RuleGetParams, } from './rules'; -export { - CatchAllAction, - CatchAllMatcher, - CatchAllUpdateResponse, - CatchAllGetResponse, - CatchAllUpdateParams, - CatchAlls, -} from './catch-alls'; diff --git a/src/resources/email-routing/rules/rules.ts b/src/resources/email-routing/rules/rules.ts index 97d05b4968..208bff7aff 100644 --- a/src/resources/email-routing/rules/rules.ts +++ b/src/resources/email-routing/rules/rules.ts @@ -1,10 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as RulesAPI from './rules'; import * as CatchAllsAPI from './catch-alls'; +import { + CatchAllAction, + CatchAllGetParams, + CatchAllGetResponse, + CatchAllMatcher, + CatchAllUpdateParams, + CatchAllUpdateResponse, + CatchAlls, +} from './catch-alls'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; export class Rules extends APIResource { @@ -15,16 +22,12 @@ export class Rules extends APIResource { * sent to a specific custom email address) plus a set of actions to take on the * email (like forwarding it to a specific destination address). */ - create( - zoneIdentifier: string, - body: RuleCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + create(params: RuleCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/email/routing/rules`, { - body, - ...options, - }) as Core.APIPromise<{ result: EmailRoutingRule }> + this._client.post(`/zones/${zone_id}/email/routing/rules`, { body, ...options }) as Core.APIPromise<{ + result: EmailRoutingRule; + }> )._thenUnwrap((obj) => obj.result); } @@ -32,13 +35,13 @@ export class Rules extends APIResource { * Update actions and matches, or enable/disable specific routing rules. */ update( - zoneIdentifier: string, ruleIdentifier: string, - body: RuleUpdateParams, + params: RuleUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.put(`/zones/${zoneIdentifier}/email/routing/rules/${ruleIdentifier}`, { + this._client.put(`/zones/${zone_id}/email/routing/rules/${ruleIdentifier}`, { body, ...options, }) as Core.APIPromise<{ result: EmailRoutingRule }> @@ -49,24 +52,12 @@ export class Rules extends APIResource { * Lists existing routing rules. */ list( - zoneIdentifier: string, - query?: RuleListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - query: RuleListParams | Core.RequestOptions = {}, + params: RuleListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(zoneIdentifier, {}, query); - } + const { zone_id, ...query } = params; return this._client.getAPIList( - `/zones/${zoneIdentifier}/email/routing/rules`, + `/zones/${zone_id}/email/routing/rules`, EmailRoutingRulesV4PagePaginationArray, { query, ...options }, ); @@ -76,13 +67,14 @@ export class Rules extends APIResource { * Delete a specific routing rule. */ delete( - zoneIdentifier: string, ruleIdentifier: string, + params: RuleDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id } = params; return ( this._client.delete( - `/zones/${zoneIdentifier}/email/routing/rules/${ruleIdentifier}`, + `/zones/${zone_id}/email/routing/rules/${ruleIdentifier}`, options, ) as Core.APIPromise<{ result: EmailRoutingRule }> )._thenUnwrap((obj) => obj.result); @@ -92,13 +84,14 @@ export class Rules extends APIResource { * Get information for a specific routing rule already created. */ get( - zoneIdentifier: string, ruleIdentifier: string, + params: RuleGetParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id } = params; return ( this._client.get( - `/zones/${zoneIdentifier}/email/routing/rules/${ruleIdentifier}`, + `/zones/${zone_id}/email/routing/rules/${ruleIdentifier}`, options, ) as Core.APIPromise<{ result: EmailRoutingRule }> )._thenUnwrap((obj) => obj.result); @@ -210,77 +203,117 @@ export interface MatcherParam { export interface RuleCreateParams { /** - * List actions patterns. + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: List actions patterns. */ actions: Array; /** - * Matching patterns to forward to your actions. + * Body param: Matching patterns to forward to your actions. */ matchers: Array; /** - * Routing rule status. + * Body param: Routing rule status. */ enabled?: true | false; /** - * Routing rule name. + * Body param: Routing rule name. */ name?: string; /** - * Priority of the routing rule. + * Body param: Priority of the routing rule. */ priority?: number; } export interface RuleUpdateParams { /** - * List actions patterns. + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: List actions patterns. */ actions: Array; /** - * Matching patterns to forward to your actions. + * Body param: Matching patterns to forward to your actions. */ matchers: Array; /** - * Routing rule status. + * Body param: Routing rule status. */ enabled?: true | false; /** - * Routing rule name. + * Body param: Routing rule name. */ name?: string; /** - * Priority of the routing rule. + * Body param: Priority of the routing rule. */ priority?: number; } export interface RuleListParams extends V4PagePaginationArrayParams { /** - * Filter by enabled routing rules. + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Filter by enabled routing rules. */ enabled?: true | false; } -export namespace Rules { - export import Action = RulesAPI.Action; - export import EmailRoutingRule = RulesAPI.EmailRoutingRule; - export import Matcher = RulesAPI.Matcher; - export import EmailRoutingRulesV4PagePaginationArray = RulesAPI.EmailRoutingRulesV4PagePaginationArray; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; - export import CatchAlls = CatchAllsAPI.CatchAlls; - export import CatchAllAction = CatchAllsAPI.CatchAllAction; - export import CatchAllMatcher = CatchAllsAPI.CatchAllMatcher; - export import CatchAllUpdateResponse = CatchAllsAPI.CatchAllUpdateResponse; - export import CatchAllGetResponse = CatchAllsAPI.CatchAllGetResponse; - export import CatchAllUpdateParams = CatchAllsAPI.CatchAllUpdateParams; +export interface RuleDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface RuleGetParams { + /** + * Identifier + */ + zone_id: string; +} + +Rules.EmailRoutingRulesV4PagePaginationArray = EmailRoutingRulesV4PagePaginationArray; +Rules.CatchAlls = CatchAlls; + +export declare namespace Rules { + export { + type Action as Action, + type EmailRoutingRule as EmailRoutingRule, + type Matcher as Matcher, + EmailRoutingRulesV4PagePaginationArray as EmailRoutingRulesV4PagePaginationArray, + type RuleCreateParams as RuleCreateParams, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleGetParams as RuleGetParams, + }; + + export { + CatchAlls as CatchAlls, + type CatchAllAction as CatchAllAction, + type CatchAllMatcher as CatchAllMatcher, + type CatchAllUpdateResponse as CatchAllUpdateResponse, + type CatchAllGetResponse as CatchAllGetResponse, + type CatchAllUpdateParams as CatchAllUpdateParams, + type CatchAllGetParams as CatchAllGetParams, + }; } diff --git a/src/resources/email-security/email-security.ts b/src/resources/email-security/email-security.ts new file mode 100644 index 0000000000..36038ed702 --- /dev/null +++ b/src/resources/email-security/email-security.ts @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as SubmissionsAPI from './submissions'; +import { + SubmissionListParams, + SubmissionListResponse, + SubmissionListResponsesV4PagePaginationArray, + Submissions, +} from './submissions'; +import * as InvestigateAPI from './investigate/investigate'; +import { + Investigate, + InvestigateGetParams, + InvestigateGetResponse, + InvestigateListParams, + InvestigateListResponse, + InvestigateListResponsesV4PagePaginationArray, +} from './investigate/investigate'; +import * as SettingsAPI from './settings/settings'; +import { Settings } from './settings/settings'; + +export class EmailSecurity extends APIResource { + investigate: InvestigateAPI.Investigate = new InvestigateAPI.Investigate(this._client); + settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); + submissions: SubmissionsAPI.Submissions = new SubmissionsAPI.Submissions(this._client); +} + +EmailSecurity.Investigate = Investigate; +EmailSecurity.InvestigateListResponsesV4PagePaginationArray = InvestigateListResponsesV4PagePaginationArray; +EmailSecurity.Settings = Settings; +EmailSecurity.Submissions = Submissions; +EmailSecurity.SubmissionListResponsesV4PagePaginationArray = SubmissionListResponsesV4PagePaginationArray; + +export declare namespace EmailSecurity { + export { + Investigate as Investigate, + type InvestigateListResponse as InvestigateListResponse, + type InvestigateGetResponse as InvestigateGetResponse, + InvestigateListResponsesV4PagePaginationArray as InvestigateListResponsesV4PagePaginationArray, + type InvestigateListParams as InvestigateListParams, + type InvestigateGetParams as InvestigateGetParams, + }; + + export { Settings as Settings }; + + export { + Submissions as Submissions, + type SubmissionListResponse as SubmissionListResponse, + SubmissionListResponsesV4PagePaginationArray as SubmissionListResponsesV4PagePaginationArray, + type SubmissionListParams as SubmissionListParams, + }; +} diff --git a/src/resources/email-security/index.ts b/src/resources/email-security/index.ts new file mode 100644 index 0000000000..fea9a511e2 --- /dev/null +++ b/src/resources/email-security/index.ts @@ -0,0 +1,18 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { EmailSecurity } from './email-security'; +export { + InvestigateListResponsesV4PagePaginationArray, + Investigate, + type InvestigateListResponse, + type InvestigateGetResponse, + type InvestigateListParams, + type InvestigateGetParams, +} from './investigate/index'; +export { Settings } from './settings/index'; +export { + SubmissionListResponsesV4PagePaginationArray, + Submissions, + type SubmissionListResponse, + type SubmissionListParams, +} from './submissions'; diff --git a/src/resources/email-security/investigate/detections.ts b/src/resources/email-security/investigate/detections.ts new file mode 100644 index 0000000000..23c45cc5c0 --- /dev/null +++ b/src/resources/email-security/investigate/detections.ts @@ -0,0 +1,137 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Detections extends APIResource { + /** + * Returns detection details such as threat categories and sender information for + * non-benign messages. + */ + get( + postfixId: string, + params: DetectionGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/investigate/${postfixId}/detections`, + options, + ) as Core.APIPromise<{ result: DetectionGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface DetectionGetResponse { + action: string; + + attachments: Array; + + headers: Array; + + links: Array; + + sender_info: DetectionGetResponse.SenderInfo; + + threat_categories: Array; + + validation: DetectionGetResponse.Validation; + + final_disposition?: + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + | null; +} + +export namespace DetectionGetResponse { + export interface Attachment { + size: number; + + content_type?: string | null; + + detection?: + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + | null; + + encrypted?: boolean | null; + + name?: string | null; + } + + export interface Header { + name: string; + + value: string; + } + + export interface Link { + href: string; + + text?: string | null; + } + + export interface SenderInfo { + /** + * The name of the autonomous system. + */ + as_name?: string | null; + + /** + * The number of the autonomous system. + */ + as_number?: number | null; + + geo?: string | null; + + ip?: string | null; + + pld?: string | null; + } + + export interface ThreatCategory { + id: number; + + description?: string | null; + + name?: string | null; + } + + export interface Validation { + comment?: string | null; + + dkim?: 'pass' | 'neutral' | 'fail' | 'error' | 'none' | null; + + dmarc?: 'pass' | 'neutral' | 'fail' | 'error' | 'none' | null; + + spf?: 'pass' | 'neutral' | 'fail' | 'error' | 'none' | null; + } +} + +export interface DetectionGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +export declare namespace Detections { + export { type DetectionGetResponse as DetectionGetResponse, type DetectionGetParams as DetectionGetParams }; +} diff --git a/src/resources/email-security/investigate/index.ts b/src/resources/email-security/investigate/index.ts new file mode 100644 index 0000000000..cde8e584e9 --- /dev/null +++ b/src/resources/email-security/investigate/index.ts @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Detections, type DetectionGetResponse, type DetectionGetParams } from './detections'; +export { + InvestigateListResponsesV4PagePaginationArray, + Investigate, + type InvestigateListResponse, + type InvestigateGetResponse, + type InvestigateListParams, + type InvestigateGetParams, +} from './investigate'; +export { + Move, + type MoveCreateResponse, + type MoveBulkResponse, + type MoveCreateParams, + type MoveBulkParams, +} from './move'; +export { + Preview, + type PreviewCreateResponse, + type PreviewGetResponse, + type PreviewCreateParams, + type PreviewGetParams, +} from './preview'; +export { Raw, type RawGetResponse, type RawGetParams } from './raw'; +export { Reclassify, type ReclassifyCreateResponse, type ReclassifyCreateParams } from './reclassify'; +export { Release, type ReleaseBulkResponse, type ReleaseBulkParams } from './release'; +export { Trace, type TraceGetResponse, type TraceGetParams } from './trace'; diff --git a/src/resources/email-security/investigate/investigate.ts b/src/resources/email-security/investigate/investigate.ts new file mode 100644 index 0000000000..ab0a2e952f --- /dev/null +++ b/src/resources/email-security/investigate/investigate.ts @@ -0,0 +1,394 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as DetectionsAPI from './detections'; +import { DetectionGetParams, DetectionGetResponse, Detections } from './detections'; +import * as MoveAPI from './move'; +import { Move, MoveBulkParams, MoveBulkResponse, MoveCreateParams, MoveCreateResponse } from './move'; +import * as PreviewAPI from './preview'; +import { + Preview, + PreviewCreateParams, + PreviewCreateResponse, + PreviewGetParams, + PreviewGetResponse, +} from './preview'; +import * as RawAPI from './raw'; +import { Raw, RawGetParams, RawGetResponse } from './raw'; +import * as ReclassifyAPI from './reclassify'; +import { Reclassify, ReclassifyCreateParams, ReclassifyCreateResponse } from './reclassify'; +import * as ReleaseAPI from './release'; +import { Release, ReleaseBulkParams, ReleaseBulkResponse } from './release'; +import * as TraceAPI from './trace'; +import { Trace, TraceGetParams, TraceGetResponse } from './trace'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Investigate extends APIResource { + detections: DetectionsAPI.Detections = new DetectionsAPI.Detections(this._client); + preview: PreviewAPI.Preview = new PreviewAPI.Preview(this._client); + raw: RawAPI.Raw = new RawAPI.Raw(this._client); + trace: TraceAPI.Trace = new TraceAPI.Trace(this._client); + move: MoveAPI.Move = new MoveAPI.Move(this._client); + reclassify: ReclassifyAPI.Reclassify = new ReclassifyAPI.Reclassify(this._client); + release: ReleaseAPI.Release = new ReleaseAPI.Release(this._client); + + /** + * Returns information for each email that matches the search parameter(s). + */ + list( + params: InvestigateListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/email-security/investigate`, + InvestigateListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Get message details + */ + get( + postfixId: string, + params: InvestigateGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/investigate/${postfixId}`, + options, + ) as Core.APIPromise<{ result: InvestigateGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class InvestigateListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface InvestigateListResponse { + id: string; + + action_log: unknown; + + client_recipients: Array; + + detection_reasons: Array; + + is_phish_submission: boolean; + + is_quarantined: boolean; + + /** + * The identifier of the message. + */ + postfix_id: string; + + ts: string; + + alert_id?: string | null; + + delivery_mode?: + | 'DIRECT' + | 'BCC' + | 'JOURNAL' + | 'REVIEW_SUBMISSION' + | 'DMARC_UNVERIFIED' + | 'DMARC_FAILURE_REPORT' + | 'DMARC_AGGREGATE_REPORT' + | 'THREAT_INTEL_SUBMISSION' + | 'SIMULATION_SUBMISSION' + | 'API' + | 'RETRO_SCAN' + | null; + + edf_hash?: string | null; + + final_disposition?: + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + | null; + + from?: string | null; + + from_name?: string | null; + + message_id?: string | null; + + sent_date?: string | null; + + subject?: string | null; + + threat_categories?: Array | null; + + to?: Array | null; + + to_name?: Array | null; + + validation?: InvestigateListResponse.Validation | null; +} + +export namespace InvestigateListResponse { + export interface Validation { + comment?: string | null; + + dkim?: 'pass' | 'neutral' | 'fail' | 'error' | 'none' | null; + + dmarc?: 'pass' | 'neutral' | 'fail' | 'error' | 'none' | null; + + spf?: 'pass' | 'neutral' | 'fail' | 'error' | 'none' | null; + } +} + +export interface InvestigateGetResponse { + id: string; + + action_log: unknown; + + client_recipients: Array; + + detection_reasons: Array; + + is_phish_submission: boolean; + + is_quarantined: boolean; + + /** + * The identifier of the message. + */ + postfix_id: string; + + ts: string; + + alert_id?: string | null; + + delivery_mode?: + | 'DIRECT' + | 'BCC' + | 'JOURNAL' + | 'REVIEW_SUBMISSION' + | 'DMARC_UNVERIFIED' + | 'DMARC_FAILURE_REPORT' + | 'DMARC_AGGREGATE_REPORT' + | 'THREAT_INTEL_SUBMISSION' + | 'SIMULATION_SUBMISSION' + | 'API' + | 'RETRO_SCAN' + | null; + + edf_hash?: string | null; + + final_disposition?: + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + | null; + + from?: string | null; + + from_name?: string | null; + + message_id?: string | null; + + sent_date?: string | null; + + subject?: string | null; + + threat_categories?: Array | null; + + to?: Array | null; + + to_name?: Array | null; + + validation?: InvestigateGetResponse.Validation | null; +} + +export namespace InvestigateGetResponse { + export interface Validation { + comment?: string | null; + + dkim?: 'pass' | 'neutral' | 'fail' | 'error' | 'none' | null; + + dmarc?: 'pass' | 'neutral' | 'fail' | 'error' | 'none' | null; + + spf?: 'pass' | 'neutral' | 'fail' | 'error' | 'none' | null; + } +} + +export interface InvestigateListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Query param: Determines if the message action log is included in the response. + */ + action_log?: boolean; + + /** + * Query param: + */ + alert_id?: string; + + /** + * Query param: Determines if the search results will include detections or not. + */ + detections_only?: boolean; + + /** + * Query param: The sender domains the search filters by. + */ + domain?: string; + + /** + * Query param: The end of the search date range. Defaults to `now`. + */ + end?: string; + + /** + * Query param: The dispositions the search filters by. + */ + final_disposition?: 'MALICIOUS' | 'SUSPICIOUS' | 'SPOOF' | 'SPAM' | 'BULK'; + + /** + * Query param: The message actions the search filters by. + */ + message_action?: 'PREVIEW' | 'QUARANTINE_RELEASED' | 'MOVED'; + + /** + * Query param: + */ + message_id?: string; + + /** + * Query param: + */ + metric?: string; + + /** + * Query param: The space-delimited term used in the query. The search is + * case-insensitive. + * + * The content of the following email metadata fields are searched: + * + * - alert_id + * - CC + * - From (envelope_from) + * - From Name + * - final_disposition + * - md5 hash (of any attachment) + * - sha1 hash (of any attachment) + * - sha256 hash (of any attachment) + * - name (of any attachment) + * - Reason + * - Received DateTime (yyyy-mm-ddThh:mm:ss) + * - Sent DateTime (yyyy-mm-ddThh:mm:ss) + * - ReplyTo + * - To (envelope_to) + * - To Name + * - Message-ID + * - smtp_helo_server_ip + * - smtp_previous_hop_ip + * - x_originating_ip + * - Subject + */ + query?: string; + + /** + * Query param: + */ + recipient?: string; + + /** + * Query param: + */ + sender?: string; + + /** + * Query param: The beginning of the search date range. Defaults to + * `now - 30 days`. + */ + start?: string; +} + +export interface InvestigateGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +Investigate.InvestigateListResponsesV4PagePaginationArray = InvestigateListResponsesV4PagePaginationArray; +Investigate.Detections = Detections; +Investigate.Preview = Preview; +Investigate.Raw = Raw; +Investigate.Trace = Trace; +Investigate.Move = Move; +Investigate.Reclassify = Reclassify; +Investigate.Release = Release; + +export declare namespace Investigate { + export { + type InvestigateListResponse as InvestigateListResponse, + type InvestigateGetResponse as InvestigateGetResponse, + InvestigateListResponsesV4PagePaginationArray as InvestigateListResponsesV4PagePaginationArray, + type InvestigateListParams as InvestigateListParams, + type InvestigateGetParams as InvestigateGetParams, + }; + + export { + Detections as Detections, + type DetectionGetResponse as DetectionGetResponse, + type DetectionGetParams as DetectionGetParams, + }; + + export { + Preview as Preview, + type PreviewCreateResponse as PreviewCreateResponse, + type PreviewGetResponse as PreviewGetResponse, + type PreviewCreateParams as PreviewCreateParams, + type PreviewGetParams as PreviewGetParams, + }; + + export { Raw as Raw, type RawGetResponse as RawGetResponse, type RawGetParams as RawGetParams }; + + export { Trace as Trace, type TraceGetResponse as TraceGetResponse, type TraceGetParams as TraceGetParams }; + + export { + Move as Move, + type MoveCreateResponse as MoveCreateResponse, + type MoveBulkResponse as MoveBulkResponse, + type MoveCreateParams as MoveCreateParams, + type MoveBulkParams as MoveBulkParams, + }; + + export { + Reclassify as Reclassify, + type ReclassifyCreateResponse as ReclassifyCreateResponse, + type ReclassifyCreateParams as ReclassifyCreateParams, + }; + + export { + Release as Release, + type ReleaseBulkResponse as ReleaseBulkResponse, + type ReleaseBulkParams as ReleaseBulkParams, + }; +} diff --git a/src/resources/email-security/investigate/move.ts b/src/resources/email-security/investigate/move.ts new file mode 100644 index 0000000000..67218ad04c --- /dev/null +++ b/src/resources/email-security/investigate/move.ts @@ -0,0 +1,124 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Move extends APIResource { + /** + * Move a message + */ + create( + postfixId: string, + params: MoveCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/email-security/investigate/${postfixId}/move`, { + body, + ...options, + }) as Core.APIPromise<{ result: MoveCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Move multiple messages + */ + bulk(params: MoveBulkParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/email-security/investigate/move`, { + body, + ...options, + }) as Core.APIPromise<{ result: MoveBulkResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type MoveCreateResponse = Array; + +export namespace MoveCreateResponse { + export interface MoveCreateResponseItem { + completed_timestamp: string; + + destination: string; + + item_count: number; + + message_id: string; + + operation: string; + + recipient: string; + + status: string; + } +} + +export type MoveBulkResponse = Array; + +export namespace MoveBulkResponse { + export interface MoveBulkResponseItem { + completed_timestamp: string; + + destination: string; + + item_count: number; + + message_id: string; + + operation: string; + + recipient: string; + + status: string; + } +} + +export interface MoveCreateParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + destination: + | 'Inbox' + | 'JunkEmail' + | 'DeletedItems' + | 'RecoverableItemsDeletions' + | 'RecoverableItemsPurges'; +} + +export interface MoveBulkParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + destination: + | 'Inbox' + | 'JunkEmail' + | 'DeletedItems' + | 'RecoverableItemsDeletions' + | 'RecoverableItemsPurges'; + + /** + * Body param: + */ + postfix_ids: Array; +} + +export declare namespace Move { + export { + type MoveCreateResponse as MoveCreateResponse, + type MoveBulkResponse as MoveBulkResponse, + type MoveCreateParams as MoveCreateParams, + type MoveBulkParams as MoveBulkParams, + }; +} diff --git a/src/resources/email-security/investigate/preview.ts b/src/resources/email-security/investigate/preview.ts new file mode 100644 index 0000000000..5ee20b3331 --- /dev/null +++ b/src/resources/email-security/investigate/preview.ts @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Preview extends APIResource { + /** + * Preview for non-detection messages + */ + create(params: PreviewCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/email-security/investigate/preview`, { + body, + ...options, + }) as Core.APIPromise<{ result: PreviewCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Returns a preview of the message body as a base64 encoded PNG image for + * non-benign messages. + */ + get( + postfixId: string, + params: PreviewGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/investigate/${postfixId}/preview`, + options, + ) as Core.APIPromise<{ result: PreviewGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface PreviewCreateResponse { + /** + * A base64 encoded PNG image of the email. + */ + screenshot: string; +} + +export interface PreviewGetResponse { + /** + * A base64 encoded PNG image of the email. + */ + screenshot: string; +} + +export interface PreviewCreateParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: The identifier of the message. + */ + postfix_id: string; +} + +export interface PreviewGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +export declare namespace Preview { + export { + type PreviewCreateResponse as PreviewCreateResponse, + type PreviewGetResponse as PreviewGetResponse, + type PreviewCreateParams as PreviewCreateParams, + type PreviewGetParams as PreviewGetParams, + }; +} diff --git a/src/resources/email-security/investigate/raw.ts b/src/resources/email-security/investigate/raw.ts new file mode 100644 index 0000000000..611179b942 --- /dev/null +++ b/src/resources/email-security/investigate/raw.ts @@ -0,0 +1,41 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Raw extends APIResource { + /** + * Returns the raw eml of any non-benign message. + */ + get( + postfixId: string, + params: RawGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/investigate/${postfixId}/raw`, + options, + ) as Core.APIPromise<{ result: RawGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface RawGetResponse { + /** + * A UTF-8 encoded eml file of the email. + */ + raw: string; +} + +export interface RawGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +export declare namespace Raw { + export { type RawGetResponse as RawGetResponse, type RawGetParams as RawGetParams }; +} diff --git a/src/resources/email-security/investigate/reclassify.ts b/src/resources/email-security/investigate/reclassify.ts new file mode 100644 index 0000000000..bbb0b5b7aa --- /dev/null +++ b/src/resources/email-security/investigate/reclassify.ts @@ -0,0 +1,49 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Reclassify extends APIResource { + /** + * Change email classfication + */ + create( + postfixId: string, + params: ReclassifyCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/email-security/investigate/${postfixId}/reclassify`, { + body, + ...options, + }) as Core.APIPromise<{ result: ReclassifyCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type ReclassifyCreateResponse = unknown; + +export interface ReclassifyCreateParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + expected_disposition: 'NONE' | 'BULK' | 'MALICIOUS' | 'SPAM' | 'SPOOF' | 'SUSPICIOUS'; + + /** + * Body param: Base64 encoded content of the EML file + */ + eml_content?: string | null; +} + +export declare namespace Reclassify { + export { + type ReclassifyCreateResponse as ReclassifyCreateResponse, + type ReclassifyCreateParams as ReclassifyCreateParams, + }; +} diff --git a/src/resources/email-security/investigate/release.ts b/src/resources/email-security/investigate/release.ts new file mode 100644 index 0000000000..370e614f4f --- /dev/null +++ b/src/resources/email-security/investigate/release.ts @@ -0,0 +1,53 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Release extends APIResource { + /** + * Release messages from quarantine + */ + bulk(params: ReleaseBulkParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, body } = params; + return ( + this._client.post(`/accounts/${account_id}/email-security/investigate/release`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: ReleaseBulkResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type ReleaseBulkResponse = Array; + +export namespace ReleaseBulkResponse { + export interface ReleaseBulkResponseItem { + /** + * The identifier of the message. + */ + postfix_id: string; + + delivered?: Array | null; + + failed?: Array | null; + + undelivered?: Array | null; + } +} + +export interface ReleaseBulkParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: A list of messages identfied by their `postfix_id`s that should be + * released. + */ + body: Array; +} + +export declare namespace Release { + export { type ReleaseBulkResponse as ReleaseBulkResponse, type ReleaseBulkParams as ReleaseBulkParams }; +} diff --git a/src/resources/email-security/investigate/trace.ts b/src/resources/email-security/investigate/trace.ts new file mode 100644 index 0000000000..8d69f6acf0 --- /dev/null +++ b/src/resources/email-security/investigate/trace.ts @@ -0,0 +1,70 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Trace extends APIResource { + /** + * Get email trace + */ + get( + postfixId: string, + params: TraceGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/investigate/${postfixId}/trace`, + options, + ) as Core.APIPromise<{ result: TraceGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface TraceGetResponse { + inbound: TraceGetResponse.Inbound; + + outbound: TraceGetResponse.Outbound; +} + +export namespace TraceGetResponse { + export interface Inbound { + lines?: Array | null; + } + + export namespace Inbound { + export interface Line { + lineno: number; + + message: string; + + ts: string; + } + } + + export interface Outbound { + lines?: Array | null; + } + + export namespace Outbound { + export interface Line { + lineno: number; + + message: string; + + ts: string; + } + } +} + +export interface TraceGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +export declare namespace Trace { + export { type TraceGetResponse as TraceGetResponse, type TraceGetParams as TraceGetParams }; +} diff --git a/src/resources/email-security/settings/allow-policies.ts b/src/resources/email-security/settings/allow-policies.ts new file mode 100644 index 0000000000..a146ed87d7 --- /dev/null +++ b/src/resources/email-security/settings/allow-policies.ts @@ -0,0 +1,539 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class AllowPolicies extends APIResource { + /** + * Create an email allow policy + */ + create( + params: AllowPolicyCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/email-security/settings/allow_policies`, { + body, + ...options, + }) as Core.APIPromise<{ result: AllowPolicyCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Lists, searches, and sorts an account’s email allow policies. + */ + list( + params: AllowPolicyListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/email-security/settings/allow_policies`, + AllowPolicyListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete an email allow policy + */ + delete( + policyId: number, + params: AllowPolicyDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/email-security/settings/allow_policies/${policyId}`, + options, + ) as Core.APIPromise<{ result: AllowPolicyDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update an email allow policy + */ + edit( + policyId: number, + params: AllowPolicyEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/email-security/settings/allow_policies/${policyId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: AllowPolicyEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get an email allow policy + */ + get( + policyId: number, + params: AllowPolicyGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/settings/allow_policies/${policyId}`, + options, + ) as Core.APIPromise<{ result: AllowPolicyGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class AllowPolicyListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface AllowPolicyCreateResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; + + created_at: string; + + /** + * Messages from this sender will be exempted from Spam, Spoof and Bulk + * dispositions. Note: This will not exempt messages with Malicious or Suspicious + * dispositions. + */ + is_acceptable_sender: boolean; + + /** + * Messages to this recipient will bypass all detections. + */ + is_exempt_recipient: boolean; + + is_regex: boolean; + + /** + * Messages from this sender will bypass all detections and link following. + */ + is_trusted_sender: boolean; + + last_modified: string; + + pattern: string; + + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + /** + * Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors + * policies that pass authentication. + */ + verify_sender: boolean; + + comments?: string | null; + + /** + * @deprecated + */ + is_recipient?: boolean; + + /** + * @deprecated + */ + is_sender?: boolean; + + /** + * @deprecated + */ + is_spoof?: boolean; +} + +export interface AllowPolicyListResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; + + created_at: string; + + /** + * Messages from this sender will be exempted from Spam, Spoof and Bulk + * dispositions. Note: This will not exempt messages with Malicious or Suspicious + * dispositions. + */ + is_acceptable_sender: boolean; + + /** + * Messages to this recipient will bypass all detections. + */ + is_exempt_recipient: boolean; + + is_regex: boolean; + + /** + * Messages from this sender will bypass all detections and link following. + */ + is_trusted_sender: boolean; + + last_modified: string; + + pattern: string; + + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + /** + * Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors + * policies that pass authentication. + */ + verify_sender: boolean; + + comments?: string | null; + + /** + * @deprecated + */ + is_recipient?: boolean; + + /** + * @deprecated + */ + is_sender?: boolean; + + /** + * @deprecated + */ + is_spoof?: boolean; +} + +export interface AllowPolicyDeleteResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; +} + +export interface AllowPolicyEditResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; + + created_at: string; + + /** + * Messages from this sender will be exempted from Spam, Spoof and Bulk + * dispositions. Note: This will not exempt messages with Malicious or Suspicious + * dispositions. + */ + is_acceptable_sender: boolean; + + /** + * Messages to this recipient will bypass all detections. + */ + is_exempt_recipient: boolean; + + is_regex: boolean; + + /** + * Messages from this sender will bypass all detections and link following. + */ + is_trusted_sender: boolean; + + last_modified: string; + + pattern: string; + + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + /** + * Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors + * policies that pass authentication. + */ + verify_sender: boolean; + + comments?: string | null; + + /** + * @deprecated + */ + is_recipient?: boolean; + + /** + * @deprecated + */ + is_sender?: boolean; + + /** + * @deprecated + */ + is_spoof?: boolean; +} + +export interface AllowPolicyGetResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; + + created_at: string; + + /** + * Messages from this sender will be exempted from Spam, Spoof and Bulk + * dispositions. Note: This will not exempt messages with Malicious or Suspicious + * dispositions. + */ + is_acceptable_sender: boolean; + + /** + * Messages to this recipient will bypass all detections. + */ + is_exempt_recipient: boolean; + + is_regex: boolean; + + /** + * Messages from this sender will bypass all detections and link following. + */ + is_trusted_sender: boolean; + + last_modified: string; + + pattern: string; + + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + /** + * Enforce DMARC, SPF or DKIM authentication. When on, Email Security only honors + * policies that pass authentication. + */ + verify_sender: boolean; + + comments?: string | null; + + /** + * @deprecated + */ + is_recipient?: boolean; + + /** + * @deprecated + */ + is_sender?: boolean; + + /** + * @deprecated + */ + is_spoof?: boolean; +} + +export interface AllowPolicyCreateParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: Messages from this sender will be exempted from Spam, Spoof and Bulk + * dispositions. Note: This will not exempt messages with Malicious or Suspicious + * dispositions. + */ + is_acceptable_sender: boolean; + + /** + * Body param: Messages to this recipient will bypass all detections. + */ + is_exempt_recipient: boolean; + + /** + * Body param: + */ + is_regex: boolean; + + /** + * Body param: Messages from this sender will bypass all detections and link + * following. + */ + is_trusted_sender: boolean; + + /** + * Body param: + */ + pattern: string; + + /** + * Body param: + */ + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + /** + * Body param: Enforce DMARC, SPF or DKIM authentication. When on, Email Security + * only honors policies that pass authentication. + */ + verify_sender: boolean; + + /** + * Body param: + */ + comments?: string | null; + + /** + * Body param: + */ + is_recipient?: boolean; + + /** + * Body param: + */ + is_sender?: boolean; + + /** + * Body param: + */ + is_spoof?: boolean; +} + +export interface AllowPolicyListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Query param: The sorting direction. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: + */ + is_acceptable_sender?: boolean; + + /** + * Query param: + */ + is_exempt_recipient?: boolean; + + /** + * Query param: + */ + is_recipient?: boolean; + + /** + * Query param: + */ + is_sender?: boolean; + + /** + * Query param: + */ + is_spoof?: boolean; + + /** + * Query param: + */ + is_trusted_sender?: boolean; + + /** + * Query param: The field to sort by. + */ + order?: 'pattern' | 'created_at'; + + /** + * Query param: + */ + pattern_type?: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + /** + * Query param: Allows searching in multiple properties of a record simultaneously. + * This parameter is intended for human users, not automation. Its exact behavior + * is intentionally left unspecified and is subject to change in the future. + */ + search?: string; + + /** + * Query param: + */ + verify_sender?: boolean; +} + +export interface AllowPolicyDeleteParams { + /** + * Account Identifier + */ + account_id: string; +} + +export interface AllowPolicyEditParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + comments?: string | null; + + /** + * Body param: Messages from this sender will be exempted from Spam, Spoof and Bulk + * dispositions. Note: This will not exempt messages with Malicious or Suspicious + * dispositions. + */ + is_acceptable_sender?: boolean | null; + + /** + * Body param: Messages to this recipient will bypass all detections. + */ + is_exempt_recipient?: boolean | null; + + /** + * Body param: + */ + is_regex?: boolean | null; + + /** + * Body param: Messages from this sender will bypass all detections and link + * following. + */ + is_trusted_sender?: boolean | null; + + /** + * Body param: + */ + pattern?: string | null; + + /** + * Body param: + */ + pattern_type?: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN' | null; + + /** + * Body param: Enforce DMARC, SPF or DKIM authentication. When on, Email Security + * only honors policies that pass authentication. + */ + verify_sender?: boolean | null; +} + +export interface AllowPolicyGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +AllowPolicies.AllowPolicyListResponsesV4PagePaginationArray = AllowPolicyListResponsesV4PagePaginationArray; + +export declare namespace AllowPolicies { + export { + type AllowPolicyCreateResponse as AllowPolicyCreateResponse, + type AllowPolicyListResponse as AllowPolicyListResponse, + type AllowPolicyDeleteResponse as AllowPolicyDeleteResponse, + type AllowPolicyEditResponse as AllowPolicyEditResponse, + type AllowPolicyGetResponse as AllowPolicyGetResponse, + AllowPolicyListResponsesV4PagePaginationArray as AllowPolicyListResponsesV4PagePaginationArray, + type AllowPolicyCreateParams as AllowPolicyCreateParams, + type AllowPolicyListParams as AllowPolicyListParams, + type AllowPolicyDeleteParams as AllowPolicyDeleteParams, + type AllowPolicyEditParams as AllowPolicyEditParams, + type AllowPolicyGetParams as AllowPolicyGetParams, + }; +} diff --git a/src/resources/email-security/settings/block-senders.ts b/src/resources/email-security/settings/block-senders.ts new file mode 100644 index 0000000000..96dcd050d5 --- /dev/null +++ b/src/resources/email-security/settings/block-senders.ts @@ -0,0 +1,289 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class BlockSenders extends APIResource { + /** + * Create a blocked email sender + */ + create( + params: BlockSenderCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/email-security/settings/block_senders`, { + body, + ...options, + }) as Core.APIPromise<{ result: BlockSenderCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List blocked email senders + */ + list( + params: BlockSenderListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/email-security/settings/block_senders`, + BlockSenderListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete a blocked email sender + */ + delete( + patternId: number, + params: BlockSenderDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/email-security/settings/block_senders/${patternId}`, + options, + ) as Core.APIPromise<{ result: BlockSenderDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update a blocked email sender + */ + edit( + patternId: number, + params: BlockSenderEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/email-security/settings/block_senders/${patternId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: BlockSenderEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a blocked email sender + */ + get( + patternId: number, + params: BlockSenderGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/settings/block_senders/${patternId}`, + options, + ) as Core.APIPromise<{ result: BlockSenderGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class BlockSenderListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface BlockSenderCreateResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; + + created_at: string; + + is_regex: boolean; + + last_modified: string; + + pattern: string; + + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + comments?: string | null; +} + +export interface BlockSenderListResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; + + created_at: string; + + is_regex: boolean; + + last_modified: string; + + pattern: string; + + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + comments?: string | null; +} + +export interface BlockSenderDeleteResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; +} + +export interface BlockSenderEditResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; + + created_at: string; + + is_regex: boolean; + + last_modified: string; + + pattern: string; + + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + comments?: string | null; +} + +export interface BlockSenderGetResponse { + /** + * The unique identifier for the allow policy. + */ + id: number; + + created_at: string; + + is_regex: boolean; + + last_modified: string; + + pattern: string; + + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + comments?: string | null; +} + +export interface BlockSenderCreateParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + is_regex: boolean; + + /** + * Body param: + */ + pattern: string; + + /** + * Body param: + */ + pattern_type: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + /** + * Body param: + */ + comments?: string | null; +} + +export interface BlockSenderListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Query param: The sorting direction. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: The field to sort by. + */ + order?: 'pattern' | 'created_at'; + + /** + * Query param: + */ + pattern_type?: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN'; + + /** + * Query param: Allows searching in multiple properties of a record simultaneously. + * This parameter is intended for human users, not automation. Its exact behavior + * is intentionally left unspecified and is subject to change in the future. + */ + search?: string; +} + +export interface BlockSenderDeleteParams { + /** + * Account Identifier + */ + account_id: string; +} + +export interface BlockSenderEditParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + comments?: string | null; + + /** + * Body param: + */ + is_regex?: boolean | null; + + /** + * Body param: + */ + pattern?: string | null; + + /** + * Body param: + */ + pattern_type?: 'EMAIL' | 'DOMAIN' | 'IP' | 'UNKNOWN' | null; +} + +export interface BlockSenderGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +BlockSenders.BlockSenderListResponsesV4PagePaginationArray = BlockSenderListResponsesV4PagePaginationArray; + +export declare namespace BlockSenders { + export { + type BlockSenderCreateResponse as BlockSenderCreateResponse, + type BlockSenderListResponse as BlockSenderListResponse, + type BlockSenderDeleteResponse as BlockSenderDeleteResponse, + type BlockSenderEditResponse as BlockSenderEditResponse, + type BlockSenderGetResponse as BlockSenderGetResponse, + BlockSenderListResponsesV4PagePaginationArray as BlockSenderListResponsesV4PagePaginationArray, + type BlockSenderCreateParams as BlockSenderCreateParams, + type BlockSenderListParams as BlockSenderListParams, + type BlockSenderDeleteParams as BlockSenderDeleteParams, + type BlockSenderEditParams as BlockSenderEditParams, + type BlockSenderGetParams as BlockSenderGetParams, + }; +} diff --git a/src/resources/email-security/settings/domains.ts b/src/resources/email-security/settings/domains.ts new file mode 100644 index 0000000000..a62726afae --- /dev/null +++ b/src/resources/email-security/settings/domains.ts @@ -0,0 +1,384 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class Domains extends APIResource { + /** + * Lists, searches, and sorts an account’s email domains. + */ + list( + params: DomainListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/email-security/settings/domains`, + DomainListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Unprotect an email domain + */ + delete( + domainId: number, + params: DomainDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/email-security/settings/domains/${domainId}`, + options, + ) as Core.APIPromise<{ result: DomainDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Unprotect multiple email domains + */ + bulkDelete( + params: DomainBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/email-security/settings/domains`, + options, + ) as Core.APIPromise<{ result: DomainBulkDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update an email domain + */ + edit( + domainId: number, + params: DomainEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/email-security/settings/domains/${domainId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: DomainEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get an email domain + */ + get( + domainId: number, + params: DomainGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/settings/domains/${domainId}`, + options, + ) as Core.APIPromise<{ result: DomainGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class DomainListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface DomainListResponse { + /** + * The unique identifier for the domain. + */ + id: number; + + allowed_delivery_modes: Array<'DIRECT' | 'BCC' | 'JOURNAL' | 'API' | 'RETRO_SCAN'>; + + created_at: string; + + domain: string; + + drop_dispositions: Array< + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + >; + + ip_restrictions: Array; + + last_modified: string; + + lookback_hops: number; + + transport: string; + + folder?: 'AllItems' | 'Inbox' | null; + + inbox_provider?: 'Microsoft' | 'Google' | null; + + integration_id?: string | null; + + o365_tenant_id?: string | null; + + require_tls_inbound?: boolean | null; + + require_tls_outbound?: boolean | null; +} + +export interface DomainDeleteResponse { + /** + * The unique identifier for the domain. + */ + id: number; +} + +export type DomainBulkDeleteResponse = Array; + +export namespace DomainBulkDeleteResponse { + export interface DomainBulkDeleteResponseItem { + /** + * The unique identifier for the domain. + */ + id: number; + } +} + +export interface DomainEditResponse { + /** + * The unique identifier for the domain. + */ + id: number; + + allowed_delivery_modes: Array<'DIRECT' | 'BCC' | 'JOURNAL' | 'API' | 'RETRO_SCAN'>; + + created_at: string; + + domain: string; + + drop_dispositions: Array< + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + >; + + ip_restrictions: Array; + + last_modified: string; + + lookback_hops: number; + + transport: string; + + folder?: 'AllItems' | 'Inbox' | null; + + inbox_provider?: 'Microsoft' | 'Google' | null; + + integration_id?: string | null; + + o365_tenant_id?: string | null; + + require_tls_inbound?: boolean | null; + + require_tls_outbound?: boolean | null; +} + +export interface DomainGetResponse { + /** + * The unique identifier for the domain. + */ + id: number; + + allowed_delivery_modes: Array<'DIRECT' | 'BCC' | 'JOURNAL' | 'API' | 'RETRO_SCAN'>; + + created_at: string; + + domain: string; + + drop_dispositions: Array< + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + >; + + ip_restrictions: Array; + + last_modified: string; + + lookback_hops: number; + + transport: string; + + folder?: 'AllItems' | 'Inbox' | null; + + inbox_provider?: 'Microsoft' | 'Google' | null; + + integration_id?: string | null; + + o365_tenant_id?: string | null; + + require_tls_inbound?: boolean | null; + + require_tls_outbound?: boolean | null; +} + +export interface DomainListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Query param: Filters response to domains with the provided delivery mode. + */ + allowed_delivery_mode?: 'DIRECT' | 'BCC' | 'JOURNAL' | 'API' | 'RETRO_SCAN'; + + /** + * Query param: The sorting direction. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: Filters results by the provided domains, allowing for multiple + * occurrences. + */ + domain?: Array; + + /** + * Query param: The field to sort by. + */ + order?: 'domain' | 'created_at'; + + /** + * Query param: Allows searching in multiple properties of a record simultaneously. + * This parameter is intended for human users, not automation. Its exact behavior + * is intentionally left unspecified and is subject to change in the future. + */ + search?: string; +} + +export interface DomainDeleteParams { + /** + * Account Identifier + */ + account_id: string; +} + +export interface DomainBulkDeleteParams { + /** + * Account Identifier + */ + account_id: string; +} + +export interface DomainEditParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + ip_restrictions: Array; + + /** + * Body param: + */ + domain?: string | null; + + /** + * Body param: + */ + drop_dispositions?: Array< + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + >; + + /** + * Body param: + */ + folder?: 'AllItems' | 'Inbox'; + + /** + * Body param: + */ + integration_id?: string | null; + + /** + * Body param: + */ + lookback_hops?: number | null; + + /** + * Body param: + */ + require_tls_inbound?: boolean; + + /** + * Body param: + */ + require_tls_outbound?: boolean; + + /** + * Body param: + */ + transport?: string; +} + +export interface DomainGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +Domains.DomainListResponsesV4PagePaginationArray = DomainListResponsesV4PagePaginationArray; + +export declare namespace Domains { + export { + type DomainListResponse as DomainListResponse, + type DomainDeleteResponse as DomainDeleteResponse, + type DomainBulkDeleteResponse as DomainBulkDeleteResponse, + type DomainEditResponse as DomainEditResponse, + type DomainGetResponse as DomainGetResponse, + DomainListResponsesV4PagePaginationArray as DomainListResponsesV4PagePaginationArray, + type DomainListParams as DomainListParams, + type DomainDeleteParams as DomainDeleteParams, + type DomainBulkDeleteParams as DomainBulkDeleteParams, + type DomainEditParams as DomainEditParams, + type DomainGetParams as DomainGetParams, + }; +} diff --git a/src/resources/email-security/settings/impersonation-registry.ts b/src/resources/email-security/settings/impersonation-registry.ts new file mode 100644 index 0000000000..0d59379ccd --- /dev/null +++ b/src/resources/email-security/settings/impersonation-registry.ts @@ -0,0 +1,312 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class ImpersonationRegistry extends APIResource { + /** + * Create an entry in impersonation registry + */ + create( + params: ImpersonationRegistryCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/email-security/settings/impersonation_registry`, { + body, + ...options, + }) as Core.APIPromise<{ result: ImpersonationRegistryCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Lists, searches, and sorts entries in the impersonation registry. + */ + list( + params: ImpersonationRegistryListParams, + options?: Core.RequestOptions, + ): Core.PagePromise< + ImpersonationRegistryListResponsesV4PagePaginationArray, + ImpersonationRegistryListResponse + > { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/email-security/settings/impersonation_registry`, + ImpersonationRegistryListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete an entry from impersonation registry + */ + delete( + displayNameId: number, + params: ImpersonationRegistryDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/email-security/settings/impersonation_registry/${displayNameId}`, + options, + ) as Core.APIPromise<{ result: ImpersonationRegistryDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update an entry in impersonation registry + */ + edit( + displayNameId: number, + params: ImpersonationRegistryEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/email-security/settings/impersonation_registry/${displayNameId}`, + { body, ...options }, + ) as Core.APIPromise<{ result: ImpersonationRegistryEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get an entry in impersonation registry + */ + get( + displayNameId: number, + params: ImpersonationRegistryGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/settings/impersonation_registry/${displayNameId}`, + options, + ) as Core.APIPromise<{ result: ImpersonationRegistryGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class ImpersonationRegistryListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface ImpersonationRegistryCreateResponse { + id: number; + + created_at: string; + + email: string; + + is_email_regex: boolean; + + last_modified: string; + + name: string; + + comments?: string | null; + + directory_id?: number | null; + + directory_node_id?: number | null; + + /** + * @deprecated + */ + external_directory_node_id?: string | null; + + provenance?: string | null; +} + +export interface ImpersonationRegistryListResponse { + id: number; + + created_at: string; + + email: string; + + is_email_regex: boolean; + + last_modified: string; + + name: string; + + comments?: string | null; + + directory_id?: number | null; + + directory_node_id?: number | null; + + /** + * @deprecated + */ + external_directory_node_id?: string | null; + + provenance?: string | null; +} + +export interface ImpersonationRegistryDeleteResponse { + id: number; +} + +export interface ImpersonationRegistryEditResponse { + id: number; + + created_at: string; + + email: string; + + is_email_regex: boolean; + + last_modified: string; + + name: string; + + comments?: string | null; + + directory_id?: number | null; + + directory_node_id?: number | null; + + /** + * @deprecated + */ + external_directory_node_id?: string | null; + + provenance?: string | null; +} + +export interface ImpersonationRegistryGetResponse { + id: number; + + created_at: string; + + email: string; + + is_email_regex: boolean; + + last_modified: string; + + name: string; + + comments?: string | null; + + directory_id?: number | null; + + directory_node_id?: number | null; + + /** + * @deprecated + */ + external_directory_node_id?: string | null; + + provenance?: string | null; +} + +export interface ImpersonationRegistryCreateParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + email: string; + + /** + * Body param: + */ + is_email_regex: boolean; + + /** + * Body param: + */ + name: string; +} + +export interface ImpersonationRegistryListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Query param: The sorting direction. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: The field to sort by. + */ + order?: 'name' | 'email' | 'created_at'; + + /** + * Query param: + */ + provenance?: 'A1S_INTERNAL' | 'SNOOPY-CASB_OFFICE_365' | 'SNOOPY-OFFICE_365' | 'SNOOPY-GOOGLE_DIRECTORY'; + + /** + * Query param: Allows searching in multiple properties of a record simultaneously. + * This parameter is intended for human users, not automation. Its exact behavior + * is intentionally left unspecified and is subject to change in the future. + */ + search?: string; +} + +export interface ImpersonationRegistryDeleteParams { + /** + * Account Identifier + */ + account_id: string; +} + +export interface ImpersonationRegistryEditParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + email?: string | null; + + /** + * Body param: + */ + is_email_regex?: boolean | null; + + /** + * Body param: + */ + name?: string | null; +} + +export interface ImpersonationRegistryGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +ImpersonationRegistry.ImpersonationRegistryListResponsesV4PagePaginationArray = + ImpersonationRegistryListResponsesV4PagePaginationArray; + +export declare namespace ImpersonationRegistry { + export { + type ImpersonationRegistryCreateResponse as ImpersonationRegistryCreateResponse, + type ImpersonationRegistryListResponse as ImpersonationRegistryListResponse, + type ImpersonationRegistryDeleteResponse as ImpersonationRegistryDeleteResponse, + type ImpersonationRegistryEditResponse as ImpersonationRegistryEditResponse, + type ImpersonationRegistryGetResponse as ImpersonationRegistryGetResponse, + ImpersonationRegistryListResponsesV4PagePaginationArray as ImpersonationRegistryListResponsesV4PagePaginationArray, + type ImpersonationRegistryCreateParams as ImpersonationRegistryCreateParams, + type ImpersonationRegistryListParams as ImpersonationRegistryListParams, + type ImpersonationRegistryDeleteParams as ImpersonationRegistryDeleteParams, + type ImpersonationRegistryEditParams as ImpersonationRegistryEditParams, + type ImpersonationRegistryGetParams as ImpersonationRegistryGetParams, + }; +} diff --git a/src/resources/email-security/settings/index.ts b/src/resources/email-security/settings/index.ts new file mode 100644 index 0000000000..5091578987 --- /dev/null +++ b/src/resources/email-security/settings/index.ts @@ -0,0 +1,73 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + AllowPolicyListResponsesV4PagePaginationArray, + AllowPolicies, + type AllowPolicyCreateResponse, + type AllowPolicyListResponse, + type AllowPolicyDeleteResponse, + type AllowPolicyEditResponse, + type AllowPolicyGetResponse, + type AllowPolicyCreateParams, + type AllowPolicyListParams, + type AllowPolicyDeleteParams, + type AllowPolicyEditParams, + type AllowPolicyGetParams, +} from './allow-policies'; +export { + BlockSenderListResponsesV4PagePaginationArray, + BlockSenders, + type BlockSenderCreateResponse, + type BlockSenderListResponse, + type BlockSenderDeleteResponse, + type BlockSenderEditResponse, + type BlockSenderGetResponse, + type BlockSenderCreateParams, + type BlockSenderListParams, + type BlockSenderDeleteParams, + type BlockSenderEditParams, + type BlockSenderGetParams, +} from './block-senders'; +export { + DomainListResponsesV4PagePaginationArray, + Domains, + type DomainListResponse, + type DomainDeleteResponse, + type DomainBulkDeleteResponse, + type DomainEditResponse, + type DomainGetResponse, + type DomainListParams, + type DomainDeleteParams, + type DomainBulkDeleteParams, + type DomainEditParams, + type DomainGetParams, +} from './domains'; +export { + ImpersonationRegistryListResponsesV4PagePaginationArray, + ImpersonationRegistry, + type ImpersonationRegistryCreateResponse, + type ImpersonationRegistryListResponse, + type ImpersonationRegistryDeleteResponse, + type ImpersonationRegistryEditResponse, + type ImpersonationRegistryGetResponse, + type ImpersonationRegistryCreateParams, + type ImpersonationRegistryListParams, + type ImpersonationRegistryDeleteParams, + type ImpersonationRegistryEditParams, + type ImpersonationRegistryGetParams, +} from './impersonation-registry'; +export { Settings } from './settings'; +export { + TrustedDomainListResponsesV4PagePaginationArray, + TrustedDomains, + type TrustedDomainCreateResponse, + type TrustedDomainListResponse, + type TrustedDomainDeleteResponse, + type TrustedDomainEditResponse, + type TrustedDomainGetResponse, + type TrustedDomainCreateParams, + type TrustedDomainListParams, + type TrustedDomainDeleteParams, + type TrustedDomainEditParams, + type TrustedDomainGetParams, +} from './trusted-domains'; diff --git a/src/resources/email-security/settings/settings.ts b/src/resources/email-security/settings/settings.ts new file mode 100644 index 0000000000..968a3c4023 --- /dev/null +++ b/src/resources/email-security/settings/settings.ts @@ -0,0 +1,176 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as AllowPoliciesAPI from './allow-policies'; +import { + AllowPolicies, + AllowPolicyCreateParams, + AllowPolicyCreateResponse, + AllowPolicyDeleteParams, + AllowPolicyDeleteResponse, + AllowPolicyEditParams, + AllowPolicyEditResponse, + AllowPolicyGetParams, + AllowPolicyGetResponse, + AllowPolicyListParams, + AllowPolicyListResponse, + AllowPolicyListResponsesV4PagePaginationArray, +} from './allow-policies'; +import * as BlockSendersAPI from './block-senders'; +import { + BlockSenderCreateParams, + BlockSenderCreateResponse, + BlockSenderDeleteParams, + BlockSenderDeleteResponse, + BlockSenderEditParams, + BlockSenderEditResponse, + BlockSenderGetParams, + BlockSenderGetResponse, + BlockSenderListParams, + BlockSenderListResponse, + BlockSenderListResponsesV4PagePaginationArray, + BlockSenders, +} from './block-senders'; +import * as DomainsAPI from './domains'; +import { + DomainBulkDeleteParams, + DomainBulkDeleteResponse, + DomainDeleteParams, + DomainDeleteResponse, + DomainEditParams, + DomainEditResponse, + DomainGetParams, + DomainGetResponse, + DomainListParams, + DomainListResponse, + DomainListResponsesV4PagePaginationArray, + Domains, +} from './domains'; +import * as ImpersonationRegistryAPI from './impersonation-registry'; +import { + ImpersonationRegistry, + ImpersonationRegistryCreateParams, + ImpersonationRegistryCreateResponse, + ImpersonationRegistryDeleteParams, + ImpersonationRegistryDeleteResponse, + ImpersonationRegistryEditParams, + ImpersonationRegistryEditResponse, + ImpersonationRegistryGetParams, + ImpersonationRegistryGetResponse, + ImpersonationRegistryListParams, + ImpersonationRegistryListResponse, + ImpersonationRegistryListResponsesV4PagePaginationArray, +} from './impersonation-registry'; +import * as TrustedDomainsAPI from './trusted-domains'; +import { + TrustedDomainCreateParams, + TrustedDomainCreateResponse, + TrustedDomainDeleteParams, + TrustedDomainDeleteResponse, + TrustedDomainEditParams, + TrustedDomainEditResponse, + TrustedDomainGetParams, + TrustedDomainGetResponse, + TrustedDomainListParams, + TrustedDomainListResponse, + TrustedDomainListResponsesV4PagePaginationArray, + TrustedDomains, +} from './trusted-domains'; + +export class Settings extends APIResource { + allowPolicies: AllowPoliciesAPI.AllowPolicies = new AllowPoliciesAPI.AllowPolicies(this._client); + blockSenders: BlockSendersAPI.BlockSenders = new BlockSendersAPI.BlockSenders(this._client); + domains: DomainsAPI.Domains = new DomainsAPI.Domains(this._client); + impersonationRegistry: ImpersonationRegistryAPI.ImpersonationRegistry = + new ImpersonationRegistryAPI.ImpersonationRegistry(this._client); + trustedDomains: TrustedDomainsAPI.TrustedDomains = new TrustedDomainsAPI.TrustedDomains(this._client); +} + +Settings.AllowPolicies = AllowPolicies; +Settings.AllowPolicyListResponsesV4PagePaginationArray = AllowPolicyListResponsesV4PagePaginationArray; +Settings.BlockSenders = BlockSenders; +Settings.BlockSenderListResponsesV4PagePaginationArray = BlockSenderListResponsesV4PagePaginationArray; +Settings.Domains = Domains; +Settings.DomainListResponsesV4PagePaginationArray = DomainListResponsesV4PagePaginationArray; +Settings.ImpersonationRegistry = ImpersonationRegistry; +Settings.ImpersonationRegistryListResponsesV4PagePaginationArray = + ImpersonationRegistryListResponsesV4PagePaginationArray; +Settings.TrustedDomains = TrustedDomains; +Settings.TrustedDomainListResponsesV4PagePaginationArray = TrustedDomainListResponsesV4PagePaginationArray; + +export declare namespace Settings { + export { + AllowPolicies as AllowPolicies, + type AllowPolicyCreateResponse as AllowPolicyCreateResponse, + type AllowPolicyListResponse as AllowPolicyListResponse, + type AllowPolicyDeleteResponse as AllowPolicyDeleteResponse, + type AllowPolicyEditResponse as AllowPolicyEditResponse, + type AllowPolicyGetResponse as AllowPolicyGetResponse, + AllowPolicyListResponsesV4PagePaginationArray as AllowPolicyListResponsesV4PagePaginationArray, + type AllowPolicyCreateParams as AllowPolicyCreateParams, + type AllowPolicyListParams as AllowPolicyListParams, + type AllowPolicyDeleteParams as AllowPolicyDeleteParams, + type AllowPolicyEditParams as AllowPolicyEditParams, + type AllowPolicyGetParams as AllowPolicyGetParams, + }; + + export { + BlockSenders as BlockSenders, + type BlockSenderCreateResponse as BlockSenderCreateResponse, + type BlockSenderListResponse as BlockSenderListResponse, + type BlockSenderDeleteResponse as BlockSenderDeleteResponse, + type BlockSenderEditResponse as BlockSenderEditResponse, + type BlockSenderGetResponse as BlockSenderGetResponse, + BlockSenderListResponsesV4PagePaginationArray as BlockSenderListResponsesV4PagePaginationArray, + type BlockSenderCreateParams as BlockSenderCreateParams, + type BlockSenderListParams as BlockSenderListParams, + type BlockSenderDeleteParams as BlockSenderDeleteParams, + type BlockSenderEditParams as BlockSenderEditParams, + type BlockSenderGetParams as BlockSenderGetParams, + }; + + export { + Domains as Domains, + type DomainListResponse as DomainListResponse, + type DomainDeleteResponse as DomainDeleteResponse, + type DomainBulkDeleteResponse as DomainBulkDeleteResponse, + type DomainEditResponse as DomainEditResponse, + type DomainGetResponse as DomainGetResponse, + DomainListResponsesV4PagePaginationArray as DomainListResponsesV4PagePaginationArray, + type DomainListParams as DomainListParams, + type DomainDeleteParams as DomainDeleteParams, + type DomainBulkDeleteParams as DomainBulkDeleteParams, + type DomainEditParams as DomainEditParams, + type DomainGetParams as DomainGetParams, + }; + + export { + ImpersonationRegistry as ImpersonationRegistry, + type ImpersonationRegistryCreateResponse as ImpersonationRegistryCreateResponse, + type ImpersonationRegistryListResponse as ImpersonationRegistryListResponse, + type ImpersonationRegistryDeleteResponse as ImpersonationRegistryDeleteResponse, + type ImpersonationRegistryEditResponse as ImpersonationRegistryEditResponse, + type ImpersonationRegistryGetResponse as ImpersonationRegistryGetResponse, + ImpersonationRegistryListResponsesV4PagePaginationArray as ImpersonationRegistryListResponsesV4PagePaginationArray, + type ImpersonationRegistryCreateParams as ImpersonationRegistryCreateParams, + type ImpersonationRegistryListParams as ImpersonationRegistryListParams, + type ImpersonationRegistryDeleteParams as ImpersonationRegistryDeleteParams, + type ImpersonationRegistryEditParams as ImpersonationRegistryEditParams, + type ImpersonationRegistryGetParams as ImpersonationRegistryGetParams, + }; + + export { + TrustedDomains as TrustedDomains, + type TrustedDomainCreateResponse as TrustedDomainCreateResponse, + type TrustedDomainListResponse as TrustedDomainListResponse, + type TrustedDomainDeleteResponse as TrustedDomainDeleteResponse, + type TrustedDomainEditResponse as TrustedDomainEditResponse, + type TrustedDomainGetResponse as TrustedDomainGetResponse, + TrustedDomainListResponsesV4PagePaginationArray as TrustedDomainListResponsesV4PagePaginationArray, + type TrustedDomainCreateParams as TrustedDomainCreateParams, + type TrustedDomainListParams as TrustedDomainListParams, + type TrustedDomainDeleteParams as TrustedDomainDeleteParams, + type TrustedDomainEditParams as TrustedDomainEditParams, + type TrustedDomainGetParams as TrustedDomainGetParams, + }; +} diff --git a/src/resources/email-security/settings/trusted-domains.ts b/src/resources/email-security/settings/trusted-domains.ts new file mode 100644 index 0000000000..44eb965593 --- /dev/null +++ b/src/resources/email-security/settings/trusted-domains.ts @@ -0,0 +1,426 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; + +export class TrustedDomains extends APIResource { + /** + * Create a trusted email domain + */ + create( + params: TrustedDomainCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/email-security/settings/trusted_domains`, { + body, + ...options, + }) as Core.APIPromise<{ result: TrustedDomainCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Lists, searches, and sorts an account’s trusted email domains. + */ + list( + params: TrustedDomainListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/email-security/settings/trusted_domains`, + TrustedDomainListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete a trusted email domain + */ + delete( + trustedDomainId: number, + params: TrustedDomainDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/email-security/settings/trusted_domains/${trustedDomainId}`, + options, + ) as Core.APIPromise<{ result: TrustedDomainDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update a trusted email domain + */ + edit( + trustedDomainId: number, + params: TrustedDomainEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/email-security/settings/trusted_domains/${trustedDomainId}`, + { body, ...options }, + ) as Core.APIPromise<{ result: TrustedDomainEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a trusted email domain + */ + get( + trustedDomainId: number, + params: TrustedDomainGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/email-security/settings/trusted_domains/${trustedDomainId}`, + options, + ) as Core.APIPromise<{ result: TrustedDomainGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class TrustedDomainListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export type TrustedDomainCreateResponse = + | TrustedDomainCreateResponse.EmailSecurityTrustedDomain + | Array; + +export namespace TrustedDomainCreateResponse { + export interface EmailSecurityTrustedDomain { + /** + * The unique identifier for the trusted domain. + */ + id: number; + + created_at: string; + + /** + * Select to prevent recently registered domains from triggering a Suspicious or + * Malicious disposition. + */ + is_recent: boolean; + + is_regex: boolean; + + /** + * Select for partner or other approved domains that have similar spelling to your + * connected domains. Prevents listed domains from triggering a Spoof disposition. + */ + is_similarity: boolean; + + last_modified: string; + + pattern: string; + + comments?: string | null; + } + + export interface UnionMember1 { + /** + * The unique identifier for the trusted domain. + */ + id: number; + + created_at: string; + + /** + * Select to prevent recently registered domains from triggering a Suspicious or + * Malicious disposition. + */ + is_recent: boolean; + + is_regex: boolean; + + /** + * Select for partner or other approved domains that have similar spelling to your + * connected domains. Prevents listed domains from triggering a Spoof disposition. + */ + is_similarity: boolean; + + last_modified: string; + + pattern: string; + + comments?: string | null; + } +} + +export interface TrustedDomainListResponse { + /** + * The unique identifier for the trusted domain. + */ + id: number; + + created_at: string; + + /** + * Select to prevent recently registered domains from triggering a Suspicious or + * Malicious disposition. + */ + is_recent: boolean; + + is_regex: boolean; + + /** + * Select for partner or other approved domains that have similar spelling to your + * connected domains. Prevents listed domains from triggering a Spoof disposition. + */ + is_similarity: boolean; + + last_modified: string; + + pattern: string; + + comments?: string | null; +} + +export interface TrustedDomainDeleteResponse { + /** + * The unique identifier for the trusted domain. + */ + id: number; +} + +export interface TrustedDomainEditResponse { + /** + * The unique identifier for the trusted domain. + */ + id: number; + + created_at: string; + + /** + * Select to prevent recently registered domains from triggering a Suspicious or + * Malicious disposition. + */ + is_recent: boolean; + + is_regex: boolean; + + /** + * Select for partner or other approved domains that have similar spelling to your + * connected domains. Prevents listed domains from triggering a Spoof disposition. + */ + is_similarity: boolean; + + last_modified: string; + + pattern: string; + + comments?: string | null; +} + +export interface TrustedDomainGetResponse { + /** + * The unique identifier for the trusted domain. + */ + id: number; + + created_at: string; + + /** + * Select to prevent recently registered domains from triggering a Suspicious or + * Malicious disposition. + */ + is_recent: boolean; + + is_regex: boolean; + + /** + * Select for partner or other approved domains that have similar spelling to your + * connected domains. Prevents listed domains from triggering a Spoof disposition. + */ + is_similarity: boolean; + + last_modified: string; + + pattern: string; + + comments?: string | null; +} + +export type TrustedDomainCreateParams = + | TrustedDomainCreateParams.EmailSecurityCreateTrustedDomain + | TrustedDomainCreateParams.Variant1; + +export declare namespace TrustedDomainCreateParams { + export interface EmailSecurityCreateTrustedDomain { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: Select to prevent recently registered domains from triggering a + * Suspicious or Malicious disposition. + */ + is_recent: boolean; + + /** + * Body param: + */ + is_regex: boolean; + + /** + * Body param: Select for partner or other approved domains that have similar + * spelling to your connected domains. Prevents listed domains from triggering a + * Spoof disposition. + */ + is_similarity: boolean; + + /** + * Body param: + */ + pattern: string; + + /** + * Body param: + */ + comments?: string | null; + } + + export interface Variant1 { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + body: Array; + } + + export namespace Variant1 { + export interface Body { + /** + * Select to prevent recently registered domains from triggering a Suspicious or + * Malicious disposition. + */ + is_recent: boolean; + + is_regex: boolean; + + /** + * Select for partner or other approved domains that have similar spelling to your + * connected domains. Prevents listed domains from triggering a Spoof disposition. + */ + is_similarity: boolean; + + pattern: string; + + comments?: string | null; + } + } +} + +export interface TrustedDomainListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Query param: The sorting direction. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: + */ + is_recent?: boolean; + + /** + * Query param: + */ + is_similarity?: boolean; + + /** + * Query param: The field to sort by. + */ + order?: 'pattern' | 'created_at'; + + /** + * Query param: Allows searching in multiple properties of a record simultaneously. + * This parameter is intended for human users, not automation. Its exact behavior + * is intentionally left unspecified and is subject to change in the future. + */ + search?: string; +} + +export interface TrustedDomainDeleteParams { + /** + * Account Identifier + */ + account_id: string; +} + +export interface TrustedDomainEditParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Body param: + */ + comments?: string | null; + + /** + * Body param: Select to prevent recently registered domains from triggering a + * Suspicious or Malicious disposition. + */ + is_recent?: boolean | null; + + /** + * Body param: + */ + is_regex?: boolean | null; + + /** + * Body param: Select for partner or other approved domains that have similar + * spelling to your connected domains. Prevents listed domains from triggering a + * Spoof disposition. + */ + is_similarity?: boolean | null; + + /** + * Body param: + */ + pattern?: string | null; +} + +export interface TrustedDomainGetParams { + /** + * Account Identifier + */ + account_id: string; +} + +TrustedDomains.TrustedDomainListResponsesV4PagePaginationArray = + TrustedDomainListResponsesV4PagePaginationArray; + +export declare namespace TrustedDomains { + export { + type TrustedDomainCreateResponse as TrustedDomainCreateResponse, + type TrustedDomainListResponse as TrustedDomainListResponse, + type TrustedDomainDeleteResponse as TrustedDomainDeleteResponse, + type TrustedDomainEditResponse as TrustedDomainEditResponse, + type TrustedDomainGetResponse as TrustedDomainGetResponse, + TrustedDomainListResponsesV4PagePaginationArray as TrustedDomainListResponsesV4PagePaginationArray, + type TrustedDomainCreateParams as TrustedDomainCreateParams, + type TrustedDomainListParams as TrustedDomainListParams, + type TrustedDomainDeleteParams as TrustedDomainDeleteParams, + type TrustedDomainEditParams as TrustedDomainEditParams, + type TrustedDomainGetParams as TrustedDomainGetParams, + }; +} diff --git a/src/resources/email-security/submissions.ts b/src/resources/email-security/submissions.ts new file mode 100644 index 0000000000..5637256c03 --- /dev/null +++ b/src/resources/email-security/submissions.ts @@ -0,0 +1,117 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Submissions extends APIResource { + /** + * This endpoint returns information for submissions to made to reclassify emails. + */ + list( + params: SubmissionListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/email-security/submissions`, + SubmissionListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } +} + +export class SubmissionListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface SubmissionListResponse { + requested_ts: string; + + submission_id: string; + + original_disposition?: + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + | null; + + outcome?: string | null; + + outcome_disposition?: + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + | null; + + requested_by?: string | null; + + requested_disposition?: + | 'MALICIOUS' + | 'MALICIOUS-BEC' + | 'SUSPICIOUS' + | 'SPOOF' + | 'SPAM' + | 'BULK' + | 'ENCRYPTED' + | 'EXTERNAL' + | 'UNKNOWN' + | 'NONE' + | null; + + status?: string | null; + + subject?: string | null; + + type?: string | null; +} + +export interface SubmissionListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account Identifier + */ + account_id: string; + + /** + * Query param: The end of the search date range. Defaults to `now`. + */ + end?: string; + + /** + * Query param: The beginning of the search date range. Defaults to + * `now - 30 days`. + */ + start?: string; + + /** + * Query param: + */ + submission_id?: string; + + /** + * Query param: + */ + type?: 'TEAM' | 'USER'; +} + +Submissions.SubmissionListResponsesV4PagePaginationArray = SubmissionListResponsesV4PagePaginationArray; + +export declare namespace Submissions { + export { + type SubmissionListResponse as SubmissionListResponse, + SubmissionListResponsesV4PagePaginationArray as SubmissionListResponsesV4PagePaginationArray, + type SubmissionListParams as SubmissionListParams, + }; +} diff --git a/src/resources/event-notifications/event-notifications.ts b/src/resources/event-notifications/event-notifications.ts deleted file mode 100644 index f428122919..0000000000 --- a/src/resources/event-notifications/event-notifications.ts +++ /dev/null @@ -1,12 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import * as R2API from './r2/r2'; - -export class EventNotifications extends APIResource { - r2: R2API.R2 = new R2API.R2(this._client); -} - -export namespace EventNotifications { - export import R2 = R2API.R2; -} diff --git a/src/resources/event-notifications/r2/configuration/configuration.ts b/src/resources/event-notifications/r2/configuration/configuration.ts deleted file mode 100644 index c682458c88..0000000000 --- a/src/resources/event-notifications/r2/configuration/configuration.ts +++ /dev/null @@ -1,82 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../../resource'; -import * as Core from '../../../../core'; -import * as ConfigurationAPI from './configuration'; -import * as QueuesAPI from './queues'; - -export class Configuration extends APIResource { - queues: QueuesAPI.Queues = new QueuesAPI.Queues(this._client); - - /** - * Returns all notification rules for each queue for which bucket notifications are - * produced. - */ - get( - bucketName: string, - params: ConfigurationGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get( - `/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration`, - options, - ) as Core.APIPromise<{ result: ConfigurationGetResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export type ConfigurationGetResponse = Record>; - -export namespace ConfigurationGetResponse { - export interface mq_detail { - /** - * Queue ID that will receive notifications based on the configured rules - */ - queue: string; - - /** - * Array of rules to drive notifications - */ - rules: Array; - } - - export namespace mq_detail { - export interface Rule { - /** - * Array of R2 object actions that will trigger notifications - */ - actions: Array< - 'PutObject' | 'CopyObject' | 'DeleteObject' | 'CompleteMultipartUpload' | 'AbortMultipartUpload' - >; - - /** - * Notifications will be sent only for objects with this prefix - */ - prefix?: string; - - /** - * Notifications will be sent only for objects with this suffix - */ - suffix?: string; - } - } -} - -export interface ConfigurationGetParams { - /** - * Identifier - */ - account_id: string; -} - -export namespace Configuration { - export import ConfigurationGetResponse = ConfigurationAPI.ConfigurationGetResponse; - export import ConfigurationGetParams = ConfigurationAPI.ConfigurationGetParams; - export import Queues = QueuesAPI.Queues; - export import QueueUpdateResponse = QueuesAPI.QueueUpdateResponse; - export import QueueDeleteResponse = QueuesAPI.QueueDeleteResponse; - export import QueueUpdateParams = QueuesAPI.QueueUpdateParams; - export import QueueDeleteParams = QueuesAPI.QueueDeleteParams; -} diff --git a/src/resources/event-notifications/r2/configuration/index.ts b/src/resources/event-notifications/r2/configuration/index.ts deleted file mode 100644 index b81a9f8da9..0000000000 --- a/src/resources/event-notifications/r2/configuration/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { ConfigurationGetResponse, ConfigurationGetParams, Configuration } from './configuration'; -export { - QueueUpdateResponse, - QueueDeleteResponse, - QueueUpdateParams, - QueueDeleteParams, - Queues, -} from './queues'; diff --git a/src/resources/event-notifications/r2/index.ts b/src/resources/event-notifications/r2/index.ts deleted file mode 100644 index 601572c2dd..0000000000 --- a/src/resources/event-notifications/r2/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { ConfigurationGetResponse, ConfigurationGetParams, Configuration } from './configuration/index'; -export { R2 } from './r2'; diff --git a/src/resources/event-notifications/r2/r2.ts b/src/resources/event-notifications/r2/r2.ts deleted file mode 100644 index ace8e1f627..0000000000 --- a/src/resources/event-notifications/r2/r2.ts +++ /dev/null @@ -1,14 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as ConfigurationAPI from './configuration/configuration'; - -export class R2 extends APIResource { - configuration: ConfigurationAPI.Configuration = new ConfigurationAPI.Configuration(this._client); -} - -export namespace R2 { - export import Configuration = ConfigurationAPI.Configuration; - export import ConfigurationGetResponse = ConfigurationAPI.ConfigurationGetResponse; - export import ConfigurationGetParams = ConfigurationAPI.ConfigurationGetParams; -} diff --git a/src/resources/filters.ts b/src/resources/filters.ts index ac743a2f67..7ffbb7d7a2 100644 --- a/src/resources/filters.ts +++ b/src/resources/filters.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; -import { isRequestOptions } from '../core'; import * as Core from '../core'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../pagination'; @@ -12,12 +11,12 @@ export class Filters extends APIResource { * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ create( - zoneIdentifier: string, - body: FilterCreateParams, + params: FilterCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/filters`, { body, ...options }) as Core.APIPromise<{ + this._client.post(`/zones/${zone_id}/filters`, { body, ...options }) as Core.APIPromise<{ result: FilterCreateResponse | null; }> )._thenUnwrap((obj) => obj.result); @@ -29,15 +28,16 @@ export class Filters extends APIResource { * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ update( - zoneIdentifier: string, - id: string, - body: FilterUpdateParams, + filterId: string, + params: FilterUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, body } = params; return ( - this._client.put(`/zones/${zoneIdentifier}/filters/${id}`, { body, ...options }) as Core.APIPromise<{ - result: FirewallFilter; - }> + this._client.put(`/zones/${zone_id}/filters/${filterId}`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: FirewallFilter }> )._thenUnwrap((obj) => obj.result); } @@ -48,23 +48,11 @@ export class Filters extends APIResource { * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ list( - zoneIdentifier: string, - query?: FilterListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - query: FilterListParams | Core.RequestOptions = {}, + params: FilterListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(zoneIdentifier, {}, query); - } - return this._client.getAPIList(`/zones/${zoneIdentifier}/filters`, FirewallFiltersV4PagePaginationArray, { + const { zone_id, ...query } = params; + return this._client.getAPIList(`/zones/${zone_id}/filters`, FirewallFiltersV4PagePaginationArray, { query, ...options, }); @@ -75,22 +63,66 @@ export class Filters extends APIResource { * * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ - delete(zoneIdentifier: string, id: string, options?: Core.RequestOptions): Core.APIPromise { + delete( + filterId: string, + params: FilterDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.delete(`/zones/${zoneIdentifier}/filters/${id}`, options) as Core.APIPromise<{ + this._client.delete(`/zones/${zone_id}/filters/${filterId}`, options) as Core.APIPromise<{ result: FirewallFilter; }> )._thenUnwrap((obj) => obj.result); } + /** + * Deletes one or more existing filters. + * + * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. + */ + bulkDelete( + params: FilterBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.delete(`/zones/${zone_id}/filters`, options) as Core.APIPromise<{ + result: FilterBulkDeleteResponse | null; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Updates one or more existing filters. + * + * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. + */ + bulkUpdate( + params: FilterBulkUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.put(`/zones/${zone_id}/filters`, { body, ...options }) as Core.APIPromise<{ + result: FilterBulkUpdateResponse | null; + }> + )._thenUnwrap((obj) => obj.result); + } + /** * Fetches the details of a filter. * * @deprecated The Filters API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ - get(zoneIdentifier: string, id: string, options?: Core.RequestOptions): Core.APIPromise { + get( + filterId: string, + params: FilterGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/filters/${id}`, options) as Core.APIPromise<{ + this._client.get(`/zones/${zone_id}/filters/${filterId}`, options) as Core.APIPromise<{ result: FirewallFilter; }> )._thenUnwrap((obj) => obj.result); @@ -127,35 +159,117 @@ export interface FirewallFilter { ref?: string; } +export interface FirewallFilterParam { + /** + * An informative summary of the filter. + */ + description?: string; + + /** + * The filter expression. For more information, refer to + * [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + */ + expression?: string; + + /** + * When true, indicates that the filter is currently paused. + */ + paused?: boolean; + + /** + * A short reference tag. Allows you to select related filters. + */ + ref?: string; +} + export type FilterCreateResponse = Array; -export type FilterCreateParams = unknown; +export type FilterBulkDeleteResponse = Array; + +export type FilterBulkUpdateResponse = Array; + +export interface FilterCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The filter expression. For more information, refer to + * [Expressions](https://developers.cloudflare.com/ruleset-engine/rules-language/expressions/). + */ + expression: string; +} -export type FilterUpdateParams = unknown; +export interface FilterUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + body: unknown; +} export interface FilterListParams extends V4PagePaginationArrayParams { /** - * The unique identifier of the filter. + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: The unique identifier of the filter. */ id?: string; /** - * A case-insensitive string to find in the description. + * Query param: A case-insensitive string to find in the description. */ description?: string; /** - * A case-insensitive string to find in the expression. + * Query param: A case-insensitive string to find in the expression. */ expression?: string; /** - * When true, indicates that the filter is currently paused. + * Query param: When true, indicates that the filter is currently paused. */ paused?: boolean; /** - * The filter ref (a short reference tag) to search for. Must be an exact match. + * Query param: The filter ref (a short reference tag) to search for. Must be an + * exact match. */ ref?: string; } + +export interface FilterDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface FilterBulkDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface FilterBulkUpdateParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface FilterGetParams { + /** + * Identifier + */ + zone_id: string; +} diff --git a/src/resources/firewall/access-rules.ts b/src/resources/firewall/access-rules.ts index 9fea9a359d..edc662dd9c 100644 --- a/src/resources/firewall/access-rules.ts +++ b/src/resources/firewall/access-rules.ts @@ -3,8 +3,7 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import { CloudflareError } from '../../error'; -import * as AccessRulesAPI from './access-rules'; +import { CloudflareError } from 'cloudflare/error'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class AccessRules extends APIResource { @@ -93,21 +92,18 @@ export class AccessRules extends APIResource { * Note: This operation will affect all zones in the account or zone. */ delete( - identifier: unknown, + ruleId: string, params?: AccessRuleDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise; + delete(ruleId: string, options?: Core.RequestOptions): Core.APIPromise; delete( - identifier: unknown, - options?: Core.RequestOptions, - ): Core.APIPromise; - delete( - identifier: unknown, + ruleId: string, params: AccessRuleDeleteParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { if (isRequestOptions(params)) { - return this.delete(identifier, {}, params); + return this.delete(ruleId, {}, params); } const { account_id, zone_id } = params; if (!account_id && !zone_id) { @@ -128,7 +124,7 @@ export class AccessRules extends APIResource { }; return ( this._client.delete( - `/${accountOrZone}/${accountOrZoneId}/firewall/access_rules/rules/${identifier}`, + `/${accountOrZone}/${accountOrZoneId}/firewall/access_rules/rules/${ruleId}`, options, ) as Core.APIPromise<{ result: AccessRuleDeleteResponse | null }> )._thenUnwrap((obj) => obj.result); @@ -140,7 +136,7 @@ export class AccessRules extends APIResource { * Note: This operation will affect all zones in the account or zone. */ edit( - identifier: unknown, + ruleId: string, params: AccessRuleEditParams, options?: Core.RequestOptions, ): Core.APIPromise { @@ -162,7 +158,7 @@ export class AccessRules extends APIResource { accountOrZoneId: zone_id, }; return ( - this._client.patch(`/${accountOrZone}/${accountOrZoneId}/firewall/access_rules/rules/${identifier}`, { + this._client.patch(`/${accountOrZone}/${accountOrZoneId}/firewall/access_rules/rules/${ruleId}`, { body, ...options, }) as Core.APIPromise<{ result: AccessRuleEditResponse }> @@ -173,18 +169,18 @@ export class AccessRules extends APIResource { * Fetches the details of an IP Access rule defined. */ get( - identifier: unknown, + ruleId: string, params?: AccessRuleGetParams, options?: Core.RequestOptions, ): Core.APIPromise; - get(identifier: unknown, options?: Core.RequestOptions): Core.APIPromise; + get(ruleId: string, options?: Core.RequestOptions): Core.APIPromise; get( - identifier: unknown, + ruleId: string, params: AccessRuleGetParams | Core.RequestOptions = {}, options?: Core.RequestOptions, ): Core.APIPromise { if (isRequestOptions(params)) { - return this.get(identifier, {}, params); + return this.get(ruleId, {}, params); } const { account_id, zone_id } = params; if (!account_id && !zone_id) { @@ -205,7 +201,7 @@ export class AccessRules extends APIResource { }; return ( this._client.get( - `/${accountOrZone}/${accountOrZoneId}/firewall/access_rules/rules/${identifier}`, + `/${accountOrZone}/${accountOrZoneId}/firewall/access_rules/rules/${ruleId}`, options, ) as Core.APIPromise<{ result: AccessRuleGetResponse }> )._thenUnwrap((obj) => obj.result); @@ -350,9 +346,143 @@ export interface IPV6ConfigurationParam { value?: string; } -export type AccessRuleCreateResponse = unknown | string | null; +export interface AccessRuleCreateResponse { + /** + * The unique identifier of the IP Access rule. + */ + id: string; + + /** + * The available actions that a rule can apply to a matched request. + */ + allowed_modes: Array<'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'>; + + /** + * The rule configuration. + */ + configuration: + | AccessRuleIPConfiguration + | IPV6Configuration + | AccessRuleCIDRConfiguration + | ASNConfiguration + | CountryConfiguration; + + /** + * The action to apply to a matched request. + */ + mode: 'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'; + + /** + * The timestamp of when the rule was created. + */ + created_on?: string; + + /** + * The timestamp of when the rule was last modified. + */ + modified_on?: string; + + /** + * An informative summary of the rule, typically used as a reminder or explanation. + */ + notes?: string; + + /** + * All zones owned by the user will have the rule applied. + */ + scope?: AccessRuleCreateResponse.Scope; +} + +export namespace AccessRuleCreateResponse { + /** + * All zones owned by the user will have the rule applied. + */ + export interface Scope { + /** + * Identifier + */ + id?: string; + + /** + * The contact email address of the user. + */ + email?: string; + + /** + * The scope of the rule. + */ + type?: 'user' | 'organization'; + } +} + +export interface AccessRuleListResponse { + /** + * The unique identifier of the IP Access rule. + */ + id: string; + + /** + * The available actions that a rule can apply to a matched request. + */ + allowed_modes: Array<'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'>; + + /** + * The rule configuration. + */ + configuration: + | AccessRuleIPConfiguration + | IPV6Configuration + | AccessRuleCIDRConfiguration + | ASNConfiguration + | CountryConfiguration; + + /** + * The action to apply to a matched request. + */ + mode: 'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'; + + /** + * The timestamp of when the rule was created. + */ + created_on?: string; + + /** + * The timestamp of when the rule was last modified. + */ + modified_on?: string; + + /** + * An informative summary of the rule, typically used as a reminder or explanation. + */ + notes?: string; + + /** + * All zones owned by the user will have the rule applied. + */ + scope?: AccessRuleListResponse.Scope; +} + +export namespace AccessRuleListResponse { + /** + * All zones owned by the user will have the rule applied. + */ + export interface Scope { + /** + * Identifier + */ + id?: string; + + /** + * The contact email address of the user. + */ + email?: string; -export type AccessRuleListResponse = unknown; + /** + * The scope of the rule. + */ + type?: 'user' | 'organization'; + } +} export interface AccessRuleDeleteResponse { /** @@ -361,9 +491,143 @@ export interface AccessRuleDeleteResponse { id: string; } -export type AccessRuleEditResponse = unknown | string | null; +export interface AccessRuleEditResponse { + /** + * The unique identifier of the IP Access rule. + */ + id: string; + + /** + * The available actions that a rule can apply to a matched request. + */ + allowed_modes: Array<'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'>; -export type AccessRuleGetResponse = unknown | string | null; + /** + * The rule configuration. + */ + configuration: + | AccessRuleIPConfiguration + | IPV6Configuration + | AccessRuleCIDRConfiguration + | ASNConfiguration + | CountryConfiguration; + + /** + * The action to apply to a matched request. + */ + mode: 'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'; + + /** + * The timestamp of when the rule was created. + */ + created_on?: string; + + /** + * The timestamp of when the rule was last modified. + */ + modified_on?: string; + + /** + * An informative summary of the rule, typically used as a reminder or explanation. + */ + notes?: string; + + /** + * All zones owned by the user will have the rule applied. + */ + scope?: AccessRuleEditResponse.Scope; +} + +export namespace AccessRuleEditResponse { + /** + * All zones owned by the user will have the rule applied. + */ + export interface Scope { + /** + * Identifier + */ + id?: string; + + /** + * The contact email address of the user. + */ + email?: string; + + /** + * The scope of the rule. + */ + type?: 'user' | 'organization'; + } +} + +export interface AccessRuleGetResponse { + /** + * The unique identifier of the IP Access rule. + */ + id: string; + + /** + * The available actions that a rule can apply to a matched request. + */ + allowed_modes: Array<'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'>; + + /** + * The rule configuration. + */ + configuration: + | AccessRuleIPConfiguration + | IPV6Configuration + | AccessRuleCIDRConfiguration + | ASNConfiguration + | CountryConfiguration; + + /** + * The action to apply to a matched request. + */ + mode: 'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'; + + /** + * The timestamp of when the rule was created. + */ + created_on?: string; + + /** + * The timestamp of when the rule was last modified. + */ + modified_on?: string; + + /** + * An informative summary of the rule, typically used as a reminder or explanation. + */ + notes?: string; + + /** + * All zones owned by the user will have the rule applied. + */ + scope?: AccessRuleGetResponse.Scope; +} + +export namespace AccessRuleGetResponse { + /** + * All zones owned by the user will have the rule applied. + */ + export interface Scope { + /** + * Identifier + */ + id?: string; + + /** + * The contact email address of the user. + */ + email?: string; + + /** + * The scope of the rule. + */ + type?: 'user' | 'organization'; + } +} export interface AccessRuleCreateParams { /** @@ -413,20 +677,33 @@ export interface AccessRuleListParams extends V4PagePaginationArrayParams { */ zone_id?: string; + /** + * Query param: + */ + configuration?: AccessRuleListParams.Configuration; + /** * Query param: The direction used to sort returned rules. */ direction?: 'asc' | 'desc'; /** - * Query param: + * Query param: When set to `all`, all the search requirements must match. When set + * to `any`, only one of the search requirements has to match. */ - 'egs-pagination'?: AccessRuleListParams.EgsPagination; + match?: 'any' | 'all'; /** - * Query param: + * Query param: The action to apply to a matched request. + */ + mode?: 'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'; + + /** + * Query param: The string to search for in the notes of existing IP Access rules. + * Notes: For example, the string 'attack' would match IP Access rules with notes + * 'Attack 26/02' and 'Attack 27/02'. The search is case insensitive. */ - filters?: AccessRuleListParams.Filters; + notes?: string; /** * Query param: The field used to sort returned rules. @@ -435,30 +712,11 @@ export interface AccessRuleListParams extends V4PagePaginationArrayParams { } export namespace AccessRuleListParams { - export interface EgsPagination { - json?: EgsPagination.Json; - } - - export namespace EgsPagination { - export interface Json { - /** - * The page number of paginated results. - */ - page?: number; - - /** - * The maximum number of results per page. You can only set the value to `1` or to - * a multiple of 5 such as `5`, `10`, `15`, or `20`. - */ - per_page?: number; - } - } - - export interface Filters { + export interface Configuration { /** * The target to search in existing rules. */ - 'configuration.target'?: 'ip' | 'ip_range' | 'asn' | 'country'; + target?: 'ip' | 'ip_range' | 'asn' | 'country'; /** * The target value to search for in existing rules: an IP address, an IP address @@ -466,25 +724,7 @@ export namespace AccessRuleListParams { * Notes: You can search for a single IPv4 address, an IP address range with a * subnet of '/16' or '/24', or a two-letter ISO-3166-1 alpha-2 country code. */ - 'configuration.value'?: string; - - /** - * When set to `all`, all the search requirements must match. When set to `any`, - * only one of the search requirements has to match. - */ - match?: 'any' | 'all'; - - /** - * The action to apply to a matched request. - */ - mode?: 'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'; - - /** - * The string to search for in the notes of existing IP Access rules. Notes: For - * example, the string 'attack' would match IP Access rules with notes 'Attack - * 26/02' and 'Attack 27/02'. The search is case insensitive. - */ - notes?: string; + value?: string; } } @@ -547,21 +787,25 @@ export interface AccessRuleGetParams { zone_id?: string; } -export namespace AccessRules { - export import AccessRuleCIDRConfiguration = AccessRulesAPI.AccessRuleCIDRConfiguration; - export import AccessRuleIPConfiguration = AccessRulesAPI.AccessRuleIPConfiguration; - export import ASNConfiguration = AccessRulesAPI.ASNConfiguration; - export import CountryConfiguration = AccessRulesAPI.CountryConfiguration; - export import IPV6Configuration = AccessRulesAPI.IPV6Configuration; - export import AccessRuleCreateResponse = AccessRulesAPI.AccessRuleCreateResponse; - export import AccessRuleListResponse = AccessRulesAPI.AccessRuleListResponse; - export import AccessRuleDeleteResponse = AccessRulesAPI.AccessRuleDeleteResponse; - export import AccessRuleEditResponse = AccessRulesAPI.AccessRuleEditResponse; - export import AccessRuleGetResponse = AccessRulesAPI.AccessRuleGetResponse; - export import AccessRuleListResponsesV4PagePaginationArray = AccessRulesAPI.AccessRuleListResponsesV4PagePaginationArray; - export import AccessRuleCreateParams = AccessRulesAPI.AccessRuleCreateParams; - export import AccessRuleListParams = AccessRulesAPI.AccessRuleListParams; - export import AccessRuleDeleteParams = AccessRulesAPI.AccessRuleDeleteParams; - export import AccessRuleEditParams = AccessRulesAPI.AccessRuleEditParams; - export import AccessRuleGetParams = AccessRulesAPI.AccessRuleGetParams; +AccessRules.AccessRuleListResponsesV4PagePaginationArray = AccessRuleListResponsesV4PagePaginationArray; + +export declare namespace AccessRules { + export { + type AccessRuleCIDRConfiguration as AccessRuleCIDRConfiguration, + type AccessRuleIPConfiguration as AccessRuleIPConfiguration, + type ASNConfiguration as ASNConfiguration, + type CountryConfiguration as CountryConfiguration, + type IPV6Configuration as IPV6Configuration, + type AccessRuleCreateResponse as AccessRuleCreateResponse, + type AccessRuleListResponse as AccessRuleListResponse, + type AccessRuleDeleteResponse as AccessRuleDeleteResponse, + type AccessRuleEditResponse as AccessRuleEditResponse, + type AccessRuleGetResponse as AccessRuleGetResponse, + AccessRuleListResponsesV4PagePaginationArray as AccessRuleListResponsesV4PagePaginationArray, + type AccessRuleCreateParams as AccessRuleCreateParams, + type AccessRuleListParams as AccessRuleListParams, + type AccessRuleDeleteParams as AccessRuleDeleteParams, + type AccessRuleEditParams as AccessRuleEditParams, + type AccessRuleGetParams as AccessRuleGetParams, + }; } diff --git a/src/resources/firewall/firewall.ts b/src/resources/firewall/firewall.ts index fa985578dd..fc8b19685f 100644 --- a/src/resources/firewall/firewall.ts +++ b/src/resources/firewall/firewall.ts @@ -2,10 +2,80 @@ import { APIResource } from '../../resource'; import * as AccessRulesAPI from './access-rules'; +import { + ASNConfiguration, + AccessRuleCIDRConfiguration, + AccessRuleCreateParams, + AccessRuleCreateResponse, + AccessRuleDeleteParams, + AccessRuleDeleteResponse, + AccessRuleEditParams, + AccessRuleEditResponse, + AccessRuleGetParams, + AccessRuleGetResponse, + AccessRuleIPConfiguration, + AccessRuleListParams, + AccessRuleListResponse, + AccessRuleListResponsesV4PagePaginationArray, + AccessRules, + CountryConfiguration, + IPV6Configuration, +} from './access-rules'; import * as LockdownsAPI from './lockdowns'; +import { + Configuration, + Lockdown, + LockdownCIDRConfiguration, + LockdownCreateParams, + LockdownDeleteParams, + LockdownDeleteResponse, + LockdownGetParams, + LockdownIPConfiguration, + LockdownListParams, + LockdownURL, + LockdownUpdateParams, + Lockdowns, + LockdownsV4PagePaginationArray, +} from './lockdowns'; import * as RulesAPI from './rules'; +import { + DeletedFilter, + FirewallRule, + FirewallRulesV4PagePaginationArray, + Product, + RuleBulkDeleteParams, + RuleBulkDeleteResponse, + RuleBulkEditParams, + RuleBulkEditResponse, + RuleBulkUpdateParams, + RuleBulkUpdateResponse, + RuleCreateParams, + RuleCreateResponse, + RuleDeleteParams, + RuleEditParams, + RuleEditResponse, + RuleGetParams, + RuleListParams, + RuleUpdateParams, + Rules, +} from './rules'; import * as UARulesAPI from './ua-rules'; +import { + UARuleCreateParams, + UARuleCreateResponse, + UARuleDeleteParams, + UARuleDeleteResponse, + UARuleGetParams, + UARuleGetResponse, + UARuleListParams, + UARuleListResponse, + UARuleListResponsesV4PagePaginationArray, + UARuleUpdateParams, + UARuleUpdateResponse, + UARules, +} from './ua-rules'; import * as WAFAPI from './waf/waf'; +import { WAF } from './waf/waf'; export class Firewall extends APIResource { lockdowns: LockdownsAPI.Lockdowns = new LockdownsAPI.Lockdowns(this._client); @@ -15,56 +85,89 @@ export class Firewall extends APIResource { waf: WAFAPI.WAF = new WAFAPI.WAF(this._client); } -export namespace Firewall { - export import Lockdowns = LockdownsAPI.Lockdowns; - export import Configuration = LockdownsAPI.Configuration; - export import Lockdown = LockdownsAPI.Lockdown; - export import LockdownCIDRConfiguration = LockdownsAPI.LockdownCIDRConfiguration; - export import LockdownIPConfiguration = LockdownsAPI.LockdownIPConfiguration; - export import LockdownURL = LockdownsAPI.LockdownURL; - export import LockdownDeleteResponse = LockdownsAPI.LockdownDeleteResponse; - export import LockdownsV4PagePaginationArray = LockdownsAPI.LockdownsV4PagePaginationArray; - export import LockdownCreateParams = LockdownsAPI.LockdownCreateParams; - export import LockdownUpdateParams = LockdownsAPI.LockdownUpdateParams; - export import LockdownListParams = LockdownsAPI.LockdownListParams; - export import Rules = RulesAPI.Rules; - export import FirewallRule = RulesAPI.FirewallRule; - export import Product = RulesAPI.Product; - export import DeletedFilter = RulesAPI.DeletedFilter; - export import RuleCreateResponse = RulesAPI.RuleCreateResponse; - export import RuleEditResponse = RulesAPI.RuleEditResponse; - export import FirewallRulesV4PagePaginationArray = RulesAPI.FirewallRulesV4PagePaginationArray; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; - export import RuleEditParams = RulesAPI.RuleEditParams; - export import RuleGetParams = RulesAPI.RuleGetParams; - export import AccessRules = AccessRulesAPI.AccessRules; - export import AccessRuleCIDRConfiguration = AccessRulesAPI.AccessRuleCIDRConfiguration; - export import AccessRuleIPConfiguration = AccessRulesAPI.AccessRuleIPConfiguration; - export import ASNConfiguration = AccessRulesAPI.ASNConfiguration; - export import CountryConfiguration = AccessRulesAPI.CountryConfiguration; - export import IPV6Configuration = AccessRulesAPI.IPV6Configuration; - export import AccessRuleCreateResponse = AccessRulesAPI.AccessRuleCreateResponse; - export import AccessRuleListResponse = AccessRulesAPI.AccessRuleListResponse; - export import AccessRuleDeleteResponse = AccessRulesAPI.AccessRuleDeleteResponse; - export import AccessRuleEditResponse = AccessRulesAPI.AccessRuleEditResponse; - export import AccessRuleGetResponse = AccessRulesAPI.AccessRuleGetResponse; - export import AccessRuleListResponsesV4PagePaginationArray = AccessRulesAPI.AccessRuleListResponsesV4PagePaginationArray; - export import AccessRuleCreateParams = AccessRulesAPI.AccessRuleCreateParams; - export import AccessRuleListParams = AccessRulesAPI.AccessRuleListParams; - export import AccessRuleDeleteParams = AccessRulesAPI.AccessRuleDeleteParams; - export import AccessRuleEditParams = AccessRulesAPI.AccessRuleEditParams; - export import AccessRuleGetParams = AccessRulesAPI.AccessRuleGetParams; - export import UARules = UARulesAPI.UARules; - export import UARuleCreateResponse = UARulesAPI.UARuleCreateResponse; - export import UARuleUpdateResponse = UARulesAPI.UARuleUpdateResponse; - export import UARuleListResponse = UARulesAPI.UARuleListResponse; - export import UARuleDeleteResponse = UARulesAPI.UARuleDeleteResponse; - export import UARuleGetResponse = UARulesAPI.UARuleGetResponse; - export import UARuleListResponsesV4PagePaginationArray = UARulesAPI.UARuleListResponsesV4PagePaginationArray; - export import UARuleCreateParams = UARulesAPI.UARuleCreateParams; - export import UARuleUpdateParams = UARulesAPI.UARuleUpdateParams; - export import UARuleListParams = UARulesAPI.UARuleListParams; - export import WAF = WAFAPI.WAF; +Firewall.Lockdowns = Lockdowns; +Firewall.LockdownsV4PagePaginationArray = LockdownsV4PagePaginationArray; +Firewall.Rules = Rules; +Firewall.FirewallRulesV4PagePaginationArray = FirewallRulesV4PagePaginationArray; +Firewall.AccessRules = AccessRules; +Firewall.AccessRuleListResponsesV4PagePaginationArray = AccessRuleListResponsesV4PagePaginationArray; +Firewall.UARules = UARules; +Firewall.UARuleListResponsesV4PagePaginationArray = UARuleListResponsesV4PagePaginationArray; +Firewall.WAF = WAF; + +export declare namespace Firewall { + export { + Lockdowns as Lockdowns, + type Configuration as Configuration, + type Lockdown as Lockdown, + type LockdownCIDRConfiguration as LockdownCIDRConfiguration, + type LockdownIPConfiguration as LockdownIPConfiguration, + type LockdownURL as LockdownURL, + type LockdownDeleteResponse as LockdownDeleteResponse, + LockdownsV4PagePaginationArray as LockdownsV4PagePaginationArray, + type LockdownCreateParams as LockdownCreateParams, + type LockdownUpdateParams as LockdownUpdateParams, + type LockdownListParams as LockdownListParams, + type LockdownDeleteParams as LockdownDeleteParams, + type LockdownGetParams as LockdownGetParams, + }; + + export { + Rules as Rules, + type DeletedFilter as DeletedFilter, + type FirewallRule as FirewallRule, + type Product as Product, + type RuleCreateResponse as RuleCreateResponse, + type RuleBulkDeleteResponse as RuleBulkDeleteResponse, + type RuleBulkEditResponse as RuleBulkEditResponse, + type RuleBulkUpdateResponse as RuleBulkUpdateResponse, + type RuleEditResponse as RuleEditResponse, + FirewallRulesV4PagePaginationArray as FirewallRulesV4PagePaginationArray, + type RuleCreateParams as RuleCreateParams, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleBulkDeleteParams as RuleBulkDeleteParams, + type RuleBulkEditParams as RuleBulkEditParams, + type RuleBulkUpdateParams as RuleBulkUpdateParams, + type RuleEditParams as RuleEditParams, + type RuleGetParams as RuleGetParams, + }; + + export { + AccessRules as AccessRules, + type AccessRuleCIDRConfiguration as AccessRuleCIDRConfiguration, + type AccessRuleIPConfiguration as AccessRuleIPConfiguration, + type ASNConfiguration as ASNConfiguration, + type CountryConfiguration as CountryConfiguration, + type IPV6Configuration as IPV6Configuration, + type AccessRuleCreateResponse as AccessRuleCreateResponse, + type AccessRuleListResponse as AccessRuleListResponse, + type AccessRuleDeleteResponse as AccessRuleDeleteResponse, + type AccessRuleEditResponse as AccessRuleEditResponse, + type AccessRuleGetResponse as AccessRuleGetResponse, + AccessRuleListResponsesV4PagePaginationArray as AccessRuleListResponsesV4PagePaginationArray, + type AccessRuleCreateParams as AccessRuleCreateParams, + type AccessRuleListParams as AccessRuleListParams, + type AccessRuleDeleteParams as AccessRuleDeleteParams, + type AccessRuleEditParams as AccessRuleEditParams, + type AccessRuleGetParams as AccessRuleGetParams, + }; + + export { + UARules as UARules, + type UARuleCreateResponse as UARuleCreateResponse, + type UARuleUpdateResponse as UARuleUpdateResponse, + type UARuleListResponse as UARuleListResponse, + type UARuleDeleteResponse as UARuleDeleteResponse, + type UARuleGetResponse as UARuleGetResponse, + UARuleListResponsesV4PagePaginationArray as UARuleListResponsesV4PagePaginationArray, + type UARuleCreateParams as UARuleCreateParams, + type UARuleUpdateParams as UARuleUpdateParams, + type UARuleListParams as UARuleListParams, + type UARuleDeleteParams as UARuleDeleteParams, + type UARuleGetParams as UARuleGetParams, + }; + + export { WAF as WAF }; } diff --git a/src/resources/firewall/index.ts b/src/resources/firewall/index.ts index 82bb6e88f4..f1522cc2e6 100644 --- a/src/resources/firewall/index.ts +++ b/src/resources/firewall/index.ts @@ -1,62 +1,73 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AccessRuleCIDRConfiguration, - AccessRuleIPConfiguration, - ASNConfiguration, - CountryConfiguration, - IPV6Configuration, - AccessRuleCreateResponse, - AccessRuleListResponse, - AccessRuleDeleteResponse, - AccessRuleEditResponse, - AccessRuleGetResponse, - AccessRuleCreateParams, - AccessRuleListParams, - AccessRuleDeleteParams, - AccessRuleEditParams, - AccessRuleGetParams, AccessRuleListResponsesV4PagePaginationArray, AccessRules, + type AccessRuleCIDRConfiguration, + type AccessRuleIPConfiguration, + type ASNConfiguration, + type CountryConfiguration, + type IPV6Configuration, + type AccessRuleCreateResponse, + type AccessRuleListResponse, + type AccessRuleDeleteResponse, + type AccessRuleEditResponse, + type AccessRuleGetResponse, + type AccessRuleCreateParams, + type AccessRuleListParams, + type AccessRuleDeleteParams, + type AccessRuleEditParams, + type AccessRuleGetParams, } from './access-rules'; -export { - Configuration, - Lockdown, - LockdownCIDRConfiguration, - LockdownIPConfiguration, - LockdownURL, - LockdownDeleteResponse, - LockdownCreateParams, - LockdownUpdateParams, - LockdownListParams, - LockdownsV4PagePaginationArray, - Lockdowns, -} from './lockdowns'; export { Firewall } from './firewall'; export { - FirewallRule, - Product, - DeletedFilter, - RuleCreateResponse, - RuleEditResponse, - RuleCreateParams, - RuleUpdateParams, - RuleListParams, - RuleEditParams, - RuleGetParams, FirewallRulesV4PagePaginationArray, Rules, + type DeletedFilter, + type FirewallRule, + type Product, + type RuleCreateResponse, + type RuleBulkDeleteResponse, + type RuleBulkEditResponse, + type RuleBulkUpdateResponse, + type RuleEditResponse, + type RuleCreateParams, + type RuleUpdateParams, + type RuleListParams, + type RuleDeleteParams, + type RuleBulkDeleteParams, + type RuleBulkEditParams, + type RuleBulkUpdateParams, + type RuleEditParams, + type RuleGetParams, } from './rules'; export { - UARuleCreateResponse, - UARuleUpdateResponse, - UARuleListResponse, - UARuleDeleteResponse, - UARuleGetResponse, - UARuleCreateParams, - UARuleUpdateParams, - UARuleListParams, + LockdownsV4PagePaginationArray, + Lockdowns, + type Configuration, + type Lockdown, + type LockdownCIDRConfiguration, + type LockdownIPConfiguration, + type LockdownURL, + type LockdownDeleteResponse, + type LockdownCreateParams, + type LockdownUpdateParams, + type LockdownListParams, + type LockdownDeleteParams, + type LockdownGetParams, +} from './lockdowns'; +export { UARuleListResponsesV4PagePaginationArray, UARules, + type UARuleCreateResponse, + type UARuleUpdateResponse, + type UARuleListResponse, + type UARuleDeleteResponse, + type UARuleGetResponse, + type UARuleCreateParams, + type UARuleUpdateParams, + type UARuleListParams, + type UARuleDeleteParams, + type UARuleGetParams, } from './ua-rules'; export { WAF } from './waf/index'; diff --git a/src/resources/firewall/lockdowns.ts b/src/resources/firewall/lockdowns.ts index 583215924c..72b1cd8a95 100644 --- a/src/resources/firewall/lockdowns.ts +++ b/src/resources/firewall/lockdowns.ts @@ -1,25 +1,20 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as LockdownsAPI from './lockdowns'; +import * as OverridesAPI from './waf/overrides'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class Lockdowns extends APIResource { /** * Creates a new Zone Lockdown rule. */ - create( - zoneIdentifier: string, - body: LockdownCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + create(params: LockdownCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/firewall/lockdowns`, { - body, - ...options, - }) as Core.APIPromise<{ result: Lockdown }> + this._client.post(`/zones/${zone_id}/firewall/lockdowns`, { body, ...options }) as Core.APIPromise<{ + result: Lockdown; + }> )._thenUnwrap((obj) => obj.result); } @@ -27,13 +22,13 @@ export class Lockdowns extends APIResource { * Updates an existing Zone Lockdown rule. */ update( - zoneIdentifier: string, - id: string, - body: LockdownUpdateParams, + lockDownsId: string, + params: LockdownUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.put(`/zones/${zoneIdentifier}/firewall/lockdowns/${id}`, { + this._client.put(`/zones/${zone_id}/firewall/lockdowns/${lockDownsId}`, { body, ...options, }) as Core.APIPromise<{ result: Lockdown }> @@ -45,39 +40,27 @@ export class Lockdowns extends APIResource { * parameters. */ list( - zoneIdentifier: string, - query?: LockdownListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - query: LockdownListParams | Core.RequestOptions = {}, + params: LockdownListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(zoneIdentifier, {}, query); - } - return this._client.getAPIList( - `/zones/${zoneIdentifier}/firewall/lockdowns`, - LockdownsV4PagePaginationArray, - { query, ...options }, - ); + const { zone_id, ...query } = params; + return this._client.getAPIList(`/zones/${zone_id}/firewall/lockdowns`, LockdownsV4PagePaginationArray, { + query, + ...options, + }); } /** * Deletes an existing Zone Lockdown rule. */ delete( - zoneIdentifier: string, - id: string, + lockDownsId: string, + params: LockdownDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.delete(`/zones/${zoneIdentifier}/firewall/lockdowns/${id}`, options) as Core.APIPromise<{ + this._client.delete(`/zones/${zone_id}/firewall/lockdowns/${lockDownsId}`, options) as Core.APIPromise<{ result: LockdownDeleteResponse; }> )._thenUnwrap((obj) => obj.result); @@ -86,9 +69,14 @@ export class Lockdowns extends APIResource { /** * Fetches the details of a Zone Lockdown rule. */ - get(zoneIdentifier: string, id: string, options?: Core.RequestOptions): Core.APIPromise { + get( + lockDownsId: string, + params: LockdownGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/firewall/lockdowns/${id}`, options) as Core.APIPromise<{ + this._client.get(`/zones/${zone_id}/firewall/lockdowns/${lockDownsId}`, options) as Core.APIPromise<{ result: Lockdown; }> )._thenUnwrap((obj) => obj.result); @@ -102,7 +90,14 @@ export class LockdownsV4PagePaginationArray extends V4PagePaginationArray; + +/** + * A list of IP addresses or CIDR ranges that will be allowed to access the URLs + * specified in the Zone Lockdown rule. You can include any number of `ip` or + * `ip_range` configurations. + */ +export type ConfigurationParam = Array; export interface Lockdown { /** @@ -158,6 +153,19 @@ export interface LockdownCIDRConfiguration { value?: string; } +export interface LockdownCIDRConfigurationParam { + /** + * The configuration target. You must set the target to `ip_range` when specifying + * an IP address range in the Zone Lockdown rule. + */ + target?: 'ip_range'; + + /** + * The IP address range to match. You can only use prefix lengths `/16` and `/24`. + */ + value?: string; +} + export interface LockdownIPConfiguration { /** * The configuration target. You must set the target to `ip` when specifying an IP @@ -172,6 +180,20 @@ export interface LockdownIPConfiguration { value?: string; } +export interface LockdownIPConfigurationParam { + /** + * The configuration target. You must set the target to `ip` when specifying an IP + * address in the Zone Lockdown rule. + */ + target?: 'ip'; + + /** + * The IP address to match. This address will be compared to the IP address of + * incoming requests. + */ + value?: string; +} + export type LockdownURL = string; export interface LockdownDeleteResponse { @@ -181,68 +203,131 @@ export interface LockdownDeleteResponse { id?: string; } -export type LockdownCreateParams = unknown; +export interface LockdownCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; -export type LockdownUpdateParams = unknown; + /** + * Body param: A list of IP addresses or CIDR ranges that will be allowed to access + * the URLs specified in the Zone Lockdown rule. You can include any number of `ip` + * or `ip_range` configurations. + */ + configurations: ConfigurationParam; + + /** + * Body param: The URLs to include in the current WAF override. You can use + * wildcards. Each entered URL will be escaped before use, which means you can only + * use simple wildcard patterns. + */ + urls: Array; +} + +export interface LockdownUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: A list of IP addresses or CIDR ranges that will be allowed to access + * the URLs specified in the Zone Lockdown rule. You can include any number of `ip` + * or `ip_range` configurations. + */ + configurations: ConfigurationParam; + + /** + * Body param: The URLs to include in the current WAF override. You can use + * wildcards. Each entered URL will be escaped before use, which means you can only + * use simple wildcard patterns. + */ + urls: Array; +} export interface LockdownListParams extends V4PagePaginationArrayParams { /** - * The timestamp of when the rule was created. + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: The timestamp of when the rule was created. */ created_on?: string; /** - * A string to search for in the description of existing rules. + * Query param: A string to search for in the description of existing rules. */ description?: string; /** - * A string to search for in the description of existing rules. + * Query param: A string to search for in the description of existing rules. */ description_search?: string; /** - * A single IP address to search for in existing rules. + * Query param: A single IP address to search for in existing rules. */ ip?: string; /** - * A single IP address range to search for in existing rules. + * Query param: A single IP address range to search for in existing rules. */ ip_range_search?: string; /** - * A single IP address to search for in existing rules. + * Query param: A single IP address to search for in existing rules. */ ip_search?: string; /** - * The timestamp of when the rule was last modified. + * Query param: The timestamp of when the rule was last modified. */ modified_on?: string; /** - * The priority of the rule to control the processing order. A lower number - * indicates higher priority. If not provided, any rules with a configured priority - * will be processed before rules without a priority. + * Query param: The priority of the rule to control the processing order. A lower + * number indicates higher priority. If not provided, any rules with a configured + * priority will be processed before rules without a priority. */ priority?: number; /** - * A single URI to search for in the list of URLs of existing rules. + * Query param: A single URI to search for in the list of URLs of existing rules. */ uri_search?: string; } -export namespace Lockdowns { - export import Configuration = LockdownsAPI.Configuration; - export import Lockdown = LockdownsAPI.Lockdown; - export import LockdownCIDRConfiguration = LockdownsAPI.LockdownCIDRConfiguration; - export import LockdownIPConfiguration = LockdownsAPI.LockdownIPConfiguration; - export import LockdownURL = LockdownsAPI.LockdownURL; - export import LockdownDeleteResponse = LockdownsAPI.LockdownDeleteResponse; - export import LockdownsV4PagePaginationArray = LockdownsAPI.LockdownsV4PagePaginationArray; - export import LockdownCreateParams = LockdownsAPI.LockdownCreateParams; - export import LockdownUpdateParams = LockdownsAPI.LockdownUpdateParams; - export import LockdownListParams = LockdownsAPI.LockdownListParams; +export interface LockdownDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface LockdownGetParams { + /** + * Identifier + */ + zone_id: string; +} + +Lockdowns.LockdownsV4PagePaginationArray = LockdownsV4PagePaginationArray; + +export declare namespace Lockdowns { + export { + type Configuration as Configuration, + type Lockdown as Lockdown, + type LockdownCIDRConfiguration as LockdownCIDRConfiguration, + type LockdownIPConfiguration as LockdownIPConfiguration, + type LockdownURL as LockdownURL, + type LockdownDeleteResponse as LockdownDeleteResponse, + LockdownsV4PagePaginationArray as LockdownsV4PagePaginationArray, + type LockdownCreateParams as LockdownCreateParams, + type LockdownUpdateParams as LockdownUpdateParams, + type LockdownListParams as LockdownListParams, + type LockdownDeleteParams as LockdownDeleteParams, + type LockdownGetParams as LockdownGetParams, + }; } diff --git a/src/resources/firewall/rules.ts b/src/resources/firewall/rules.ts index 3f6c8a44bf..4a75035a5c 100644 --- a/src/resources/firewall/rules.ts +++ b/src/resources/firewall/rules.ts @@ -1,9 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as RulesAPI from './rules'; import * as FiltersAPI from '../filters'; import * as RateLimitsAPI from '../rate-limits'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; @@ -15,12 +13,12 @@ export class Rules extends APIResource { * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ create( - zoneIdentifier: string, - body: RuleCreateParams, + params: RuleCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/firewall/rules`, { body, ...options }) as Core.APIPromise<{ + this._client.post(`/zones/${zone_id}/firewall/rules`, { body, ...options }) as Core.APIPromise<{ result: RuleCreateResponse | null; }> )._thenUnwrap((obj) => obj.result); @@ -32,13 +30,13 @@ export class Rules extends APIResource { * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ update( - zoneIdentifier: string, - id: string, - body: RuleUpdateParams, + ruleId: string, + params: RuleUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.put(`/zones/${zoneIdentifier}/firewall/rules/${id}`, { + this._client.put(`/zones/${zone_id}/firewall/rules/${ruleId}`, { body, ...options, }) as Core.APIPromise<{ result: FirewallRule }> @@ -52,27 +50,14 @@ export class Rules extends APIResource { * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ list( - zoneIdentifier: string, - query?: RuleListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - query: RuleListParams | Core.RequestOptions = {}, + params: RuleListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(zoneIdentifier, {}, query); - } - return this._client.getAPIList( - `/zones/${zoneIdentifier}/firewall/rules`, - FirewallRulesV4PagePaginationArray, - { query, ...options }, - ); + const { zone_id, ...query } = params; + return this._client.getAPIList(`/zones/${zone_id}/firewall/rules`, FirewallRulesV4PagePaginationArray, { + query, + ...options, + }); } /** @@ -80,27 +65,83 @@ export class Rules extends APIResource { * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ - delete(zoneIdentifier: string, id: string, options?: Core.RequestOptions): Core.APIPromise { + delete( + ruleId: string, + params: RuleDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.delete(`/zones/${zoneIdentifier}/firewall/rules/${id}`, options) as Core.APIPromise<{ + this._client.delete(`/zones/${zone_id}/firewall/rules/${ruleId}`, options) as Core.APIPromise<{ result: FirewallRule; }> )._thenUnwrap((obj) => obj.result); } + /** + * Deletes existing firewall rules. + * + * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. + */ + bulkDelete( + params: RuleBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.delete(`/zones/${zone_id}/firewall/rules`, options) as Core.APIPromise<{ + result: RuleBulkDeleteResponse | null; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Updates the priority of existing firewall rules. + * + * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. + */ + bulkEdit( + params: RuleBulkEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, body } = params; + return ( + this._client.patch(`/zones/${zone_id}/firewall/rules`, { body: body, ...options }) as Core.APIPromise<{ + result: RuleBulkEditResponse | null; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Updates one or more existing firewall rules. + * + * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. + */ + bulkUpdate( + params: RuleBulkUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, body } = params; + return ( + this._client.put(`/zones/${zone_id}/firewall/rules`, { body: body, ...options }) as Core.APIPromise<{ + result: RuleBulkUpdateResponse | null; + }> + )._thenUnwrap((obj) => obj.result); + } + /** * Updates the priority of an existing firewall rule. * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ edit( - zoneIdentifier: string, - id: string, - body: RuleEditParams, + ruleId: string, + params: RuleEditParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.patch(`/zones/${zoneIdentifier}/firewall/rules/${id}`, { + this._client.patch(`/zones/${zone_id}/firewall/rules/${ruleId}`, { body, ...options, }) as Core.APIPromise<{ result: RuleEditResponse | null }> @@ -112,15 +153,11 @@ export class Rules extends APIResource { * * @deprecated The Firewall Rules API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#firewall-rules-api-and-filters-api for full details. */ - get( - zoneIdentifier: string, - params: RuleGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { path_id, query_id, ...query } = params; + get(ruleId: string, params: RuleGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...query } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/firewall/rules/${path_id}`, { - query: { id: query_id, ...query }, + this._client.get(`/zones/${zone_id}/firewall/rules/${ruleId}`, { + query, ...options, }) as Core.APIPromise<{ result: FirewallRule }> )._thenUnwrap((obj) => obj.result); @@ -129,6 +166,18 @@ export class Rules extends APIResource { export class FirewallRulesV4PagePaginationArray extends V4PagePaginationArray {} +export interface DeletedFilter { + /** + * The unique identifier of the filter. + */ + id: string; + + /** + * When true, indicates that the firewall rule was deleted. + */ + deleted: boolean; +} + export interface FirewallRule { /** * The unique identifier of the firewall rule. @@ -173,72 +222,267 @@ export interface FirewallRule { */ export type Product = 'zoneLockdown' | 'uaBlock' | 'bic' | 'hot' | 'securityLevel' | 'rateLimit' | 'waf'; -export interface DeletedFilter { +export type RuleCreateResponse = Array; + +export type RuleBulkDeleteResponse = Array; + +export type RuleBulkEditResponse = Array; + +export type RuleBulkUpdateResponse = Array; + +export type RuleEditResponse = Array; + +export interface RuleCreateParams { /** - * The unique identifier of the filter. + * Path param: Identifier */ - id: string; + zone_id: string; /** - * When true, indicates that the firewall rule was deleted. + * Body param: The action to perform when the threshold of matched traffic within + * the configured period is exceeded. */ - deleted: boolean; + action: RuleCreateParams.Action; + + /** + * Body param: + */ + filter: FiltersAPI.FirewallFilterParam; } -export type RuleCreateResponse = Array; +export namespace RuleCreateParams { + /** + * The action to perform when the threshold of matched traffic within the + * configured period is exceeded. + */ + export interface Action { + /** + * The action to perform. + */ + mode?: 'simulate' | 'ban' | 'challenge' | 'js_challenge' | 'managed_challenge'; -export type RuleEditResponse = Array; + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + response?: Action.Response; + + /** + * The time in seconds during which Cloudflare will perform the mitigation action. + * Must be an integer value greater than or equal to the period. Notes: If "mode" + * is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the + * zone's Challenge Passage time and you should not provide this value. + */ + timeout?: number; + } + + export namespace Action { + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + export interface Response { + /** + * The response body to return. The value must conform to the configured content + * type. + */ + body?: string; + + /** + * The content type of the body. Must be one of the following: `text/plain`, + * `text/xml`, or `application/json`. + */ + content_type?: string; + } + } +} + +export interface RuleUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The action to perform when the threshold of matched traffic within + * the configured period is exceeded. + */ + action: RuleUpdateParams.Action; + + /** + * Body param: + */ + filter: FiltersAPI.FirewallFilterParam; +} + +export namespace RuleUpdateParams { + /** + * The action to perform when the threshold of matched traffic within the + * configured period is exceeded. + */ + export interface Action { + /** + * The action to perform. + */ + mode?: 'simulate' | 'ban' | 'challenge' | 'js_challenge' | 'managed_challenge'; + + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + response?: Action.Response; + + /** + * The time in seconds during which Cloudflare will perform the mitigation action. + * Must be an integer value greater than or equal to the period. Notes: If "mode" + * is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the + * zone's Challenge Passage time and you should not provide this value. + */ + timeout?: number; + } -export type RuleCreateParams = unknown; + export namespace Action { + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + export interface Response { + /** + * The response body to return. The value must conform to the configured content + * type. + */ + body?: string; -export type RuleUpdateParams = unknown; + /** + * The content type of the body. Must be one of the following: `text/plain`, + * `text/xml`, or `application/json`. + */ + content_type?: string; + } + } +} export interface RuleListParams extends V4PagePaginationArrayParams { /** - * The unique identifier of the firewall rule. + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: The unique identifier of the firewall rule. */ id?: string; /** - * The action to search for. Must be an exact match. + * Query param: The action to search for. Must be an exact match. */ action?: string; /** - * A case-insensitive string to find in the description. + * Query param: A case-insensitive string to find in the description. */ description?: string; /** - * When true, indicates that the firewall rule is currently paused. + * Query param: When true, indicates that the firewall rule is currently paused. */ paused?: boolean; } -export type RuleEditParams = unknown; +export interface RuleDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface RuleBulkDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface RuleBulkEditParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + body: unknown; +} + +export interface RuleBulkUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + body: unknown; +} + +export interface RuleEditParams { + /** + * Identifier + */ + zone_id: string; +} export interface RuleGetParams { /** - * Path param: The unique identifier of the firewall rule. + * Path param: Identifier */ - path_id: string; + zone_id: string; /** * Query param: The unique identifier of the firewall rule. */ - query_id?: string; + id?: string; } -export namespace Rules { - export import FirewallRule = RulesAPI.FirewallRule; - export import Product = RulesAPI.Product; - export import DeletedFilter = RulesAPI.DeletedFilter; - export import RuleCreateResponse = RulesAPI.RuleCreateResponse; - export import RuleEditResponse = RulesAPI.RuleEditResponse; - export import FirewallRulesV4PagePaginationArray = RulesAPI.FirewallRulesV4PagePaginationArray; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; - export import RuleEditParams = RulesAPI.RuleEditParams; - export import RuleGetParams = RulesAPI.RuleGetParams; +Rules.FirewallRulesV4PagePaginationArray = FirewallRulesV4PagePaginationArray; + +export declare namespace Rules { + export { + type DeletedFilter as DeletedFilter, + type FirewallRule as FirewallRule, + type Product as Product, + type RuleCreateResponse as RuleCreateResponse, + type RuleBulkDeleteResponse as RuleBulkDeleteResponse, + type RuleBulkEditResponse as RuleBulkEditResponse, + type RuleBulkUpdateResponse as RuleBulkUpdateResponse, + type RuleEditResponse as RuleEditResponse, + FirewallRulesV4PagePaginationArray as FirewallRulesV4PagePaginationArray, + type RuleCreateParams as RuleCreateParams, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleBulkDeleteParams as RuleBulkDeleteParams, + type RuleBulkEditParams as RuleBulkEditParams, + type RuleBulkUpdateParams as RuleBulkUpdateParams, + type RuleEditParams as RuleEditParams, + type RuleGetParams as RuleGetParams, + }; } diff --git a/src/resources/firewall/ua-rules.ts b/src/resources/firewall/ua-rules.ts index 3d3d79131d..8c8a3d70c3 100644 --- a/src/resources/firewall/ua-rules.ts +++ b/src/resources/firewall/ua-rules.ts @@ -1,25 +1,20 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as UARulesAPI from './ua-rules'; +import * as AccessRulesAPI from './access-rules'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class UARules extends APIResource { /** * Creates a new User Agent Blocking rule in a zone. */ - create( - zoneIdentifier: string, - body: UARuleCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + create(params: UARuleCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/firewall/ua_rules`, { - body, - ...options, - }) as Core.APIPromise<{ result: UARuleCreateResponse }> + this._client.post(`/zones/${zone_id}/firewall/ua_rules`, { body, ...options }) as Core.APIPromise<{ + result: UARuleCreateResponse; + }> )._thenUnwrap((obj) => obj.result); } @@ -27,13 +22,13 @@ export class UARules extends APIResource { * Updates an existing User Agent Blocking rule. */ update( - zoneIdentifier: string, - id: string, - body: UARuleUpdateParams, + uaRuleId: string, + params: UARuleUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.put(`/zones/${zoneIdentifier}/firewall/ua_rules/${id}`, { + this._client.put(`/zones/${zone_id}/firewall/ua_rules/${uaRuleId}`, { body, ...options, }) as Core.APIPromise<{ result: UARuleUpdateResponse }> @@ -45,24 +40,12 @@ export class UARules extends APIResource { * several optional parameters. */ list( - zoneIdentifier: string, - query?: UARuleListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - query: UARuleListParams | Core.RequestOptions = {}, + params: UARuleListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(zoneIdentifier, {}, query); - } + const { zone_id, ...query } = params; return this._client.getAPIList( - `/zones/${zoneIdentifier}/firewall/ua_rules`, + `/zones/${zone_id}/firewall/ua_rules`, UARuleListResponsesV4PagePaginationArray, { query, ...options }, ); @@ -72,12 +55,13 @@ export class UARules extends APIResource { * Deletes an existing User Agent Blocking rule. */ delete( - zoneIdentifier: string, - id: string, + uaRuleId: string, + params: UARuleDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.delete(`/zones/${zoneIdentifier}/firewall/ua_rules/${id}`, options) as Core.APIPromise<{ + this._client.delete(`/zones/${zone_id}/firewall/ua_rules/${uaRuleId}`, options) as Core.APIPromise<{ result: UARuleDeleteResponse; }> )._thenUnwrap((obj) => obj.result); @@ -86,9 +70,14 @@ export class UARules extends APIResource { /** * Fetches the details of a User Agent Blocking rule. */ - get(zoneIdentifier: string, id: string, options?: Core.RequestOptions): Core.APIPromise { + get( + uaRuleId: string, + params: UARuleGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/firewall/ua_rules/${id}`, options) as Core.APIPromise<{ + this._client.get(`/zones/${zone_id}/firewall/ua_rules/${uaRuleId}`, options) as Core.APIPromise<{ result: UARuleGetResponse; }> )._thenUnwrap((obj) => obj.result); @@ -156,35 +145,100 @@ export interface UARuleDeleteResponse { export type UARuleGetResponse = unknown | string | null; -export type UARuleCreateParams = unknown; +export interface UARuleCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The rule configuration. + */ + configuration: + | AccessRulesAPI.AccessRuleIPConfigurationParam + | AccessRulesAPI.IPV6ConfigurationParam + | AccessRulesAPI.AccessRuleCIDRConfigurationParam + | AccessRulesAPI.ASNConfigurationParam + | AccessRulesAPI.CountryConfigurationParam; + + /** + * Body param: The action to apply to a matched request. + */ + mode: 'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'; +} + +export interface UARuleUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The rule configuration. + */ + configuration: + | AccessRulesAPI.AccessRuleIPConfigurationParam + | AccessRulesAPI.IPV6ConfigurationParam + | AccessRulesAPI.AccessRuleCIDRConfigurationParam + | AccessRulesAPI.ASNConfigurationParam + | AccessRulesAPI.CountryConfigurationParam; -export type UARuleUpdateParams = unknown; + /** + * Body param: The action to apply to a matched request. + */ + mode: 'block' | 'challenge' | 'whitelist' | 'js_challenge' | 'managed_challenge'; +} export interface UARuleListParams extends V4PagePaginationArrayParams { /** - * A string to search for in the description of existing rules. + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: A string to search for in the description of existing rules. */ description?: string; /** - * A string to search for in the description of existing rules. + * Query param: A string to search for in the description of existing rules. */ description_search?: string; /** - * A string to search for in the user agent values of existing rules. + * Query param: A string to search for in the user agent values of existing rules. */ ua_search?: string; } -export namespace UARules { - export import UARuleCreateResponse = UARulesAPI.UARuleCreateResponse; - export import UARuleUpdateResponse = UARulesAPI.UARuleUpdateResponse; - export import UARuleListResponse = UARulesAPI.UARuleListResponse; - export import UARuleDeleteResponse = UARulesAPI.UARuleDeleteResponse; - export import UARuleGetResponse = UARulesAPI.UARuleGetResponse; - export import UARuleListResponsesV4PagePaginationArray = UARulesAPI.UARuleListResponsesV4PagePaginationArray; - export import UARuleCreateParams = UARulesAPI.UARuleCreateParams; - export import UARuleUpdateParams = UARulesAPI.UARuleUpdateParams; - export import UARuleListParams = UARulesAPI.UARuleListParams; +export interface UARuleDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface UARuleGetParams { + /** + * Identifier + */ + zone_id: string; +} + +UARules.UARuleListResponsesV4PagePaginationArray = UARuleListResponsesV4PagePaginationArray; + +export declare namespace UARules { + export { + type UARuleCreateResponse as UARuleCreateResponse, + type UARuleUpdateResponse as UARuleUpdateResponse, + type UARuleListResponse as UARuleListResponse, + type UARuleDeleteResponse as UARuleDeleteResponse, + type UARuleGetResponse as UARuleGetResponse, + UARuleListResponsesV4PagePaginationArray as UARuleListResponsesV4PagePaginationArray, + type UARuleCreateParams as UARuleCreateParams, + type UARuleUpdateParams as UARuleUpdateParams, + type UARuleListParams as UARuleListParams, + type UARuleDeleteParams as UARuleDeleteParams, + type UARuleGetParams as UARuleGetParams, + }; } diff --git a/src/resources/firewall/waf/index.ts b/src/resources/firewall/waf/index.ts index 24c2a12290..7f47a8efe3 100644 --- a/src/resources/firewall/waf/index.ts +++ b/src/resources/firewall/waf/index.ts @@ -1,22 +1,25 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Override, - OverrideURL, - RewriteAction, - WAFRule, - OverrideDeleteResponse, - OverrideCreateParams, - OverrideUpdateParams, - OverrideListParams, OverridesV4PagePaginationArray, Overrides, + type Override, + type OverrideURL, + type RewriteAction, + type WAFRule, + type OverrideDeleteResponse, + type OverrideCreateParams, + type OverrideUpdateParams, + type OverrideListParams, + type OverrideDeleteParams, + type OverrideGetParams, } from './overrides'; export { - PackageListResponse, - PackageGetResponse, - PackageListParams, PackageListResponsesV4PagePaginationArray, Packages, + type PackageListResponse, + type PackageGetResponse, + type PackageListParams, + type PackageGetParams, } from './packages/index'; export { WAF } from './waf'; diff --git a/src/resources/firewall/waf/overrides.ts b/src/resources/firewall/waf/overrides.ts index daeaae7093..f54c8195b5 100644 --- a/src/resources/firewall/waf/overrides.ts +++ b/src/resources/firewall/waf/overrides.ts @@ -1,9 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as OverridesAPI from './overrides'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; export class Overrides extends APIResource { @@ -13,16 +11,12 @@ export class Overrides extends APIResource { * **Note:** Applies only to the * [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). */ - create( - zoneIdentifier: string, - body: OverrideCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + create(params: OverrideCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/firewall/waf/overrides`, { - body, - ...options, - }) as Core.APIPromise<{ result: Override }> + this._client.post(`/zones/${zone_id}/firewall/waf/overrides`, { body, ...options }) as Core.APIPromise<{ + result: Override; + }> )._thenUnwrap((obj) => obj.result); } @@ -33,13 +27,13 @@ export class Overrides extends APIResource { * [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). */ update( - zoneIdentifier: string, - id: string, - body: OverrideUpdateParams, + overridesId: string, + params: OverrideUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.put(`/zones/${zoneIdentifier}/firewall/waf/overrides/${id}`, { + this._client.put(`/zones/${zone_id}/firewall/waf/overrides/${overridesId}`, { body, ...options, }) as Core.APIPromise<{ result: Override }> @@ -53,24 +47,12 @@ export class Overrides extends APIResource { * [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). */ list( - zoneIdentifier: string, - query?: OverrideListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - query: OverrideListParams | Core.RequestOptions = {}, + params: OverrideListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(zoneIdentifier, {}, query); - } + const { zone_id, ...query } = params; return this._client.getAPIList( - `/zones/${zoneIdentifier}/firewall/waf/overrides`, + `/zones/${zone_id}/firewall/waf/overrides`, OverridesV4PagePaginationArray, { query, ...options }, ); @@ -83,13 +65,14 @@ export class Overrides extends APIResource { * [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). */ delete( - zoneIdentifier: string, - id: string, + overridesId: string, + params: OverrideDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id } = params; return ( this._client.delete( - `/zones/${zoneIdentifier}/firewall/waf/overrides/${id}`, + `/zones/${zone_id}/firewall/waf/overrides/${overridesId}`, options, ) as Core.APIPromise<{ result: OverrideDeleteResponse }> )._thenUnwrap((obj) => obj.result); @@ -101,11 +84,17 @@ export class Overrides extends APIResource { * **Note:** Applies only to the * [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). */ - get(zoneIdentifier: string, id: string, options?: Core.RequestOptions): Core.APIPromise { + get( + overridesId: string, + params: OverrideGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/firewall/waf/overrides/${id}`, options) as Core.APIPromise<{ - result: Override; - }> + this._client.get( + `/zones/${zone_id}/firewall/waf/overrides/${overridesId}`, + options, + ) as Core.APIPromise<{ result: Override }> )._thenUnwrap((obj) => obj.result); } } @@ -169,6 +158,8 @@ export interface Override { export type OverrideURL = string; +export type OverrideURLParam = string; + /** * Specifies that, when a WAF rule matches, its configured action will be replaced * by the action configured in this object. @@ -179,16 +170,56 @@ export interface RewriteAction { */ block?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; - challenge?: string; + /** + * The WAF rule action to apply. + */ + challenge?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; + + /** + * The WAF rule action to apply. + */ + default?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; + + /** + * The WAF rule action to apply. + */ + disable?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; + + /** + * The WAF rule action to apply. + */ + simulate?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; +} + +/** + * Specifies that, when a WAF rule matches, its configured action will be replaced + * by the action configured in this object. + */ +export interface RewriteActionParam { + /** + * The WAF rule action to apply. + */ + block?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; + + /** + * The WAF rule action to apply. + */ + challenge?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; - default?: string; + /** + * The WAF rule action to apply. + */ + default?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; /** * The WAF rule action to apply. */ disable?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; - simulate?: string; + /** + * The WAF rule action to apply. + */ + simulate?: 'challenge' | 'block' | 'simulate' | 'disable' | 'default'; } /** @@ -200,6 +231,15 @@ export interface RewriteAction { */ export type WAFRule = Record; +/** + * An object that allows you to override the action of specific WAF rules. Each key + * of this object must be the ID of a WAF rule, and each value must be a valid WAF + * action. Unless you are disabling a rule, ensure that you also enable the rule + * group that this WAF rule belongs to. When creating a new URI-based WAF override, + * you must provide a `groups` object or a `rules` object. + */ +export type WAFRuleParam = Record; + export interface OverrideDeleteResponse { /** * The unique identifier of the WAF override. @@ -207,20 +247,89 @@ export interface OverrideDeleteResponse { id?: string; } -export type OverrideCreateParams = unknown; +export interface OverrideCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The URLs to include in the current WAF override. You can use + * wildcards. Each entered URL will be escaped before use, which means you can only + * use simple wildcard patterns. + */ + urls: Array; +} + +export interface OverrideUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; -export type OverrideUpdateParams = unknown; + /** + * Body param: Identifier + */ + id: string; + + /** + * Body param: Specifies that, when a WAF rule matches, its configured action will + * be replaced by the action configured in this object. + */ + rewrite_action: RewriteActionParam; + + /** + * Body param: An object that allows you to override the action of specific WAF + * rules. Each key of this object must be the ID of a WAF rule, and each value must + * be a valid WAF action. Unless you are disabling a rule, ensure that you also + * enable the rule group that this WAF rule belongs to. When creating a new + * URI-based WAF override, you must provide a `groups` object or a `rules` object. + */ + rules: WAFRuleParam; + + /** + * Body param: The URLs to include in the current WAF override. You can use + * wildcards. Each entered URL will be escaped before use, which means you can only + * use simple wildcard patterns. + */ + urls: Array; +} + +export interface OverrideListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier + */ + zone_id: string; +} + +export interface OverrideDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface OverrideGetParams { + /** + * Identifier + */ + zone_id: string; +} -export interface OverrideListParams extends V4PagePaginationArrayParams {} +Overrides.OverridesV4PagePaginationArray = OverridesV4PagePaginationArray; -export namespace Overrides { - export import Override = OverridesAPI.Override; - export import OverrideURL = OverridesAPI.OverrideURL; - export import RewriteAction = OverridesAPI.RewriteAction; - export import WAFRule = OverridesAPI.WAFRule; - export import OverrideDeleteResponse = OverridesAPI.OverrideDeleteResponse; - export import OverridesV4PagePaginationArray = OverridesAPI.OverridesV4PagePaginationArray; - export import OverrideCreateParams = OverridesAPI.OverrideCreateParams; - export import OverrideUpdateParams = OverridesAPI.OverrideUpdateParams; - export import OverrideListParams = OverridesAPI.OverrideListParams; +export declare namespace Overrides { + export { + type Override as Override, + type OverrideURL as OverrideURL, + type RewriteAction as RewriteAction, + type WAFRule as WAFRule, + type OverrideDeleteResponse as OverrideDeleteResponse, + OverridesV4PagePaginationArray as OverridesV4PagePaginationArray, + type OverrideCreateParams as OverrideCreateParams, + type OverrideUpdateParams as OverrideUpdateParams, + type OverrideListParams as OverrideListParams, + type OverrideDeleteParams as OverrideDeleteParams, + type OverrideGetParams as OverrideGetParams, + }; } diff --git a/src/resources/firewall/waf/packages/groups.ts b/src/resources/firewall/waf/packages/groups.ts index ec5011ee03..f9134cdfe0 100644 --- a/src/resources/firewall/waf/packages/groups.ts +++ b/src/resources/firewall/waf/packages/groups.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../../resource'; import * as Core from '../../../../core'; -import * as GroupsAPI from './groups'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../pagination'; export class Groups extends APIResource { @@ -178,12 +177,16 @@ export interface GroupGetParams { zone_id: string; } -export namespace Groups { - export import Group = GroupsAPI.Group; - export import GroupEditResponse = GroupsAPI.GroupEditResponse; - export import GroupGetResponse = GroupsAPI.GroupGetResponse; - export import GroupsV4PagePaginationArray = GroupsAPI.GroupsV4PagePaginationArray; - export import GroupListParams = GroupsAPI.GroupListParams; - export import GroupEditParams = GroupsAPI.GroupEditParams; - export import GroupGetParams = GroupsAPI.GroupGetParams; +Groups.GroupsV4PagePaginationArray = GroupsV4PagePaginationArray; + +export declare namespace Groups { + export { + type Group as Group, + type GroupEditResponse as GroupEditResponse, + type GroupGetResponse as GroupGetResponse, + GroupsV4PagePaginationArray as GroupsV4PagePaginationArray, + type GroupListParams as GroupListParams, + type GroupEditParams as GroupEditParams, + type GroupGetParams as GroupGetParams, + }; } diff --git a/src/resources/firewall/waf/packages/index.ts b/src/resources/firewall/waf/packages/index.ts index 34fac46e93..0e20a4f731 100644 --- a/src/resources/firewall/waf/packages/index.ts +++ b/src/resources/firewall/waf/packages/index.ts @@ -1,31 +1,32 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AllowedModesAnomaly, - WAFRuleGroup, - RuleListResponse, - RuleEditResponse, - RuleGetResponse, - RuleListParams, - RuleEditParams, - RuleGetParams, - RuleListResponsesV4PagePaginationArray, - Rules, -} from './rules'; -export { - Group, - GroupEditResponse, - GroupGetResponse, - GroupListParams, - GroupEditParams, - GroupGetParams, GroupsV4PagePaginationArray, Groups, + type Group, + type GroupEditResponse, + type GroupGetResponse, + type GroupListParams, + type GroupEditParams, + type GroupGetParams, } from './groups'; export { - PackageListResponse, - PackageGetResponse, - PackageListParams, PackageListResponsesV4PagePaginationArray, Packages, + type PackageListResponse, + type PackageGetResponse, + type PackageListParams, + type PackageGetParams, } from './packages'; +export { + RuleListResponsesV4PagePaginationArray, + Rules, + type AllowedModesAnomaly, + type WAFRuleGroup, + type RuleListResponse, + type RuleEditResponse, + type RuleGetResponse, + type RuleListParams, + type RuleEditParams, + type RuleGetParams, +} from './rules'; diff --git a/src/resources/firewall/waf/packages/packages.ts b/src/resources/firewall/waf/packages/packages.ts index 928ec16415..bab75abe14 100644 --- a/src/resources/firewall/waf/packages/packages.ts +++ b/src/resources/firewall/waf/packages/packages.ts @@ -1,12 +1,32 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../resource'; -import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as PackagesAPI from './packages'; import * as Shared from '../../../shared'; import * as GroupsAPI from './groups'; +import { + Group, + GroupEditParams, + GroupEditResponse, + GroupGetParams, + GroupGetResponse, + GroupListParams, + Groups, + GroupsV4PagePaginationArray, +} from './groups'; import * as RulesAPI from './rules'; +import { + AllowedModesAnomaly, + RuleEditParams, + RuleEditResponse, + RuleGetParams, + RuleGetResponse, + RuleListParams, + RuleListResponse, + RuleListResponsesV4PagePaginationArray, + Rules, + WAFRuleGroup, +} from './rules'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../pagination'; export class Packages extends APIResource { @@ -20,24 +40,12 @@ export class Packages extends APIResource { * [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). */ list( - zoneIdentifier: string, - query?: PackageListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - query: PackageListParams | Core.RequestOptions = {}, + params: PackageListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(zoneIdentifier, {}, query); - } + const { zone_id, ...query } = params; return this._client.getAPIList( - `/zones/${zoneIdentifier}/firewall/waf/packages`, + `/zones/${zone_id}/firewall/waf/packages`, PackageListResponsesV4PagePaginationArray, { query, ...options }, ); @@ -50,152 +58,18 @@ export class Packages extends APIResource { * [previous version of WAF managed rules](https://developers.cloudflare.com/support/firewall/managed-rules-web-application-firewall-waf/understanding-waf-managed-rules-web-application-firewall/). */ get( - zoneIdentifier: string, - identifier: string, + packageId: string, + params: PackageGetParams, options?: Core.RequestOptions, ): Core.APIPromise { - return this._client.get(`/zones/${zoneIdentifier}/firewall/waf/packages/${identifier}`, options); + const { zone_id } = params; + return this._client.get(`/zones/${zone_id}/firewall/waf/packages/${packageId}`, options); } } export class PackageListResponsesV4PagePaginationArray extends V4PagePaginationArray {} -export type PackageListResponse = - | PackageListResponse.FirewallAPIResponseCollection - | PackageListResponse.Result; - -export namespace PackageListResponse { - export interface FirewallAPIResponseCollection { - errors: Array; - - messages: Array; - - result: unknown | Array | string | null; - - /** - * Whether the API call was successful - */ - success: true; - - result_info?: FirewallAPIResponseCollection.ResultInfo; - } - - export namespace FirewallAPIResponseCollection { - export interface ResultInfo { - /** - * Total number of results for the requested service - */ - count?: number; - - /** - * Current page within paginated list of results - */ - page?: number; - - /** - * Number of results per page of results - */ - per_page?: number; - - /** - * Total results available without any search parameters - */ - total_count?: number; - } - } - - export interface Result { - result?: Array; - } - - export namespace Result { - export interface FirewallPackageDefinition { - /** - * Identifier - */ - id: string; - - /** - * A summary of the purpose/function of the WAF package. - */ - description: string; - - /** - * The mode that defines how rules within the package are evaluated during the - * course of a request. When a package uses anomaly detection mode (`anomaly` - * value), each rule is given a score when triggered. If the total score of all - * triggered rules exceeds the sensitivity defined in the WAF package, the action - * configured in the package will be performed. Traditional detection mode - * (`traditional` value) will decide the action to take when it is triggered by the - * request. If multiple rules are triggered, the action providing the highest - * protection will be applied (for example, a 'block' action will win over a - * 'challenge' action). - */ - detection_mode: 'anomaly' | 'traditional'; - - /** - * The name of the WAF package. - */ - name: string; - - /** - * Identifier - */ - zone_id: string; - - /** - * When set to `active`, indicates that the WAF package will be applied to the - * zone. - */ - status?: 'active'; - } - - export interface FirewallAnomalyPackage { - /** - * Identifier - */ - id: string; - - /** - * A summary of the purpose/function of the WAF package. - */ - description: string; - - /** - * When a WAF package uses anomaly detection, each rule is given a score when - * triggered. If the total score of all triggered rules exceeds the sensitivity - * defined on the WAF package, the action defined on the package will be taken. - */ - detection_mode: 'anomaly' | 'traditional'; - - /** - * The name of the WAF package. - */ - name: string; - - /** - * Identifier - */ - zone_id: string; - - /** - * The default action performed by the rules in the WAF package. - */ - action_mode?: 'simulate' | 'block' | 'challenge'; - - /** - * The sensitivity of the WAF package. - */ - sensitivity?: 'high' | 'medium' | 'low' | 'off'; - - /** - * When set to `active`, indicates that the WAF package will be applied to the - * zone. - */ - status?: 'active'; - } - } -} +export type PackageListResponse = unknown; export type PackageGetResponse = PackageGetResponse.FirewallAPIResponseSingle | PackageGetResponse.Result; @@ -220,48 +94,75 @@ export namespace PackageGetResponse { export interface PackageListParams extends V4PagePaginationArrayParams { /** - * The direction used to sort returned packages. + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: The direction used to sort returned packages. */ direction?: 'asc' | 'desc'; /** - * When set to `all`, all the search requirements must match. When set to `any`, - * only one of the search requirements has to match. + * Query param: When set to `all`, all the search requirements must match. When set + * to `any`, only one of the search requirements has to match. */ match?: 'any' | 'all'; /** - * The name of the WAF package. + * Query param: The name of the WAF package. */ name?: string; /** - * The field used to sort returned packages. + * Query param: The field used to sort returned packages. */ order?: 'name'; } -export namespace Packages { - export import PackageListResponse = PackagesAPI.PackageListResponse; - export import PackageGetResponse = PackagesAPI.PackageGetResponse; - export import PackageListResponsesV4PagePaginationArray = PackagesAPI.PackageListResponsesV4PagePaginationArray; - export import PackageListParams = PackagesAPI.PackageListParams; - export import Groups = GroupsAPI.Groups; - export import Group = GroupsAPI.Group; - export import GroupEditResponse = GroupsAPI.GroupEditResponse; - export import GroupGetResponse = GroupsAPI.GroupGetResponse; - export import GroupsV4PagePaginationArray = GroupsAPI.GroupsV4PagePaginationArray; - export import GroupListParams = GroupsAPI.GroupListParams; - export import GroupEditParams = GroupsAPI.GroupEditParams; - export import GroupGetParams = GroupsAPI.GroupGetParams; - export import Rules = RulesAPI.Rules; - export import AllowedModesAnomaly = RulesAPI.AllowedModesAnomaly; - export import WAFRuleGroup = RulesAPI.WAFRuleGroup; - export import RuleListResponse = RulesAPI.RuleListResponse; - export import RuleEditResponse = RulesAPI.RuleEditResponse; - export import RuleGetResponse = RulesAPI.RuleGetResponse; - export import RuleListResponsesV4PagePaginationArray = RulesAPI.RuleListResponsesV4PagePaginationArray; - export import RuleListParams = RulesAPI.RuleListParams; - export import RuleEditParams = RulesAPI.RuleEditParams; - export import RuleGetParams = RulesAPI.RuleGetParams; +export interface PackageGetParams { + /** + * Identifier + */ + zone_id: string; +} + +Packages.PackageListResponsesV4PagePaginationArray = PackageListResponsesV4PagePaginationArray; +Packages.Groups = Groups; +Packages.GroupsV4PagePaginationArray = GroupsV4PagePaginationArray; +Packages.Rules = Rules; +Packages.RuleListResponsesV4PagePaginationArray = RuleListResponsesV4PagePaginationArray; + +export declare namespace Packages { + export { + type PackageListResponse as PackageListResponse, + type PackageGetResponse as PackageGetResponse, + PackageListResponsesV4PagePaginationArray as PackageListResponsesV4PagePaginationArray, + type PackageListParams as PackageListParams, + type PackageGetParams as PackageGetParams, + }; + + export { + Groups as Groups, + type Group as Group, + type GroupEditResponse as GroupEditResponse, + type GroupGetResponse as GroupGetResponse, + GroupsV4PagePaginationArray as GroupsV4PagePaginationArray, + type GroupListParams as GroupListParams, + type GroupEditParams as GroupEditParams, + type GroupGetParams as GroupGetParams, + }; + + export { + Rules as Rules, + type AllowedModesAnomaly as AllowedModesAnomaly, + type WAFRuleGroup as WAFRuleGroup, + type RuleListResponse as RuleListResponse, + type RuleEditResponse as RuleEditResponse, + type RuleGetResponse as RuleGetResponse, + RuleListResponsesV4PagePaginationArray as RuleListResponsesV4PagePaginationArray, + type RuleListParams as RuleListParams, + type RuleEditParams as RuleEditParams, + type RuleGetParams as RuleGetParams, + }; } diff --git a/src/resources/firewall/waf/packages/rules.ts b/src/resources/firewall/waf/packages/rules.ts index cfca715134..4884478794 100644 --- a/src/resources/firewall/waf/packages/rules.ts +++ b/src/resources/firewall/waf/packages/rules.ts @@ -457,14 +457,18 @@ export interface RuleGetParams { zone_id: string; } -export namespace Rules { - export import AllowedModesAnomaly = RulesAPI.AllowedModesAnomaly; - export import WAFRuleGroup = RulesAPI.WAFRuleGroup; - export import RuleListResponse = RulesAPI.RuleListResponse; - export import RuleEditResponse = RulesAPI.RuleEditResponse; - export import RuleGetResponse = RulesAPI.RuleGetResponse; - export import RuleListResponsesV4PagePaginationArray = RulesAPI.RuleListResponsesV4PagePaginationArray; - export import RuleListParams = RulesAPI.RuleListParams; - export import RuleEditParams = RulesAPI.RuleEditParams; - export import RuleGetParams = RulesAPI.RuleGetParams; +Rules.RuleListResponsesV4PagePaginationArray = RuleListResponsesV4PagePaginationArray; + +export declare namespace Rules { + export { + type AllowedModesAnomaly as AllowedModesAnomaly, + type WAFRuleGroup as WAFRuleGroup, + type RuleListResponse as RuleListResponse, + type RuleEditResponse as RuleEditResponse, + type RuleGetResponse as RuleGetResponse, + RuleListResponsesV4PagePaginationArray as RuleListResponsesV4PagePaginationArray, + type RuleListParams as RuleListParams, + type RuleEditParams as RuleEditParams, + type RuleGetParams as RuleGetParams, + }; } diff --git a/src/resources/firewall/waf/waf.ts b/src/resources/firewall/waf/waf.ts index 225565216a..f16358ba96 100644 --- a/src/resources/firewall/waf/waf.ts +++ b/src/resources/firewall/waf/waf.ts @@ -2,27 +2,62 @@ import { APIResource } from '../../../resource'; import * as OverridesAPI from './overrides'; +import { + Override, + OverrideCreateParams, + OverrideDeleteParams, + OverrideDeleteResponse, + OverrideGetParams, + OverrideListParams, + OverrideURL, + OverrideUpdateParams, + Overrides, + OverridesV4PagePaginationArray, + RewriteAction, + WAFRule, +} from './overrides'; import * as PackagesAPI from './packages/packages'; +import { + PackageGetParams, + PackageGetResponse, + PackageListParams, + PackageListResponse, + PackageListResponsesV4PagePaginationArray, + Packages, +} from './packages/packages'; export class WAF extends APIResource { overrides: OverridesAPI.Overrides = new OverridesAPI.Overrides(this._client); packages: PackagesAPI.Packages = new PackagesAPI.Packages(this._client); } -export namespace WAF { - export import Overrides = OverridesAPI.Overrides; - export import Override = OverridesAPI.Override; - export import OverrideURL = OverridesAPI.OverrideURL; - export import RewriteAction = OverridesAPI.RewriteAction; - export import WAFRule = OverridesAPI.WAFRule; - export import OverrideDeleteResponse = OverridesAPI.OverrideDeleteResponse; - export import OverridesV4PagePaginationArray = OverridesAPI.OverridesV4PagePaginationArray; - export import OverrideCreateParams = OverridesAPI.OverrideCreateParams; - export import OverrideUpdateParams = OverridesAPI.OverrideUpdateParams; - export import OverrideListParams = OverridesAPI.OverrideListParams; - export import Packages = PackagesAPI.Packages; - export import PackageListResponse = PackagesAPI.PackageListResponse; - export import PackageGetResponse = PackagesAPI.PackageGetResponse; - export import PackageListResponsesV4PagePaginationArray = PackagesAPI.PackageListResponsesV4PagePaginationArray; - export import PackageListParams = PackagesAPI.PackageListParams; +WAF.Overrides = Overrides; +WAF.OverridesV4PagePaginationArray = OverridesV4PagePaginationArray; +WAF.Packages = Packages; +WAF.PackageListResponsesV4PagePaginationArray = PackageListResponsesV4PagePaginationArray; + +export declare namespace WAF { + export { + Overrides as Overrides, + type Override as Override, + type OverrideURL as OverrideURL, + type RewriteAction as RewriteAction, + type WAFRule as WAFRule, + type OverrideDeleteResponse as OverrideDeleteResponse, + OverridesV4PagePaginationArray as OverridesV4PagePaginationArray, + type OverrideCreateParams as OverrideCreateParams, + type OverrideUpdateParams as OverrideUpdateParams, + type OverrideListParams as OverrideListParams, + type OverrideDeleteParams as OverrideDeleteParams, + type OverrideGetParams as OverrideGetParams, + }; + + export { + Packages as Packages, + type PackageListResponse as PackageListResponse, + type PackageGetResponse as PackageGetResponse, + PackageListResponsesV4PagePaginationArray as PackageListResponsesV4PagePaginationArray, + type PackageListParams as PackageListParams, + type PackageGetParams as PackageGetParams, + }; } diff --git a/src/resources/healthchecks/healthchecks.ts b/src/resources/healthchecks/healthchecks.ts index 3ba5bdd8b9..60c24fa6c6 100644 --- a/src/resources/healthchecks/healthchecks.ts +++ b/src/resources/healthchecks/healthchecks.ts @@ -3,7 +3,14 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as PreviewsAPI from './previews'; -import { SinglePage } from '../../pagination'; +import { + PreviewCreateParams, + PreviewDeleteParams, + PreviewDeleteResponse, + PreviewGetParams, + Previews, +} from './previews'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class Healthchecks extends APIResource { previews: PreviewsAPI.Previews = new PreviewsAPI.Previews(this._client); @@ -43,9 +50,9 @@ export class Healthchecks extends APIResource { list( params: HealthcheckListParams, options?: Core.RequestOptions, - ): Core.PagePromise { + ): Core.PagePromise { const { zone_id, ...query } = params; - return this._client.getAPIList(`/zones/${zone_id}/healthchecks`, HealthchecksSinglePage, { + return this._client.getAPIList(`/zones/${zone_id}/healthchecks`, HealthchecksV4PagePaginationArray, { query, ...options, }); @@ -101,7 +108,7 @@ export class Healthchecks extends APIResource { } } -export class HealthchecksSinglePage extends SinglePage {} +export class HealthchecksV4PagePaginationArray extends V4PagePaginationArray {} /** * WNAM: Western North America, ENAM: Eastern North America, WEU: Western Europe, @@ -615,21 +622,11 @@ export interface HealthcheckUpdateParams { type?: string; } -export interface HealthcheckListParams { +export interface HealthcheckListParams extends V4PagePaginationArrayParams { /** * Path param: Identifier */ zone_id: string; - - /** - * Query param: Page number of paginated results. - */ - page?: unknown; - - /** - * Query param: Maximum number of results per page. Must be a multiple of 5. - */ - per_page?: unknown; } export interface HealthcheckDeleteParams { @@ -727,10 +724,14 @@ export interface HealthcheckGetParams { zone_id: string; } -export namespace Healthchecks { - export import Previews = PreviewsAPI.Previews; - export import PreviewDeleteResponse = PreviewsAPI.PreviewDeleteResponse; - export import PreviewCreateParams = PreviewsAPI.PreviewCreateParams; - export import PreviewDeleteParams = PreviewsAPI.PreviewDeleteParams; - export import PreviewGetParams = PreviewsAPI.PreviewGetParams; +Healthchecks.Previews = Previews; + +export declare namespace Healthchecks { + export { + Previews as Previews, + type PreviewDeleteResponse as PreviewDeleteResponse, + type PreviewCreateParams as PreviewCreateParams, + type PreviewDeleteParams as PreviewDeleteParams, + type PreviewGetParams as PreviewGetParams, + }; } diff --git a/src/resources/healthchecks/index.ts b/src/resources/healthchecks/index.ts index 91364b0b65..3d192827dd 100644 --- a/src/resources/healthchecks/index.ts +++ b/src/resources/healthchecks/index.ts @@ -2,9 +2,9 @@ export { Healthchecks } from './healthchecks'; export { - PreviewDeleteResponse, - PreviewCreateParams, - PreviewDeleteParams, - PreviewGetParams, Previews, + type PreviewDeleteResponse, + type PreviewCreateParams, + type PreviewDeleteParams, + type PreviewGetParams, } from './previews'; diff --git a/src/resources/healthchecks/previews.ts b/src/resources/healthchecks/previews.ts index 7f31c4c2ec..bd72d02eb2 100644 --- a/src/resources/healthchecks/previews.ts +++ b/src/resources/healthchecks/previews.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PreviewsAPI from './previews'; import * as HealthchecksAPI from './healthchecks'; export class Previews extends APIResource { @@ -158,9 +157,11 @@ export interface PreviewGetParams { zone_id: string; } -export namespace Previews { - export import PreviewDeleteResponse = PreviewsAPI.PreviewDeleteResponse; - export import PreviewCreateParams = PreviewsAPI.PreviewCreateParams; - export import PreviewDeleteParams = PreviewsAPI.PreviewDeleteParams; - export import PreviewGetParams = PreviewsAPI.PreviewGetParams; +export declare namespace Previews { + export { + type PreviewDeleteResponse as PreviewDeleteResponse, + type PreviewCreateParams as PreviewCreateParams, + type PreviewDeleteParams as PreviewDeleteParams, + type PreviewGetParams as PreviewGetParams, + }; } diff --git a/src/resources/hostnames/hostnames.ts b/src/resources/hostnames/hostnames.ts index f957b44436..ba9be00c52 100644 --- a/src/resources/hostnames/hostnames.ts +++ b/src/resources/hostnames/hostnames.ts @@ -2,11 +2,14 @@ import { APIResource } from '../../resource'; import * as SettingsAPI from './settings/settings'; +import { Settings } from './settings/settings'; export class Hostnames extends APIResource { settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); } -export namespace Hostnames { - export import Settings = SettingsAPI.Settings; +Hostnames.Settings = Settings; + +export declare namespace Hostnames { + export { Settings as Settings }; } diff --git a/src/resources/hostnames/settings/index.ts b/src/resources/hostnames/settings/index.ts index e10a07e2c8..89267d0021 100644 --- a/src/resources/hostnames/settings/index.ts +++ b/src/resources/hostnames/settings/index.ts @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Settings } from './settings'; export { - Setting, - SettingValue, - TLSDeleteResponse, - TLSGetResponse, - TLSUpdateParams, - TLSDeleteParams, - TLSGetParams, TLS, + type Setting, + type SettingValue, + type TLSDeleteResponse, + type TLSGetResponse, + type TLSUpdateParams, + type TLSDeleteParams, + type TLSGetParams, } from './tls'; -export { Settings } from './settings'; diff --git a/src/resources/hostnames/settings/settings.ts b/src/resources/hostnames/settings/settings.ts index 0f03b8db42..d2d64fe152 100644 --- a/src/resources/hostnames/settings/settings.ts +++ b/src/resources/hostnames/settings/settings.ts @@ -2,18 +2,32 @@ import { APIResource } from '../../../resource'; import * as TLSAPI from './tls'; +import { + Setting, + SettingValue, + TLS, + TLSDeleteParams, + TLSDeleteResponse, + TLSGetParams, + TLSGetResponse, + TLSUpdateParams, +} from './tls'; export class Settings extends APIResource { tls: TLSAPI.TLS = new TLSAPI.TLS(this._client); } -export namespace Settings { - export import TLS = TLSAPI.TLS; - export import Setting = TLSAPI.Setting; - export import SettingValue = TLSAPI.SettingValue; - export import TLSDeleteResponse = TLSAPI.TLSDeleteResponse; - export import TLSGetResponse = TLSAPI.TLSGetResponse; - export import TLSUpdateParams = TLSAPI.TLSUpdateParams; - export import TLSDeleteParams = TLSAPI.TLSDeleteParams; - export import TLSGetParams = TLSAPI.TLSGetParams; +Settings.TLS = TLS; + +export declare namespace Settings { + export { + TLS as TLS, + type Setting as Setting, + type SettingValue as SettingValue, + type TLSDeleteResponse as TLSDeleteResponse, + type TLSGetResponse as TLSGetResponse, + type TLSUpdateParams as TLSUpdateParams, + type TLSDeleteParams as TLSDeleteParams, + type TLSGetParams as TLSGetParams, + }; } diff --git a/src/resources/hostnames/settings/tls.ts b/src/resources/hostnames/settings/tls.ts index 180f4b9bd0..297f3e8fcf 100644 --- a/src/resources/hostnames/settings/tls.ts +++ b/src/resources/hostnames/settings/tls.ts @@ -48,11 +48,11 @@ export class TLS extends APIResource { settingId: 'ciphers' | 'min_tls_version' | 'http2', params: TLSGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id } = params; return ( this._client.get(`/zones/${zone_id}/hostnames/settings/${settingId}`, options) as Core.APIPromise<{ - result: TLSGetResponse | null; + result: TLSGetResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -106,6 +106,9 @@ export interface TLSDeleteResponse { */ hostname?: string; + /** + * Deployment status for the given tls setting. + */ status?: string; /** @@ -113,7 +116,10 @@ export interface TLSDeleteResponse { */ updated_at?: string; - value?: string; + /** + * The tls setting value. + */ + value?: SettingValue; } export type TLSGetResponse = Array; @@ -173,12 +179,14 @@ export interface TLSGetParams { zone_id: string; } -export namespace TLS { - export import Setting = TLSAPI.Setting; - export import SettingValue = TLSAPI.SettingValue; - export import TLSDeleteResponse = TLSAPI.TLSDeleteResponse; - export import TLSGetResponse = TLSAPI.TLSGetResponse; - export import TLSUpdateParams = TLSAPI.TLSUpdateParams; - export import TLSDeleteParams = TLSAPI.TLSDeleteParams; - export import TLSGetParams = TLSAPI.TLSGetParams; +export declare namespace TLS { + export { + type Setting as Setting, + type SettingValue as SettingValue, + type TLSDeleteResponse as TLSDeleteResponse, + type TLSGetResponse as TLSGetResponse, + type TLSUpdateParams as TLSUpdateParams, + type TLSDeleteParams as TLSDeleteParams, + type TLSGetParams as TLSGetParams, + }; } diff --git a/src/resources/hyperdrive/configs.ts b/src/resources/hyperdrive/configs.ts index 66a42b6f68..b2184138cc 100644 --- a/src/resources/hyperdrive/configs.ts +++ b/src/resources/hyperdrive/configs.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ConfigsAPI from './configs'; import * as HyperdriveAPI from './hyperdrive'; import { HyperdrivesSinglePage } from './hyperdrive'; @@ -13,13 +12,13 @@ export class Configs extends APIResource { create( params: ConfigCreateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/hyperdrive/configs`, { body, ...options, - }) as Core.APIPromise<{ result: HyperdriveAPI.Hyperdrive | null }> + }) as Core.APIPromise<{ result: HyperdriveAPI.Hyperdrive }> )._thenUnwrap((obj) => obj.result); } @@ -30,13 +29,13 @@ export class Configs extends APIResource { hyperdriveId: string, params: ConfigUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.put(`/accounts/${account_id}/hyperdrive/configs/${hyperdriveId}`, { body, ...options, - }) as Core.APIPromise<{ result: HyperdriveAPI.Hyperdrive | null }> + }) as Core.APIPromise<{ result: HyperdriveAPI.Hyperdrive }> )._thenUnwrap((obj) => obj.result); } @@ -62,31 +61,31 @@ export class Configs extends APIResource { hyperdriveId: string, params: ConfigDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.delete( `/accounts/${account_id}/hyperdrive/configs/${hyperdriveId}`, options, - ) as Core.APIPromise<{ result: ConfigDeleteResponse }> + ) as Core.APIPromise<{ result: ConfigDeleteResponse | null }> )._thenUnwrap((obj) => obj.result); } /** - * Patches and returns the specified Hyperdrive configuration. Updates to the - * origin and caching settings are applied with an all-or-nothing approach. + * Patches and returns the specified Hyperdrive configuration. Custom caching + * settings are not kept if caching is disabled. */ edit( hyperdriveId: string, params: ConfigEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.patch(`/accounts/${account_id}/hyperdrive/configs/${hyperdriveId}`, { body, ...options, - }) as Core.APIPromise<{ result: HyperdriveAPI.Hyperdrive | null }> + }) as Core.APIPromise<{ result: HyperdriveAPI.Hyperdrive }> )._thenUnwrap((obj) => obj.result); } @@ -97,18 +96,18 @@ export class Configs extends APIResource { hyperdriveId: string, params: ConfigGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get( `/accounts/${account_id}/hyperdrive/configs/${hyperdriveId}`, options, - ) as Core.APIPromise<{ result: HyperdriveAPI.Hyperdrive | null }> + ) as Core.APIPromise<{ result: HyperdriveAPI.Hyperdrive }> )._thenUnwrap((obj) => obj.result); } } -export type ConfigDeleteResponse = unknown | string | null; +export type ConfigDeleteResponse = unknown; export interface ConfigCreateParams { /** @@ -124,16 +123,99 @@ export interface ConfigCreateParams { /** * Body param: */ - origin: HyperdriveAPI.ConfigurationParam; + origin: + | ConfigCreateParams.PublicDatabase + | ConfigCreateParams.AccessProtectedDatabaseBehindCloudflareTunnel; /** * Body param: */ - caching?: ConfigCreateParams.Caching; + caching?: + | ConfigCreateParams.HyperdriveHyperdriveCachingCommon + | ConfigCreateParams.HyperdriveHyperdriveCachingEnabled; } export namespace ConfigCreateParams { - export interface Caching { + export interface PublicDatabase { + /** + * The name of your origin database. + */ + database: string; + + /** + * The host (hostname or IP) of your origin database. + */ + host: string; + + /** + * The password required to access your origin database. This value is write-only + * and never returned by the API. + */ + password: string; + + /** + * The port (default: 5432 for Postgres) of your origin database. + */ + port: number; + + /** + * Specifies the URL scheme used to connect to your origin database. + */ + scheme: 'postgres' | 'postgresql'; + + /** + * The user of your origin database. + */ + user: string; + } + + export interface AccessProtectedDatabaseBehindCloudflareTunnel { + /** + * The Client ID of the Access token to use when connecting to the origin database + */ + access_client_id: string; + + /** + * The Client Secret of the Access token to use when connecting to the origin + * database. This value is write-only and never returned by the API. + */ + access_client_secret: string; + + /** + * The name of your origin database. + */ + database: string; + + /** + * The host (hostname or IP) of your origin database. + */ + host: string; + + /** + * The password required to access your origin database. This value is write-only + * and never returned by the API. + */ + password: string; + + /** + * Specifies the URL scheme used to connect to your origin database. + */ + scheme: 'postgres' | 'postgresql'; + + /** + * The user of your origin database. + */ + user: string; + } + + export interface HyperdriveHyperdriveCachingCommon { + /** + * When set to true, disables the caching of SQL responses. (Default: false) + */ + disabled?: boolean; + } + + export interface HyperdriveHyperdriveCachingEnabled { /** * When set to true, disables the caching of SQL responses. (Default: false) */ @@ -141,13 +223,13 @@ export namespace ConfigCreateParams { /** * When present, specifies max duration for which items should persist in the - * cache. (Default: 60) + * cache. Not returned if set to default. (Default: 60) */ max_age?: number; /** * When present, indicates the number of seconds cache may serve the response after - * it becomes stale. (Default: 15) + * it becomes stale. Not returned if set to default. (Default: 15) */ stale_while_revalidate?: number; } @@ -167,16 +249,99 @@ export interface ConfigUpdateParams { /** * Body param: */ - origin: HyperdriveAPI.ConfigurationParam; + origin: + | ConfigUpdateParams.PublicDatabase + | ConfigUpdateParams.AccessProtectedDatabaseBehindCloudflareTunnel; /** * Body param: */ - caching?: ConfigUpdateParams.Caching; + caching?: + | ConfigUpdateParams.HyperdriveHyperdriveCachingCommon + | ConfigUpdateParams.HyperdriveHyperdriveCachingEnabled; } export namespace ConfigUpdateParams { - export interface Caching { + export interface PublicDatabase { + /** + * The name of your origin database. + */ + database: string; + + /** + * The host (hostname or IP) of your origin database. + */ + host: string; + + /** + * The password required to access your origin database. This value is write-only + * and never returned by the API. + */ + password: string; + + /** + * The port (default: 5432 for Postgres) of your origin database. + */ + port: number; + + /** + * Specifies the URL scheme used to connect to your origin database. + */ + scheme: 'postgres' | 'postgresql'; + + /** + * The user of your origin database. + */ + user: string; + } + + export interface AccessProtectedDatabaseBehindCloudflareTunnel { + /** + * The Client ID of the Access token to use when connecting to the origin database + */ + access_client_id: string; + + /** + * The Client Secret of the Access token to use when connecting to the origin + * database. This value is write-only and never returned by the API. + */ + access_client_secret: string; + + /** + * The name of your origin database. + */ + database: string; + + /** + * The host (hostname or IP) of your origin database. + */ + host: string; + + /** + * The password required to access your origin database. This value is write-only + * and never returned by the API. + */ + password: string; + + /** + * Specifies the URL scheme used to connect to your origin database. + */ + scheme: 'postgres' | 'postgresql'; + + /** + * The user of your origin database. + */ + user: string; + } + + export interface HyperdriveHyperdriveCachingCommon { + /** + * When set to true, disables the caching of SQL responses. (Default: false) + */ + disabled?: boolean; + } + + export interface HyperdriveHyperdriveCachingEnabled { /** * When set to true, disables the caching of SQL responses. (Default: false) */ @@ -184,13 +349,13 @@ export namespace ConfigUpdateParams { /** * When present, specifies max duration for which items should persist in the - * cache. (Default: 60) + * cache. Not returned if set to default. (Default: 60) */ max_age?: number; /** * When present, indicates the number of seconds cache may serve the response after - * it becomes stale. (Default: 15) + * it becomes stale. Not returned if set to default. (Default: 15) */ stale_while_revalidate?: number; } @@ -219,7 +384,9 @@ export interface ConfigEditParams { /** * Body param: */ - caching?: ConfigEditParams.Caching; + caching?: + | ConfigEditParams.HyperdriveHyperdriveCachingCommon + | ConfigEditParams.HyperdriveHyperdriveCachingEnabled; /** * Body param: @@ -229,11 +396,21 @@ export interface ConfigEditParams { /** * Body param: */ - origin?: HyperdriveAPI.ConfigurationParam; + origin?: + | ConfigEditParams.HyperdriveHyperdriveDatabase + | ConfigEditParams.HyperdriveHyperdriveInternetOrigin + | ConfigEditParams.HyperdriveHyperdriveOverAccessOrigin; } export namespace ConfigEditParams { - export interface Caching { + export interface HyperdriveHyperdriveCachingCommon { + /** + * When set to true, disables the caching of SQL responses. (Default: false) + */ + disabled?: boolean; + } + + export interface HyperdriveHyperdriveCachingEnabled { /** * When set to true, disables the caching of SQL responses. (Default: false) */ @@ -241,16 +418,69 @@ export namespace ConfigEditParams { /** * When present, specifies max duration for which items should persist in the - * cache. (Default: 60) + * cache. Not returned if set to default. (Default: 60) */ max_age?: number; /** * When present, indicates the number of seconds cache may serve the response after - * it becomes stale. (Default: 15) + * it becomes stale. Not returned if set to default. (Default: 15) */ stale_while_revalidate?: number; } + + export interface HyperdriveHyperdriveDatabase { + /** + * The name of your origin database. + */ + database?: string; + + /** + * The password required to access your origin database. This value is write-only + * and never returned by the API. + */ + password?: string; + + /** + * Specifies the URL scheme used to connect to your origin database. + */ + scheme?: 'postgres' | 'postgresql'; + + /** + * The user of your origin database. + */ + user?: string; + } + + export interface HyperdriveHyperdriveInternetOrigin { + /** + * The host (hostname or IP) of your origin database. + */ + host: string; + + /** + * The port (default: 5432 for Postgres) of your origin database. + */ + port: number; + } + + export interface HyperdriveHyperdriveOverAccessOrigin { + /** + * The Client ID of the Access token to use when connecting to the origin database + */ + access_client_id: string; + + /** + * The Client Secret of the Access token to use when connecting to the origin + * database. This value is write-only and never returned by the API. + */ + access_client_secret: string; + + /** + * The host (hostname or IP) of your origin database. + */ + host: string; + } } export interface ConfigGetParams { @@ -260,14 +490,16 @@ export interface ConfigGetParams { account_id: string; } -export namespace Configs { - export import ConfigDeleteResponse = ConfigsAPI.ConfigDeleteResponse; - export import ConfigCreateParams = ConfigsAPI.ConfigCreateParams; - export import ConfigUpdateParams = ConfigsAPI.ConfigUpdateParams; - export import ConfigListParams = ConfigsAPI.ConfigListParams; - export import ConfigDeleteParams = ConfigsAPI.ConfigDeleteParams; - export import ConfigEditParams = ConfigsAPI.ConfigEditParams; - export import ConfigGetParams = ConfigsAPI.ConfigGetParams; +export declare namespace Configs { + export { + type ConfigDeleteResponse as ConfigDeleteResponse, + type ConfigCreateParams as ConfigCreateParams, + type ConfigUpdateParams as ConfigUpdateParams, + type ConfigListParams as ConfigListParams, + type ConfigDeleteParams as ConfigDeleteParams, + type ConfigEditParams as ConfigEditParams, + type ConfigGetParams as ConfigGetParams, + }; } export { HyperdrivesSinglePage }; diff --git a/src/resources/hyperdrive/hyperdrive.ts b/src/resources/hyperdrive/hyperdrive.ts index ec828d094d..2077c1ada4 100644 --- a/src/resources/hyperdrive/hyperdrive.ts +++ b/src/resources/hyperdrive/hyperdrive.ts @@ -2,6 +2,16 @@ import { APIResource } from '../../resource'; import * as ConfigsAPI from './configs'; +import { + ConfigCreateParams, + ConfigDeleteParams, + ConfigDeleteResponse, + ConfigEditParams, + ConfigGetParams, + ConfigListParams, + ConfigUpdateParams, + Configs, +} from './configs'; import { SinglePage } from '../../pagination'; export class HyperdriveResource extends APIResource { @@ -10,80 +20,142 @@ export class HyperdriveResource extends APIResource { export class HyperdrivesSinglePage extends SinglePage {} -export interface Configuration { - /** - * The name of your origin database. - */ - database: string; +export type Configuration = + | Configuration.HyperdriveHyperdriveInternetOrigin + | Configuration.HyperdriveHyperdriveOverAccessOrigin; - /** - * The host (hostname or IP) of your origin database. - */ - host: string; +export namespace Configuration { + export interface HyperdriveHyperdriveInternetOrigin { + /** + * The host (hostname or IP) of your origin database. + */ + host: string; - /** - * Specifies the URL scheme used to connect to your origin database. - */ - scheme: 'postgres' | 'postgresql' | 'mysql'; + /** + * The port (default: 5432 for Postgres) of your origin database. + */ + port: number; - /** - * The user of your origin database. - */ - user: string; + /** + * The name of your origin database. + */ + database?: string; - /** - * The Client ID of the Access token to use when connecting to the origin database - */ - access_client_id?: string; + /** + * Specifies the URL scheme used to connect to your origin database. + */ + scheme?: 'postgres' | 'postgresql'; - /** - * The port (default: 5432 for Postgres) of your origin database. - */ - port?: number; -} + /** + * The user of your origin database. + */ + user?: string; + } -export interface ConfigurationParam { - /** - * The name of your origin database. - */ - database: string; + export interface HyperdriveHyperdriveOverAccessOrigin { + /** + * The Client ID of the Access token to use when connecting to the origin database + */ + access_client_id: string; - /** - * The host (hostname or IP) of your origin database. - */ - host: string; + /** + * The host (hostname or IP) of your origin database. + */ + host: string; - /** - * Specifies the URL scheme used to connect to your origin database. - */ - scheme: 'postgres' | 'postgresql' | 'mysql'; + /** + * The name of your origin database. + */ + database?: string; - /** - * The user of your origin database. - */ - user: string; + /** + * Specifies the URL scheme used to connect to your origin database. + */ + scheme?: 'postgres' | 'postgresql'; - /** - * The Client ID of the Access token to use when connecting to the origin database - */ - access_client_id?: string; + /** + * The user of your origin database. + */ + user?: string; + } +} +export interface Hyperdrive { /** - * The port (default: 5432 for Postgres) of your origin database. + * Identifier */ - port?: number; -} + id: string; -export interface Hyperdrive { - caching?: Hyperdrive.Caching; + name: string; - name?: string; + origin: Hyperdrive.PublicDatabase | Hyperdrive.AccessProtectedDatabaseBehindCloudflareTunnel; - origin?: Configuration; + caching?: Hyperdrive.HyperdriveHyperdriveCachingCommon | Hyperdrive.HyperdriveHyperdriveCachingEnabled; } export namespace Hyperdrive { - export interface Caching { + export interface PublicDatabase { + /** + * The name of your origin database. + */ + database: string; + + /** + * The host (hostname or IP) of your origin database. + */ + host: string; + + /** + * The port (default: 5432 for Postgres) of your origin database. + */ + port: number; + + /** + * Specifies the URL scheme used to connect to your origin database. + */ + scheme: 'postgres' | 'postgresql'; + + /** + * The user of your origin database. + */ + user: string; + } + + export interface AccessProtectedDatabaseBehindCloudflareTunnel { + /** + * The Client ID of the Access token to use when connecting to the origin database + */ + access_client_id: string; + + /** + * The name of your origin database. + */ + database: string; + + /** + * The host (hostname or IP) of your origin database. + */ + host: string; + + /** + * Specifies the URL scheme used to connect to your origin database. + */ + scheme: 'postgres' | 'postgresql'; + + /** + * The user of your origin database. + */ + user: string; + } + + export interface HyperdriveHyperdriveCachingCommon { + /** + * When set to true, disables the caching of SQL responses. (Default: false) + */ + disabled?: boolean; + } + + export interface HyperdriveHyperdriveCachingEnabled { /** * When set to true, disables the caching of SQL responses. (Default: false) */ @@ -91,25 +163,29 @@ export namespace Hyperdrive { /** * When present, specifies max duration for which items should persist in the - * cache. (Default: 60) + * cache. Not returned if set to default. (Default: 60) */ max_age?: number; /** * When present, indicates the number of seconds cache may serve the response after - * it becomes stale. (Default: 15) + * it becomes stale. Not returned if set to default. (Default: 15) */ stale_while_revalidate?: number; } } -export namespace HyperdriveResource { - export import Configs = ConfigsAPI.Configs; - export import ConfigDeleteResponse = ConfigsAPI.ConfigDeleteResponse; - export import ConfigCreateParams = ConfigsAPI.ConfigCreateParams; - export import ConfigUpdateParams = ConfigsAPI.ConfigUpdateParams; - export import ConfigListParams = ConfigsAPI.ConfigListParams; - export import ConfigDeleteParams = ConfigsAPI.ConfigDeleteParams; - export import ConfigEditParams = ConfigsAPI.ConfigEditParams; - export import ConfigGetParams = ConfigsAPI.ConfigGetParams; +HyperdriveResource.Configs = Configs; + +export declare namespace HyperdriveResource { + export { + Configs as Configs, + type ConfigDeleteResponse as ConfigDeleteResponse, + type ConfigCreateParams as ConfigCreateParams, + type ConfigUpdateParams as ConfigUpdateParams, + type ConfigListParams as ConfigListParams, + type ConfigDeleteParams as ConfigDeleteParams, + type ConfigEditParams as ConfigEditParams, + type ConfigGetParams as ConfigGetParams, + }; } diff --git a/src/resources/hyperdrive/index.ts b/src/resources/hyperdrive/index.ts index 320a5f2e2b..638a077546 100644 --- a/src/resources/hyperdrive/index.ts +++ b/src/resources/hyperdrive/index.ts @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - ConfigDeleteResponse, - ConfigCreateParams, - ConfigUpdateParams, - ConfigListParams, - ConfigDeleteParams, - ConfigEditParams, - ConfigGetParams, Configs, + type ConfigDeleteResponse, + type ConfigCreateParams, + type ConfigUpdateParams, + type ConfigListParams, + type ConfigDeleteParams, + type ConfigEditParams, + type ConfigGetParams, } from './configs'; export { HyperdriveResource } from './hyperdrive'; diff --git a/src/resources/iam/iam.ts b/src/resources/iam/iam.ts index 58606c953d..7133ae36e2 100644 --- a/src/resources/iam/iam.ts +++ b/src/resources/iam/iam.ts @@ -2,7 +2,29 @@ import { APIResource } from '../../resource'; import * as PermissionGroupsAPI from './permission-groups'; +import { + PermissionGroupGetParams, + PermissionGroupGetResponse, + PermissionGroupListParams, + PermissionGroupListResponse, + PermissionGroupListResponsesV4PagePaginationArray, + PermissionGroups, +} from './permission-groups'; import * as ResourceGroupsAPI from './resource-groups'; +import { + ResourceGroupCreateParams, + ResourceGroupCreateResponse, + ResourceGroupDeleteParams, + ResourceGroupDeleteResponse, + ResourceGroupGetParams, + ResourceGroupGetResponse, + ResourceGroupListParams, + ResourceGroupListResponse, + ResourceGroupListResponsesV4PagePaginationArray, + ResourceGroupUpdateParams, + ResourceGroupUpdateResponse, + ResourceGroups, +} from './resource-groups'; export class IAM extends APIResource { permissionGroups: PermissionGroupsAPI.PermissionGroups = new PermissionGroupsAPI.PermissionGroups( @@ -11,23 +33,33 @@ export class IAM extends APIResource { resourceGroups: ResourceGroupsAPI.ResourceGroups = new ResourceGroupsAPI.ResourceGroups(this._client); } -export namespace IAM { - export import PermissionGroups = PermissionGroupsAPI.PermissionGroups; - export import PermissionGroupListResponse = PermissionGroupsAPI.PermissionGroupListResponse; - export import PermissionGroupGetResponse = PermissionGroupsAPI.PermissionGroupGetResponse; - export import PermissionGroupListResponsesV4PagePaginationArray = PermissionGroupsAPI.PermissionGroupListResponsesV4PagePaginationArray; - export import PermissionGroupListParams = PermissionGroupsAPI.PermissionGroupListParams; - export import PermissionGroupGetParams = PermissionGroupsAPI.PermissionGroupGetParams; - export import ResourceGroups = ResourceGroupsAPI.ResourceGroups; - export import ResourceGroupCreateResponse = ResourceGroupsAPI.ResourceGroupCreateResponse; - export import ResourceGroupUpdateResponse = ResourceGroupsAPI.ResourceGroupUpdateResponse; - export import ResourceGroupListResponse = ResourceGroupsAPI.ResourceGroupListResponse; - export import ResourceGroupDeleteResponse = ResourceGroupsAPI.ResourceGroupDeleteResponse; - export import ResourceGroupGetResponse = ResourceGroupsAPI.ResourceGroupGetResponse; - export import ResourceGroupListResponsesV4PagePaginationArray = ResourceGroupsAPI.ResourceGroupListResponsesV4PagePaginationArray; - export import ResourceGroupCreateParams = ResourceGroupsAPI.ResourceGroupCreateParams; - export import ResourceGroupUpdateParams = ResourceGroupsAPI.ResourceGroupUpdateParams; - export import ResourceGroupListParams = ResourceGroupsAPI.ResourceGroupListParams; - export import ResourceGroupDeleteParams = ResourceGroupsAPI.ResourceGroupDeleteParams; - export import ResourceGroupGetParams = ResourceGroupsAPI.ResourceGroupGetParams; +IAM.PermissionGroups = PermissionGroups; +IAM.PermissionGroupListResponsesV4PagePaginationArray = PermissionGroupListResponsesV4PagePaginationArray; +IAM.ResourceGroups = ResourceGroups; +IAM.ResourceGroupListResponsesV4PagePaginationArray = ResourceGroupListResponsesV4PagePaginationArray; + +export declare namespace IAM { + export { + PermissionGroups as PermissionGroups, + type PermissionGroupListResponse as PermissionGroupListResponse, + type PermissionGroupGetResponse as PermissionGroupGetResponse, + PermissionGroupListResponsesV4PagePaginationArray as PermissionGroupListResponsesV4PagePaginationArray, + type PermissionGroupListParams as PermissionGroupListParams, + type PermissionGroupGetParams as PermissionGroupGetParams, + }; + + export { + ResourceGroups as ResourceGroups, + type ResourceGroupCreateResponse as ResourceGroupCreateResponse, + type ResourceGroupUpdateResponse as ResourceGroupUpdateResponse, + type ResourceGroupListResponse as ResourceGroupListResponse, + type ResourceGroupDeleteResponse as ResourceGroupDeleteResponse, + type ResourceGroupGetResponse as ResourceGroupGetResponse, + ResourceGroupListResponsesV4PagePaginationArray as ResourceGroupListResponsesV4PagePaginationArray, + type ResourceGroupCreateParams as ResourceGroupCreateParams, + type ResourceGroupUpdateParams as ResourceGroupUpdateParams, + type ResourceGroupListParams as ResourceGroupListParams, + type ResourceGroupDeleteParams as ResourceGroupDeleteParams, + type ResourceGroupGetParams as ResourceGroupGetParams, + }; } diff --git a/src/resources/iam/index.ts b/src/resources/iam/index.ts index 59a4d0d23a..233e440ab0 100644 --- a/src/resources/iam/index.ts +++ b/src/resources/iam/index.ts @@ -2,24 +2,24 @@ export { IAM } from './iam'; export { - PermissionGroupListResponse, - PermissionGroupGetResponse, - PermissionGroupListParams, - PermissionGroupGetParams, PermissionGroupListResponsesV4PagePaginationArray, PermissionGroups, + type PermissionGroupListResponse, + type PermissionGroupGetResponse, + type PermissionGroupListParams, + type PermissionGroupGetParams, } from './permission-groups'; export { - ResourceGroupCreateResponse, - ResourceGroupUpdateResponse, - ResourceGroupListResponse, - ResourceGroupDeleteResponse, - ResourceGroupGetResponse, - ResourceGroupCreateParams, - ResourceGroupUpdateParams, - ResourceGroupListParams, - ResourceGroupDeleteParams, - ResourceGroupGetParams, ResourceGroupListResponsesV4PagePaginationArray, ResourceGroups, + type ResourceGroupCreateResponse, + type ResourceGroupUpdateResponse, + type ResourceGroupListResponse, + type ResourceGroupDeleteResponse, + type ResourceGroupGetResponse, + type ResourceGroupCreateParams, + type ResourceGroupUpdateParams, + type ResourceGroupListParams, + type ResourceGroupDeleteParams, + type ResourceGroupGetParams, } from './resource-groups'; diff --git a/src/resources/iam/permission-groups.ts b/src/resources/iam/permission-groups.ts index 3e54f8b677..02837dc61f 100644 --- a/src/resources/iam/permission-groups.ts +++ b/src/resources/iam/permission-groups.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PermissionGroupsAPI from './permission-groups'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class PermissionGroups extends APIResource { @@ -51,7 +50,7 @@ export interface PermissionGroupGetResponse { /** * Attributes associated to the permission group. */ - meta?: unknown; + meta?: PermissionGroupGetResponse.Meta; /** * Name of the group. @@ -59,6 +58,17 @@ export interface PermissionGroupGetResponse { name?: string; } +export namespace PermissionGroupGetResponse { + /** + * Attributes associated to the permission group. + */ + export interface Meta { + key?: string; + + value?: string; + } +} + export interface PermissionGroupListParams extends V4PagePaginationArrayParams { /** * Path param: Account identifier tag. @@ -88,10 +98,15 @@ export interface PermissionGroupGetParams { account_id: string; } -export namespace PermissionGroups { - export import PermissionGroupListResponse = PermissionGroupsAPI.PermissionGroupListResponse; - export import PermissionGroupGetResponse = PermissionGroupsAPI.PermissionGroupGetResponse; - export import PermissionGroupListResponsesV4PagePaginationArray = PermissionGroupsAPI.PermissionGroupListResponsesV4PagePaginationArray; - export import PermissionGroupListParams = PermissionGroupsAPI.PermissionGroupListParams; - export import PermissionGroupGetParams = PermissionGroupsAPI.PermissionGroupGetParams; +PermissionGroups.PermissionGroupListResponsesV4PagePaginationArray = + PermissionGroupListResponsesV4PagePaginationArray; + +export declare namespace PermissionGroups { + export { + type PermissionGroupListResponse as PermissionGroupListResponse, + type PermissionGroupGetResponse as PermissionGroupGetResponse, + PermissionGroupListResponsesV4PagePaginationArray as PermissionGroupListResponsesV4PagePaginationArray, + type PermissionGroupListParams as PermissionGroupListParams, + type PermissionGroupGetParams as PermissionGroupGetParams, + }; } diff --git a/src/resources/iam/resource-groups.ts b/src/resources/iam/resource-groups.ts index 2dd5a2b4c6..677f2d9c62 100644 --- a/src/resources/iam/resource-groups.ts +++ b/src/resources/iam/resource-groups.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ResourceGroupsAPI from './resource-groups'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class ResourceGroups extends APIResource { @@ -149,7 +148,7 @@ export interface ResourceGroupUpdateResponse { /** * Attributes associated to the resource group. */ - meta?: unknown; + meta?: ResourceGroupUpdateResponse.Meta; /** * Name of the resource group. @@ -187,6 +186,15 @@ export namespace ResourceGroupUpdateResponse { key: string; } } + + /** + * Attributes associated to the resource group. + */ + export interface Meta { + key?: string; + + value?: string; + } } export type ResourceGroupListResponse = unknown; @@ -215,7 +223,7 @@ export interface ResourceGroupGetResponse { /** * Attributes associated to the resource group. */ - meta?: unknown; + meta?: ResourceGroupGetResponse.Meta; /** * Name of the resource group. @@ -253,6 +261,15 @@ export namespace ResourceGroupGetResponse { key: string; } } + + /** + * Attributes associated to the resource group. + */ + export interface Meta { + key?: string; + + value?: string; + } } export interface ResourceGroupCreateParams { @@ -388,16 +405,21 @@ export interface ResourceGroupGetParams { account_id: string; } -export namespace ResourceGroups { - export import ResourceGroupCreateResponse = ResourceGroupsAPI.ResourceGroupCreateResponse; - export import ResourceGroupUpdateResponse = ResourceGroupsAPI.ResourceGroupUpdateResponse; - export import ResourceGroupListResponse = ResourceGroupsAPI.ResourceGroupListResponse; - export import ResourceGroupDeleteResponse = ResourceGroupsAPI.ResourceGroupDeleteResponse; - export import ResourceGroupGetResponse = ResourceGroupsAPI.ResourceGroupGetResponse; - export import ResourceGroupListResponsesV4PagePaginationArray = ResourceGroupsAPI.ResourceGroupListResponsesV4PagePaginationArray; - export import ResourceGroupCreateParams = ResourceGroupsAPI.ResourceGroupCreateParams; - export import ResourceGroupUpdateParams = ResourceGroupsAPI.ResourceGroupUpdateParams; - export import ResourceGroupListParams = ResourceGroupsAPI.ResourceGroupListParams; - export import ResourceGroupDeleteParams = ResourceGroupsAPI.ResourceGroupDeleteParams; - export import ResourceGroupGetParams = ResourceGroupsAPI.ResourceGroupGetParams; +ResourceGroups.ResourceGroupListResponsesV4PagePaginationArray = + ResourceGroupListResponsesV4PagePaginationArray; + +export declare namespace ResourceGroups { + export { + type ResourceGroupCreateResponse as ResourceGroupCreateResponse, + type ResourceGroupUpdateResponse as ResourceGroupUpdateResponse, + type ResourceGroupListResponse as ResourceGroupListResponse, + type ResourceGroupDeleteResponse as ResourceGroupDeleteResponse, + type ResourceGroupGetResponse as ResourceGroupGetResponse, + ResourceGroupListResponsesV4PagePaginationArray as ResourceGroupListResponsesV4PagePaginationArray, + type ResourceGroupCreateParams as ResourceGroupCreateParams, + type ResourceGroupUpdateParams as ResourceGroupUpdateParams, + type ResourceGroupListParams as ResourceGroupListParams, + type ResourceGroupDeleteParams as ResourceGroupDeleteParams, + type ResourceGroupGetParams as ResourceGroupGetParams, + }; } diff --git a/src/resources/images/images.ts b/src/resources/images/images.ts index 5162c81598..90f575c985 100644 --- a/src/resources/images/images.ts +++ b/src/resources/images/images.ts @@ -2,25 +2,43 @@ import { APIResource } from '../../resource'; import * as V1API from './v1/v1'; +import { + Image, + V1, + V1CreateParams, + V1DeleteParams, + V1DeleteResponse, + V1EditParams, + V1GetParams, + V1ListParams, + V1ListResponse, + V1ListResponsesV4PagePagination, +} from './v1/v1'; import * as V2API from './v2/v2'; +import { V2, V2ListParams, V2ListResponse } from './v2/v2'; export class Images extends APIResource { v1: V1API.V1 = new V1API.V1(this._client); v2: V2API.V2 = new V2API.V2(this._client); } -export namespace Images { - export import V1 = V1API.V1; - export import Image = V1API.Image; - export import V1ListResponse = V1API.V1ListResponse; - export import V1DeleteResponse = V1API.V1DeleteResponse; - export import V1ListResponsesV4PagePagination = V1API.V1ListResponsesV4PagePagination; - export import V1CreateParams = V1API.V1CreateParams; - export import V1ListParams = V1API.V1ListParams; - export import V1DeleteParams = V1API.V1DeleteParams; - export import V1EditParams = V1API.V1EditParams; - export import V1GetParams = V1API.V1GetParams; - export import V2 = V2API.V2; - export import V2ListResponse = V2API.V2ListResponse; - export import V2ListParams = V2API.V2ListParams; +Images.V1 = V1; +Images.V1ListResponsesV4PagePagination = V1ListResponsesV4PagePagination; +Images.V2 = V2; + +export declare namespace Images { + export { + V1 as V1, + type Image as Image, + type V1ListResponse as V1ListResponse, + type V1DeleteResponse as V1DeleteResponse, + V1ListResponsesV4PagePagination as V1ListResponsesV4PagePagination, + type V1CreateParams as V1CreateParams, + type V1ListParams as V1ListParams, + type V1DeleteParams as V1DeleteParams, + type V1EditParams as V1EditParams, + type V1GetParams as V1GetParams, + }; + + export { V2 as V2, type V2ListResponse as V2ListResponse, type V2ListParams as V2ListParams }; } diff --git a/src/resources/images/index.ts b/src/resources/images/index.ts index a4553e4a81..382d5480b3 100644 --- a/src/resources/images/index.ts +++ b/src/resources/images/index.ts @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Images } from './images'; export { - Image, - V1ListResponse, - V1DeleteResponse, - V1CreateParams, - V1ListParams, - V1DeleteParams, - V1EditParams, - V1GetParams, V1ListResponsesV4PagePagination, V1, + type Image, + type V1ListResponse, + type V1DeleteResponse, + type V1CreateParams, + type V1ListParams, + type V1DeleteParams, + type V1EditParams, + type V1GetParams, } from './v1/index'; -export { Images } from './images'; -export { V2ListResponse, V2ListParams, V2 } from './v2/index'; +export { V2, type V2ListResponse, type V2ListParams } from './v2/index'; diff --git a/src/resources/images/v1/blobs.ts b/src/resources/images/v1/blobs.ts index 1f84656905..061b78d8fa 100644 --- a/src/resources/images/v1/blobs.ts +++ b/src/resources/images/v1/blobs.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as BlobsAPI from './blobs'; import { type Response } from '../../../_shims/index'; export class Blobs extends APIResource { @@ -14,6 +13,7 @@ export class Blobs extends APIResource { const { account_id } = params; return this._client.get(`/accounts/${account_id}/images/v1/${imageId}/blob`, { ...options, + headers: { Accept: 'image/*', ...options?.headers }, __binaryResponse: true, }); } @@ -26,6 +26,6 @@ export interface BlobGetParams { account_id: string; } -export namespace Blobs { - export import BlobGetParams = BlobsAPI.BlobGetParams; +export declare namespace Blobs { + export { type BlobGetParams as BlobGetParams }; } diff --git a/src/resources/images/v1/index.ts b/src/resources/images/v1/index.ts index 9f46c98b8f..2c00f7a190 100644 --- a/src/resources/images/v1/index.ts +++ b/src/resources/images/v1/index.ts @@ -1,39 +1,39 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { BlobGetParams, Blobs } from './blobs'; +export { Blobs, type BlobGetParams } from './blobs'; +export { + Keys, + type Key, + type KeyUpdateResponse, + type KeyListResponse, + type KeyDeleteResponse, + type KeyUpdateParams, + type KeyListParams, + type KeyDeleteParams, +} from './keys'; +export { Stats, type Stat, type StatGetParams } from './stats'; export { - Image, - V1ListResponse, - V1DeleteResponse, - V1CreateParams, - V1ListParams, - V1DeleteParams, - V1EditParams, - V1GetParams, V1ListResponsesV4PagePagination, V1, + type Image, + type V1ListResponse, + type V1DeleteResponse, + type V1CreateParams, + type V1ListParams, + type V1DeleteParams, + type V1EditParams, + type V1GetParams, } from './v1'; export { - Key, - KeyUpdateResponse, - KeyListResponse, - KeyDeleteResponse, - KeyUpdateParams, - KeyListParams, - KeyDeleteParams, - Keys, -} from './keys'; -export { Stat, StatGetParams, Stats } from './stats'; -export { - Variant, - VariantCreateResponse, - VariantDeleteResponse, - VariantEditResponse, - VariantGetResponse, - VariantCreateParams, - VariantListParams, - VariantDeleteParams, - VariantEditParams, - VariantGetParams, Variants, + type Variant, + type VariantCreateResponse, + type VariantDeleteResponse, + type VariantEditResponse, + type VariantGetResponse, + type VariantCreateParams, + type VariantListParams, + type VariantDeleteParams, + type VariantEditParams, + type VariantGetParams, } from './variants'; diff --git a/src/resources/images/v1/keys.ts b/src/resources/images/v1/keys.ts index f2f2bb61dd..9e531ee7ca 100644 --- a/src/resources/images/v1/keys.ts +++ b/src/resources/images/v1/keys.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as KeysAPI from './keys'; export class Keys extends APIResource { /** @@ -98,12 +97,14 @@ export interface KeyDeleteParams { account_id: string; } -export namespace Keys { - export import Key = KeysAPI.Key; - export import KeyUpdateResponse = KeysAPI.KeyUpdateResponse; - export import KeyListResponse = KeysAPI.KeyListResponse; - export import KeyDeleteResponse = KeysAPI.KeyDeleteResponse; - export import KeyUpdateParams = KeysAPI.KeyUpdateParams; - export import KeyListParams = KeysAPI.KeyListParams; - export import KeyDeleteParams = KeysAPI.KeyDeleteParams; +export declare namespace Keys { + export { + type Key as Key, + type KeyUpdateResponse as KeyUpdateResponse, + type KeyListResponse as KeyListResponse, + type KeyDeleteResponse as KeyDeleteResponse, + type KeyUpdateParams as KeyUpdateParams, + type KeyListParams as KeyListParams, + type KeyDeleteParams as KeyDeleteParams, + }; } diff --git a/src/resources/images/v1/stats.ts b/src/resources/images/v1/stats.ts index a1e2d3b38a..eb4fe9dd69 100644 --- a/src/resources/images/v1/stats.ts +++ b/src/resources/images/v1/stats.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as StatsAPI from './stats'; export class Stats extends APIResource { /** @@ -43,7 +42,6 @@ export interface StatGetParams { account_id: string; } -export namespace Stats { - export import Stat = StatsAPI.Stat; - export import StatGetParams = StatsAPI.StatGetParams; +export declare namespace Stats { + export { type Stat as Stat, type StatGetParams as StatGetParams }; } diff --git a/src/resources/images/v1/v1.ts b/src/resources/images/v1/v1.ts index 4aca25107c..01a8da0f32 100644 --- a/src/resources/images/v1/v1.ts +++ b/src/resources/images/v1/v1.ts @@ -2,12 +2,35 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as V1API from './v1'; -import * as Shared from '../../shared'; import * as BlobsAPI from './blobs'; +import { BlobGetParams, Blobs } from './blobs'; import * as KeysAPI from './keys'; +import { + Key, + KeyDeleteParams, + KeyDeleteResponse, + KeyListParams, + KeyListResponse, + KeyUpdateParams, + KeyUpdateResponse, + Keys, +} from './keys'; import * as StatsAPI from './stats'; +import { Stat, StatGetParams, Stats } from './stats'; import * as VariantsAPI from './variants'; +import { + Variant, + VariantCreateParams, + VariantCreateResponse, + VariantDeleteParams, + VariantDeleteResponse, + VariantEditParams, + VariantEditResponse, + VariantGetParams, + VariantGetResponse, + VariantListParams, + Variants, +} from './variants'; import { V4PagePagination, type V4PagePaginationParams } from '../../../pagination'; export class V1 extends APIResource { @@ -123,29 +146,14 @@ export interface Image { /** * Object specifying available variants for an image. */ - variants?: Array; + variants?: Array; } export interface V1ListResponse { - errors: Array; - - messages: Array; - - result: V1ListResponse.Result; - - /** - * Whether the API call was successful - */ - success: true; -} - -export namespace V1ListResponse { - export interface Result { - images?: Array; - } + images?: Array; } -export type V1DeleteResponse = unknown | string | null; +export type V1DeleteResponse = unknown | string; export interface V1CreateParams { /** @@ -218,38 +226,51 @@ export interface V1GetParams { account_id: string; } -export namespace V1 { - export import Image = V1API.Image; - export import V1ListResponse = V1API.V1ListResponse; - export import V1DeleteResponse = V1API.V1DeleteResponse; - export import V1ListResponsesV4PagePagination = V1API.V1ListResponsesV4PagePagination; - export import V1CreateParams = V1API.V1CreateParams; - export import V1ListParams = V1API.V1ListParams; - export import V1DeleteParams = V1API.V1DeleteParams; - export import V1EditParams = V1API.V1EditParams; - export import V1GetParams = V1API.V1GetParams; - export import Keys = KeysAPI.Keys; - export import Key = KeysAPI.Key; - export import KeyUpdateResponse = KeysAPI.KeyUpdateResponse; - export import KeyListResponse = KeysAPI.KeyListResponse; - export import KeyDeleteResponse = KeysAPI.KeyDeleteResponse; - export import KeyUpdateParams = KeysAPI.KeyUpdateParams; - export import KeyListParams = KeysAPI.KeyListParams; - export import KeyDeleteParams = KeysAPI.KeyDeleteParams; - export import Stats = StatsAPI.Stats; - export import Stat = StatsAPI.Stat; - export import StatGetParams = StatsAPI.StatGetParams; - export import Variants = VariantsAPI.Variants; - export import Variant = VariantsAPI.Variant; - export import VariantCreateResponse = VariantsAPI.VariantCreateResponse; - export import VariantDeleteResponse = VariantsAPI.VariantDeleteResponse; - export import VariantEditResponse = VariantsAPI.VariantEditResponse; - export import VariantGetResponse = VariantsAPI.VariantGetResponse; - export import VariantCreateParams = VariantsAPI.VariantCreateParams; - export import VariantListParams = VariantsAPI.VariantListParams; - export import VariantDeleteParams = VariantsAPI.VariantDeleteParams; - export import VariantEditParams = VariantsAPI.VariantEditParams; - export import VariantGetParams = VariantsAPI.VariantGetParams; - export import Blobs = BlobsAPI.Blobs; - export import BlobGetParams = BlobsAPI.BlobGetParams; +V1.V1ListResponsesV4PagePagination = V1ListResponsesV4PagePagination; +V1.Keys = Keys; +V1.Stats = Stats; +V1.Variants = Variants; +V1.Blobs = Blobs; + +export declare namespace V1 { + export { + type Image as Image, + type V1ListResponse as V1ListResponse, + type V1DeleteResponse as V1DeleteResponse, + V1ListResponsesV4PagePagination as V1ListResponsesV4PagePagination, + type V1CreateParams as V1CreateParams, + type V1ListParams as V1ListParams, + type V1DeleteParams as V1DeleteParams, + type V1EditParams as V1EditParams, + type V1GetParams as V1GetParams, + }; + + export { + Keys as Keys, + type Key as Key, + type KeyUpdateResponse as KeyUpdateResponse, + type KeyListResponse as KeyListResponse, + type KeyDeleteResponse as KeyDeleteResponse, + type KeyUpdateParams as KeyUpdateParams, + type KeyListParams as KeyListParams, + type KeyDeleteParams as KeyDeleteParams, + }; + + export { Stats as Stats, type Stat as Stat, type StatGetParams as StatGetParams }; + + export { + Variants as Variants, + type Variant as Variant, + type VariantCreateResponse as VariantCreateResponse, + type VariantDeleteResponse as VariantDeleteResponse, + type VariantEditResponse as VariantEditResponse, + type VariantGetResponse as VariantGetResponse, + type VariantCreateParams as VariantCreateParams, + type VariantListParams as VariantListParams, + type VariantDeleteParams as VariantDeleteParams, + type VariantEditParams as VariantEditParams, + type VariantGetParams as VariantGetParams, + }; + + export { Blobs as Blobs, type BlobGetParams as BlobGetParams }; } diff --git a/src/resources/images/v1/variants.ts b/src/resources/images/v1/variants.ts index 341ade6c7d..844e0f7deb 100644 --- a/src/resources/images/v1/variants.ts +++ b/src/resources/images/v1/variants.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as VariantsAPI from './variants'; export class Variants extends APIResource { /** @@ -186,7 +185,7 @@ export namespace VariantCreateResponse { } } -export type VariantDeleteResponse = unknown | string | null; +export type VariantDeleteResponse = unknown | string; export interface VariantEditResponse { variant?: VariantEditResponse.Variant; @@ -404,15 +403,17 @@ export interface VariantGetParams { account_id: string; } -export namespace Variants { - export import Variant = VariantsAPI.Variant; - export import VariantCreateResponse = VariantsAPI.VariantCreateResponse; - export import VariantDeleteResponse = VariantsAPI.VariantDeleteResponse; - export import VariantEditResponse = VariantsAPI.VariantEditResponse; - export import VariantGetResponse = VariantsAPI.VariantGetResponse; - export import VariantCreateParams = VariantsAPI.VariantCreateParams; - export import VariantListParams = VariantsAPI.VariantListParams; - export import VariantDeleteParams = VariantsAPI.VariantDeleteParams; - export import VariantEditParams = VariantsAPI.VariantEditParams; - export import VariantGetParams = VariantsAPI.VariantGetParams; +export declare namespace Variants { + export { + type Variant as Variant, + type VariantCreateResponse as VariantCreateResponse, + type VariantDeleteResponse as VariantDeleteResponse, + type VariantEditResponse as VariantEditResponse, + type VariantGetResponse as VariantGetResponse, + type VariantCreateParams as VariantCreateParams, + type VariantListParams as VariantListParams, + type VariantDeleteParams as VariantDeleteParams, + type VariantEditParams as VariantEditParams, + type VariantGetParams as VariantGetParams, + }; } diff --git a/src/resources/images/v2/direct-uploads.ts b/src/resources/images/v2/direct-uploads.ts index ee7a62928d..93d13ece16 100644 --- a/src/resources/images/v2/direct-uploads.ts +++ b/src/resources/images/v2/direct-uploads.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as DirectUploadsAPI from './direct-uploads'; export class DirectUploads extends APIResource { /** @@ -73,7 +72,9 @@ export interface DirectUploadCreateParams { requireSignedURLs?: boolean; } -export namespace DirectUploads { - export import DirectUploadCreateResponse = DirectUploadsAPI.DirectUploadCreateResponse; - export import DirectUploadCreateParams = DirectUploadsAPI.DirectUploadCreateParams; +export declare namespace DirectUploads { + export { + type DirectUploadCreateResponse as DirectUploadCreateResponse, + type DirectUploadCreateParams as DirectUploadCreateParams, + }; } diff --git a/src/resources/images/v2/index.ts b/src/resources/images/v2/index.ts index c0d98e2aa5..e53adac492 100644 --- a/src/resources/images/v2/index.ts +++ b/src/resources/images/v2/index.ts @@ -1,4 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { DirectUploadCreateResponse, DirectUploadCreateParams, DirectUploads } from './direct-uploads'; -export { V2ListResponse, V2ListParams, V2 } from './v2'; +export { + DirectUploads, + type DirectUploadCreateResponse, + type DirectUploadCreateParams, +} from './direct-uploads'; +export { V2, type V2ListResponse, type V2ListParams } from './v2'; diff --git a/src/resources/images/v2/v2.ts b/src/resources/images/v2/v2.ts index a107c46fb7..8a3ec73525 100644 --- a/src/resources/images/v2/v2.ts +++ b/src/resources/images/v2/v2.ts @@ -2,9 +2,9 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as V2API from './v2'; import * as V1API from '../v1/v1'; import * as DirectUploadsAPI from './direct-uploads'; +import { DirectUploadCreateParams, DirectUploadCreateResponse, DirectUploads } from './direct-uploads'; export class V2 extends APIResource { directUploads: DirectUploadsAPI.DirectUploads = new DirectUploadsAPI.DirectUploads(this._client); @@ -57,10 +57,14 @@ export interface V2ListParams { sort_order?: 'asc' | 'desc'; } -export namespace V2 { - export import V2ListResponse = V2API.V2ListResponse; - export import V2ListParams = V2API.V2ListParams; - export import DirectUploads = DirectUploadsAPI.DirectUploads; - export import DirectUploadCreateResponse = DirectUploadsAPI.DirectUploadCreateResponse; - export import DirectUploadCreateParams = DirectUploadsAPI.DirectUploadCreateParams; +V2.DirectUploads = DirectUploads; + +export declare namespace V2 { + export { type V2ListResponse as V2ListResponse, type V2ListParams as V2ListParams }; + + export { + DirectUploads as DirectUploads, + type DirectUploadCreateResponse as DirectUploadCreateResponse, + type DirectUploadCreateParams as DirectUploadCreateParams, + }; } diff --git a/src/resources/index.ts b/src/resources/index.ts index a72a097310..aa3b916fc7 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -2,8 +2,10 @@ export * from './shared'; export { ACM } from './acm/acm'; +export { AI } from './ai/ai'; export { AIGateway } from './ai-gateway/ai-gateway'; export { APIGateway } from './api-gateway/api-gateway'; +export { AbuseReports } from './abuse-reports'; export { Accounts } from './accounts/accounts'; export { Addressing } from './addressing/addressing'; export { Alerting } from './alerting/alerting'; @@ -11,25 +13,26 @@ export { Argo } from './argo/argo'; export { AuditLogs } from './audit-logs'; export { Billing } from './billing/billing'; export { BotManagement } from './bot-management'; +export { BotnetFeed } from './botnet-feed/botnet-feed'; export { BrandProtection } from './brand-protection'; export { Cache } from './cache/cache'; export { Calls } from './calls/calls'; export { CertificateAuthorities } from './certificate-authorities/certificate-authorities'; -export { Challenges } from './challenges/challenges'; export { ClientCertificates } from './client-certificates'; export { CloudConnector } from './cloud-connector/cloud-connector'; export { CloudforceOne } from './cloudforce-one/cloudforce-one'; +export { ContentScanning } from './content-scanning/content-scanning'; export { CustomCertificates } from './custom-certificates/custom-certificates'; export { CustomHostnames } from './custom-hostnames/custom-hostnames'; export { CustomNameservers } from './custom-nameservers'; export { D1Resource } from './d1/d1'; export { DCVDelegation } from './dcv-delegation'; export { DNS } from './dns/dns'; -export { DNSSECResource } from './dnssec'; +export { DNSFirewall } from './dns-firewall/dns-firewall'; export { Diagnostics } from './diagnostics/diagnostics'; export { DurableObjects } from './durable-objects/durable-objects'; export { EmailRouting } from './email-routing/email-routing'; -export { EventNotifications } from './event-notifications/event-notifications'; +export { EmailSecurity } from './email-security/email-security'; export { Filters } from './filters'; export { Firewall } from './firewall/firewall'; export { Healthchecks } from './healthchecks/healthchecks'; @@ -41,48 +44,46 @@ export { Images } from './images/images'; export { Intel } from './intel/intel'; export { KV } from './kv/kv'; export { KeylessCertificates } from './keyless-certificates'; +export { LeakedCredentialChecks } from './leaked-credential-checks/leaked-credential-checks'; export { LoadBalancers } from './load-balancers/load-balancers'; export { Logpush } from './logpush/logpush'; export { Logs } from './logs/logs'; export { MTLSCertificates } from './mtls-certificates/mtls-certificates'; export { MagicNetworkMonitoring } from './magic-network-monitoring/magic-network-monitoring'; export { MagicTransit } from './magic-transit/magic-transit'; -export { ManagedHeaders } from './managed-headers'; +export { ManagedTransforms } from './managed-transforms'; export { Memberships } from './memberships'; export { OriginCACertificates } from './origin-ca-certificates'; export { OriginPostQuantumEncryption } from './origin-post-quantum-encryption'; export { OriginTLSClientAuth } from './origin-tls-client-auth/origin-tls-client-auth'; -export { PCAPs } from './pcaps/pcaps'; +export { PageRules } from './page-rules'; export { PageShield } from './page-shield/page-shield'; -export { Pagerules } from './pagerules/pagerules'; export { Pages } from './pages/pages'; -export { Plans } from './plans'; export { Queues } from './queues/queues'; export { R2 } from './r2/r2'; export { RUM } from './rum/rum'; export { Radar } from './radar/radar'; export { RateLimits } from './rate-limits'; -export { RatePlans } from './rate-plans'; export { Registrar } from './registrar/registrar'; export { RequestTracers } from './request-tracers/request-tracers'; +export { ResourceSharing } from './resource-sharing/resource-sharing'; export { Rules } from './rules/rules'; export { Rulesets } from './rulesets/rulesets'; export { SSL } from './ssl/ssl'; -export { SecondaryDNS } from './secondary-dns/secondary-dns'; +export { SecurityTXT } from './security-txt'; export { Snippets } from './snippets/snippets'; export { Spectrum } from './spectrum/spectrum'; export { Speed } from './speed/speed'; -export { Storage } from './storage/storage'; export { Stream } from './stream/stream'; -export { Subscriptions } from './subscriptions'; +export { Turnstile } from './turnstile/turnstile'; export { URLNormalization } from './url-normalization'; export { URLScanner } from './url-scanner/url-scanner'; export { User } from './user/user'; export { Vectorize } from './vectorize/vectorize'; -export { WARPConnector } from './warp-connector'; export { WaitingRooms } from './waiting-rooms/waiting-rooms'; export { Web3 } from './web3/web3'; export { Workers } from './workers/workers'; export { WorkersForPlatforms } from './workers-for-platforms/workers-for-platforms'; +export { Workflows } from './workflows/workflows'; export { ZeroTrust } from './zero-trust/zero-trust'; export { Zones } from './zones/zones'; diff --git a/src/resources/intel/asn/asn.ts b/src/resources/intel/asn/asn.ts index b3d70ac9f2..530cb586ed 100644 --- a/src/resources/intel/asn/asn.ts +++ b/src/resources/intel/asn/asn.ts @@ -2,15 +2,16 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ASNAPI from './asn'; import * as Shared from '../../shared'; import * as SubnetsAPI from './subnets'; +import { SubnetGetParams, SubnetGetResponse, Subnets } from './subnets'; export class ASN extends APIResource { subnets: SubnetsAPI.Subnets = new SubnetsAPI.Subnets(this._client); /** - * Get ASN Overview + * Gets an overview of the Autonomous System Number (ASN) and a list of subnets for + * it. */ get( asn: Shared.ASNParam, @@ -33,9 +34,14 @@ export interface ASNGetParams { account_id: string; } -export namespace ASN { - export import ASNGetParams = ASNAPI.ASNGetParams; - export import Subnets = SubnetsAPI.Subnets; - export import SubnetGetResponse = SubnetsAPI.SubnetGetResponse; - export import SubnetGetParams = SubnetsAPI.SubnetGetParams; +ASN.Subnets = Subnets; + +export declare namespace ASN { + export { type ASNGetParams as ASNGetParams }; + + export { + Subnets as Subnets, + type SubnetGetResponse as SubnetGetResponse, + type SubnetGetParams as SubnetGetParams, + }; } diff --git a/src/resources/intel/asn/index.ts b/src/resources/intel/asn/index.ts index 93306f3866..1836c71269 100644 --- a/src/resources/intel/asn/index.ts +++ b/src/resources/intel/asn/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { ASNGetParams, ASN } from './asn'; -export { SubnetGetResponse, SubnetGetParams, Subnets } from './subnets'; +export { ASN, type ASNGetParams } from './asn'; +export { Subnets, type SubnetGetResponse, type SubnetGetParams } from './subnets'; diff --git a/src/resources/intel/asn/subnets.ts b/src/resources/intel/asn/subnets.ts index ccf67aced7..b0bbbb47ee 100644 --- a/src/resources/intel/asn/subnets.ts +++ b/src/resources/intel/asn/subnets.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as SubnetsAPI from './subnets'; import * as Shared from '../../shared'; export class Subnets extends APIResource { @@ -49,7 +48,6 @@ export interface SubnetGetParams { account_id: string; } -export namespace Subnets { - export import SubnetGetResponse = SubnetsAPI.SubnetGetResponse; - export import SubnetGetParams = SubnetsAPI.SubnetGetParams; +export declare namespace Subnets { + export { type SubnetGetResponse as SubnetGetResponse, type SubnetGetParams as SubnetGetParams }; } diff --git a/src/resources/intel/attack-surface-report/attack-surface-report.ts b/src/resources/intel/attack-surface-report/attack-surface-report.ts index bc4865775c..ed340559ad 100644 --- a/src/resources/intel/attack-surface-report/attack-surface-report.ts +++ b/src/resources/intel/attack-surface-report/attack-surface-report.ts @@ -2,29 +2,55 @@ import { APIResource } from '../../../resource'; import * as IssueTypesAPI from './issue-types'; +import { IssueTypeGetParams, IssueTypeGetResponse, IssueTypes } from './issue-types'; import * as IssuesAPI from './issues'; +import { + IssueClassParams, + IssueClassResponse, + IssueDismissParams, + IssueDismissResponse, + IssueListParams, + IssueListResponse, + IssueListResponsesV4PagePagination, + IssueSeverityParams, + IssueSeverityResponse, + IssueType, + IssueTypeParams, + IssueTypeResponse, + Issues, + SeverityQueryParam, +} from './issues'; export class AttackSurfaceReport extends APIResource { issueTypes: IssueTypesAPI.IssueTypes = new IssueTypesAPI.IssueTypes(this._client); issues: IssuesAPI.Issues = new IssuesAPI.Issues(this._client); } -export namespace AttackSurfaceReport { - export import IssueTypes = IssueTypesAPI.IssueTypes; - export import IssueTypeGetResponse = IssueTypesAPI.IssueTypeGetResponse; - export import IssueTypeGetParams = IssueTypesAPI.IssueTypeGetParams; - export import Issues = IssuesAPI.Issues; - export import IssueType = IssuesAPI.IssueType; - export import SeverityQueryParam = IssuesAPI.SeverityQueryParam; - export import IssueListResponse = IssuesAPI.IssueListResponse; - export import IssueClassResponse = IssuesAPI.IssueClassResponse; - export import IssueDismissResponse = IssuesAPI.IssueDismissResponse; - export import IssueSeverityResponse = IssuesAPI.IssueSeverityResponse; - export import IssueTypeResponse = IssuesAPI.IssueTypeResponse; - export import IssueListResponsesV4PagePagination = IssuesAPI.IssueListResponsesV4PagePagination; - export import IssueListParams = IssuesAPI.IssueListParams; - export import IssueClassParams = IssuesAPI.IssueClassParams; - export import IssueDismissParams = IssuesAPI.IssueDismissParams; - export import IssueSeverityParams = IssuesAPI.IssueSeverityParams; - export import IssueTypeParams = IssuesAPI.IssueTypeParams; +AttackSurfaceReport.IssueTypes = IssueTypes; +AttackSurfaceReport.Issues = Issues; +AttackSurfaceReport.IssueListResponsesV4PagePagination = IssueListResponsesV4PagePagination; + +export declare namespace AttackSurfaceReport { + export { + IssueTypes as IssueTypes, + type IssueTypeGetResponse as IssueTypeGetResponse, + type IssueTypeGetParams as IssueTypeGetParams, + }; + + export { + Issues as Issues, + type IssueType as IssueType, + type SeverityQueryParam as SeverityQueryParam, + type IssueListResponse as IssueListResponse, + type IssueClassResponse as IssueClassResponse, + type IssueDismissResponse as IssueDismissResponse, + type IssueSeverityResponse as IssueSeverityResponse, + type IssueTypeResponse as IssueTypeResponse, + IssueListResponsesV4PagePagination as IssueListResponsesV4PagePagination, + type IssueListParams as IssueListParams, + type IssueClassParams as IssueClassParams, + type IssueDismissParams as IssueDismissParams, + type IssueSeverityParams as IssueSeverityParams, + type IssueTypeParams as IssueTypeParams, + }; } diff --git a/src/resources/intel/attack-surface-report/index.ts b/src/resources/intel/attack-surface-report/index.ts index da490f9ca2..d820411e8b 100644 --- a/src/resources/intel/attack-surface-report/index.ts +++ b/src/resources/intel/attack-surface-report/index.ts @@ -2,19 +2,19 @@ export { AttackSurfaceReport } from './attack-surface-report'; export { - IssueType, - SeverityQueryParam, - IssueListResponse, - IssueClassResponse, - IssueDismissResponse, - IssueSeverityResponse, - IssueTypeResponse, - IssueListParams, - IssueClassParams, - IssueDismissParams, - IssueSeverityParams, - IssueTypeParams, IssueListResponsesV4PagePagination, Issues, + type IssueType, + type SeverityQueryParam, + type IssueListResponse, + type IssueClassResponse, + type IssueDismissResponse, + type IssueSeverityResponse, + type IssueTypeResponse, + type IssueListParams, + type IssueClassParams, + type IssueDismissParams, + type IssueSeverityParams, + type IssueTypeParams, } from './issues'; -export { IssueTypeGetResponse, IssueTypeGetParams, IssueTypes } from './issue-types'; +export { IssueTypes, type IssueTypeGetResponse, type IssueTypeGetParams } from './issue-types'; diff --git a/src/resources/intel/attack-surface-report/issue-types.ts b/src/resources/intel/attack-surface-report/issue-types.ts index 941e7530da..169b3c5e81 100644 --- a/src/resources/intel/attack-surface-report/issue-types.ts +++ b/src/resources/intel/attack-surface-report/issue-types.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as IssueTypesAPI from './issue-types'; export class IssueTypes extends APIResource { /** @@ -28,7 +27,6 @@ export interface IssueTypeGetParams { account_id: string; } -export namespace IssueTypes { - export import IssueTypeGetResponse = IssueTypesAPI.IssueTypeGetResponse; - export import IssueTypeGetParams = IssueTypesAPI.IssueTypeGetParams; +export declare namespace IssueTypes { + export { type IssueTypeGetResponse as IssueTypeGetResponse, type IssueTypeGetParams as IssueTypeGetParams }; } diff --git a/src/resources/intel/attack-surface-report/issues.ts b/src/resources/intel/attack-surface-report/issues.ts index 2f5d4067b1..5e8e241f83 100644 --- a/src/resources/intel/attack-surface-report/issues.ts +++ b/src/resources/intel/attack-surface-report/issues.ts @@ -44,12 +44,10 @@ export class Issues extends APIResource { options?: Core.RequestOptions, ): Core.APIPromise { const { account_id, ...body } = params; - return ( - this._client.put(`/accounts/${account_id}/intel/attack-surface-report/${issueId}/dismiss`, { - body, - ...options, - }) as Core.APIPromise<{ result: IssueDismissResponse }> - )._thenUnwrap((obj) => obj.result); + return this._client.put(`/accounts/${account_id}/intel/attack-surface-report/${issueId}/dismiss`, { + body, + ...options, + }); } /** @@ -103,62 +101,47 @@ export type SeverityQueryParam = 'low' | 'moderate' | 'critical'; export type SeverityQueryParamParam = 'low' | 'moderate' | 'critical'; export interface IssueListResponse { - errors: Array; + /** + * Total number of results + */ + count?: number; - messages: Array; + issues?: Array; /** - * Whether the API call was successful + * Current page within paginated list of results */ - success: true; + page?: number; - result?: IssueListResponse.Result; + /** + * Number of results per page of results + */ + per_page?: number; } export namespace IssueListResponse { - export interface Result { - /** - * Total number of results - */ - count?: number; - - issues?: Array; + export interface Issue { + id?: string; - /** - * Current page within paginated list of results - */ - page?: number; + dismissed?: boolean; - /** - * Number of results per page of results - */ - per_page?: number; - } - - export namespace Result { - export interface Issue { - id?: string; - - dismissed?: boolean; - - issue_class?: string; + issue_class?: string; - issue_type?: IssuesAPI.IssueType; + issue_type?: IssuesAPI.IssueType; - payload?: unknown; + payload?: unknown; - resolve_link?: string; + resolve_link?: string; - resolve_text?: string; + resolve_text?: string; - severity?: 'Low' | 'Moderate' | 'Critical'; + severity?: 'Low' | 'Moderate' | 'Critical'; - since?: string; + since?: string; - subject?: string; + subject?: string; - timestamp?: string; - } + timestamp?: string; } } @@ -172,7 +155,16 @@ export namespace IssueClassResponse { } } -export type IssueDismissResponse = unknown | string; +export interface IssueDismissResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; +} export type IssueSeverityResponse = Array; @@ -454,18 +446,22 @@ export interface IssueTypeParams { 'subject~neq'?: Array; } -export namespace Issues { - export import IssueType = IssuesAPI.IssueType; - export import SeverityQueryParam = IssuesAPI.SeverityQueryParam; - export import IssueListResponse = IssuesAPI.IssueListResponse; - export import IssueClassResponse = IssuesAPI.IssueClassResponse; - export import IssueDismissResponse = IssuesAPI.IssueDismissResponse; - export import IssueSeverityResponse = IssuesAPI.IssueSeverityResponse; - export import IssueTypeResponse = IssuesAPI.IssueTypeResponse; - export import IssueListResponsesV4PagePagination = IssuesAPI.IssueListResponsesV4PagePagination; - export import IssueListParams = IssuesAPI.IssueListParams; - export import IssueClassParams = IssuesAPI.IssueClassParams; - export import IssueDismissParams = IssuesAPI.IssueDismissParams; - export import IssueSeverityParams = IssuesAPI.IssueSeverityParams; - export import IssueTypeParams = IssuesAPI.IssueTypeParams; +Issues.IssueListResponsesV4PagePagination = IssueListResponsesV4PagePagination; + +export declare namespace Issues { + export { + type IssueType as IssueType, + type SeverityQueryParam as SeverityQueryParam, + type IssueListResponse as IssueListResponse, + type IssueClassResponse as IssueClassResponse, + type IssueDismissResponse as IssueDismissResponse, + type IssueSeverityResponse as IssueSeverityResponse, + type IssueTypeResponse as IssueTypeResponse, + IssueListResponsesV4PagePagination as IssueListResponsesV4PagePagination, + type IssueListParams as IssueListParams, + type IssueClassParams as IssueClassParams, + type IssueDismissParams as IssueDismissParams, + type IssueSeverityParams as IssueSeverityParams, + type IssueTypeParams as IssueTypeParams, + }; } diff --git a/src/resources/intel/dns.ts b/src/resources/intel/dns.ts index 79260d4852..d5d834e8a8 100644 --- a/src/resources/intel/dns.ts +++ b/src/resources/intel/dns.ts @@ -2,27 +2,22 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as DNSAPI from './dns'; -import * as Shared from '../shared'; import { V4PagePagination, type V4PagePaginationParams } from '../../pagination'; export class DNS extends APIResource { /** - * Get Passive DNS by IP + * Gets a list of all the domains that have resolved to a specific IP address. */ - list( - params: DNSListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { + list(params: DNSListParams, options?: Core.RequestOptions): Core.PagePromise { const { account_id, ...query } = params; - return this._client.getAPIList(`/accounts/${account_id}/intel/dns`, DNSListResponsesV4PagePagination, { + return this._client.getAPIList(`/accounts/${account_id}/intel/dns`, DNSV4PagePagination, { query, ...options, }); } } -export class DNSListResponsesV4PagePagination extends V4PagePagination {} +export class DNSV4PagePagination extends V4PagePagination {} export interface DNS { /** @@ -56,7 +51,7 @@ export namespace DNS { /** * Hostname that the IP was observed resolving to. */ - hostname?: unknown; + hostname?: string; /** * Last seen date of the DNS record during the time period. @@ -65,19 +60,6 @@ export namespace DNS { } } -export interface DNSListResponse { - errors: Array; - - messages: Array; - - /** - * Whether the API call was successful - */ - success: true; - - result?: DNS; -} - export interface DNSListParams extends V4PagePaginationParams { /** * Path param: Identifier @@ -109,9 +91,8 @@ export namespace DNSListParams { } } -export namespace DNS { - export import DNS = DNSAPI.DNS; - export import DNSListResponse = DNSAPI.DNSListResponse; - export import DNSListResponsesV4PagePagination = DNSAPI.DNSListResponsesV4PagePagination; - export import DNSListParams = DNSAPI.DNSListParams; +DNS.DNSV4PagePagination = DNSV4PagePagination; + +export declare namespace DNS { + export { type DNS as DNS, DNSV4PagePagination as DNSV4PagePagination, type DNSListParams as DNSListParams }; } diff --git a/src/resources/intel/domain-history.ts b/src/resources/intel/domain-history.ts index 7321170e22..57dffd0790 100644 --- a/src/resources/intel/domain-history.ts +++ b/src/resources/intel/domain-history.ts @@ -2,11 +2,11 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as DomainHistoryAPI from './domain-history'; export class DomainHistoryResource extends APIResource { /** - * Get Domain History + * Gets historical security threat and content categories currently and previously + * assigned to a domain. */ get( params: DomainHistoryGetParams, @@ -52,8 +52,10 @@ export interface DomainHistoryGetParams { domain?: string; } -export namespace DomainHistoryResource { - export import DomainHistory = DomainHistoryAPI.DomainHistory; - export import DomainHistoryGetResponse = DomainHistoryAPI.DomainHistoryGetResponse; - export import DomainHistoryGetParams = DomainHistoryAPI.DomainHistoryGetParams; +export declare namespace DomainHistoryResource { + export { + type DomainHistory as DomainHistory, + type DomainHistoryGetResponse as DomainHistoryGetResponse, + type DomainHistoryGetParams as DomainHistoryGetParams, + }; } diff --git a/src/resources/intel/domains/bulks.ts b/src/resources/intel/domains/bulks.ts index 78a72bccdf..46e535cb83 100644 --- a/src/resources/intel/domains/bulks.ts +++ b/src/resources/intel/domains/bulks.ts @@ -2,11 +2,10 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as BulksAPI from './bulks'; export class Bulks extends APIResource { /** - * Get Multiple Domain Details + * Same as summary */ get(params: BulkGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...query } = params; @@ -33,10 +32,7 @@ export namespace BulkGetResponse { */ application?: BulkGetResponseItem.Application; - /** - * Current content categories. - */ - content_categories?: Array; + content_categories?: Array; domain?: string; @@ -62,7 +58,7 @@ export namespace BulkGetResponse { */ risk_score?: number; - risk_types?: Array; + risk_types?: Array; } export namespace BulkGetResponseItem { @@ -85,6 +81,17 @@ export namespace BulkGetResponse { name?: string; } + /** + * Current content categories. + */ + export interface ContentCategory { + id?: number; + + name?: string; + + super_category_id?: number; + } + export interface InheritedContentCategory { id?: number; @@ -100,6 +107,14 @@ export namespace BulkGetResponse { super_category_id?: number; } + + export interface RiskType { + id?: number; + + name?: string; + + super_category_id?: number; + } } } @@ -116,7 +131,6 @@ export interface BulkGetParams { domain?: unknown; } -export namespace Bulks { - export import BulkGetResponse = BulksAPI.BulkGetResponse; - export import BulkGetParams = BulksAPI.BulkGetParams; +export declare namespace Bulks { + export { type BulkGetResponse as BulkGetResponse, type BulkGetParams as BulkGetParams }; } diff --git a/src/resources/intel/domains/domains.ts b/src/resources/intel/domains/domains.ts index 5053152dda..9f3b988cc1 100644 --- a/src/resources/intel/domains/domains.ts +++ b/src/resources/intel/domains/domains.ts @@ -2,14 +2,14 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as DomainsAPI from './domains'; import * as BulksAPI from './bulks'; +import { BulkGetParams, BulkGetResponse, Bulks } from './bulks'; export class Domains extends APIResource { bulks: BulksAPI.Bulks = new BulksAPI.Bulks(this._client); /** - * Get Domain Details + * Gets security details and statistics about a domain. */ get(params: DomainGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...query } = params; @@ -32,10 +32,7 @@ export interface Domain { */ application?: Domain.Application; - /** - * Current content categories. - */ - content_categories?: Array; + content_categories?: Array; domain?: string; @@ -67,7 +64,7 @@ export interface Domain { */ risk_score?: number; - risk_types?: Array; + risk_types?: Array; } export namespace Domain { @@ -90,6 +87,17 @@ export namespace Domain { name?: string; } + /** + * Current content categories. + */ + export interface ContentCategory { + id?: number; + + name?: string; + + super_category_id?: number; + } + export interface InheritedContentCategory { id?: number; @@ -118,6 +126,14 @@ export namespace Domain { */ value?: string; } + + export interface RiskType { + id?: number; + + name?: string; + + super_category_id?: number; + } } export interface DomainGetParams { @@ -132,10 +148,10 @@ export interface DomainGetParams { domain?: string; } -export namespace Domains { - export import Domain = DomainsAPI.Domain; - export import DomainGetParams = DomainsAPI.DomainGetParams; - export import Bulks = BulksAPI.Bulks; - export import BulkGetResponse = BulksAPI.BulkGetResponse; - export import BulkGetParams = BulksAPI.BulkGetParams; +Domains.Bulks = Bulks; + +export declare namespace Domains { + export { type Domain as Domain, type DomainGetParams as DomainGetParams }; + + export { Bulks as Bulks, type BulkGetResponse as BulkGetResponse, type BulkGetParams as BulkGetParams }; } diff --git a/src/resources/intel/domains/index.ts b/src/resources/intel/domains/index.ts index 01ad658f8f..c1e77ab87e 100644 --- a/src/resources/intel/domains/index.ts +++ b/src/resources/intel/domains/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { BulkGetResponse, BulkGetParams, Bulks } from './bulks'; -export { Domain, DomainGetParams, Domains } from './domains'; +export { Bulks, type BulkGetResponse, type BulkGetParams } from './bulks'; +export { Domains, type Domain, type DomainGetParams } from './domains'; diff --git a/src/resources/intel/index.ts b/src/resources/intel/index.ts index 8c8dadddaa..aaf903a157 100644 --- a/src/resources/intel/index.ts +++ b/src/resources/intel/index.ts @@ -1,36 +1,36 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { ASNGetParams, ASN } from './asn/index'; +export { ASN, type ASNGetParams } from './asn/index'; export { AttackSurfaceReport } from './attack-surface-report/index'; -export { DNS, DNSListResponse, DNSListParams, DNSListResponsesV4PagePagination } from './dns'; -export { Domain, DomainGetParams, Domains } from './domains/index'; +export { DNSV4PagePagination, DNS, type DNSListParams } from './dns'; export { - DomainHistory, - DomainHistoryGetResponse, - DomainHistoryGetParams, DomainHistoryResource, + type DomainHistory, + type DomainHistoryGetResponse, + type DomainHistoryGetParams, } from './domain-history'; -export { IP, IPGetResponse, IPGetParams, IPs } from './ips'; -export { IPList, IPListGetResponse, IPListGetParams, IPLists } from './ip-lists'; +export { Domains, type Domain, type DomainGetParams } from './domains/index'; +export { IPLists, type IPList, type IPListGetResponse, type IPListGetParams } from './ip-lists'; +export { IPs, type IP, type IPGetResponse, type IPGetParams } from './ips'; export { - IndicatorFeedCreateResponse, - IndicatorFeedUpdateResponse, - IndicatorFeedListResponse, - IndicatorFeedDataResponse, - IndicatorFeedGetResponse, - IndicatorFeedCreateParams, - IndicatorFeedUpdateParams, - IndicatorFeedListParams, - IndicatorFeedDataParams, - IndicatorFeedGetParams, IndicatorFeedListResponsesSinglePage, IndicatorFeeds, + type IndicatorFeedCreateResponse, + type IndicatorFeedUpdateResponse, + type IndicatorFeedListResponse, + type IndicatorFeedDataResponse, + type IndicatorFeedGetResponse, + type IndicatorFeedCreateParams, + type IndicatorFeedUpdateParams, + type IndicatorFeedListParams, + type IndicatorFeedDataParams, + type IndicatorFeedGetParams, } from './indicator-feeds/index'; export { Intel } from './intel'; export { - MiscategorizationCreateResponse, - MiscategorizationCreateParams, Miscategorizations, + type MiscategorizationCreateResponse, + type MiscategorizationCreateParams, } from './miscategorizations'; -export { Sinkhole, SinkholeListParams, SinkholesSinglePage, Sinkholes } from './sinkholes'; -export { Whois, WhoisGetResponse, WhoisGetParams } from './whois'; +export { SinkholesSinglePage, Sinkholes, type Sinkhole, type SinkholeListParams } from './sinkholes'; +export { Whois, type WhoisGetResponse, type WhoisGetParams } from './whois'; diff --git a/src/resources/intel/indicator-feeds/downloads.ts b/src/resources/intel/indicator-feeds/downloads.ts new file mode 100644 index 0000000000..376e506a1b --- /dev/null +++ b/src/resources/intel/indicator-feeds/downloads.ts @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Downloads extends APIResource { + /** + * Download indicator feed data + */ + get( + feedId: number, + params: DownloadGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/intel/indicator_feeds/${feedId}/download`, + options, + ) as Core.APIPromise<{ result: DownloadGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface DownloadGetResponse { + /** + * Feed id + */ + file_id?: number; + + /** + * Name of the file unified in our system + */ + filename?: string; + + /** + * Current status of upload, should be unified + */ + status?: string; +} + +export interface DownloadGetParams { + /** + * Identifier + */ + account_id: string; +} + +export declare namespace Downloads { + export { type DownloadGetResponse as DownloadGetResponse, type DownloadGetParams as DownloadGetParams }; +} diff --git a/src/resources/intel/indicator-feeds/index.ts b/src/resources/intel/indicator-feeds/index.ts index 8efda88792..c9f2ee64de 100644 --- a/src/resources/intel/indicator-feeds/index.ts +++ b/src/resources/intel/indicator-feeds/index.ts @@ -1,26 +1,27 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Downloads, type DownloadGetResponse, type DownloadGetParams } from './downloads'; export { - IndicatorFeedCreateResponse, - IndicatorFeedUpdateResponse, - IndicatorFeedListResponse, - IndicatorFeedDataResponse, - IndicatorFeedGetResponse, - IndicatorFeedCreateParams, - IndicatorFeedUpdateParams, - IndicatorFeedListParams, - IndicatorFeedDataParams, - IndicatorFeedGetParams, IndicatorFeedListResponsesSinglePage, IndicatorFeeds, + type IndicatorFeedCreateResponse, + type IndicatorFeedUpdateResponse, + type IndicatorFeedListResponse, + type IndicatorFeedDataResponse, + type IndicatorFeedGetResponse, + type IndicatorFeedCreateParams, + type IndicatorFeedUpdateParams, + type IndicatorFeedListParams, + type IndicatorFeedDataParams, + type IndicatorFeedGetParams, } from './indicator-feeds'; export { - PermissionCreateResponse, - PermissionListResponse, - PermissionDeleteResponse, - PermissionCreateParams, - PermissionListParams, - PermissionDeleteParams, Permissions, + type PermissionCreateResponse, + type PermissionListResponse, + type PermissionDeleteResponse, + type PermissionCreateParams, + type PermissionListParams, + type PermissionDeleteParams, } from './permissions'; -export { SnapshotUpdateResponse, SnapshotUpdateParams, Snapshots } from './snapshots'; +export { Snapshots, type SnapshotUpdateResponse, type SnapshotUpdateParams } from './snapshots'; diff --git a/src/resources/intel/indicator-feeds/indicator-feeds.ts b/src/resources/intel/indicator-feeds/indicator-feeds.ts index d1dea08ec8..acaa129b7a 100644 --- a/src/resources/intel/indicator-feeds/indicator-feeds.ts +++ b/src/resources/intel/indicator-feeds/indicator-feeds.ts @@ -2,14 +2,26 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as IndicatorFeedsAPI from './indicator-feeds'; +import * as DownloadsAPI from './downloads'; +import { DownloadGetParams, DownloadGetResponse, Downloads } from './downloads'; import * as PermissionsAPI from './permissions'; +import { + PermissionCreateParams, + PermissionCreateResponse, + PermissionDeleteParams, + PermissionDeleteResponse, + PermissionListParams, + PermissionListResponse, + Permissions, +} from './permissions'; import * as SnapshotsAPI from './snapshots'; +import { SnapshotUpdateParams, SnapshotUpdateResponse, Snapshots } from './snapshots'; import { SinglePage } from '../../../pagination'; export class IndicatorFeeds extends APIResource { snapshots: SnapshotsAPI.Snapshots = new SnapshotsAPI.Snapshots(this._client); permissions: PermissionsAPI.Permissions = new PermissionsAPI.Permissions(this._client); + downloads: DownloadsAPI.Downloads = new DownloadsAPI.Downloads(this._client); /** * Create new indicator feed @@ -115,6 +127,11 @@ export interface IndicatorFeedCreateResponse { */ is_attributable?: boolean; + /** + * Whether the indicator feed can be downloaded + */ + is_downloadable?: boolean; + /** * Whether the indicator feed is exposed to customers */ @@ -152,6 +169,11 @@ export interface IndicatorFeedUpdateResponse { */ is_attributable?: boolean; + /** + * Whether the indicator feed can be downloaded + */ + is_downloadable?: boolean; + /** * Whether the indicator feed is exposed to customers */ @@ -189,6 +211,11 @@ export interface IndicatorFeedListResponse { */ is_attributable?: boolean; + /** + * Whether the indicator feed can be downloaded + */ + is_downloadable?: boolean; + /** * Whether the indicator feed is exposed to customers */ @@ -228,6 +255,11 @@ export interface IndicatorFeedGetResponse { */ is_attributable?: boolean; + /** + * Whether the indicator feed can be downloaded + */ + is_downloadable?: boolean; + /** * Whether the indicator feed is exposed to customers */ @@ -292,6 +324,11 @@ export interface IndicatorFeedUpdateParams { */ is_attributable?: boolean; + /** + * Body param: The new is_downloadable value of the feed + */ + is_downloadable?: boolean; + /** * Body param: The new is_public value of the feed */ @@ -324,26 +361,45 @@ export interface IndicatorFeedGetParams { account_id: string; } -export namespace IndicatorFeeds { - export import IndicatorFeedCreateResponse = IndicatorFeedsAPI.IndicatorFeedCreateResponse; - export import IndicatorFeedUpdateResponse = IndicatorFeedsAPI.IndicatorFeedUpdateResponse; - export import IndicatorFeedListResponse = IndicatorFeedsAPI.IndicatorFeedListResponse; - export import IndicatorFeedDataResponse = IndicatorFeedsAPI.IndicatorFeedDataResponse; - export import IndicatorFeedGetResponse = IndicatorFeedsAPI.IndicatorFeedGetResponse; - export import IndicatorFeedListResponsesSinglePage = IndicatorFeedsAPI.IndicatorFeedListResponsesSinglePage; - export import IndicatorFeedCreateParams = IndicatorFeedsAPI.IndicatorFeedCreateParams; - export import IndicatorFeedUpdateParams = IndicatorFeedsAPI.IndicatorFeedUpdateParams; - export import IndicatorFeedListParams = IndicatorFeedsAPI.IndicatorFeedListParams; - export import IndicatorFeedDataParams = IndicatorFeedsAPI.IndicatorFeedDataParams; - export import IndicatorFeedGetParams = IndicatorFeedsAPI.IndicatorFeedGetParams; - export import Snapshots = SnapshotsAPI.Snapshots; - export import SnapshotUpdateResponse = SnapshotsAPI.SnapshotUpdateResponse; - export import SnapshotUpdateParams = SnapshotsAPI.SnapshotUpdateParams; - export import Permissions = PermissionsAPI.Permissions; - export import PermissionCreateResponse = PermissionsAPI.PermissionCreateResponse; - export import PermissionListResponse = PermissionsAPI.PermissionListResponse; - export import PermissionDeleteResponse = PermissionsAPI.PermissionDeleteResponse; - export import PermissionCreateParams = PermissionsAPI.PermissionCreateParams; - export import PermissionListParams = PermissionsAPI.PermissionListParams; - export import PermissionDeleteParams = PermissionsAPI.PermissionDeleteParams; +IndicatorFeeds.IndicatorFeedListResponsesSinglePage = IndicatorFeedListResponsesSinglePage; +IndicatorFeeds.Snapshots = Snapshots; +IndicatorFeeds.Permissions = Permissions; +IndicatorFeeds.Downloads = Downloads; + +export declare namespace IndicatorFeeds { + export { + type IndicatorFeedCreateResponse as IndicatorFeedCreateResponse, + type IndicatorFeedUpdateResponse as IndicatorFeedUpdateResponse, + type IndicatorFeedListResponse as IndicatorFeedListResponse, + type IndicatorFeedDataResponse as IndicatorFeedDataResponse, + type IndicatorFeedGetResponse as IndicatorFeedGetResponse, + IndicatorFeedListResponsesSinglePage as IndicatorFeedListResponsesSinglePage, + type IndicatorFeedCreateParams as IndicatorFeedCreateParams, + type IndicatorFeedUpdateParams as IndicatorFeedUpdateParams, + type IndicatorFeedListParams as IndicatorFeedListParams, + type IndicatorFeedDataParams as IndicatorFeedDataParams, + type IndicatorFeedGetParams as IndicatorFeedGetParams, + }; + + export { + Snapshots as Snapshots, + type SnapshotUpdateResponse as SnapshotUpdateResponse, + type SnapshotUpdateParams as SnapshotUpdateParams, + }; + + export { + Permissions as Permissions, + type PermissionCreateResponse as PermissionCreateResponse, + type PermissionListResponse as PermissionListResponse, + type PermissionDeleteResponse as PermissionDeleteResponse, + type PermissionCreateParams as PermissionCreateParams, + type PermissionListParams as PermissionListParams, + type PermissionDeleteParams as PermissionDeleteParams, + }; + + export { + Downloads as Downloads, + type DownloadGetResponse as DownloadGetResponse, + type DownloadGetParams as DownloadGetParams, + }; } diff --git a/src/resources/intel/indicator-feeds/permissions.ts b/src/resources/intel/indicator-feeds/permissions.ts index d501b9885c..8625ee3ae1 100644 --- a/src/resources/intel/indicator-feeds/permissions.ts +++ b/src/resources/intel/indicator-feeds/permissions.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as PermissionsAPI from './permissions'; export class Permissions extends APIResource { /** @@ -77,6 +76,11 @@ export namespace PermissionListResponse { */ is_attributable?: boolean; + /** + * Whether the indicator feed can be downloaded + */ + is_downloadable?: boolean; + /** * Whether the indicator feed is exposed to customers */ @@ -137,11 +141,13 @@ export interface PermissionDeleteParams { feed_id?: number; } -export namespace Permissions { - export import PermissionCreateResponse = PermissionsAPI.PermissionCreateResponse; - export import PermissionListResponse = PermissionsAPI.PermissionListResponse; - export import PermissionDeleteResponse = PermissionsAPI.PermissionDeleteResponse; - export import PermissionCreateParams = PermissionsAPI.PermissionCreateParams; - export import PermissionListParams = PermissionsAPI.PermissionListParams; - export import PermissionDeleteParams = PermissionsAPI.PermissionDeleteParams; +export declare namespace Permissions { + export { + type PermissionCreateResponse as PermissionCreateResponse, + type PermissionListResponse as PermissionListResponse, + type PermissionDeleteResponse as PermissionDeleteResponse, + type PermissionCreateParams as PermissionCreateParams, + type PermissionListParams as PermissionListParams, + type PermissionDeleteParams as PermissionDeleteParams, + }; } diff --git a/src/resources/intel/indicator-feeds/snapshots.ts b/src/resources/intel/indicator-feeds/snapshots.ts index 11e57f0322..cd7b91d0e0 100644 --- a/src/resources/intel/indicator-feeds/snapshots.ts +++ b/src/resources/intel/indicator-feeds/snapshots.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as SnapshotsAPI from './snapshots'; export class Snapshots extends APIResource { /** @@ -52,7 +51,9 @@ export interface SnapshotUpdateParams { source?: string; } -export namespace Snapshots { - export import SnapshotUpdateResponse = SnapshotsAPI.SnapshotUpdateResponse; - export import SnapshotUpdateParams = SnapshotsAPI.SnapshotUpdateParams; +export declare namespace Snapshots { + export { + type SnapshotUpdateResponse as SnapshotUpdateResponse, + type SnapshotUpdateParams as SnapshotUpdateParams, + }; } diff --git a/src/resources/intel/intel.ts b/src/resources/intel/intel.ts index 0e079b060e..d2279d8198 100644 --- a/src/resources/intel/intel.ts +++ b/src/resources/intel/intel.ts @@ -2,16 +2,49 @@ import { APIResource } from '../../resource'; import * as DNSAPI from './dns'; +import { DNS, DNSListParams, DNSV4PagePagination } from './dns'; import * as DomainHistoryAPI from './domain-history'; +import { + DomainHistory, + DomainHistoryGetParams, + DomainHistoryGetResponse, + DomainHistoryResource, +} from './domain-history'; import * as IPListsAPI from './ip-lists'; +import { IPList, IPListGetParams, IPListGetResponse, IPLists } from './ip-lists'; import * as IPsAPI from './ips'; +import { IP, IPGetParams, IPGetResponse, IPs } from './ips'; import * as MiscategorizationsAPI from './miscategorizations'; +import { + MiscategorizationCreateParams, + MiscategorizationCreateResponse, + Miscategorizations, +} from './miscategorizations'; import * as SinkholesAPI from './sinkholes'; +import { Sinkhole, SinkholeListParams, Sinkholes, SinkholesSinglePage } from './sinkholes'; import * as WhoisAPI from './whois'; +import { Whois, WhoisGetParams, WhoisGetResponse } from './whois'; import * as ASNAPI from './asn/asn'; +import { ASN, ASNGetParams } from './asn/asn'; import * as AttackSurfaceReportAPI from './attack-surface-report/attack-surface-report'; +import { AttackSurfaceReport } from './attack-surface-report/attack-surface-report'; import * as DomainsAPI from './domains/domains'; +import { Domain, DomainGetParams, Domains } from './domains/domains'; import * as IndicatorFeedsAPI from './indicator-feeds/indicator-feeds'; +import { + IndicatorFeedCreateParams, + IndicatorFeedCreateResponse, + IndicatorFeedDataParams, + IndicatorFeedDataResponse, + IndicatorFeedGetParams, + IndicatorFeedGetResponse, + IndicatorFeedListParams, + IndicatorFeedListResponse, + IndicatorFeedListResponsesSinglePage, + IndicatorFeedUpdateParams, + IndicatorFeedUpdateResponse, + IndicatorFeeds, +} from './indicator-feeds/indicator-feeds'; export class Intel extends APIResource { asn: ASNAPI.ASN = new ASNAPI.ASN(this._client); @@ -32,49 +65,75 @@ export class Intel extends APIResource { new AttackSurfaceReportAPI.AttackSurfaceReport(this._client); } -export namespace Intel { - export import ASN = ASNAPI.ASN; - export import ASNGetParams = ASNAPI.ASNGetParams; - export import DNS = DNSAPI.DNS; - export import DNSListResponse = DNSAPI.DNSListResponse; - export import DNSListResponsesV4PagePagination = DNSAPI.DNSListResponsesV4PagePagination; - export import DNSListParams = DNSAPI.DNSListParams; - export import Domains = DomainsAPI.Domains; - export import Domain = DomainsAPI.Domain; - export import DomainGetParams = DomainsAPI.DomainGetParams; - export import DomainHistoryResource = DomainHistoryAPI.DomainHistoryResource; - export import DomainHistory = DomainHistoryAPI.DomainHistory; - export import DomainHistoryGetResponse = DomainHistoryAPI.DomainHistoryGetResponse; - export import DomainHistoryGetParams = DomainHistoryAPI.DomainHistoryGetParams; - export import IPs = IPsAPI.IPs; - export import IP = IPsAPI.IP; - export import IPGetResponse = IPsAPI.IPGetResponse; - export import IPGetParams = IPsAPI.IPGetParams; - export import IPLists = IPListsAPI.IPLists; - export import IPList = IPListsAPI.IPList; - export import IPListGetResponse = IPListsAPI.IPListGetResponse; - export import IPListGetParams = IPListsAPI.IPListGetParams; - export import Miscategorizations = MiscategorizationsAPI.Miscategorizations; - export import MiscategorizationCreateResponse = MiscategorizationsAPI.MiscategorizationCreateResponse; - export import MiscategorizationCreateParams = MiscategorizationsAPI.MiscategorizationCreateParams; - export import Whois = WhoisAPI.Whois; - export import WhoisGetResponse = WhoisAPI.WhoisGetResponse; - export import WhoisGetParams = WhoisAPI.WhoisGetParams; - export import IndicatorFeeds = IndicatorFeedsAPI.IndicatorFeeds; - export import IndicatorFeedCreateResponse = IndicatorFeedsAPI.IndicatorFeedCreateResponse; - export import IndicatorFeedUpdateResponse = IndicatorFeedsAPI.IndicatorFeedUpdateResponse; - export import IndicatorFeedListResponse = IndicatorFeedsAPI.IndicatorFeedListResponse; - export import IndicatorFeedDataResponse = IndicatorFeedsAPI.IndicatorFeedDataResponse; - export import IndicatorFeedGetResponse = IndicatorFeedsAPI.IndicatorFeedGetResponse; - export import IndicatorFeedListResponsesSinglePage = IndicatorFeedsAPI.IndicatorFeedListResponsesSinglePage; - export import IndicatorFeedCreateParams = IndicatorFeedsAPI.IndicatorFeedCreateParams; - export import IndicatorFeedUpdateParams = IndicatorFeedsAPI.IndicatorFeedUpdateParams; - export import IndicatorFeedListParams = IndicatorFeedsAPI.IndicatorFeedListParams; - export import IndicatorFeedDataParams = IndicatorFeedsAPI.IndicatorFeedDataParams; - export import IndicatorFeedGetParams = IndicatorFeedsAPI.IndicatorFeedGetParams; - export import Sinkholes = SinkholesAPI.Sinkholes; - export import Sinkhole = SinkholesAPI.Sinkhole; - export import SinkholesSinglePage = SinkholesAPI.SinkholesSinglePage; - export import SinkholeListParams = SinkholesAPI.SinkholeListParams; - export import AttackSurfaceReport = AttackSurfaceReportAPI.AttackSurfaceReport; +Intel.ASN = ASN; +Intel.DNSV4PagePagination = DNSV4PagePagination; +Intel.Domains = Domains; +Intel.DomainHistoryResource = DomainHistoryResource; +Intel.IPs = IPs; +Intel.IPLists = IPLists; +Intel.Miscategorizations = Miscategorizations; +Intel.IndicatorFeeds = IndicatorFeeds; +Intel.IndicatorFeedListResponsesSinglePage = IndicatorFeedListResponsesSinglePage; +Intel.Sinkholes = Sinkholes; +Intel.SinkholesSinglePage = SinkholesSinglePage; +Intel.AttackSurfaceReport = AttackSurfaceReport; + +export declare namespace Intel { + export { ASN as ASN, type ASNGetParams as ASNGetParams }; + + export { type DNS as DNS, DNSV4PagePagination as DNSV4PagePagination, type DNSListParams as DNSListParams }; + + export { Domains as Domains, type Domain as Domain, type DomainGetParams as DomainGetParams }; + + export { + DomainHistoryResource as DomainHistoryResource, + type DomainHistory as DomainHistory, + type DomainHistoryGetResponse as DomainHistoryGetResponse, + type DomainHistoryGetParams as DomainHistoryGetParams, + }; + + export { IPs as IPs, type IP as IP, type IPGetResponse as IPGetResponse, type IPGetParams as IPGetParams }; + + export { + IPLists as IPLists, + type IPList as IPList, + type IPListGetResponse as IPListGetResponse, + type IPListGetParams as IPListGetParams, + }; + + export { + Miscategorizations as Miscategorizations, + type MiscategorizationCreateResponse as MiscategorizationCreateResponse, + type MiscategorizationCreateParams as MiscategorizationCreateParams, + }; + + export { + type Whois as Whois, + type WhoisGetResponse as WhoisGetResponse, + type WhoisGetParams as WhoisGetParams, + }; + + export { + IndicatorFeeds as IndicatorFeeds, + type IndicatorFeedCreateResponse as IndicatorFeedCreateResponse, + type IndicatorFeedUpdateResponse as IndicatorFeedUpdateResponse, + type IndicatorFeedListResponse as IndicatorFeedListResponse, + type IndicatorFeedDataResponse as IndicatorFeedDataResponse, + type IndicatorFeedGetResponse as IndicatorFeedGetResponse, + IndicatorFeedListResponsesSinglePage as IndicatorFeedListResponsesSinglePage, + type IndicatorFeedCreateParams as IndicatorFeedCreateParams, + type IndicatorFeedUpdateParams as IndicatorFeedUpdateParams, + type IndicatorFeedListParams as IndicatorFeedListParams, + type IndicatorFeedDataParams as IndicatorFeedDataParams, + type IndicatorFeedGetParams as IndicatorFeedGetParams, + }; + + export { + Sinkholes as Sinkholes, + type Sinkhole as Sinkhole, + SinkholesSinglePage as SinkholesSinglePage, + type SinkholeListParams as SinkholeListParams, + }; + + export { AttackSurfaceReport as AttackSurfaceReport }; } diff --git a/src/resources/intel/ip-lists.ts b/src/resources/intel/ip-lists.ts index bb2d323170..633a6716c0 100644 --- a/src/resources/intel/ip-lists.ts +++ b/src/resources/intel/ip-lists.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as IPListsAPI from './ip-lists'; export class IPLists extends APIResource { /** @@ -35,8 +34,10 @@ export interface IPListGetParams { account_id: string; } -export namespace IPLists { - export import IPList = IPListsAPI.IPList; - export import IPListGetResponse = IPListsAPI.IPListGetResponse; - export import IPListGetParams = IPListsAPI.IPListGetParams; +export declare namespace IPLists { + export { + type IPList as IPList, + type IPListGetResponse as IPListGetResponse, + type IPListGetParams as IPListGetParams, + }; } diff --git a/src/resources/intel/ips.ts b/src/resources/intel/ips.ts index 79bcf0d8c0..0e86d2270a 100644 --- a/src/resources/intel/ips.ts +++ b/src/resources/intel/ips.ts @@ -2,11 +2,11 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as IPsAPI from './ips'; export class IPs extends APIResource { /** - * Get IP Overview + * Gets the geolocation, ASN, infrastructure type of the ASN, and any security + * threat categories of an IP address. */ get(params: IPGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...query } = params; @@ -25,9 +25,9 @@ export interface IP { */ belongs_to_ref?: IP.BelongsToRef; - ip?: string | string; + ip?: string; - risk_types?: Array; + risk_types?: Array; } export namespace IP { @@ -49,6 +49,14 @@ export namespace IP { value?: string; } + + export interface RiskType { + id?: number; + + name?: string; + + super_category_id?: number; + } } export type IPGetResponse = Array; @@ -70,8 +78,6 @@ export interface IPGetParams { ipv6?: string; } -export namespace IPs { - export import IP = IPsAPI.IP; - export import IPGetResponse = IPsAPI.IPGetResponse; - export import IPGetParams = IPsAPI.IPGetParams; +export declare namespace IPs { + export { type IP as IP, type IPGetResponse as IPGetResponse, type IPGetParams as IPGetParams }; } diff --git a/src/resources/intel/miscategorizations.ts b/src/resources/intel/miscategorizations.ts index 2bec93ec3b..077bfb7a0e 100644 --- a/src/resources/intel/miscategorizations.ts +++ b/src/resources/intel/miscategorizations.ts @@ -2,27 +2,31 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as MiscategorizationsAPI from './miscategorizations'; +import * as Shared from '../shared'; export class Miscategorizations extends APIResource { /** - * Create Miscategorization + * Allows you to submit requests to change a domain’s category. */ create( params: MiscategorizationCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { const { account_id, ...body } = params; - return ( - this._client.post(`/accounts/${account_id}/intel/miscategorization`, { - body, - ...options, - }) as Core.APIPromise<{ result: MiscategorizationCreateResponse }> - )._thenUnwrap((obj) => obj.result); + return this._client.post(`/accounts/${account_id}/intel/miscategorization`, { body, ...options }); } } -export type MiscategorizationCreateResponse = unknown | string; +export interface MiscategorizationCreateResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; +} export interface MiscategorizationCreateParams { /** @@ -48,7 +52,7 @@ export interface MiscategorizationCreateParams { /** * Body param: Provide only if indicator_type is `ipv4` or `ipv6`. */ - ip?: unknown; + ip?: string | null; /** * Body param: Security category IDs to add. @@ -68,7 +72,9 @@ export interface MiscategorizationCreateParams { url?: string; } -export namespace Miscategorizations { - export import MiscategorizationCreateResponse = MiscategorizationsAPI.MiscategorizationCreateResponse; - export import MiscategorizationCreateParams = MiscategorizationsAPI.MiscategorizationCreateParams; +export declare namespace Miscategorizations { + export { + type MiscategorizationCreateResponse as MiscategorizationCreateResponse, + type MiscategorizationCreateParams as MiscategorizationCreateParams, + }; } diff --git a/src/resources/intel/sinkholes.ts b/src/resources/intel/sinkholes.ts index 4f2e3f86bb..d28caf0fbb 100644 --- a/src/resources/intel/sinkholes.ts +++ b/src/resources/intel/sinkholes.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SinkholesAPI from './sinkholes'; import { SinglePage } from '../../pagination'; export class Sinkholes extends APIResource { @@ -64,8 +63,12 @@ export interface SinkholeListParams { account_id: string; } -export namespace Sinkholes { - export import Sinkhole = SinkholesAPI.Sinkhole; - export import SinkholesSinglePage = SinkholesAPI.SinkholesSinglePage; - export import SinkholeListParams = SinkholesAPI.SinkholeListParams; +Sinkholes.SinkholesSinglePage = SinkholesSinglePage; + +export declare namespace Sinkholes { + export { + type Sinkhole as Sinkhole, + SinkholesSinglePage as SinkholesSinglePage, + type SinkholeListParams as SinkholeListParams, + }; } diff --git a/src/resources/intel/whois.ts b/src/resources/intel/whois.ts index 2bdcd10760..bf94dab574 100644 --- a/src/resources/intel/whois.ts +++ b/src/resources/intel/whois.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as WhoisAPI from './whois'; export class Whois extends APIResource { /** @@ -226,8 +225,10 @@ export interface WhoisGetParams { domain?: string; } -export namespace Whois { - export import Whois = WhoisAPI.Whois; - export import WhoisGetResponse = WhoisAPI.WhoisGetResponse; - export import WhoisGetParams = WhoisAPI.WhoisGetParams; +export declare namespace Whois { + export { + type Whois as Whois, + type WhoisGetResponse as WhoisGetResponse, + type WhoisGetParams as WhoisGetParams, + }; } diff --git a/src/resources/keyless-certificates.ts b/src/resources/keyless-certificates.ts index c629a8f0f9..11fca9e12a 100644 --- a/src/resources/keyless-certificates.ts +++ b/src/resources/keyless-certificates.ts @@ -126,7 +126,7 @@ export interface KeylessCertificate { * Available permissions for the Keyless SSL for the current user requesting the * item. */ - permissions: Array; + permissions: Array; /** * The keyless SSL port used to communicate between Cloudflare and the client's diff --git a/src/resources/kv/index.ts b/src/resources/kv/index.ts index ecc5cc36fe..a8c5f15acb 100644 --- a/src/resources/kv/index.ts +++ b/src/resources/kv/index.ts @@ -2,14 +2,18 @@ export { KV } from './kv'; export { - Namespace, - NamespaceUpdateResponse, - NamespaceDeleteResponse, - NamespaceCreateParams, - NamespaceUpdateParams, - NamespaceListParams, - NamespaceDeleteParams, - NamespaceGetParams, NamespacesV4PagePaginationArray, Namespaces, + type Namespace, + type NamespaceUpdateResponse, + type NamespaceDeleteResponse, + type NamespaceBulkDeleteResponse, + type NamespaceBulkUpdateResponse, + type NamespaceCreateParams, + type NamespaceUpdateParams, + type NamespaceListParams, + type NamespaceDeleteParams, + type NamespaceBulkDeleteParams, + type NamespaceBulkUpdateParams, + type NamespaceGetParams, } from './namespaces/index'; diff --git a/src/resources/kv/kv.ts b/src/resources/kv/kv.ts index d68cc9a01c..15034b22f4 100644 --- a/src/resources/kv/kv.ts +++ b/src/resources/kv/kv.ts @@ -2,20 +2,45 @@ import { APIResource } from '../../resource'; import * as NamespacesAPI from './namespaces/namespaces'; +import { + Namespace, + NamespaceBulkDeleteParams, + NamespaceBulkDeleteResponse, + NamespaceBulkUpdateParams, + NamespaceBulkUpdateResponse, + NamespaceCreateParams, + NamespaceDeleteParams, + NamespaceDeleteResponse, + NamespaceGetParams, + NamespaceListParams, + NamespaceUpdateParams, + NamespaceUpdateResponse, + Namespaces, + NamespacesV4PagePaginationArray, +} from './namespaces/namespaces'; export class KV extends APIResource { namespaces: NamespacesAPI.Namespaces = new NamespacesAPI.Namespaces(this._client); } -export namespace KV { - export import Namespaces = NamespacesAPI.Namespaces; - export import Namespace = NamespacesAPI.Namespace; - export import NamespaceUpdateResponse = NamespacesAPI.NamespaceUpdateResponse; - export import NamespaceDeleteResponse = NamespacesAPI.NamespaceDeleteResponse; - export import NamespacesV4PagePaginationArray = NamespacesAPI.NamespacesV4PagePaginationArray; - export import NamespaceCreateParams = NamespacesAPI.NamespaceCreateParams; - export import NamespaceUpdateParams = NamespacesAPI.NamespaceUpdateParams; - export import NamespaceListParams = NamespacesAPI.NamespaceListParams; - export import NamespaceDeleteParams = NamespacesAPI.NamespaceDeleteParams; - export import NamespaceGetParams = NamespacesAPI.NamespaceGetParams; +KV.Namespaces = Namespaces; +KV.NamespacesV4PagePaginationArray = NamespacesV4PagePaginationArray; + +export declare namespace KV { + export { + Namespaces as Namespaces, + type Namespace as Namespace, + type NamespaceUpdateResponse as NamespaceUpdateResponse, + type NamespaceDeleteResponse as NamespaceDeleteResponse, + type NamespaceBulkDeleteResponse as NamespaceBulkDeleteResponse, + type NamespaceBulkUpdateResponse as NamespaceBulkUpdateResponse, + NamespacesV4PagePaginationArray as NamespacesV4PagePaginationArray, + type NamespaceCreateParams as NamespaceCreateParams, + type NamespaceUpdateParams as NamespaceUpdateParams, + type NamespaceListParams as NamespaceListParams, + type NamespaceDeleteParams as NamespaceDeleteParams, + type NamespaceBulkDeleteParams as NamespaceBulkDeleteParams, + type NamespaceBulkUpdateParams as NamespaceBulkUpdateParams, + type NamespaceGetParams as NamespaceGetParams, + }; } diff --git a/src/resources/storage/analytics.ts b/src/resources/kv/namespaces/analytics.ts similarity index 91% rename from src/resources/storage/analytics.ts rename to src/resources/kv/namespaces/analytics.ts index 65ec67714b..d996fc4ccb 100644 --- a/src/resources/storage/analytics.ts +++ b/src/resources/kv/namespaces/analytics.ts @@ -1,8 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as AnalyticsAPI from './analytics'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; export class Analytics extends APIResource { /** @@ -47,12 +46,12 @@ export interface Components { /** * Maximum results for each metric. */ - max: unknown; + max: Record; /** * Minimum results for each metric. */ - min: unknown; + min: Record; /** * For specifying result metrics. @@ -67,7 +66,12 @@ export interface Components { /** * Total results for metrics across all data. */ - totals: unknown; + totals: Record; + + /** + * Time interval buckets by beginning and ending + */ + time_intervals?: Array>; } export namespace Components { @@ -75,7 +79,9 @@ export namespace Components { /** * List of metrics returned by the query. */ - metrics: Array; + metrics: Array>; + + dimensions?: Array; } /** @@ -125,7 +131,7 @@ export namespace Components { * Array of dimensions or metrics to sort by, each dimension/metric may be prefixed * by - (descending) or + (ascending). */ - sort?: Array; + sort?: Array; /** * End of time interval to query, defaults to current time. @@ -149,12 +155,12 @@ export interface Schema { /** * Maximum results for each metric. */ - max: unknown; + max: Record; /** * Minimum results for each metric. */ - min: unknown; + min: Record; /** * For specifying result metrics. @@ -169,7 +175,12 @@ export interface Schema { /** * Total results for metrics across all data. */ - totals: unknown; + totals: Record; + + /** + * Time interval buckets by beginning and ending + */ + time_intervals?: Array>; } export namespace Schema { @@ -177,7 +188,9 @@ export namespace Schema { /** * List of metrics returned by the query. */ - metrics: Array; + metrics: Array>; + + dimensions?: Array; } /** @@ -227,7 +240,7 @@ export namespace Schema { * Array of dimensions or metrics to sort by, each dimension/metric may be prefixed * by - (descending) or + (ascending). */ - sort?: Array; + sort?: Array; /** * End of time interval to query, defaults to current time. @@ -296,7 +309,7 @@ export namespace AnalyticsListParams { * Array of dimensions or metrics to sort by, each dimension/metric may be prefixed * by - (descending) or + (ascending). */ - sort?: Array; + sort?: Array; /** * End of time interval to query, defaults to current time. @@ -365,7 +378,7 @@ export namespace AnalyticsStoredParams { * Array of dimensions or metrics to sort by, each dimension/metric may be prefixed * by - (descending) or + (ascending). */ - sort?: Array; + sort?: Array; /** * End of time interval to query, defaults to current time. @@ -374,9 +387,11 @@ export namespace AnalyticsStoredParams { } } -export namespace Analytics { - export import Components = AnalyticsAPI.Components; - export import Schema = AnalyticsAPI.Schema; - export import AnalyticsListParams = AnalyticsAPI.AnalyticsListParams; - export import AnalyticsStoredParams = AnalyticsAPI.AnalyticsStoredParams; +export declare namespace Analytics { + export { + type Components as Components, + type Schema as Schema, + type AnalyticsListParams as AnalyticsListParams, + type AnalyticsStoredParams as AnalyticsStoredParams, + }; } diff --git a/src/resources/kv/namespaces/bulk.ts b/src/resources/kv/namespaces/bulk.ts deleted file mode 100644 index ed8f88a230..0000000000 --- a/src/resources/kv/namespaces/bulk.ts +++ /dev/null @@ -1,116 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as BulkAPI from './bulk'; - -export class Bulk extends APIResource { - /** - * Write multiple keys and values at once. Body should be an array of up to 10,000 - * key-value pairs to be stored, along with optional expiration information. - * Existing values and expirations will be overwritten. If neither `expiration` nor - * `expiration_ttl` is specified, the key-value pair will never expire. If both are - * set, `expiration_ttl` is used and `expiration` is ignored. The entire request - * size must be 100 megabytes or less. - */ - update( - namespaceId: string, - params: BulkUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, body } = params; - return ( - this._client.put(`/accounts/${account_id}/storage/kv/namespaces/${namespaceId}/bulk`, { - body: body, - ...options, - }) as Core.APIPromise<{ result: BulkUpdateResponse | null }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Remove multiple KV pairs from the namespace. Body should be an array of up to - * 10,000 keys to be removed. - */ - delete( - namespaceId: string, - params: BulkDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/storage/kv/namespaces/${namespaceId}/bulk`, - options, - ) as Core.APIPromise<{ result: BulkDeleteResponse | null }> - )._thenUnwrap((obj) => obj.result); - } -} - -export interface BulkUpdateResponse {} - -export interface BulkDeleteResponse {} - -export interface BulkUpdateParams { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: - */ - body: Array; -} - -export namespace BulkUpdateParams { - export interface Body { - /** - * Whether or not the server should base64 decode the value before storing it. - * Useful for writing values that wouldn't otherwise be valid JSON strings, such as - * images. - */ - base64?: boolean; - - /** - * The time, measured in number of seconds since the UNIX epoch, at which the key - * should expire. - */ - expiration?: number; - - /** - * The number of seconds for which the key should be visible before it expires. At - * least 60. - */ - expiration_ttl?: number; - - /** - * A key's name. The name may be at most 512 bytes. All printable, non-whitespace - * characters are valid. - */ - key?: string; - - /** - * Arbitrary JSON that is associated with a key. - */ - metadata?: Record; - - /** - * A UTF-8 encoded string to be stored, up to 25 MiB in length. - */ - value?: string; - } -} - -export interface BulkDeleteParams { - /** - * Identifier - */ - account_id: string; -} - -export namespace Bulk { - export import BulkUpdateResponse = BulkAPI.BulkUpdateResponse; - export import BulkDeleteResponse = BulkAPI.BulkDeleteResponse; - export import BulkUpdateParams = BulkAPI.BulkUpdateParams; - export import BulkDeleteParams = BulkAPI.BulkDeleteParams; -} diff --git a/src/resources/kv/namespaces/index.ts b/src/resources/kv/namespaces/index.ts index 1fa99eaa8b..1dc1c6409a 100644 --- a/src/resources/kv/namespaces/index.ts +++ b/src/resources/kv/namespaces/index.ts @@ -1,25 +1,35 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { BulkUpdateResponse, BulkDeleteResponse, BulkUpdateParams, BulkDeleteParams, Bulk } from './bulk'; -export { Key, KeyListParams, KeysCursorLimitPagination, Keys } from './keys'; -export { MetadataGetResponse, MetadataGetParams, Metadata } from './metadata'; export { - Namespace, - NamespaceUpdateResponse, - NamespaceDeleteResponse, - NamespaceCreateParams, - NamespaceUpdateParams, - NamespaceListParams, - NamespaceDeleteParams, - NamespaceGetParams, + Analytics, + type Components, + type Schema, + type AnalyticsListParams, + type AnalyticsStoredParams, +} from './analytics'; +export { KeysCursorLimitPagination, Keys, type Key, type KeyListParams } from './keys'; +export { Metadata, type MetadataGetResponse, type MetadataGetParams } from './metadata'; +export { NamespacesV4PagePaginationArray, Namespaces, + type Namespace, + type NamespaceUpdateResponse, + type NamespaceDeleteResponse, + type NamespaceBulkDeleteResponse, + type NamespaceBulkUpdateResponse, + type NamespaceCreateParams, + type NamespaceUpdateParams, + type NamespaceListParams, + type NamespaceDeleteParams, + type NamespaceBulkDeleteParams, + type NamespaceBulkUpdateParams, + type NamespaceGetParams, } from './namespaces'; export { - ValueUpdateResponse, - ValueDeleteResponse, - ValueUpdateParams, - ValueDeleteParams, - ValueGetParams, Values, + type ValueUpdateResponse, + type ValueDeleteResponse, + type ValueUpdateParams, + type ValueDeleteParams, + type ValueGetParams, } from './values'; diff --git a/src/resources/kv/namespaces/keys.ts b/src/resources/kv/namespaces/keys.ts index b938d01c1e..befb8ba794 100644 --- a/src/resources/kv/namespaces/keys.ts +++ b/src/resources/kv/namespaces/keys.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as KeysAPI from './keys'; import { CursorLimitPagination, type CursorLimitPaginationParams } from '../../../pagination'; export class Keys extends APIResource { @@ -61,8 +60,12 @@ export interface KeyListParams extends CursorLimitPaginationParams { prefix?: string; } -export namespace Keys { - export import Key = KeysAPI.Key; - export import KeysCursorLimitPagination = KeysAPI.KeysCursorLimitPagination; - export import KeyListParams = KeysAPI.KeyListParams; +Keys.KeysCursorLimitPagination = KeysCursorLimitPagination; + +export declare namespace Keys { + export { + type Key as Key, + KeysCursorLimitPagination as KeysCursorLimitPagination, + type KeyListParams as KeyListParams, + }; } diff --git a/src/resources/kv/namespaces/metadata.ts b/src/resources/kv/namespaces/metadata.ts index d9ba02cebd..3111527816 100644 --- a/src/resources/kv/namespaces/metadata.ts +++ b/src/resources/kv/namespaces/metadata.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as MetadataAPI from './metadata'; export class Metadata extends APIResource { /** @@ -38,7 +37,6 @@ export interface MetadataGetParams { account_id: string; } -export namespace Metadata { - export import MetadataGetResponse = MetadataAPI.MetadataGetResponse; - export import MetadataGetParams = MetadataAPI.MetadataGetParams; +export declare namespace Metadata { + export { type MetadataGetResponse as MetadataGetResponse, type MetadataGetParams as MetadataGetParams }; } diff --git a/src/resources/kv/namespaces/namespaces.ts b/src/resources/kv/namespaces/namespaces.ts index 4a240ebc3c..0f4eb36444 100644 --- a/src/resources/kv/namespaces/namespaces.ts +++ b/src/resources/kv/namespaces/namespaces.ts @@ -2,15 +2,25 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as NamespacesAPI from './namespaces'; -import * as BulkAPI from './bulk'; +import * as AnalyticsAPI from './analytics'; +import { Analytics, AnalyticsListParams, AnalyticsStoredParams, Components, Schema } from './analytics'; import * as KeysAPI from './keys'; +import { Key, KeyListParams, Keys, KeysCursorLimitPagination } from './keys'; import * as MetadataAPI from './metadata'; +import { Metadata, MetadataGetParams, MetadataGetResponse } from './metadata'; import * as ValuesAPI from './values'; +import { + ValueDeleteParams, + ValueDeleteResponse, + ValueGetParams, + ValueUpdateParams, + ValueUpdateResponse, + Values, +} from './values'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; export class Namespaces extends APIResource { - bulk: BulkAPI.Bulk = new BulkAPI.Bulk(this._client); + analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client); keys: KeysAPI.Keys = new KeysAPI.Keys(this._client); metadata: MetadataAPI.Metadata = new MetadataAPI.Metadata(this._client); values: ValuesAPI.Values = new ValuesAPI.Values(this._client); @@ -79,6 +89,46 @@ export class Namespaces extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Remove multiple KV pairs from the namespace. Body should be an array of up to + * 10,000 keys to be removed. + */ + bulkDelete( + namespaceId: string, + params: NamespaceBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, body } = params; + return ( + this._client.post(`/accounts/${account_id}/storage/kv/namespaces/${namespaceId}/bulk/delete`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: NamespaceBulkDeleteResponse | null }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Write multiple keys and values at once. Body should be an array of up to 10,000 + * key-value pairs to be stored, along with optional expiration information. + * Existing values and expirations will be overwritten. If neither `expiration` nor + * `expiration_ttl` is specified, the key-value pair will never expire. If both are + * set, `expiration_ttl` is used and `expiration` is ignored. The entire request + * size must be 100 megabytes or less. + */ + bulkUpdate( + namespaceId: string, + params: NamespaceBulkUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, body } = params; + return ( + this._client.put(`/accounts/${account_id}/storage/kv/namespaces/${namespaceId}/bulk`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: NamespaceBulkUpdateResponse | null }> + )._thenUnwrap((obj) => obj.result); + } + /** * Get the namespace corresponding to the given ID. */ @@ -121,6 +171,30 @@ export interface NamespaceUpdateResponse {} export interface NamespaceDeleteResponse {} +export interface NamespaceBulkDeleteResponse { + /** + * Number of keys successfully updated + */ + successful_key_count?: number; + + /** + * Name of the keys that failed to be fully updated. They should be retried. + */ + unsuccessful_keys?: Array; +} + +export interface NamespaceBulkUpdateResponse { + /** + * Number of keys successfully updated + */ + successful_key_count?: number; + + /** + * Name of the keys that failed to be fully updated. They should be retried. + */ + unsuccessful_keys?: Array; +} + export interface NamespaceCreateParams { /** * Path param: Identifier @@ -169,6 +243,69 @@ export interface NamespaceDeleteParams { account_id: string; } +export interface NamespaceBulkDeleteParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: + */ + body: Array; +} + +export interface NamespaceBulkUpdateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: + */ + body: Array; +} + +export namespace NamespaceBulkUpdateParams { + export interface Body { + /** + * Whether or not the server should base64 decode the value before storing it. + * Useful for writing values that wouldn't otherwise be valid JSON strings, such as + * images. + */ + base64?: boolean; + + /** + * The time, measured in number of seconds since the UNIX epoch, at which the key + * should expire. + */ + expiration?: number; + + /** + * The number of seconds for which the key should be visible before it expires. At + * least 60. + */ + expiration_ttl?: number; + + /** + * A key's name. The name may be at most 512 bytes. All printable, non-whitespace + * characters are valid. + */ + key?: string; + + /** + * Arbitrary JSON that is associated with a key. + */ + metadata?: Record; + + /** + * A UTF-8 encoded string to be stored, up to 25 MiB in length. + */ + value?: string; + } +} + export interface NamespaceGetParams { /** * Identifier @@ -176,32 +313,57 @@ export interface NamespaceGetParams { account_id: string; } -export namespace Namespaces { - export import Namespace = NamespacesAPI.Namespace; - export import NamespaceUpdateResponse = NamespacesAPI.NamespaceUpdateResponse; - export import NamespaceDeleteResponse = NamespacesAPI.NamespaceDeleteResponse; - export import NamespacesV4PagePaginationArray = NamespacesAPI.NamespacesV4PagePaginationArray; - export import NamespaceCreateParams = NamespacesAPI.NamespaceCreateParams; - export import NamespaceUpdateParams = NamespacesAPI.NamespaceUpdateParams; - export import NamespaceListParams = NamespacesAPI.NamespaceListParams; - export import NamespaceDeleteParams = NamespacesAPI.NamespaceDeleteParams; - export import NamespaceGetParams = NamespacesAPI.NamespaceGetParams; - export import Bulk = BulkAPI.Bulk; - export import BulkUpdateResponse = BulkAPI.BulkUpdateResponse; - export import BulkDeleteResponse = BulkAPI.BulkDeleteResponse; - export import BulkUpdateParams = BulkAPI.BulkUpdateParams; - export import BulkDeleteParams = BulkAPI.BulkDeleteParams; - export import Keys = KeysAPI.Keys; - export import Key = KeysAPI.Key; - export import KeysCursorLimitPagination = KeysAPI.KeysCursorLimitPagination; - export import KeyListParams = KeysAPI.KeyListParams; - export import Metadata = MetadataAPI.Metadata; - export import MetadataGetResponse = MetadataAPI.MetadataGetResponse; - export import MetadataGetParams = MetadataAPI.MetadataGetParams; - export import Values = ValuesAPI.Values; - export import ValueUpdateResponse = ValuesAPI.ValueUpdateResponse; - export import ValueDeleteResponse = ValuesAPI.ValueDeleteResponse; - export import ValueUpdateParams = ValuesAPI.ValueUpdateParams; - export import ValueDeleteParams = ValuesAPI.ValueDeleteParams; - export import ValueGetParams = ValuesAPI.ValueGetParams; +Namespaces.NamespacesV4PagePaginationArray = NamespacesV4PagePaginationArray; +Namespaces.Analytics = Analytics; +Namespaces.Keys = Keys; +Namespaces.KeysCursorLimitPagination = KeysCursorLimitPagination; +Namespaces.Metadata = Metadata; +Namespaces.Values = Values; + +export declare namespace Namespaces { + export { + type Namespace as Namespace, + type NamespaceUpdateResponse as NamespaceUpdateResponse, + type NamespaceDeleteResponse as NamespaceDeleteResponse, + type NamespaceBulkDeleteResponse as NamespaceBulkDeleteResponse, + type NamespaceBulkUpdateResponse as NamespaceBulkUpdateResponse, + NamespacesV4PagePaginationArray as NamespacesV4PagePaginationArray, + type NamespaceCreateParams as NamespaceCreateParams, + type NamespaceUpdateParams as NamespaceUpdateParams, + type NamespaceListParams as NamespaceListParams, + type NamespaceDeleteParams as NamespaceDeleteParams, + type NamespaceBulkDeleteParams as NamespaceBulkDeleteParams, + type NamespaceBulkUpdateParams as NamespaceBulkUpdateParams, + type NamespaceGetParams as NamespaceGetParams, + }; + + export { + Analytics as Analytics, + type Components as Components, + type Schema as Schema, + type AnalyticsListParams as AnalyticsListParams, + type AnalyticsStoredParams as AnalyticsStoredParams, + }; + + export { + Keys as Keys, + type Key as Key, + KeysCursorLimitPagination as KeysCursorLimitPagination, + type KeyListParams as KeyListParams, + }; + + export { + Metadata as Metadata, + type MetadataGetResponse as MetadataGetResponse, + type MetadataGetParams as MetadataGetParams, + }; + + export { + Values as Values, + type ValueUpdateResponse as ValueUpdateResponse, + type ValueDeleteResponse as ValueDeleteResponse, + type ValueUpdateParams as ValueUpdateParams, + type ValueDeleteParams as ValueDeleteParams, + type ValueGetParams as ValueGetParams, + }; } diff --git a/src/resources/kv/namespaces/values.ts b/src/resources/kv/namespaces/values.ts index 98a07df9da..502e8c34e5 100644 --- a/src/resources/kv/namespaces/values.ts +++ b/src/resources/kv/namespaces/values.ts @@ -2,17 +2,18 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ValuesAPI from './values'; import { type Response } from '../../../_shims/index'; export class Values extends APIResource { /** * Write a value identified by a key. Use URL-encoding to use special characters * (for example, `:`, `!`, `%`) in the key name. Body should be the value to be - * stored along with JSON metadata to be associated with the key/value pair. - * Existing values, expirations, and metadata will be overwritten. If neither - * `expiration` nor `expiration_ttl` is specified, the key-value pair will never - * expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. + * stored. If JSON metadata to be associated with the key/value pair is needed, use + * `multipart/form-data` content type for your PUT request (see dropdown below in + * `REQUEST BODY SCHEMA`). Existing values, expirations, and metadata will be + * overwritten. If neither `expiration` nor `expiration_ttl` is specified, the + * key-value pair will never expire. If both are set, `expiration_ttl` is used and + * `expiration` is ignored. */ update( namespaceId: string, @@ -20,11 +21,16 @@ export class Values extends APIResource { params: ValueUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, ...body } = params; + const { account_id, expiration, expiration_ttl, ...body } = params; return ( this._client.put( `/accounts/${account_id}/storage/kv/namespaces/${namespaceId}/values/${keyName}`, - Core.multipartFormRequestOptions({ body, ...options }), + Core.maybeMultipartFormRequestOptions({ + query: { expiration, expiration_ttl }, + body, + ...options, + headers: { 'Content-Type': '*/*', ...options?.headers }, + }), ) as Core.APIPromise<{ result: ValueUpdateResponse | null }> )._thenUnwrap((obj) => obj.result); } @@ -64,7 +70,11 @@ export class Values extends APIResource { const { account_id } = params; return this._client.get( `/accounts/${account_id}/storage/kv/namespaces/${namespaceId}/values/${keyName}`, - { ...options, __binaryResponse: true }, + { + ...options, + headers: { Accept: 'application/octet-stream', ...options?.headers }, + __binaryResponse: true, + }, ); } } @@ -88,6 +98,18 @@ export interface ValueUpdateParams { * Body param: A byte sequence to be stored, up to 25 MiB in length. */ value: string; + + /** + * Query param: The time, measured in number of seconds since the UNIX epoch, at + * which the key should expire. + */ + expiration?: number; + + /** + * Query param: The number of seconds for which the key should be visible before it + * expires. At least 60. + */ + expiration_ttl?: number; } export interface ValueDeleteParams { @@ -104,10 +126,12 @@ export interface ValueGetParams { account_id: string; } -export namespace Values { - export import ValueUpdateResponse = ValuesAPI.ValueUpdateResponse; - export import ValueDeleteResponse = ValuesAPI.ValueDeleteResponse; - export import ValueUpdateParams = ValuesAPI.ValueUpdateParams; - export import ValueDeleteParams = ValuesAPI.ValueDeleteParams; - export import ValueGetParams = ValuesAPI.ValueGetParams; +export declare namespace Values { + export { + type ValueUpdateResponse as ValueUpdateResponse, + type ValueDeleteResponse as ValueDeleteResponse, + type ValueUpdateParams as ValueUpdateParams, + type ValueDeleteParams as ValueDeleteParams, + type ValueGetParams as ValueGetParams, + }; } diff --git a/src/resources/leaked-credential-checks/detections.ts b/src/resources/leaked-credential-checks/detections.ts new file mode 100644 index 0000000000..353a0cecd5 --- /dev/null +++ b/src/resources/leaked-credential-checks/detections.ts @@ -0,0 +1,203 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { SinglePage } from '../../pagination'; + +export class Detections extends APIResource { + /** + * Create user-defined detection pattern for Leaked Credential Checks + */ + create( + params: DetectionCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/leaked-credential-checks/detections`, { + body, + ...options, + }) as Core.APIPromise<{ result: DetectionCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update user-defined detection pattern for Leaked Credential Checks + */ + update( + detectionId: string, + params: DetectionUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.put(`/zones/${zone_id}/leaked-credential-checks/detections/${detectionId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: DetectionUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List user-defined detection patterns for Leaked Credential Checks + */ + list( + params: DetectionListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id } = params; + return this._client.getAPIList( + `/zones/${zone_id}/leaked-credential-checks/detections`, + DetectionListResponsesSinglePage, + options, + ); + } + + /** + * Remove user-defined detection pattern for Leaked Credential Checks + */ + delete( + detectionId: string, + params: DetectionDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.delete( + `/zones/${zone_id}/leaked-credential-checks/detections/${detectionId}`, + options, + ) as Core.APIPromise<{ result: DetectionDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class DetectionListResponsesSinglePage extends SinglePage {} + +/** + * A custom set of username/password expressions to match Leaked Credential Checks + * on + */ +export interface DetectionCreateResponse { + /** + * The unique ID for this custom detection + */ + id?: string; + + /** + * The ruleset expression to use in matching the password in a request + */ + password?: string; + + /** + * The ruleset expression to use in matching the username in a request + */ + username?: string; +} + +/** + * A custom set of username/password expressions to match Leaked Credential Checks + * on + */ +export interface DetectionUpdateResponse { + /** + * The unique ID for this custom detection + */ + id?: string; + + /** + * The ruleset expression to use in matching the password in a request + */ + password?: string; + + /** + * The ruleset expression to use in matching the username in a request + */ + username?: string; +} + +/** + * A custom set of username/password expressions to match Leaked Credential Checks + * on + */ +export interface DetectionListResponse { + /** + * The unique ID for this custom detection + */ + id?: string; + + /** + * The ruleset expression to use in matching the password in a request + */ + password?: string; + + /** + * The ruleset expression to use in matching the username in a request + */ + username?: string; +} + +export type DetectionDeleteResponse = unknown; + +export interface DetectionCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The ruleset expression to use in matching the password in a request + */ + password?: string; + + /** + * Body param: The ruleset expression to use in matching the username in a request + */ + username?: string; +} + +export interface DetectionUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The ruleset expression to use in matching the password in a request + */ + password?: string; + + /** + * Body param: The ruleset expression to use in matching the username in a request + */ + username?: string; +} + +export interface DetectionListParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface DetectionDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +Detections.DetectionListResponsesSinglePage = DetectionListResponsesSinglePage; + +export declare namespace Detections { + export { + type DetectionCreateResponse as DetectionCreateResponse, + type DetectionUpdateResponse as DetectionUpdateResponse, + type DetectionListResponse as DetectionListResponse, + type DetectionDeleteResponse as DetectionDeleteResponse, + DetectionListResponsesSinglePage as DetectionListResponsesSinglePage, + type DetectionCreateParams as DetectionCreateParams, + type DetectionUpdateParams as DetectionUpdateParams, + type DetectionListParams as DetectionListParams, + type DetectionDeleteParams as DetectionDeleteParams, + }; +} diff --git a/src/resources/leaked-credential-checks/index.ts b/src/resources/leaked-credential-checks/index.ts new file mode 100644 index 0000000000..1844848bf2 --- /dev/null +++ b/src/resources/leaked-credential-checks/index.ts @@ -0,0 +1,15 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + DetectionListResponsesSinglePage, + Detections, + type DetectionCreateResponse, + type DetectionUpdateResponse, + type DetectionListResponse, + type DetectionDeleteResponse, + type DetectionCreateParams, + type DetectionUpdateParams, + type DetectionListParams, + type DetectionDeleteParams, +} from './detections'; +export { LeakedCredentialChecks } from './leaked-credential-checks'; diff --git a/src/resources/leaked-credential-checks/leaked-credential-checks.ts b/src/resources/leaked-credential-checks/leaked-credential-checks.ts new file mode 100644 index 0000000000..a94753581e --- /dev/null +++ b/src/resources/leaked-credential-checks/leaked-credential-checks.ts @@ -0,0 +1,109 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as DetectionsAPI from './detections'; +import { + DetectionCreateParams, + DetectionCreateResponse, + DetectionDeleteParams, + DetectionDeleteResponse, + DetectionListParams, + DetectionListResponse, + DetectionListResponsesSinglePage, + DetectionUpdateParams, + DetectionUpdateResponse, + Detections, +} from './detections'; + +export class LeakedCredentialChecks extends APIResource { + detections: DetectionsAPI.Detections = new DetectionsAPI.Detections(this._client); + + /** + * Updates the current status of Leaked Credential Checks + */ + create( + params: LeakedCredentialCheckCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/leaked-credential-checks`, { + body, + ...options, + }) as Core.APIPromise<{ result: LeakedCredentialCheckCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves the current status of Leaked Credential Checks + */ + get( + params: LeakedCredentialCheckGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/leaked-credential-checks`, options) as Core.APIPromise<{ + result: LeakedCredentialCheckGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * The overall status for Leaked Credential Checks + */ +export interface LeakedCredentialCheckCreateResponse { + /** + * Whether or not Leaked Credential Checks are enabled + */ + enabled?: boolean; +} + +/** + * The overall status for Leaked Credential Checks + */ +export interface LeakedCredentialCheckGetResponse { + /** + * Whether or not Leaked Credential Checks are enabled + */ + enabled?: boolean; +} + +export interface LeakedCredentialCheckCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Whether or not Leaked Credential Checks are enabled + */ + enabled?: boolean; +} + +export interface LeakedCredentialCheckGetParams { + /** + * Identifier + */ + zone_id: string; +} + +LeakedCredentialChecks.Detections = Detections; +LeakedCredentialChecks.DetectionListResponsesSinglePage = DetectionListResponsesSinglePage; + +export declare namespace LeakedCredentialChecks { + export { + Detections as Detections, + type DetectionCreateResponse as DetectionCreateResponse, + type DetectionUpdateResponse as DetectionUpdateResponse, + type DetectionListResponse as DetectionListResponse, + type DetectionDeleteResponse as DetectionDeleteResponse, + DetectionListResponsesSinglePage as DetectionListResponsesSinglePage, + type DetectionCreateParams as DetectionCreateParams, + type DetectionUpdateParams as DetectionUpdateParams, + type DetectionListParams as DetectionListParams, + type DetectionDeleteParams as DetectionDeleteParams, + }; +} diff --git a/src/resources/load-balancers/index.ts b/src/resources/load-balancers/index.ts index d137d0197f..f4353364b1 100644 --- a/src/resources/load-balancers/index.ts +++ b/src/resources/load-balancers/index.ts @@ -2,29 +2,37 @@ export { LoadBalancers } from './load-balancers'; export { - Monitor, - MonitorDeleteResponse, - MonitorCreateParams, - MonitorUpdateParams, - MonitorListParams, - MonitorDeleteParams, - MonitorEditParams, - MonitorGetParams, MonitorsSinglePage, Monitors, + type Monitor, + type MonitorDeleteResponse, + type MonitorCreateParams, + type MonitorUpdateParams, + type MonitorListParams, + type MonitorDeleteParams, + type MonitorEditParams, + type MonitorGetParams, } from './monitors/index'; export { - Pool, - PoolDeleteResponse, - PoolCreateParams, - PoolUpdateParams, - PoolListParams, - PoolDeleteParams, - PoolEditParams, - PoolGetParams, PoolsSinglePage, Pools, + type Pool, + type PoolDeleteResponse, + type PoolBulkEditResponse, + type PoolCreateParams, + type PoolUpdateParams, + type PoolListParams, + type PoolDeleteParams, + type PoolBulkEditParams, + type PoolEditParams, + type PoolGetParams, } from './pools/index'; -export { PreviewGetResponse, PreviewGetParams, Previews } from './previews'; -export { RegionListResponse, RegionGetResponse, RegionListParams, RegionGetParams, Regions } from './regions'; -export { SearchGetResponse, SearchGetParams, Searches } from './searches'; +export { Previews, type PreviewGetResponse, type PreviewGetParams } from './previews'; +export { + Regions, + type RegionListResponse, + type RegionGetResponse, + type RegionListParams, + type RegionGetParams, +} from './regions'; +export { Searches, type SearchGetResponse, type SearchGetParams } from './searches'; diff --git a/src/resources/load-balancers/load-balancers.ts b/src/resources/load-balancers/load-balancers.ts index aeef387a7d..a654590327 100644 --- a/src/resources/load-balancers/load-balancers.ts +++ b/src/resources/load-balancers/load-balancers.ts @@ -4,10 +4,39 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as LoadBalancersAPI from './load-balancers'; import * as PreviewsAPI from './previews'; +import { PreviewGetParams, PreviewGetResponse, Previews } from './previews'; import * as RegionsAPI from './regions'; +import { RegionGetParams, RegionGetResponse, RegionListParams, RegionListResponse, Regions } from './regions'; import * as SearchesAPI from './searches'; +import { SearchGetParams, SearchGetResponse, Searches } from './searches'; import * as MonitorsAPI from './monitors/monitors'; +import { + Monitor, + MonitorCreateParams, + MonitorDeleteParams, + MonitorDeleteResponse, + MonitorEditParams, + MonitorGetParams, + MonitorListParams, + MonitorUpdateParams, + Monitors, + MonitorsSinglePage, +} from './monitors/monitors'; import * as PoolsAPI from './pools/pools'; +import { + Pool, + PoolBulkEditParams, + PoolBulkEditResponse, + PoolCreateParams, + PoolDeleteParams, + PoolDeleteResponse, + PoolEditParams, + PoolGetParams, + PoolListParams, + PoolUpdateParams, + Pools, + PoolsSinglePage, +} from './pools/pools'; import { SinglePage } from '../../pagination'; export class LoadBalancers extends APIResource { @@ -286,7 +315,7 @@ export interface LoadBalancer { * back to using the corresponding region_pool mapping if it exists else to * default_pools. */ - country_pools?: unknown; + country_pools?: Record>; created_on?: string; @@ -309,7 +338,7 @@ export interface LoadBalancer { /** * The pool ID to use when all other pools are detected as unhealthy. */ - fallback_pool?: unknown; + fallback_pool?: string; /** * Controls location-based steering for non-proxied requests. See `steering_policy` @@ -326,13 +355,18 @@ export interface LoadBalancer { */ name?: string; + /** + * List of networks where Load Balancer or Pool is enabled. + */ + networks?: Array; + /** * (Enterprise only): A mapping of Cloudflare PoP identifiers to a list of pool IDs * (ordered by their failover priority) for the PoP (datacenter). Any PoPs not * explicitly defined will fall back to using the corresponding country_pool, then * region_pool mapping if it exists else to default_pools. */ - pop_pools?: unknown; + pop_pools?: Record>; /** * Whether the hostname should be gray clouded (false) or orange clouded (true). @@ -356,7 +390,7 @@ export interface LoadBalancer { * priority) for the given region. Any regions not explicitly defined will fall * back to using default_pools. */ - region_pools?: unknown; + region_pools?: Record>; /** * BETA Field Not General Access: A list of rules for this load balancer to @@ -366,7 +400,7 @@ export interface LoadBalancer { /** * Specifies the type of session affinity the load balancer should use unless - * specified as `"none"` or "" (default). The supported types are: + * specified as `"none"`. The supported types are: * * - `"cookie"`: On the first request to a proxied load balancer, a cookie is * generated, encoding information of which origin the request will be forwarded @@ -760,7 +794,7 @@ export interface RandomSteering { * A mapping of pool IDs to custom weights. The weight is relative to other pools * in the load balancer. */ - pool_weights?: unknown; + pool_weights?: Record; } /** @@ -784,7 +818,7 @@ export interface RandomSteeringParam { * A mapping of pool IDs to custom weights. The weight is relative to other pools * in the load balancer. */ - pool_weights?: unknown; + pool_weights?: Record; } /** @@ -888,7 +922,7 @@ export namespace Rules { * back to using the corresponding region_pool mapping if it exists else to * default_pools. */ - country_pools?: unknown; + country_pools?: Record>; /** * A list of pool IDs ordered by their failover priority. Pools defined here are @@ -899,7 +933,7 @@ export namespace Rules { /** * The pool ID to use when all other pools are detected as unhealthy. */ - fallback_pool?: unknown; + fallback_pool?: string; /** * Controls location-based steering for non-proxied requests. See `steering_policy` @@ -913,7 +947,7 @@ export namespace Rules { * explicitly defined will fall back to using the corresponding country_pool, then * region_pool mapping if it exists else to default_pools. */ - pop_pools?: unknown; + pop_pools?: Record>; /** * Configures pool weights. @@ -932,11 +966,11 @@ export namespace Rules { * priority) for the given region. Any regions not explicitly defined will fall * back to using default_pools. */ - region_pools?: unknown; + region_pools?: Record>; /** * Specifies the type of session affinity the load balancer should use unless - * specified as `"none"` or "" (default). The supported types are: + * specified as `"none"`. The supported types are: * * - `"cookie"`: On the first request to a proxied load balancer, a cookie is * generated, encoding information of which origin the request will be forwarded @@ -1115,7 +1149,7 @@ export namespace RulesParam { * back to using the corresponding region_pool mapping if it exists else to * default_pools. */ - country_pools?: unknown; + country_pools?: Record>; /** * A list of pool IDs ordered by their failover priority. Pools defined here are @@ -1126,7 +1160,7 @@ export namespace RulesParam { /** * The pool ID to use when all other pools are detected as unhealthy. */ - fallback_pool?: unknown; + fallback_pool?: string; /** * Controls location-based steering for non-proxied requests. See `steering_policy` @@ -1140,7 +1174,7 @@ export namespace RulesParam { * explicitly defined will fall back to using the corresponding country_pool, then * region_pool mapping if it exists else to default_pools. */ - pop_pools?: unknown; + pop_pools?: Record>; /** * Configures pool weights. @@ -1159,11 +1193,11 @@ export namespace RulesParam { * priority) for the given region. Any regions not explicitly defined will fall * back to using default_pools. */ - region_pools?: unknown; + region_pools?: Record>; /** * Specifies the type of session affinity the load balancer should use unless - * specified as `"none"` or "" (default). The supported types are: + * specified as `"none"`. The supported types are: * * - `"cookie"`: On the first request to a proxied load balancer, a cookie is * generated, encoding information of which origin the request will be forwarded @@ -1243,7 +1277,7 @@ export namespace RulesParam { /** * Specifies the type of session affinity the load balancer should use unless - * specified as `"none"` or "" (default). The supported types are: + * specified as `"none"`. The supported types are: * * - `"cookie"`: On the first request to a proxied load balancer, a cookie is * generated, encoding information of which origin the request will be forwarded @@ -1266,11 +1300,11 @@ export namespace RulesParam { * `headers` in `session_affinity_attributes` for additional required * configuration. */ -export type SessionAffinity = 'none' | 'cookie' | 'ip_cookie' | 'header' | '""'; +export type SessionAffinity = 'none' | 'cookie' | 'ip_cookie' | 'header'; /** * Specifies the type of session affinity the load balancer should use unless - * specified as `"none"` or "" (default). The supported types are: + * specified as `"none"`. The supported types are: * * - `"cookie"`: On the first request to a proxied load balancer, a cookie is * generated, encoding information of which origin the request will be forwarded @@ -1293,7 +1327,7 @@ export type SessionAffinity = 'none' | 'cookie' | 'ip_cookie' | 'header' | '""'; * `headers` in `session_affinity_attributes` for additional required * configuration. */ -export type SessionAffinityParam = 'none' | 'cookie' | 'ip_cookie' | 'header' | '""'; +export type SessionAffinityParam = 'none' | 'cookie' | 'ip_cookie' | 'header'; /** * Configures attributes for session affinity. @@ -1461,7 +1495,7 @@ export type SteeringPolicy = | 'proximity' | 'least_outstanding_requests' | 'least_connections' - | '""'; + | ''; /** * Steering Policy for this load balancer. @@ -1495,7 +1529,7 @@ export type SteeringPolicyParam = | 'proximity' | 'least_outstanding_requests' | 'least_connections' - | '""'; + | ''; export interface LoadBalancerDeleteResponse { id?: string; @@ -1517,7 +1551,7 @@ export interface LoadBalancerCreateParams { /** * Body param: The pool ID to use when all other pools are detected as unhealthy. */ - fallback_pool: unknown; + fallback_pool: string; /** * Body param: The DNS hostname to associate with your Load Balancer. If this @@ -1542,7 +1576,7 @@ export interface LoadBalancerCreateParams { * will fall back to using the corresponding region_pool mapping if it exists else * to default_pools. */ - country_pools?: unknown; + country_pools?: Record>; /** * Body param: Object description. @@ -1555,13 +1589,18 @@ export interface LoadBalancerCreateParams { */ location_strategy?: LocationStrategyParam; + /** + * Body param: List of networks where Load Balancer or Pool is enabled. + */ + networks?: Array; + /** * Body param: (Enterprise only): A mapping of Cloudflare PoP identifiers to a list * of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any * PoPs not explicitly defined will fall back to using the corresponding * country_pool, then region_pool mapping if it exists else to default_pools. */ - pop_pools?: unknown; + pop_pools?: Record>; /** * Body param: Whether the hostname should be gray clouded (false) or orange @@ -1586,7 +1625,7 @@ export interface LoadBalancerCreateParams { * failover priority) for the given region. Any regions not explicitly defined will * fall back to using default_pools. */ - region_pools?: unknown; + region_pools?: Record>; /** * Body param: BETA Field Not General Access: A list of rules for this load @@ -1596,7 +1635,7 @@ export interface LoadBalancerCreateParams { /** * Body param: Specifies the type of session affinity the load balancer should use - * unless specified as `"none"` or "" (default). The supported types are: + * unless specified as `"none"`. The supported types are: * * - `"cookie"`: On the first request to a proxied load balancer, a cookie is * generated, encoding information of which origin the request will be forwarded @@ -1691,7 +1730,7 @@ export interface LoadBalancerUpdateParams { /** * Body param: The pool ID to use when all other pools are detected as unhealthy. */ - fallback_pool: unknown; + fallback_pool: string; /** * Body param: The DNS hostname to associate with your Load Balancer. If this @@ -1716,7 +1755,7 @@ export interface LoadBalancerUpdateParams { * will fall back to using the corresponding region_pool mapping if it exists else * to default_pools. */ - country_pools?: unknown; + country_pools?: Record>; /** * Body param: Object description. @@ -1734,13 +1773,18 @@ export interface LoadBalancerUpdateParams { */ location_strategy?: LocationStrategyParam; + /** + * Body param: List of networks where Load Balancer or Pool is enabled. + */ + networks?: Array; + /** * Body param: (Enterprise only): A mapping of Cloudflare PoP identifiers to a list * of pool IDs (ordered by their failover priority) for the PoP (datacenter). Any * PoPs not explicitly defined will fall back to using the corresponding * country_pool, then region_pool mapping if it exists else to default_pools. */ - pop_pools?: unknown; + pop_pools?: Record>; /** * Body param: Whether the hostname should be gray clouded (false) or orange @@ -1765,7 +1809,7 @@ export interface LoadBalancerUpdateParams { * failover priority) for the given region. Any regions not explicitly defined will * fall back to using default_pools. */ - region_pools?: unknown; + region_pools?: Record>; /** * Body param: BETA Field Not General Access: A list of rules for this load @@ -1775,7 +1819,7 @@ export interface LoadBalancerUpdateParams { /** * Body param: Specifies the type of session affinity the load balancer should use - * unless specified as `"none"` or "" (default). The supported types are: + * unless specified as `"none"`. The supported types are: * * - `"cookie"`: On the first request to a proxied load balancer, a cookie is * generated, encoding information of which origin the request will be forwarded @@ -1884,7 +1928,7 @@ export interface LoadBalancerEditParams { * will fall back to using the corresponding region_pool mapping if it exists else * to default_pools. */ - country_pools?: unknown; + country_pools?: Record>; /** * Body param: A list of pool IDs ordered by their failover priority. Pools defined @@ -1906,7 +1950,7 @@ export interface LoadBalancerEditParams { /** * Body param: The pool ID to use when all other pools are detected as unhealthy. */ - fallback_pool?: unknown; + fallback_pool?: string; /** * Body param: Controls location-based steering for non-proxied requests. See @@ -1927,7 +1971,7 @@ export interface LoadBalancerEditParams { * PoPs not explicitly defined will fall back to using the corresponding * country_pool, then region_pool mapping if it exists else to default_pools. */ - pop_pools?: unknown; + pop_pools?: Record>; /** * Body param: Whether the hostname should be gray clouded (false) or orange @@ -1952,7 +1996,7 @@ export interface LoadBalancerEditParams { * failover priority) for the given region. Any regions not explicitly defined will * fall back to using default_pools. */ - region_pools?: unknown; + region_pools?: Record>; /** * Body param: BETA Field Not General Access: A list of rules for this load @@ -1962,7 +2006,7 @@ export interface LoadBalancerEditParams { /** * Body param: Specifies the type of session affinity the load balancer should use - * unless specified as `"none"` or "" (default). The supported types are: + * unless specified as `"none"`. The supported types are: * * - `"cookie"`: On the first request to a proxied load balancer, a cookie is * generated, encoding information of which origin the request will be forwarded @@ -2045,36 +2089,60 @@ export interface LoadBalancerGetParams { zone_id: string; } -export namespace LoadBalancers { - export import Monitors = MonitorsAPI.Monitors; - export import Monitor = MonitorsAPI.Monitor; - export import MonitorDeleteResponse = MonitorsAPI.MonitorDeleteResponse; - export import MonitorsSinglePage = MonitorsAPI.MonitorsSinglePage; - export import MonitorCreateParams = MonitorsAPI.MonitorCreateParams; - export import MonitorUpdateParams = MonitorsAPI.MonitorUpdateParams; - export import MonitorListParams = MonitorsAPI.MonitorListParams; - export import MonitorDeleteParams = MonitorsAPI.MonitorDeleteParams; - export import MonitorEditParams = MonitorsAPI.MonitorEditParams; - export import MonitorGetParams = MonitorsAPI.MonitorGetParams; - export import Pools = PoolsAPI.Pools; - export import Pool = PoolsAPI.Pool; - export import PoolDeleteResponse = PoolsAPI.PoolDeleteResponse; - export import PoolsSinglePage = PoolsAPI.PoolsSinglePage; - export import PoolCreateParams = PoolsAPI.PoolCreateParams; - export import PoolUpdateParams = PoolsAPI.PoolUpdateParams; - export import PoolListParams = PoolsAPI.PoolListParams; - export import PoolDeleteParams = PoolsAPI.PoolDeleteParams; - export import PoolEditParams = PoolsAPI.PoolEditParams; - export import PoolGetParams = PoolsAPI.PoolGetParams; - export import Previews = PreviewsAPI.Previews; - export import PreviewGetResponse = PreviewsAPI.PreviewGetResponse; - export import PreviewGetParams = PreviewsAPI.PreviewGetParams; - export import Regions = RegionsAPI.Regions; - export import RegionListResponse = RegionsAPI.RegionListResponse; - export import RegionGetResponse = RegionsAPI.RegionGetResponse; - export import RegionListParams = RegionsAPI.RegionListParams; - export import RegionGetParams = RegionsAPI.RegionGetParams; - export import Searches = SearchesAPI.Searches; - export import SearchGetResponse = SearchesAPI.SearchGetResponse; - export import SearchGetParams = SearchesAPI.SearchGetParams; +LoadBalancers.Monitors = Monitors; +LoadBalancers.MonitorsSinglePage = MonitorsSinglePage; +LoadBalancers.Pools = Pools; +LoadBalancers.PoolsSinglePage = PoolsSinglePage; +LoadBalancers.Previews = Previews; +LoadBalancers.Regions = Regions; +LoadBalancers.Searches = Searches; + +export declare namespace LoadBalancers { + export { + Monitors as Monitors, + type Monitor as Monitor, + type MonitorDeleteResponse as MonitorDeleteResponse, + MonitorsSinglePage as MonitorsSinglePage, + type MonitorCreateParams as MonitorCreateParams, + type MonitorUpdateParams as MonitorUpdateParams, + type MonitorListParams as MonitorListParams, + type MonitorDeleteParams as MonitorDeleteParams, + type MonitorEditParams as MonitorEditParams, + type MonitorGetParams as MonitorGetParams, + }; + + export { + Pools as Pools, + type Pool as Pool, + type PoolDeleteResponse as PoolDeleteResponse, + type PoolBulkEditResponse as PoolBulkEditResponse, + PoolsSinglePage as PoolsSinglePage, + type PoolCreateParams as PoolCreateParams, + type PoolUpdateParams as PoolUpdateParams, + type PoolListParams as PoolListParams, + type PoolDeleteParams as PoolDeleteParams, + type PoolBulkEditParams as PoolBulkEditParams, + type PoolEditParams as PoolEditParams, + type PoolGetParams as PoolGetParams, + }; + + export { + Previews as Previews, + type PreviewGetResponse as PreviewGetResponse, + type PreviewGetParams as PreviewGetParams, + }; + + export { + Regions as Regions, + type RegionListResponse as RegionListResponse, + type RegionGetResponse as RegionGetResponse, + type RegionListParams as RegionListParams, + type RegionGetParams as RegionGetParams, + }; + + export { + Searches as Searches, + type SearchGetResponse as SearchGetResponse, + type SearchGetParams as SearchGetParams, + }; } diff --git a/src/resources/load-balancers/monitors/index.ts b/src/resources/load-balancers/monitors/index.ts index c19e5d704c..656856b3d1 100644 --- a/src/resources/load-balancers/monitors/index.ts +++ b/src/resources/load-balancers/monitors/index.ts @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Monitor, - MonitorDeleteResponse, - MonitorCreateParams, - MonitorUpdateParams, - MonitorListParams, - MonitorDeleteParams, - MonitorEditParams, - MonitorGetParams, MonitorsSinglePage, Monitors, + type Monitor, + type MonitorDeleteResponse, + type MonitorCreateParams, + type MonitorUpdateParams, + type MonitorListParams, + type MonitorDeleteParams, + type MonitorEditParams, + type MonitorGetParams, } from './monitors'; -export { PreviewCreateResponse, PreviewCreateParams, Previews } from './previews'; -export { ReferenceGetResponse, ReferenceGetParams, References } from './references'; +export { Previews, type PreviewCreateResponse, type PreviewCreateParams } from './previews'; +export { References, type ReferenceGetResponse, type ReferenceGetParams } from './references'; diff --git a/src/resources/load-balancers/monitors/monitors.ts b/src/resources/load-balancers/monitors/monitors.ts index d26b8ff423..62eb846319 100644 --- a/src/resources/load-balancers/monitors/monitors.ts +++ b/src/resources/load-balancers/monitors/monitors.ts @@ -2,9 +2,10 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as MonitorsAPI from './monitors'; import * as PreviewsAPI from './previews'; +import { PreviewCreateParams, PreviewCreateResponse, Previews } from './previews'; import * as ReferencesAPI from './references'; +import { ReferenceGetParams, ReferenceGetResponse, References } from './references'; import { SinglePage } from '../../../pagination'; export class Monitors extends APIResource { @@ -158,7 +159,7 @@ export interface Monitor { * a Host header by default. The User-Agent header cannot be overridden. This * parameter is only valid for HTTP and HTTPS monitors. */ - header?: unknown; + header?: Record>; /** * The interval between each health check. Shorter intervals may improve failover @@ -221,12 +222,6 @@ export interface MonitorCreateParams { */ account_id: string; - /** - * Body param: The expected HTTP response code or code range of the health check. - * This parameter is only valid for HTTP and HTTPS monitors. - */ - expected_codes: string; - /** * Body param: Do not validate the certificate when monitor use HTTPS. This * parameter is currently only valid for HTTP and HTTPS monitors. @@ -257,6 +252,12 @@ export interface MonitorCreateParams { */ expected_body?: string; + /** + * Body param: The expected HTTP response code or code range of the health check. + * This parameter is only valid for HTTP and HTTPS monitors. + */ + expected_codes?: string; + /** * Body param: Follow redirects if returned by the origin. This parameter is only * valid for HTTP and HTTPS monitors. @@ -268,7 +269,7 @@ export interface MonitorCreateParams { * recommended you set a Host header by default. The User-Agent header cannot be * overridden. This parameter is only valid for HTTP and HTTPS monitors. */ - header?: unknown; + header?: Record>; /** * Body param: The interval between each health check. Shorter intervals may @@ -327,12 +328,6 @@ export interface MonitorUpdateParams { */ account_id: string; - /** - * Body param: The expected HTTP response code or code range of the health check. - * This parameter is only valid for HTTP and HTTPS monitors. - */ - expected_codes: string; - /** * Body param: Do not validate the certificate when monitor use HTTPS. This * parameter is currently only valid for HTTP and HTTPS monitors. @@ -363,6 +358,12 @@ export interface MonitorUpdateParams { */ expected_body?: string; + /** + * Body param: The expected HTTP response code or code range of the health check. + * This parameter is only valid for HTTP and HTTPS monitors. + */ + expected_codes?: string; + /** * Body param: Follow redirects if returned by the origin. This parameter is only * valid for HTTP and HTTPS monitors. @@ -374,7 +375,7 @@ export interface MonitorUpdateParams { * recommended you set a Host header by default. The User-Agent header cannot be * overridden. This parameter is only valid for HTTP and HTTPS monitors. */ - header?: unknown; + header?: Record>; /** * Body param: The interval between each health check. Shorter intervals may @@ -447,12 +448,6 @@ export interface MonitorEditParams { */ account_id: string; - /** - * Body param: The expected HTTP response code or code range of the health check. - * This parameter is only valid for HTTP and HTTPS monitors. - */ - expected_codes: string; - /** * Body param: Do not validate the certificate when monitor use HTTPS. This * parameter is currently only valid for HTTP and HTTPS monitors. @@ -483,6 +478,12 @@ export interface MonitorEditParams { */ expected_body?: string; + /** + * Body param: The expected HTTP response code or code range of the health check. + * This parameter is only valid for HTTP and HTTPS monitors. + */ + expected_codes?: string; + /** * Body param: Follow redirects if returned by the origin. This parameter is only * valid for HTTP and HTTPS monitors. @@ -494,7 +495,7 @@ export interface MonitorEditParams { * recommended you set a Host header by default. The User-Agent header cannot be * overridden. This parameter is only valid for HTTP and HTTPS monitors. */ - header?: unknown; + header?: Record>; /** * Body param: The interval between each health check. Shorter intervals may @@ -554,20 +555,32 @@ export interface MonitorGetParams { account_id: string; } -export namespace Monitors { - export import Monitor = MonitorsAPI.Monitor; - export import MonitorDeleteResponse = MonitorsAPI.MonitorDeleteResponse; - export import MonitorsSinglePage = MonitorsAPI.MonitorsSinglePage; - export import MonitorCreateParams = MonitorsAPI.MonitorCreateParams; - export import MonitorUpdateParams = MonitorsAPI.MonitorUpdateParams; - export import MonitorListParams = MonitorsAPI.MonitorListParams; - export import MonitorDeleteParams = MonitorsAPI.MonitorDeleteParams; - export import MonitorEditParams = MonitorsAPI.MonitorEditParams; - export import MonitorGetParams = MonitorsAPI.MonitorGetParams; - export import Previews = PreviewsAPI.Previews; - export import PreviewCreateResponse = PreviewsAPI.PreviewCreateResponse; - export import PreviewCreateParams = PreviewsAPI.PreviewCreateParams; - export import References = ReferencesAPI.References; - export import ReferenceGetResponse = ReferencesAPI.ReferenceGetResponse; - export import ReferenceGetParams = ReferencesAPI.ReferenceGetParams; +Monitors.MonitorsSinglePage = MonitorsSinglePage; +Monitors.Previews = Previews; +Monitors.References = References; + +export declare namespace Monitors { + export { + type Monitor as Monitor, + type MonitorDeleteResponse as MonitorDeleteResponse, + MonitorsSinglePage as MonitorsSinglePage, + type MonitorCreateParams as MonitorCreateParams, + type MonitorUpdateParams as MonitorUpdateParams, + type MonitorListParams as MonitorListParams, + type MonitorDeleteParams as MonitorDeleteParams, + type MonitorEditParams as MonitorEditParams, + type MonitorGetParams as MonitorGetParams, + }; + + export { + Previews as Previews, + type PreviewCreateResponse as PreviewCreateResponse, + type PreviewCreateParams as PreviewCreateParams, + }; + + export { + References as References, + type ReferenceGetResponse as ReferenceGetResponse, + type ReferenceGetParams as ReferenceGetParams, + }; } diff --git a/src/resources/load-balancers/monitors/previews.ts b/src/resources/load-balancers/monitors/previews.ts index 3a409074c3..1322c46f35 100644 --- a/src/resources/load-balancers/monitors/previews.ts +++ b/src/resources/load-balancers/monitors/previews.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as PreviewsAPI from './previews'; export class Previews extends APIResource { /** @@ -39,12 +38,6 @@ export interface PreviewCreateParams { */ account_id: string; - /** - * Body param: The expected HTTP response code or code range of the health check. - * This parameter is only valid for HTTP and HTTPS monitors. - */ - expected_codes: string; - /** * Body param: Do not validate the certificate when monitor use HTTPS. This * parameter is currently only valid for HTTP and HTTPS monitors. @@ -75,6 +68,12 @@ export interface PreviewCreateParams { */ expected_body?: string; + /** + * Body param: The expected HTTP response code or code range of the health check. + * This parameter is only valid for HTTP and HTTPS monitors. + */ + expected_codes?: string; + /** * Body param: Follow redirects if returned by the origin. This parameter is only * valid for HTTP and HTTPS monitors. @@ -86,7 +85,7 @@ export interface PreviewCreateParams { * recommended you set a Host header by default. The User-Agent header cannot be * overridden. This parameter is only valid for HTTP and HTTPS monitors. */ - header?: unknown; + header?: Record>; /** * Body param: The interval between each health check. Shorter intervals may @@ -139,7 +138,9 @@ export interface PreviewCreateParams { type?: 'http' | 'https' | 'tcp' | 'udp_icmp' | 'icmp_ping' | 'smtp'; } -export namespace Previews { - export import PreviewCreateResponse = PreviewsAPI.PreviewCreateResponse; - export import PreviewCreateParams = PreviewsAPI.PreviewCreateParams; +export declare namespace Previews { + export { + type PreviewCreateResponse as PreviewCreateResponse, + type PreviewCreateParams as PreviewCreateParams, + }; } diff --git a/src/resources/load-balancers/monitors/references.ts b/src/resources/load-balancers/monitors/references.ts index 6b733eb4c1..9934f7f32b 100644 --- a/src/resources/load-balancers/monitors/references.ts +++ b/src/resources/load-balancers/monitors/references.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ReferencesAPI from './references'; export class References extends APIResource { /** @@ -12,13 +11,13 @@ export class References extends APIResource { monitorId: string, params: ReferenceGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get( `/accounts/${account_id}/load_balancers/monitors/${monitorId}/references`, options, - ) as Core.APIPromise<{ result: ReferenceGetResponse | null }> + ) as Core.APIPromise<{ result: ReferenceGetResponse }> )._thenUnwrap((obj) => obj.result); } } @@ -47,7 +46,6 @@ export interface ReferenceGetParams { account_id: string; } -export namespace References { - export import ReferenceGetResponse = ReferencesAPI.ReferenceGetResponse; - export import ReferenceGetParams = ReferencesAPI.ReferenceGetParams; +export declare namespace References { + export { type ReferenceGetResponse as ReferenceGetResponse, type ReferenceGetParams as ReferenceGetParams }; } diff --git a/src/resources/load-balancers/pools/health.ts b/src/resources/load-balancers/pools/health.ts index cfc9c5b784..4d1dac6ae9 100644 --- a/src/resources/load-balancers/pools/health.ts +++ b/src/resources/load-balancers/pools/health.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as HealthAPI from './health'; export class Health extends APIResource { /** @@ -54,19 +53,67 @@ export interface HealthCreateResponse { * A list of regions from which to run health checks. Null means every Cloudflare * data center. */ -export type HealthGetResponse = unknown | string | null; +export interface HealthGetResponse { + /** + * Pool ID + */ + pool_id?: string; -export interface HealthCreateParams { /** - * Path param: Identifier + * List of regions and associated health status. */ - account_id: string; + pop_health?: HealthGetResponse.POPHealth; +} +export namespace HealthGetResponse { /** - * Body param: The expected HTTP response code or code range of the health check. - * This parameter is only valid for HTTP and HTTPS monitors. + * List of regions and associated health status. + */ + export interface POPHealth { + /** + * Whether health check in region is healthy. + */ + healthy?: boolean; + + origins?: Array; + } + + export namespace POPHealth { + export interface Origin { + ip?: Origin.IP; + } + + export namespace Origin { + export interface IP { + /** + * Failure reason. + */ + failure_reason?: string; + + /** + * Origin health status. + */ + healthy?: boolean; + + /** + * Response code from origin health check. + */ + response_code?: number; + + /** + * Origin RTT (Round Trip Time) response. + */ + rtt?: string; + } + } + } +} + +export interface HealthCreateParams { + /** + * Path param: Identifier */ - expected_codes: string; + account_id: string; /** * Body param: Do not validate the certificate when monitor use HTTPS. This @@ -98,6 +145,12 @@ export interface HealthCreateParams { */ expected_body?: string; + /** + * Body param: The expected HTTP response code or code range of the health check. + * This parameter is only valid for HTTP and HTTPS monitors. + */ + expected_codes?: string; + /** * Body param: Follow redirects if returned by the origin. This parameter is only * valid for HTTP and HTTPS monitors. @@ -109,7 +162,7 @@ export interface HealthCreateParams { * recommended you set a Host header by default. The User-Agent header cannot be * overridden. This parameter is only valid for HTTP and HTTPS monitors. */ - header?: unknown; + header?: Record>; /** * Body param: The interval between each health check. Shorter intervals may @@ -169,9 +222,11 @@ export interface HealthGetParams { account_id: string; } -export namespace Health { - export import HealthCreateResponse = HealthAPI.HealthCreateResponse; - export import HealthGetResponse = HealthAPI.HealthGetResponse; - export import HealthCreateParams = HealthAPI.HealthCreateParams; - export import HealthGetParams = HealthAPI.HealthGetParams; +export declare namespace Health { + export { + type HealthCreateResponse as HealthCreateResponse, + type HealthGetResponse as HealthGetResponse, + type HealthCreateParams as HealthCreateParams, + type HealthGetParams as HealthGetParams, + }; } diff --git a/src/resources/load-balancers/pools/index.ts b/src/resources/load-balancers/pools/index.ts index 095568cc74..058ae51510 100644 --- a/src/resources/load-balancers/pools/index.ts +++ b/src/resources/load-balancers/pools/index.ts @@ -1,22 +1,24 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - HealthCreateResponse, - HealthGetResponse, - HealthCreateParams, - HealthGetParams, Health, + type HealthCreateResponse, + type HealthGetResponse, + type HealthCreateParams, + type HealthGetParams, } from './health'; export { - Pool, - PoolDeleteResponse, - PoolCreateParams, - PoolUpdateParams, - PoolListParams, - PoolDeleteParams, - PoolEditParams, - PoolGetParams, PoolsSinglePage, Pools, + type Pool, + type PoolDeleteResponse, + type PoolBulkEditResponse, + type PoolCreateParams, + type PoolUpdateParams, + type PoolListParams, + type PoolDeleteParams, + type PoolBulkEditParams, + type PoolEditParams, + type PoolGetParams, } from './pools'; -export { ReferenceGetResponse, ReferenceGetParams, References } from './references'; +export { References, type ReferenceGetResponse, type ReferenceGetParams } from './references'; diff --git a/src/resources/load-balancers/pools/pools.ts b/src/resources/load-balancers/pools/pools.ts index cfe0eb0a52..77f042448c 100644 --- a/src/resources/load-balancers/pools/pools.ts +++ b/src/resources/load-balancers/pools/pools.ts @@ -2,10 +2,17 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as PoolsAPI from './pools'; import * as LoadBalancersAPI from '../load-balancers'; import * as HealthAPI from './health'; +import { + Health, + HealthCreateParams, + HealthCreateResponse, + HealthGetParams, + HealthGetResponse, +} from './health'; import * as ReferencesAPI from './references'; +import { ReferenceGetParams, ReferenceGetResponse, References } from './references'; import { SinglePage } from '../../../pagination'; export class Pools extends APIResource { @@ -66,6 +73,22 @@ export class Pools extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Apply changes to a number of existing pools, overwriting the supplied + * properties. Pools are ordered by ascending `name`. Returns the list of affected + * pools. Supports the standard pagination query parameters, either + * `limit`/`offset` or `per_page`/`page`. + */ + bulkEdit(params: PoolBulkEditParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/load_balancers/pools`, { + body, + ...options, + }) as Core.APIPromise<{ result: PoolBulkEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + /** * Apply changes to an existing pool, overwriting the supplied properties. */ @@ -153,7 +176,7 @@ export interface Pool { * The ID of the Monitor to use for checking the health of origins within this * pool. */ - monitor?: unknown; + monitor?: string; /** * A short name (tag) for the pool. Only alphanumeric characters, hyphens, and @@ -161,6 +184,11 @@ export interface Pool { */ name?: string; + /** + * List of networks where Load Balancer or Pool is enabled. + */ + networks?: Array; + /** * This field is now deprecated. It has been moved to Cloudflare's Centralized * Notification service @@ -193,6 +221,8 @@ export interface PoolDeleteResponse { id?: string; } +export type PoolBulkEditResponse = Array; + export interface PoolCreateParams { /** * Path param: Identifier @@ -252,7 +282,7 @@ export interface PoolCreateParams { * Body param: The ID of the Monitor to use for checking the health of origins * within this pool. */ - monitor?: unknown; + monitor?: string; /** * Body param: This field is now deprecated. It has been moved to Cloudflare's @@ -341,7 +371,7 @@ export interface PoolUpdateParams { * Body param: The ID of the Monitor to use for checking the health of origins * within this pool. */ - monitor?: unknown; + monitor?: string; /** * Body param: This field is now deprecated. It has been moved to Cloudflare's @@ -375,7 +405,7 @@ export interface PoolListParams { * Query param: The ID of the Monitor to use for checking the health of origins * within this pool. */ - monitor?: unknown; + monitor?: string; } export interface PoolDeleteParams { @@ -385,6 +415,20 @@ export interface PoolDeleteParams { account_id: string; } +export interface PoolBulkEditParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: The email address to send health status notifications to. This field + * is now deprecated in favor of Cloudflare Notifications for Load Balancing, so + * only resetting this field with an empty string `""` is accepted. + */ + notification_email?: ''; +} + export interface PoolEditParams { /** * Path param: Identifier @@ -437,7 +481,7 @@ export interface PoolEditParams { * Body param: The ID of the Monitor to use for checking the health of origins * within this pool. */ - monitor?: unknown; + monitor?: string; /** * Body param: A short name (tag) for the pool. Only alphanumeric characters, @@ -481,22 +525,36 @@ export interface PoolGetParams { account_id: string; } -export namespace Pools { - export import Pool = PoolsAPI.Pool; - export import PoolDeleteResponse = PoolsAPI.PoolDeleteResponse; - export import PoolsSinglePage = PoolsAPI.PoolsSinglePage; - export import PoolCreateParams = PoolsAPI.PoolCreateParams; - export import PoolUpdateParams = PoolsAPI.PoolUpdateParams; - export import PoolListParams = PoolsAPI.PoolListParams; - export import PoolDeleteParams = PoolsAPI.PoolDeleteParams; - export import PoolEditParams = PoolsAPI.PoolEditParams; - export import PoolGetParams = PoolsAPI.PoolGetParams; - export import Health = HealthAPI.Health; - export import HealthCreateResponse = HealthAPI.HealthCreateResponse; - export import HealthGetResponse = HealthAPI.HealthGetResponse; - export import HealthCreateParams = HealthAPI.HealthCreateParams; - export import HealthGetParams = HealthAPI.HealthGetParams; - export import References = ReferencesAPI.References; - export import ReferenceGetResponse = ReferencesAPI.ReferenceGetResponse; - export import ReferenceGetParams = ReferencesAPI.ReferenceGetParams; +Pools.PoolsSinglePage = PoolsSinglePage; +Pools.Health = Health; +Pools.References = References; + +export declare namespace Pools { + export { + type Pool as Pool, + type PoolDeleteResponse as PoolDeleteResponse, + type PoolBulkEditResponse as PoolBulkEditResponse, + PoolsSinglePage as PoolsSinglePage, + type PoolCreateParams as PoolCreateParams, + type PoolUpdateParams as PoolUpdateParams, + type PoolListParams as PoolListParams, + type PoolDeleteParams as PoolDeleteParams, + type PoolBulkEditParams as PoolBulkEditParams, + type PoolEditParams as PoolEditParams, + type PoolGetParams as PoolGetParams, + }; + + export { + Health as Health, + type HealthCreateResponse as HealthCreateResponse, + type HealthGetResponse as HealthGetResponse, + type HealthCreateParams as HealthCreateParams, + type HealthGetParams as HealthGetParams, + }; + + export { + References as References, + type ReferenceGetResponse as ReferenceGetResponse, + type ReferenceGetParams as ReferenceGetParams, + }; } diff --git a/src/resources/load-balancers/pools/references.ts b/src/resources/load-balancers/pools/references.ts index 0ac756d9cd..7d467af8d4 100644 --- a/src/resources/load-balancers/pools/references.ts +++ b/src/resources/load-balancers/pools/references.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ReferencesAPI from './references'; export class References extends APIResource { /** @@ -12,13 +11,13 @@ export class References extends APIResource { poolId: string, params: ReferenceGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get( `/accounts/${account_id}/load_balancers/pools/${poolId}/references`, options, - ) as Core.APIPromise<{ result: ReferenceGetResponse | null }> + ) as Core.APIPromise<{ result: ReferenceGetResponse }> )._thenUnwrap((obj) => obj.result); } } @@ -47,7 +46,6 @@ export interface ReferenceGetParams { account_id: string; } -export namespace References { - export import ReferenceGetResponse = ReferencesAPI.ReferenceGetResponse; - export import ReferenceGetParams = ReferencesAPI.ReferenceGetParams; +export declare namespace References { + export { type ReferenceGetResponse as ReferenceGetResponse, type ReferenceGetParams as ReferenceGetParams }; } diff --git a/src/resources/load-balancers/previews.ts b/src/resources/load-balancers/previews.ts index ceb822cc14..afe3657ab5 100644 --- a/src/resources/load-balancers/previews.ts +++ b/src/resources/load-balancers/previews.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PreviewsAPI from './previews'; export class Previews extends APIResource { /** @@ -26,16 +25,16 @@ export class Previews extends APIResource { /** * Resulting health data from a preview operation. */ -export type PreviewGetResponse = Record; +export type PreviewGetResponse = Record; export namespace PreviewGetResponse { - export interface unnamed_schema_with_map_parent_0 { + export interface item { healthy?: boolean; - origins?: Array>; + origins?: Array>; } - export namespace unnamed_schema_with_map_parent_0 { + export namespace item { /** * The origin ipv4/ipv6 address or domain name mapped to it's health data. */ @@ -58,7 +57,6 @@ export interface PreviewGetParams { account_id: string; } -export namespace Previews { - export import PreviewGetResponse = PreviewsAPI.PreviewGetResponse; - export import PreviewGetParams = PreviewsAPI.PreviewGetParams; +export declare namespace Previews { + export { type PreviewGetResponse as PreviewGetResponse, type PreviewGetParams as PreviewGetParams }; } diff --git a/src/resources/load-balancers/regions.ts b/src/resources/load-balancers/regions.ts index ac16610868..b9bf06d4f9 100644 --- a/src/resources/load-balancers/regions.ts +++ b/src/resources/load-balancers/regions.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as RegionsAPI from './regions'; export class Regions extends APIResource { /** @@ -85,9 +84,11 @@ export interface RegionGetParams { account_id: string; } -export namespace Regions { - export import RegionListResponse = RegionsAPI.RegionListResponse; - export import RegionGetResponse = RegionsAPI.RegionGetResponse; - export import RegionListParams = RegionsAPI.RegionListParams; - export import RegionGetParams = RegionsAPI.RegionGetParams; +export declare namespace Regions { + export { + type RegionListResponse as RegionListResponse, + type RegionGetResponse as RegionGetResponse, + type RegionListParams as RegionListParams, + type RegionGetParams as RegionGetParams, + }; } diff --git a/src/resources/load-balancers/searches.ts b/src/resources/load-balancers/searches.ts index 7f4f538190..4a24c3f977 100644 --- a/src/resources/load-balancers/searches.ts +++ b/src/resources/load-balancers/searches.ts @@ -2,24 +2,57 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SearchesAPI from './searches'; export class Searches extends APIResource { /** * Search for Load Balancing resources. */ - get(params: SearchGetParams, options?: Core.RequestOptions): Core.APIPromise { + get(params: SearchGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...query } = params; return ( this._client.get(`/accounts/${account_id}/load_balancers/search`, { query, ...options, - }) as Core.APIPromise<{ result: SearchGetResponse | null }> + }) as Core.APIPromise<{ result: SearchGetResponse }> )._thenUnwrap((obj) => obj.result); } } -export type SearchGetResponse = Array; +export interface SearchGetResponse { + /** + * A list of resources matching the search query. + */ + resources?: Array; +} + +export namespace SearchGetResponse { + /** + * A reference to a load balancer resource. + */ + export interface Resource { + /** + * When listed as a reference, the type (direction) of the reference. + */ + reference_type?: 'referral' | 'referrer'; + + /** + * A list of references to (referrer) or from (referral) this resource. + */ + references?: Array; + + resource_id?: string; + + /** + * The human-identifiable name of the resource. + */ + resource_name?: string; + + /** + * The type of the resource. + */ + resource_type?: 'load_balancer' | 'monitor' | 'pool'; + } +} export interface SearchGetParams { /** @@ -30,12 +63,12 @@ export interface SearchGetParams { /** * Query param: */ - page?: unknown; + page?: number; /** * Query param: */ - per_page?: unknown; + per_page?: number; /** * Query param: @@ -57,7 +90,6 @@ export namespace SearchGetParams { } } -export namespace Searches { - export import SearchGetResponse = SearchesAPI.SearchGetResponse; - export import SearchGetParams = SearchesAPI.SearchGetParams; +export declare namespace Searches { + export { type SearchGetResponse as SearchGetResponse, type SearchGetParams as SearchGetParams }; } diff --git a/src/resources/logpush/datasets/datasets.ts b/src/resources/logpush/datasets/datasets.ts index 901686e865..54b4932816 100644 --- a/src/resources/logpush/datasets/datasets.ts +++ b/src/resources/logpush/datasets/datasets.ts @@ -2,18 +2,24 @@ import { APIResource } from '../../../resource'; import * as FieldsAPI from './fields'; +import { FieldGetParams, FieldGetResponse, Fields } from './fields'; import * as JobsAPI from './jobs'; +import { JobGetParams, JobGetResponse, Jobs } from './jobs'; export class Datasets extends APIResource { fields: FieldsAPI.Fields = new FieldsAPI.Fields(this._client); jobs: JobsAPI.Jobs = new JobsAPI.Jobs(this._client); } -export namespace Datasets { - export import Fields = FieldsAPI.Fields; - export import FieldGetResponse = FieldsAPI.FieldGetResponse; - export import FieldGetParams = FieldsAPI.FieldGetParams; - export import Jobs = JobsAPI.Jobs; - export import JobGetResponse = JobsAPI.JobGetResponse; - export import JobGetParams = JobsAPI.JobGetParams; +Datasets.Fields = Fields; +Datasets.Jobs = Jobs; + +export declare namespace Datasets { + export { + Fields as Fields, + type FieldGetResponse as FieldGetResponse, + type FieldGetParams as FieldGetParams, + }; + + export { Jobs as Jobs, type JobGetResponse as JobGetResponse, type JobGetParams as JobGetParams }; } diff --git a/src/resources/logpush/datasets/fields.ts b/src/resources/logpush/datasets/fields.ts index 313198df44..f32d303ce8 100644 --- a/src/resources/logpush/datasets/fields.ts +++ b/src/resources/logpush/datasets/fields.ts @@ -3,8 +3,7 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import { CloudflareError } from '../../../error'; -import * as FieldsAPI from './fields'; +import { CloudflareError } from 'cloudflare/error'; export class Fields extends APIResource { /** @@ -65,7 +64,6 @@ export interface FieldGetParams { zone_id?: string; } -export namespace Fields { - export import FieldGetResponse = FieldsAPI.FieldGetResponse; - export import FieldGetParams = FieldsAPI.FieldGetParams; +export declare namespace Fields { + export { type FieldGetResponse as FieldGetResponse, type FieldGetParams as FieldGetParams }; } diff --git a/src/resources/logpush/datasets/index.ts b/src/resources/logpush/datasets/index.ts index b80889fd4d..377e750207 100644 --- a/src/resources/logpush/datasets/index.ts +++ b/src/resources/logpush/datasets/index.ts @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Datasets } from './datasets'; -export { FieldGetResponse, FieldGetParams, Fields } from './fields'; -export { JobGetResponse, JobGetParams, Jobs } from './jobs'; +export { Fields, type FieldGetResponse, type FieldGetParams } from './fields'; +export { Jobs, type JobGetResponse, type JobGetParams } from './jobs'; diff --git a/src/resources/logpush/datasets/jobs.ts b/src/resources/logpush/datasets/jobs.ts index c6e67c727c..b016bc109a 100644 --- a/src/resources/logpush/datasets/jobs.ts +++ b/src/resources/logpush/datasets/jobs.ts @@ -3,8 +3,7 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import { CloudflareError } from '../../../error'; -import * as DatasetsJobsAPI from './jobs'; +import { CloudflareError } from 'cloudflare/error'; import * as JobsAPI from '../jobs'; export class Jobs extends APIResource { @@ -65,7 +64,6 @@ export interface JobGetParams { zone_id?: string; } -export namespace Jobs { - export import JobGetResponse = DatasetsJobsAPI.JobGetResponse; - export import JobGetParams = DatasetsJobsAPI.JobGetParams; +export declare namespace Jobs { + export { type JobGetResponse as JobGetResponse, type JobGetParams as JobGetParams }; } diff --git a/src/resources/logpush/edge.ts b/src/resources/logpush/edge.ts index 70e1bc7259..3539a1d364 100644 --- a/src/resources/logpush/edge.ts +++ b/src/resources/logpush/edge.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as EdgeAPI from './edge'; export class Edge extends APIResource { /** @@ -90,9 +89,11 @@ export interface EdgeGetParams { zone_id: string; } -export namespace Edge { - export import InstantLogpushJob = EdgeAPI.InstantLogpushJob; - export import EdgeGetResponse = EdgeAPI.EdgeGetResponse; - export import EdgeCreateParams = EdgeAPI.EdgeCreateParams; - export import EdgeGetParams = EdgeAPI.EdgeGetParams; +export declare namespace Edge { + export { + type InstantLogpushJob as InstantLogpushJob, + type EdgeGetResponse as EdgeGetResponse, + type EdgeCreateParams as EdgeCreateParams, + type EdgeGetParams as EdgeGetParams, + }; } diff --git a/src/resources/logpush/index.ts b/src/resources/logpush/index.ts index 9a75e9e651..adc3f3a65d 100644 --- a/src/resources/logpush/index.ts +++ b/src/resources/logpush/index.ts @@ -1,31 +1,37 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Datasets } from './datasets/index'; -export { InstantLogpushJob, EdgeGetResponse, EdgeCreateParams, EdgeGetParams, Edge } from './edge'; +export { + Edge, + type InstantLogpushJob, + type EdgeGetResponse, + type EdgeCreateParams, + type EdgeGetParams, +} from './edge'; export { Logpush } from './logpush'; export { - LogpushJob, - OutputOptions, - JobDeleteResponse, - JobCreateParams, - JobUpdateParams, - JobListParams, - JobDeleteParams, - JobGetParams, LogpushJobsSinglePage, Jobs, + type LogpushJob, + type OutputOptions, + type JobDeleteResponse, + type JobCreateParams, + type JobUpdateParams, + type JobListParams, + type JobDeleteParams, + type JobGetParams, } from './jobs'; export { - OwnershipValidation, - OwnershipCreateResponse, - OwnershipCreateParams, - OwnershipValidateParams, Ownership, + type OwnershipValidation, + type OwnershipCreateResponse, + type OwnershipCreateParams, + type OwnershipValidateParams, } from './ownership'; export { - ValidateDestinationResponse, - ValidateOriginResponse, - ValidateDestinationParams, - ValidateOriginParams, Validate, + type ValidateDestinationResponse, + type ValidateOriginResponse, + type ValidateDestinationParams, + type ValidateOriginParams, } from './validate'; diff --git a/src/resources/logpush/jobs.ts b/src/resources/logpush/jobs.ts index ec5e715ac8..f90b659490 100644 --- a/src/resources/logpush/jobs.ts +++ b/src/resources/logpush/jobs.ts @@ -3,8 +3,7 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import { CloudflareError } from '../../error'; -import * as JobsAPI from './jobs'; +import { CloudflareError } from 'cloudflare/error'; import { SinglePage } from '../../pagination'; export class Jobs extends APIResource { @@ -116,13 +115,13 @@ export class Jobs extends APIResource { jobId: number, params?: JobDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise; - delete(jobId: number, options?: Core.RequestOptions): Core.APIPromise; + ): Core.APIPromise; + delete(jobId: number, options?: Core.RequestOptions): Core.APIPromise; delete( jobId: number, params: JobDeleteParams | Core.RequestOptions = {}, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { if (isRequestOptions(params)) { return this.delete(jobId, {}, params); } @@ -147,7 +146,7 @@ export class Jobs extends APIResource { this._client.delete( `/${accountOrZone}/${accountOrZoneId}/logpush/jobs/${jobId}`, options, - ) as Core.APIPromise<{ result: JobDeleteResponse | null }> + ) as Core.APIPromise<{ result: JobDeleteResponse }> )._thenUnwrap((obj) => obj.result); } @@ -460,7 +459,12 @@ export interface OutputOptionsParam { timestamp_format?: 'unixnano' | 'unix' | 'rfc3339'; } -export type JobDeleteResponse = unknown; +export interface JobDeleteResponse { + /** + * Unique id of the job. + */ + id?: number; +} export interface JobCreateParams { /** @@ -642,6 +646,13 @@ export interface JobUpdateParams { */ max_upload_records?: number | null; + /** + * Body param: Optional human readable job name. Not unique. Cloudflare suggests + * that you set this to a meaningful string, like the domain name, to make it + * easier to identify your job. + */ + name?: string | null; + /** * Body param: The structured replacement for `logpull_options`. When including * this field, the `logpull_option` field will be ignored. @@ -690,14 +701,18 @@ export interface JobGetParams { zone_id?: string; } -export namespace Jobs { - export import LogpushJob = JobsAPI.LogpushJob; - export import OutputOptions = JobsAPI.OutputOptions; - export import JobDeleteResponse = JobsAPI.JobDeleteResponse; - export import LogpushJobsSinglePage = JobsAPI.LogpushJobsSinglePage; - export import JobCreateParams = JobsAPI.JobCreateParams; - export import JobUpdateParams = JobsAPI.JobUpdateParams; - export import JobListParams = JobsAPI.JobListParams; - export import JobDeleteParams = JobsAPI.JobDeleteParams; - export import JobGetParams = JobsAPI.JobGetParams; +Jobs.LogpushJobsSinglePage = LogpushJobsSinglePage; + +export declare namespace Jobs { + export { + type LogpushJob as LogpushJob, + type OutputOptions as OutputOptions, + type JobDeleteResponse as JobDeleteResponse, + LogpushJobsSinglePage as LogpushJobsSinglePage, + type JobCreateParams as JobCreateParams, + type JobUpdateParams as JobUpdateParams, + type JobListParams as JobListParams, + type JobDeleteParams as JobDeleteParams, + type JobGetParams as JobGetParams, + }; } diff --git a/src/resources/logpush/logpush.ts b/src/resources/logpush/logpush.ts index 97fa183fdd..1c0bc8a0e2 100644 --- a/src/resources/logpush/logpush.ts +++ b/src/resources/logpush/logpush.ts @@ -2,10 +2,38 @@ import { APIResource } from '../../resource'; import * as EdgeAPI from './edge'; +import { Edge, EdgeCreateParams, EdgeGetParams, EdgeGetResponse, InstantLogpushJob } from './edge'; import * as JobsAPI from './jobs'; +import { + JobCreateParams, + JobDeleteParams, + JobDeleteResponse, + JobGetParams, + JobListParams, + JobUpdateParams, + Jobs, + LogpushJob, + LogpushJobsSinglePage, + OutputOptions, +} from './jobs'; import * as OwnershipAPI from './ownership'; +import { + Ownership, + OwnershipCreateParams, + OwnershipCreateResponse, + OwnershipValidateParams, + OwnershipValidation, +} from './ownership'; import * as ValidateAPI from './validate'; +import { + Validate, + ValidateDestinationParams, + ValidateDestinationResponse, + ValidateOriginParams, + ValidateOriginResponse, +} from './validate'; import * as DatasetsAPI from './datasets/datasets'; +import { Datasets } from './datasets/datasets'; export class Logpush extends APIResource { datasets: DatasetsAPI.Datasets = new DatasetsAPI.Datasets(this._client); @@ -15,31 +43,50 @@ export class Logpush extends APIResource { validate: ValidateAPI.Validate = new ValidateAPI.Validate(this._client); } -export namespace Logpush { - export import Datasets = DatasetsAPI.Datasets; - export import Edge = EdgeAPI.Edge; - export import InstantLogpushJob = EdgeAPI.InstantLogpushJob; - export import EdgeGetResponse = EdgeAPI.EdgeGetResponse; - export import EdgeCreateParams = EdgeAPI.EdgeCreateParams; - export import EdgeGetParams = EdgeAPI.EdgeGetParams; - export import Jobs = JobsAPI.Jobs; - export import LogpushJob = JobsAPI.LogpushJob; - export import OutputOptions = JobsAPI.OutputOptions; - export import JobDeleteResponse = JobsAPI.JobDeleteResponse; - export import LogpushJobsSinglePage = JobsAPI.LogpushJobsSinglePage; - export import JobCreateParams = JobsAPI.JobCreateParams; - export import JobUpdateParams = JobsAPI.JobUpdateParams; - export import JobListParams = JobsAPI.JobListParams; - export import JobDeleteParams = JobsAPI.JobDeleteParams; - export import JobGetParams = JobsAPI.JobGetParams; - export import Ownership = OwnershipAPI.Ownership; - export import OwnershipValidation = OwnershipAPI.OwnershipValidation; - export import OwnershipCreateResponse = OwnershipAPI.OwnershipCreateResponse; - export import OwnershipCreateParams = OwnershipAPI.OwnershipCreateParams; - export import OwnershipValidateParams = OwnershipAPI.OwnershipValidateParams; - export import Validate = ValidateAPI.Validate; - export import ValidateDestinationResponse = ValidateAPI.ValidateDestinationResponse; - export import ValidateOriginResponse = ValidateAPI.ValidateOriginResponse; - export import ValidateDestinationParams = ValidateAPI.ValidateDestinationParams; - export import ValidateOriginParams = ValidateAPI.ValidateOriginParams; +Logpush.Datasets = Datasets; +Logpush.Edge = Edge; +Logpush.Jobs = Jobs; +Logpush.LogpushJobsSinglePage = LogpushJobsSinglePage; +Logpush.Ownership = Ownership; +Logpush.Validate = Validate; + +export declare namespace Logpush { + export { Datasets as Datasets }; + + export { + Edge as Edge, + type InstantLogpushJob as InstantLogpushJob, + type EdgeGetResponse as EdgeGetResponse, + type EdgeCreateParams as EdgeCreateParams, + type EdgeGetParams as EdgeGetParams, + }; + + export { + Jobs as Jobs, + type LogpushJob as LogpushJob, + type OutputOptions as OutputOptions, + type JobDeleteResponse as JobDeleteResponse, + LogpushJobsSinglePage as LogpushJobsSinglePage, + type JobCreateParams as JobCreateParams, + type JobUpdateParams as JobUpdateParams, + type JobListParams as JobListParams, + type JobDeleteParams as JobDeleteParams, + type JobGetParams as JobGetParams, + }; + + export { + Ownership as Ownership, + type OwnershipValidation as OwnershipValidation, + type OwnershipCreateResponse as OwnershipCreateResponse, + type OwnershipCreateParams as OwnershipCreateParams, + type OwnershipValidateParams as OwnershipValidateParams, + }; + + export { + Validate as Validate, + type ValidateDestinationResponse as ValidateDestinationResponse, + type ValidateOriginResponse as ValidateOriginResponse, + type ValidateDestinationParams as ValidateDestinationParams, + type ValidateOriginParams as ValidateOriginParams, + }; } diff --git a/src/resources/logpush/ownership.ts b/src/resources/logpush/ownership.ts index 8bb768dd6c..67770ebcfa 100644 --- a/src/resources/logpush/ownership.ts +++ b/src/resources/logpush/ownership.ts @@ -2,8 +2,7 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import { CloudflareError } from '../../error'; -import * as OwnershipAPI from './ownership'; +import { CloudflareError } from 'cloudflare/error'; export class Ownership extends APIResource { /** @@ -130,9 +129,11 @@ export interface OwnershipValidateParams { zone_id?: string; } -export namespace Ownership { - export import OwnershipValidation = OwnershipAPI.OwnershipValidation; - export import OwnershipCreateResponse = OwnershipAPI.OwnershipCreateResponse; - export import OwnershipCreateParams = OwnershipAPI.OwnershipCreateParams; - export import OwnershipValidateParams = OwnershipAPI.OwnershipValidateParams; +export declare namespace Ownership { + export { + type OwnershipValidation as OwnershipValidation, + type OwnershipCreateResponse as OwnershipCreateResponse, + type OwnershipCreateParams as OwnershipCreateParams, + type OwnershipValidateParams as OwnershipValidateParams, + }; } diff --git a/src/resources/logpush/validate.ts b/src/resources/logpush/validate.ts index 649ad805f0..5e2779e288 100644 --- a/src/resources/logpush/validate.ts +++ b/src/resources/logpush/validate.ts @@ -2,8 +2,7 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import { CloudflareError } from '../../error'; -import * as ValidateAPI from './validate'; +import { CloudflareError } from 'cloudflare/error'; export class Validate extends APIResource { /** @@ -125,9 +124,11 @@ export interface ValidateOriginParams { zone_id?: string; } -export namespace Validate { - export import ValidateDestinationResponse = ValidateAPI.ValidateDestinationResponse; - export import ValidateOriginResponse = ValidateAPI.ValidateOriginResponse; - export import ValidateDestinationParams = ValidateAPI.ValidateDestinationParams; - export import ValidateOriginParams = ValidateAPI.ValidateOriginParams; +export declare namespace Validate { + export { + type ValidateDestinationResponse as ValidateDestinationResponse, + type ValidateOriginResponse as ValidateOriginResponse, + type ValidateDestinationParams as ValidateDestinationParams, + type ValidateOriginParams as ValidateOriginParams, + }; } diff --git a/src/resources/logs/control/cmb/cmb.ts b/src/resources/logs/control/cmb/cmb.ts index 8009e1085e..281cbbf509 100644 --- a/src/resources/logs/control/cmb/cmb.ts +++ b/src/resources/logs/control/cmb/cmb.ts @@ -2,16 +2,28 @@ import { APIResource } from '../../../../resource'; import * as ConfigAPI from './config'; +import { + CmbConfig, + Config, + ConfigCreateParams, + ConfigDeleteParams, + ConfigDeleteResponse, + ConfigGetParams, +} from './config'; export class Cmb extends APIResource { config: ConfigAPI.Config = new ConfigAPI.Config(this._client); } -export namespace Cmb { - export import Config = ConfigAPI.Config; - export import CmbConfig = ConfigAPI.CmbConfig; - export import ConfigDeleteResponse = ConfigAPI.ConfigDeleteResponse; - export import ConfigCreateParams = ConfigAPI.ConfigCreateParams; - export import ConfigDeleteParams = ConfigAPI.ConfigDeleteParams; - export import ConfigGetParams = ConfigAPI.ConfigGetParams; +Cmb.Config = Config; + +export declare namespace Cmb { + export { + Config as Config, + type CmbConfig as CmbConfig, + type ConfigDeleteResponse as ConfigDeleteResponse, + type ConfigCreateParams as ConfigCreateParams, + type ConfigDeleteParams as ConfigDeleteParams, + type ConfigGetParams as ConfigGetParams, + }; } diff --git a/src/resources/logs/control/cmb/config.ts b/src/resources/logs/control/cmb/config.ts index 2ea50010ce..15e887feb0 100644 --- a/src/resources/logs/control/cmb/config.ts +++ b/src/resources/logs/control/cmb/config.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../../resource'; import * as Core from '../../../../core'; -import * as ConfigAPI from './config'; export class Config extends APIResource { /** @@ -81,10 +80,12 @@ export interface ConfigGetParams { account_id: string; } -export namespace Config { - export import CmbConfig = ConfigAPI.CmbConfig; - export import ConfigDeleteResponse = ConfigAPI.ConfigDeleteResponse; - export import ConfigCreateParams = ConfigAPI.ConfigCreateParams; - export import ConfigDeleteParams = ConfigAPI.ConfigDeleteParams; - export import ConfigGetParams = ConfigAPI.ConfigGetParams; +export declare namespace Config { + export { + type CmbConfig as CmbConfig, + type ConfigDeleteResponse as ConfigDeleteResponse, + type ConfigCreateParams as ConfigCreateParams, + type ConfigDeleteParams as ConfigDeleteParams, + type ConfigGetParams as ConfigGetParams, + }; } diff --git a/src/resources/logs/control/cmb/index.ts b/src/resources/logs/control/cmb/index.ts index cbf88f9561..0d9ca574cc 100644 --- a/src/resources/logs/control/cmb/index.ts +++ b/src/resources/logs/control/cmb/index.ts @@ -2,10 +2,10 @@ export { Cmb } from './cmb'; export { - CmbConfig, - ConfigDeleteResponse, - ConfigCreateParams, - ConfigDeleteParams, - ConfigGetParams, Config, + type CmbConfig, + type ConfigDeleteResponse, + type ConfigCreateParams, + type ConfigDeleteParams, + type ConfigGetParams, } from './config'; diff --git a/src/resources/logs/control/control.ts b/src/resources/logs/control/control.ts index 5f5c1e3c0e..8c4fdeea5c 100644 --- a/src/resources/logs/control/control.ts +++ b/src/resources/logs/control/control.ts @@ -2,17 +2,32 @@ import { APIResource } from '../../../resource'; import * as RetentionAPI from './retention'; +import { + Retention, + RetentionCreateParams, + RetentionCreateResponse, + RetentionGetParams, + RetentionGetResponse, +} from './retention'; import * as CmbAPI from './cmb/cmb'; +import { Cmb } from './cmb/cmb'; export class Control extends APIResource { retention: RetentionAPI.Retention = new RetentionAPI.Retention(this._client); cmb: CmbAPI.Cmb = new CmbAPI.Cmb(this._client); } -export namespace Control { - export import Retention = RetentionAPI.Retention; - export import RetentionCreateResponse = RetentionAPI.RetentionCreateResponse; - export import RetentionGetResponse = RetentionAPI.RetentionGetResponse; - export import RetentionCreateParams = RetentionAPI.RetentionCreateParams; - export import Cmb = CmbAPI.Cmb; +Control.Retention = Retention; +Control.Cmb = Cmb; + +export declare namespace Control { + export { + Retention as Retention, + type RetentionCreateResponse as RetentionCreateResponse, + type RetentionGetResponse as RetentionGetResponse, + type RetentionCreateParams as RetentionCreateParams, + type RetentionGetParams as RetentionGetParams, + }; + + export { Cmb as Cmb }; } diff --git a/src/resources/logs/control/index.ts b/src/resources/logs/control/index.ts index e431d52a6a..700f3ebeda 100644 --- a/src/resources/logs/control/index.ts +++ b/src/resources/logs/control/index.ts @@ -2,4 +2,10 @@ export { Cmb } from './cmb/index'; export { Control } from './control'; -export { RetentionCreateResponse, RetentionGetResponse, RetentionCreateParams, Retention } from './retention'; +export { + Retention, + type RetentionCreateResponse, + type RetentionGetResponse, + type RetentionCreateParams, + type RetentionGetParams, +} from './retention'; diff --git a/src/resources/logs/control/retention.ts b/src/resources/logs/control/retention.ts index 383c8714c3..d4e19f4f28 100644 --- a/src/resources/logs/control/retention.ts +++ b/src/resources/logs/control/retention.ts @@ -2,54 +2,78 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as RetentionAPI from './retention'; export class Retention extends APIResource { /** * Updates log retention flag for Logpull API. */ create( - zoneIdentifier: string, - body: RetentionCreateParams, + params: RetentionCreateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/logs/control/retention/flag`, { + this._client.post(`/zones/${zone_id}/logs/control/retention/flag`, { body, ...options, - }) as Core.APIPromise<{ result: RetentionCreateResponse }> + }) as Core.APIPromise<{ result: RetentionCreateResponse | null }> )._thenUnwrap((obj) => obj.result); } /** * Gets log retention flag for Logpull API. */ - get(zoneIdentifier: string, options?: Core.RequestOptions): Core.APIPromise { + get( + params: RetentionGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/logs/control/retention/flag`, options) as Core.APIPromise<{ - result: RetentionGetResponse; + this._client.get(`/zones/${zone_id}/logs/control/retention/flag`, options) as Core.APIPromise<{ + result: RetentionGetResponse | null; }> )._thenUnwrap((obj) => obj.result); } } export interface RetentionCreateResponse { + /** + * The log retention flag for Logpull API. + */ flag?: boolean; } export interface RetentionGetResponse { + /** + * The log retention flag for Logpull API. + */ flag?: boolean; } export interface RetentionCreateParams { /** - * The log retention flag for Logpull API. + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The log retention flag for Logpull API. + */ + flag?: boolean; +} + +export interface RetentionGetParams { + /** + * Identifier */ - flag: boolean; + zone_id: string; } -export namespace Retention { - export import RetentionCreateResponse = RetentionAPI.RetentionCreateResponse; - export import RetentionGetResponse = RetentionAPI.RetentionGetResponse; - export import RetentionCreateParams = RetentionAPI.RetentionCreateParams; +export declare namespace Retention { + export { + type RetentionCreateResponse as RetentionCreateResponse, + type RetentionGetResponse as RetentionGetResponse, + type RetentionCreateParams as RetentionCreateParams, + type RetentionGetParams as RetentionGetParams, + }; } diff --git a/src/resources/logs/index.ts b/src/resources/logs/index.ts index c8b3d7afa4..edef47a1eb 100644 --- a/src/resources/logs/index.ts +++ b/src/resources/logs/index.ts @@ -2,5 +2,5 @@ export { Control } from './control/index'; export { Logs } from './logs'; -export { RayIDGetResponse, RayIDGetParams, RayID } from './rayid'; -export { ReceivedGetResponse, ReceivedGetParams, Received } from './received/index'; +export { RayID, type RayIDGetResponse, type RayIDGetParams } from './rayid'; +export { Received, type ReceivedGetResponse, type ReceivedGetParams } from './received/index'; diff --git a/src/resources/logs/logs.ts b/src/resources/logs/logs.ts index 97d33bfd3d..8bc3fd5875 100644 --- a/src/resources/logs/logs.ts +++ b/src/resources/logs/logs.ts @@ -2,8 +2,11 @@ import { APIResource } from '../../resource'; import * as RayIDAPI from './rayid'; +import { RayID, RayIDGetParams, RayIDGetResponse } from './rayid'; import * as ControlAPI from './control/control'; +import { Control } from './control/control'; import * as ReceivedAPI from './received/received'; +import { Received, ReceivedGetParams, ReceivedGetResponse } from './received/received'; export class Logs extends APIResource { control: ControlAPI.Control = new ControlAPI.Control(this._client); @@ -11,12 +14,18 @@ export class Logs extends APIResource { received: ReceivedAPI.Received = new ReceivedAPI.Received(this._client); } -export namespace Logs { - export import Control = ControlAPI.Control; - export import RayID = RayIDAPI.RayID; - export import RayIDGetResponse = RayIDAPI.RayIDGetResponse; - export import RayIDGetParams = RayIDAPI.RayIDGetParams; - export import Received = ReceivedAPI.Received; - export import ReceivedGetResponse = ReceivedAPI.ReceivedGetResponse; - export import ReceivedGetParams = ReceivedAPI.ReceivedGetParams; +Logs.Control = Control; +Logs.RayID = RayID; +Logs.Received = Received; + +export declare namespace Logs { + export { Control as Control }; + + export { RayID as RayID, type RayIDGetResponse as RayIDGetResponse, type RayIDGetParams as RayIDGetParams }; + + export { + Received as Received, + type ReceivedGetResponse as ReceivedGetResponse, + type ReceivedGetParams as ReceivedGetParams, + }; } diff --git a/src/resources/logs/rayid.ts b/src/resources/logs/rayid.ts index d3dc7b72da..0704ee5c26 100644 --- a/src/resources/logs/rayid.ts +++ b/src/resources/logs/rayid.ts @@ -1,9 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as RayIDAPI from './rayid'; export class RayID extends APIResource { /** @@ -11,26 +9,12 @@ export class RayID extends APIResource { * return zero, one, or more records (ray ids are not unique). */ get( - zoneIdentifier: string, - rayIdentifier: string, - query?: RayIDGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - get( - zoneIdentifier: string, - rayIdentifier: string, - options?: Core.RequestOptions, - ): Core.APIPromise; - get( - zoneIdentifier: string, - rayIdentifier: string, - query: RayIDGetParams | Core.RequestOptions = {}, + RayID: string, + params: RayIDGetParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.get(zoneIdentifier, rayIdentifier, {}, query); - } - return this._client.get(`/zones/${zoneIdentifier}/logs/rayids/${rayIdentifier}`, { query, ...options }); + const { zone_id, ...query } = params; + return this._client.get(`/zones/${zone_id}/logs/rayids/${RayID}`, { query, ...options }); } } @@ -38,31 +22,35 @@ export type RayIDGetResponse = string | unknown; export interface RayIDGetParams { /** - * The `/received` route by default returns a limited set of fields, and allows - * customers to override the default field set by specifying individual fields. The - * reasons for this are: 1. Most customers require only a small subset of fields, - * but that subset varies from customer to customer; 2. Flat schema is much easier - * to work with downstream (importing into BigTable etc); 3. Performance (time to - * process, file size). If `?fields=` is not specified, default field set is - * returned. This default field set may change at any time. When `?fields=` is - * provided, each record is returned with the specified fields. `fields` must be - * specified as a comma separated list without any whitespaces, and all fields must - * exist. The order in which fields are specified does not matter, and the order of - * fields in the response is not specified. + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: The `/received` route by default returns a limited set of fields, + * and allows customers to override the default field set by specifying individual + * fields. The reasons for this are: 1. Most customers require only a small subset + * of fields, but that subset varies from customer to customer; 2. Flat schema is + * much easier to work with downstream (importing into BigTable etc); 3. + * Performance (time to process, file size). If `?fields=` is not specified, + * default field set is returned. This default field set may change at any time. + * When `?fields=` is provided, each record is returned with the specified fields. + * `fields` must be specified as a comma separated list without any whitespaces, + * and all fields must exist. The order in which fields are specified does not + * matter, and the order of fields in the response is not specified. */ fields?: string; /** - * By default, timestamps in responses are returned as Unix nanosecond integers. - * The `?timestamps=` argument can be set to change the format in which response - * timestamps are returned. Possible values are: `unix`, `unixnano`, `rfc3339`. - * Note that `unix` and `unixnano` return timestamps as integers; `rfc3339` returns - * timestamps as strings. + * Query param: By default, timestamps in responses are returned as Unix nanosecond + * integers. The `?timestamps=` argument can be set to change the format in which + * response timestamps are returned. Possible values are: `unix`, `unixnano`, + * `rfc3339`. Note that `unix` and `unixnano` return timestamps as integers; + * `rfc3339` returns timestamps as strings. */ timestamps?: 'unix' | 'unixnano' | 'rfc3339'; } -export namespace RayID { - export import RayIDGetResponse = RayIDAPI.RayIDGetResponse; - export import RayIDGetParams = RayIDAPI.RayIDGetParams; +export declare namespace RayID { + export { type RayIDGetResponse as RayIDGetResponse, type RayIDGetParams as RayIDGetParams }; } diff --git a/src/resources/logs/received/fields.ts b/src/resources/logs/received/fields.ts index 48ee4d3d7b..811f223ca0 100644 --- a/src/resources/logs/received/fields.ts +++ b/src/resources/logs/received/fields.ts @@ -2,15 +2,15 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as FieldsAPI from './fields'; export class Fields extends APIResource { /** * Lists all fields available. The response is json object with key-value pairs, * where keys are field names, and values are descriptions. */ - get(zoneIdentifier: string, options?: Core.RequestOptions): Core.APIPromise { - return this._client.get(`/zones/${zoneIdentifier}/logs/received/fields`, options); + get(params: FieldGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return this._client.get(`/zones/${zone_id}/logs/received/fields`, options); } } @@ -18,6 +18,13 @@ export interface FieldGetResponse { key?: string; } -export namespace Fields { - export import FieldGetResponse = FieldsAPI.FieldGetResponse; +export interface FieldGetParams { + /** + * Identifier + */ + zone_id: string; +} + +export declare namespace Fields { + export { type FieldGetResponse as FieldGetResponse, type FieldGetParams as FieldGetParams }; } diff --git a/src/resources/logs/received/index.ts b/src/resources/logs/received/index.ts index adc2f62489..872f107c23 100644 --- a/src/resources/logs/received/index.ts +++ b/src/resources/logs/received/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { FieldGetResponse, Fields } from './fields'; -export { ReceivedGetResponse, ReceivedGetParams, Received } from './received'; +export { Fields, type FieldGetResponse, type FieldGetParams } from './fields'; +export { Received, type ReceivedGetResponse, type ReceivedGetParams } from './received'; diff --git a/src/resources/logs/received/received.ts b/src/resources/logs/received/received.ts index 1d612838fa..f6697d739e 100644 --- a/src/resources/logs/received/received.ts +++ b/src/resources/logs/received/received.ts @@ -2,8 +2,8 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ReceivedAPI from './received'; import * as FieldsAPI from './fields'; +import { FieldGetParams, FieldGetResponse, Fields } from './fields'; export class Received extends APIResource { fields: FieldsAPI.Fields = new FieldsAPI.Fields(this._client); @@ -18,12 +18,9 @@ export class Received extends APIResource { * `start=2018-05-20T10:01:00Z&end=2018-05-20T10:02:00Z` and so on; the overlap * will be handled properly. */ - get( - zoneIdentifier: string, - query: ReceivedGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.get(`/zones/${zoneIdentifier}/logs/received`, { query, ...options }); + get(params: ReceivedGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...query } = params; + return this._client.get(`/zones/${zone_id}/logs/received`, { query, ...options }); } } @@ -31,69 +28,80 @@ export type ReceivedGetResponse = string | unknown; export interface ReceivedGetParams { /** - * Sets the (exclusive) end of the requested time frame. This can be a unix - * timestamp (in seconds or nanoseconds), or an absolute timestamp that conforms to - * RFC 3339. `end` must be at least five minutes earlier than now and must be later - * than `start`. Difference between `start` and `end` must be not greater than one - * hour. + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Sets the (exclusive) end of the requested time frame. This can be a + * unix timestamp (in seconds or nanoseconds), or an absolute timestamp that + * conforms to RFC 3339. `end` must be at least five minutes earlier than now and + * must be later than `start`. Difference between `start` and `end` must be not + * greater than one hour. */ end: string | number; /** - * When `?count=` is provided, the response will contain up to `count` results. - * Since results are not sorted, you are likely to get different data for repeated - * requests. `count` must be an integer > 0. + * Query param: When `?count=` is provided, the response will contain up to `count` + * results. Since results are not sorted, you are likely to get different data for + * repeated requests. `count` must be an integer > 0. */ count?: number; /** - * The `/received` route by default returns a limited set of fields, and allows - * customers to override the default field set by specifying individual fields. The - * reasons for this are: 1. Most customers require only a small subset of fields, - * but that subset varies from customer to customer; 2. Flat schema is much easier - * to work with downstream (importing into BigTable etc); 3. Performance (time to - * process, file size). If `?fields=` is not specified, default field set is - * returned. This default field set may change at any time. When `?fields=` is - * provided, each record is returned with the specified fields. `fields` must be - * specified as a comma separated list without any whitespaces, and all fields must - * exist. The order in which fields are specified does not matter, and the order of - * fields in the response is not specified. + * Query param: The `/received` route by default returns a limited set of fields, + * and allows customers to override the default field set by specifying individual + * fields. The reasons for this are: 1. Most customers require only a small subset + * of fields, but that subset varies from customer to customer; 2. Flat schema is + * much easier to work with downstream (importing into BigTable etc); 3. + * Performance (time to process, file size). If `?fields=` is not specified, + * default field set is returned. This default field set may change at any time. + * When `?fields=` is provided, each record is returned with the specified fields. + * `fields` must be specified as a comma separated list without any whitespaces, + * and all fields must exist. The order in which fields are specified does not + * matter, and the order of fields in the response is not specified. */ fields?: string; /** - * When `?sample=` is provided, a sample of matching records is returned. If - * `sample=0.1` then 10% of records will be returned. Sampling is random: repeated - * calls will not only return different records, but likely will also vary slightly - * in number of returned records. When `?count=` is also specified, `count` is - * applied to the number of returned records, not the sampled records. So, with - * `sample=0.05` and `count=7`, when there is a total of 100 records available, - * approximately five will be returned. When there are 1000 records, seven will be - * returned. When there are 10,000 records, seven will be returned. + * Query param: When `?sample=` is provided, a sample of matching records is + * returned. If `sample=0.1` then 10% of records will be returned. Sampling is + * random: repeated calls will not only return different records, but likely will + * also vary slightly in number of returned records. When `?count=` is also + * specified, `count` is applied to the number of returned records, not the sampled + * records. So, with `sample=0.05` and `count=7`, when there is a total of 100 + * records available, approximately five will be returned. When there are 1000 + * records, seven will be returned. When there are 10,000 records, seven will be + * returned. */ sample?: number; /** - * Sets the (inclusive) beginning of the requested time frame. This can be a unix - * timestamp (in seconds or nanoseconds), or an absolute timestamp that conforms to - * RFC 3339. At this point in time, it cannot exceed a time in the past greater - * than seven days. + * Query param: Sets the (inclusive) beginning of the requested time frame. This + * can be a unix timestamp (in seconds or nanoseconds), or an absolute timestamp + * that conforms to RFC 3339. At this point in time, it cannot exceed a time in the + * past greater than seven days. */ start?: string | number; /** - * By default, timestamps in responses are returned as Unix nanosecond integers. - * The `?timestamps=` argument can be set to change the format in which response - * timestamps are returned. Possible values are: `unix`, `unixnano`, `rfc3339`. - * Note that `unix` and `unixnano` return timestamps as integers; `rfc3339` returns - * timestamps as strings. + * Query param: By default, timestamps in responses are returned as Unix nanosecond + * integers. The `?timestamps=` argument can be set to change the format in which + * response timestamps are returned. Possible values are: `unix`, `unixnano`, + * `rfc3339`. Note that `unix` and `unixnano` return timestamps as integers; + * `rfc3339` returns timestamps as strings. */ timestamps?: 'unix' | 'unixnano' | 'rfc3339'; } -export namespace Received { - export import ReceivedGetResponse = ReceivedAPI.ReceivedGetResponse; - export import ReceivedGetParams = ReceivedAPI.ReceivedGetParams; - export import Fields = FieldsAPI.Fields; - export import FieldGetResponse = FieldsAPI.FieldGetResponse; +Received.Fields = Fields; + +export declare namespace Received { + export { type ReceivedGetResponse as ReceivedGetResponse, type ReceivedGetParams as ReceivedGetParams }; + + export { + Fields as Fields, + type FieldGetResponse as FieldGetResponse, + type FieldGetParams as FieldGetParams, + }; } diff --git a/src/resources/magic-network-monitoring/configs/configs.ts b/src/resources/magic-network-monitoring/configs/configs.ts index 21fe9972d0..6ca54734fd 100644 --- a/src/resources/magic-network-monitoring/configs/configs.ts +++ b/src/resources/magic-network-monitoring/configs/configs.ts @@ -2,8 +2,8 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ConfigsAPI from './configs'; import * as FullAPI from './full'; +import { Full, FullGetParams } from './full'; export class Configs extends APIResource { full: FullAPI.Full = new FullAPI.Full(this._client); @@ -12,9 +12,9 @@ export class Configs extends APIResource { * Create a new network monitoring configuration. */ create(params: ConfigCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( - this._client.post(`/accounts/${account_id}/mnm/config`, { body: body, ...options }) as Core.APIPromise<{ + this._client.post(`/accounts/${account_id}/mnm/config`, { body, ...options }) as Core.APIPromise<{ result: Configuration; }> )._thenUnwrap((obj) => obj.result); @@ -25,9 +25,9 @@ export class Configs extends APIResource { * configuration to be updated at once. */ update(params: ConfigUpdateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( - this._client.put(`/accounts/${account_id}/mnm/config`, { body: body, ...options }) as Core.APIPromise<{ + this._client.put(`/accounts/${account_id}/mnm/config`, { body, ...options }) as Core.APIPromise<{ result: Configuration; }> )._thenUnwrap((obj) => obj.result); @@ -49,17 +49,16 @@ export class Configs extends APIResource { * Update fields in an existing network monitoring configuration. */ edit(params: ConfigEditParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( - this._client.patch(`/accounts/${account_id}/mnm/config`, { - body: body, - ...options, - }) as Core.APIPromise<{ result: Configuration }> + this._client.patch(`/accounts/${account_id}/mnm/config`, { body, ...options }) as Core.APIPromise<{ + result: Configuration; + }> )._thenUnwrap((obj) => obj.result); } /** - * Lists default sampling and router IPs for account. + * Lists default sampling, router IPs and warp devices for account. */ get(params: ConfigGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id } = params; @@ -84,6 +83,31 @@ export interface Configuration { name: string; router_ips: Array; + + warp_devices: Array; +} + +export namespace Configuration { + /** + * Object representing a warp device with an ID and name. + */ + export interface WARPDevice { + /** + * Unique identifier for the warp device. + */ + id: string; + + /** + * Name of the warp device. + */ + name: string; + + /** + * IPv4 CIDR of the router sourcing flow data associated with this warp device. + * Only /32 addresses are currently supported. + */ + router_ip: string; + } } export interface ConfigCreateParams { @@ -92,10 +116,49 @@ export interface ConfigCreateParams { */ account_id: string; + /** + * Body param: Fallback sampling rate of flow messages being sent in packets per + * second. This should match the packet sampling rate configured on the router. + */ + default_sampling: number; + + /** + * Body param: The account name. + */ + name: string; + + /** + * Body param: + */ + router_ips?: Array; + /** * Body param: */ - body: unknown; + warp_devices?: Array; +} + +export namespace ConfigCreateParams { + /** + * Object representing a warp device with an ID and name. + */ + export interface WARPDevice { + /** + * Unique identifier for the warp device. + */ + id: string; + + /** + * Name of the warp device. + */ + name: string; + + /** + * IPv4 CIDR of the router sourcing flow data associated with this warp device. + * Only /32 addresses are currently supported. + */ + router_ip: string; + } } export interface ConfigUpdateParams { @@ -104,10 +167,49 @@ export interface ConfigUpdateParams { */ account_id: string; + /** + * Body param: Fallback sampling rate of flow messages being sent in packets per + * second. This should match the packet sampling rate configured on the router. + */ + default_sampling: number; + + /** + * Body param: The account name. + */ + name: string; + /** * Body param: */ - body: unknown; + router_ips?: Array; + + /** + * Body param: + */ + warp_devices?: Array; +} + +export namespace ConfigUpdateParams { + /** + * Object representing a warp device with an ID and name. + */ + export interface WARPDevice { + /** + * Unique identifier for the warp device. + */ + id: string; + + /** + * Name of the warp device. + */ + name: string; + + /** + * IPv4 CIDR of the router sourcing flow data associated with this warp device. + * Only /32 addresses are currently supported. + */ + router_ip: string; + } } export interface ConfigDeleteParams { @@ -120,23 +222,66 @@ export interface ConfigEditParams { */ account_id: string; + /** + * Body param: Fallback sampling rate of flow messages being sent in packets per + * second. This should match the packet sampling rate configured on the router. + */ + default_sampling?: number; + + /** + * Body param: The account name. + */ + name?: string; + + /** + * Body param: + */ + router_ips?: Array; + /** * Body param: */ - body: unknown; + warp_devices?: Array; +} + +export namespace ConfigEditParams { + /** + * Object representing a warp device with an ID and name. + */ + export interface WARPDevice { + /** + * Unique identifier for the warp device. + */ + id: string; + + /** + * Name of the warp device. + */ + name: string; + + /** + * IPv4 CIDR of the router sourcing flow data associated with this warp device. + * Only /32 addresses are currently supported. + */ + router_ip: string; + } } export interface ConfigGetParams { account_id: string; } -export namespace Configs { - export import Configuration = ConfigsAPI.Configuration; - export import ConfigCreateParams = ConfigsAPI.ConfigCreateParams; - export import ConfigUpdateParams = ConfigsAPI.ConfigUpdateParams; - export import ConfigDeleteParams = ConfigsAPI.ConfigDeleteParams; - export import ConfigEditParams = ConfigsAPI.ConfigEditParams; - export import ConfigGetParams = ConfigsAPI.ConfigGetParams; - export import Full = FullAPI.Full; - export import FullGetParams = FullAPI.FullGetParams; +Configs.Full = Full; + +export declare namespace Configs { + export { + type Configuration as Configuration, + type ConfigCreateParams as ConfigCreateParams, + type ConfigUpdateParams as ConfigUpdateParams, + type ConfigDeleteParams as ConfigDeleteParams, + type ConfigEditParams as ConfigEditParams, + type ConfigGetParams as ConfigGetParams, + }; + + export { Full as Full, type FullGetParams as FullGetParams }; } diff --git a/src/resources/magic-network-monitoring/configs/full.ts b/src/resources/magic-network-monitoring/configs/full.ts index 50e3d2d88b..be3abef480 100644 --- a/src/resources/magic-network-monitoring/configs/full.ts +++ b/src/resources/magic-network-monitoring/configs/full.ts @@ -2,12 +2,11 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as FullAPI from './full'; import * as ConfigsAPI from './configs'; export class Full extends APIResource { /** - * Lists default sampling, router IPs, and rules for account. + * Lists default sampling, router IPs, warp devices, and rules for account. */ get(params: FullGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id } = params; @@ -23,6 +22,6 @@ export interface FullGetParams { account_id: string; } -export namespace Full { - export import FullGetParams = FullAPI.FullGetParams; +export declare namespace Full { + export { type FullGetParams as FullGetParams }; } diff --git a/src/resources/magic-network-monitoring/configs/index.ts b/src/resources/magic-network-monitoring/configs/index.ts index 84ea79ba6f..da6b24e588 100644 --- a/src/resources/magic-network-monitoring/configs/index.ts +++ b/src/resources/magic-network-monitoring/configs/index.ts @@ -1,12 +1,12 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Configuration, - ConfigCreateParams, - ConfigUpdateParams, - ConfigDeleteParams, - ConfigEditParams, - ConfigGetParams, Configs, + type Configuration, + type ConfigCreateParams, + type ConfigUpdateParams, + type ConfigDeleteParams, + type ConfigEditParams, + type ConfigGetParams, } from './configs'; -export { FullGetParams, Full } from './full'; +export { Full, type FullGetParams } from './full'; diff --git a/src/resources/magic-network-monitoring/index.ts b/src/resources/magic-network-monitoring/index.ts index 4659508ad0..3b7a83bab7 100644 --- a/src/resources/magic-network-monitoring/index.ts +++ b/src/resources/magic-network-monitoring/index.ts @@ -1,23 +1,23 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Configuration, - ConfigCreateParams, - ConfigUpdateParams, - ConfigDeleteParams, - ConfigEditParams, - ConfigGetParams, Configs, + type Configuration, + type ConfigCreateParams, + type ConfigUpdateParams, + type ConfigDeleteParams, + type ConfigEditParams, + type ConfigGetParams, } from './configs/index'; export { MagicNetworkMonitoring } from './magic-network-monitoring'; export { - MagicNetworkMonitoringRule, - RuleCreateParams, - RuleUpdateParams, - RuleListParams, - RuleDeleteParams, - RuleEditParams, - RuleGetParams, MagicNetworkMonitoringRulesSinglePage, Rules, + type MagicNetworkMonitoringRule, + type RuleCreateParams, + type RuleUpdateParams, + type RuleListParams, + type RuleDeleteParams, + type RuleEditParams, + type RuleGetParams, } from './rules/index'; diff --git a/src/resources/magic-network-monitoring/magic-network-monitoring.ts b/src/resources/magic-network-monitoring/magic-network-monitoring.ts index f717cb98ba..4025a732d4 100644 --- a/src/resources/magic-network-monitoring/magic-network-monitoring.ts +++ b/src/resources/magic-network-monitoring/magic-network-monitoring.ts @@ -2,28 +2,57 @@ import { APIResource } from '../../resource'; import * as ConfigsAPI from './configs/configs'; +import { + ConfigCreateParams, + ConfigDeleteParams, + ConfigEditParams, + ConfigGetParams, + ConfigUpdateParams, + Configs, + Configuration, +} from './configs/configs'; import * as RulesAPI from './rules/rules'; +import { + MagicNetworkMonitoringRule, + MagicNetworkMonitoringRulesSinglePage, + RuleCreateParams, + RuleDeleteParams, + RuleEditParams, + RuleGetParams, + RuleListParams, + RuleUpdateParams, + Rules, +} from './rules/rules'; export class MagicNetworkMonitoring extends APIResource { configs: ConfigsAPI.Configs = new ConfigsAPI.Configs(this._client); rules: RulesAPI.Rules = new RulesAPI.Rules(this._client); } -export namespace MagicNetworkMonitoring { - export import Configs = ConfigsAPI.Configs; - export import Configuration = ConfigsAPI.Configuration; - export import ConfigCreateParams = ConfigsAPI.ConfigCreateParams; - export import ConfigUpdateParams = ConfigsAPI.ConfigUpdateParams; - export import ConfigDeleteParams = ConfigsAPI.ConfigDeleteParams; - export import ConfigEditParams = ConfigsAPI.ConfigEditParams; - export import ConfigGetParams = ConfigsAPI.ConfigGetParams; - export import Rules = RulesAPI.Rules; - export import MagicNetworkMonitoringRule = RulesAPI.MagicNetworkMonitoringRule; - export import MagicNetworkMonitoringRulesSinglePage = RulesAPI.MagicNetworkMonitoringRulesSinglePage; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; - export import RuleDeleteParams = RulesAPI.RuleDeleteParams; - export import RuleEditParams = RulesAPI.RuleEditParams; - export import RuleGetParams = RulesAPI.RuleGetParams; +MagicNetworkMonitoring.Configs = Configs; +MagicNetworkMonitoring.Rules = Rules; +MagicNetworkMonitoring.MagicNetworkMonitoringRulesSinglePage = MagicNetworkMonitoringRulesSinglePage; + +export declare namespace MagicNetworkMonitoring { + export { + Configs as Configs, + type Configuration as Configuration, + type ConfigCreateParams as ConfigCreateParams, + type ConfigUpdateParams as ConfigUpdateParams, + type ConfigDeleteParams as ConfigDeleteParams, + type ConfigEditParams as ConfigEditParams, + type ConfigGetParams as ConfigGetParams, + }; + + export { + Rules as Rules, + type MagicNetworkMonitoringRule as MagicNetworkMonitoringRule, + MagicNetworkMonitoringRulesSinglePage as MagicNetworkMonitoringRulesSinglePage, + type RuleCreateParams as RuleCreateParams, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleEditParams as RuleEditParams, + type RuleGetParams as RuleGetParams, + }; } diff --git a/src/resources/magic-network-monitoring/rules/advertisements.ts b/src/resources/magic-network-monitoring/rules/advertisements.ts index 6dcc856384..d36e5b7a16 100644 --- a/src/resources/magic-network-monitoring/rules/advertisements.ts +++ b/src/resources/magic-network-monitoring/rules/advertisements.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as AdvertisementsAPI from './advertisements'; export class Advertisements extends APIResource { /** @@ -44,7 +43,6 @@ export interface AdvertisementEditParams { body: unknown; } -export namespace Advertisements { - export import Advertisement = AdvertisementsAPI.Advertisement; - export import AdvertisementEditParams = AdvertisementsAPI.AdvertisementEditParams; +export declare namespace Advertisements { + export { type Advertisement as Advertisement, type AdvertisementEditParams as AdvertisementEditParams }; } diff --git a/src/resources/magic-network-monitoring/rules/index.ts b/src/resources/magic-network-monitoring/rules/index.ts index 6f14e418e6..a2f52aaa4b 100644 --- a/src/resources/magic-network-monitoring/rules/index.ts +++ b/src/resources/magic-network-monitoring/rules/index.ts @@ -1,14 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Advertisement, AdvertisementEditParams, Advertisements } from './advertisements'; +export { Advertisements, type Advertisement, type AdvertisementEditParams } from './advertisements'; export { - MagicNetworkMonitoringRule, - RuleCreateParams, - RuleUpdateParams, - RuleListParams, - RuleDeleteParams, - RuleEditParams, - RuleGetParams, MagicNetworkMonitoringRulesSinglePage, Rules, + type MagicNetworkMonitoringRule, + type RuleCreateParams, + type RuleUpdateParams, + type RuleListParams, + type RuleDeleteParams, + type RuleEditParams, + type RuleGetParams, } from './rules'; diff --git a/src/resources/magic-network-monitoring/rules/rules.ts b/src/resources/magic-network-monitoring/rules/rules.ts index 417f83d8ee..247d5279fd 100644 --- a/src/resources/magic-network-monitoring/rules/rules.ts +++ b/src/resources/magic-network-monitoring/rules/rules.ts @@ -2,8 +2,8 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as RulesAPI from './rules'; import * as AdvertisementsAPI from './advertisements'; +import { Advertisement, AdvertisementEditParams, Advertisements } from './advertisements'; import { SinglePage } from '../../../pagination'; export class Rules extends APIResource { @@ -17,9 +17,9 @@ export class Rules extends APIResource { params: RuleCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( - this._client.post(`/accounts/${account_id}/mnm/rules`, { body: body, ...options }) as Core.APIPromise<{ + this._client.post(`/accounts/${account_id}/mnm/rules`, { body, ...options }) as Core.APIPromise<{ result: MagicNetworkMonitoringRule | null; }> )._thenUnwrap((obj) => obj.result); @@ -32,9 +32,9 @@ export class Rules extends APIResource { params: RuleUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( - this._client.put(`/accounts/${account_id}/mnm/rules`, { body: body, ...options }) as Core.APIPromise<{ + this._client.put(`/accounts/${account_id}/mnm/rules`, { body, ...options }) as Core.APIPromise<{ result: MagicNetworkMonitoringRule | null; }> )._thenUnwrap((obj) => obj.result); @@ -79,10 +79,10 @@ export class Rules extends APIResource { params: RuleEditParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( this._client.patch(`/accounts/${account_id}/mnm/rules/${ruleId}`, { - body: body, + body, ...options, }) as Core.APIPromise<{ result: MagicNetworkMonitoringRule | null }> )._thenUnwrap((obj) => obj.result); @@ -157,10 +157,47 @@ export interface RuleCreateParams { */ account_id: string; + /** + * Body param: The amount of time that the rule threshold must be exceeded to send + * an alert notification. The final value must be equivalent to one of the + * following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format + * is AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at + * least one unit must be provided. + */ + duration: string; + + /** + * Body param: The name of the rule. Must be unique. Supports characters A-Z, a-z, + * 0-9, underscore (\_), dash (-), period (.), and tilde (~). You can’t have a + * space in the rule name. Max 256 characters. + */ + name: string; + + /** + * Body param: Toggle on if you would like Cloudflare to automatically advertise + * the IP Prefixes within the rule via Magic Transit when the rule is triggered. + * Only available for users of Magic Transit. + */ + automatic_advertisement?: boolean | null; + + /** + * Body param: The number of bits per second for the rule. When this value is + * exceeded for the set duration, an alert notification is sent. Minimum of 1 and + * no maximum. + */ + bandwidth?: number; + + /** + * Body param: The number of packets per second for the rule. When this value is + * exceeded for the set duration, an alert notification is sent. Minimum of 1 and + * no maximum. + */ + packet_threshold?: number; + /** * Body param: */ - body: unknown; + prefixes?: Array; } export interface RuleUpdateParams { @@ -169,10 +206,52 @@ export interface RuleUpdateParams { */ account_id: string; + /** + * Body param: The amount of time that the rule threshold must be exceeded to send + * an alert notification. The final value must be equivalent to one of the + * following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format + * is AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at + * least one unit must be provided. + */ + duration: string; + + /** + * Body param: The name of the rule. Must be unique. Supports characters A-Z, a-z, + * 0-9, underscore (\_), dash (-), period (.), and tilde (~). You can’t have a + * space in the rule name. Max 256 characters. + */ + name: string; + + /** + * Body param: The id of the rule. Must be unique. + */ + id?: string; + + /** + * Body param: Toggle on if you would like Cloudflare to automatically advertise + * the IP Prefixes within the rule via Magic Transit when the rule is triggered. + * Only available for users of Magic Transit. + */ + automatic_advertisement?: boolean | null; + + /** + * Body param: The number of bits per second for the rule. When this value is + * exceeded for the set duration, an alert notification is sent. Minimum of 1 and + * no maximum. + */ + bandwidth?: number; + + /** + * Body param: The number of packets per second for the rule. When this value is + * exceeded for the set duration, an alert notification is sent. Minimum of 1 and + * no maximum. + */ + packet_threshold?: number; + /** * Body param: */ - body: unknown; + prefixes?: Array; } export interface RuleListParams { @@ -189,26 +268,71 @@ export interface RuleEditParams { */ account_id: string; + /** + * Body param: Toggle on if you would like Cloudflare to automatically advertise + * the IP Prefixes within the rule via Magic Transit when the rule is triggered. + * Only available for users of Magic Transit. + */ + automatic_advertisement?: boolean | null; + + /** + * Body param: The number of bits per second for the rule. When this value is + * exceeded for the set duration, an alert notification is sent. Minimum of 1 and + * no maximum. + */ + bandwidth?: number; + + /** + * Body param: The amount of time that the rule threshold must be exceeded to send + * an alert notification. The final value must be equivalent to one of the + * following 8 values ["1m","5m","10m","15m","20m","30m","45m","60m"]. The format + * is AhBmCsDmsEusFns where A, B, C, D, E and F durations are optional; however at + * least one unit must be provided. + */ + duration?: string; + + /** + * Body param: The name of the rule. Must be unique. Supports characters A-Z, a-z, + * 0-9, underscore (\_), dash (-), period (.), and tilde (~). You can’t have a + * space in the rule name. Max 256 characters. + */ + name?: string; + + /** + * Body param: The number of packets per second for the rule. When this value is + * exceeded for the set duration, an alert notification is sent. Minimum of 1 and + * no maximum. + */ + packet_threshold?: number; + /** * Body param: */ - body: unknown; + prefixes?: Array; } export interface RuleGetParams { account_id: string; } -export namespace Rules { - export import MagicNetworkMonitoringRule = RulesAPI.MagicNetworkMonitoringRule; - export import MagicNetworkMonitoringRulesSinglePage = RulesAPI.MagicNetworkMonitoringRulesSinglePage; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; - export import RuleDeleteParams = RulesAPI.RuleDeleteParams; - export import RuleEditParams = RulesAPI.RuleEditParams; - export import RuleGetParams = RulesAPI.RuleGetParams; - export import Advertisements = AdvertisementsAPI.Advertisements; - export import Advertisement = AdvertisementsAPI.Advertisement; - export import AdvertisementEditParams = AdvertisementsAPI.AdvertisementEditParams; +Rules.MagicNetworkMonitoringRulesSinglePage = MagicNetworkMonitoringRulesSinglePage; +Rules.Advertisements = Advertisements; + +export declare namespace Rules { + export { + type MagicNetworkMonitoringRule as MagicNetworkMonitoringRule, + MagicNetworkMonitoringRulesSinglePage as MagicNetworkMonitoringRulesSinglePage, + type RuleCreateParams as RuleCreateParams, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleEditParams as RuleEditParams, + type RuleGetParams as RuleGetParams, + }; + + export { + Advertisements as Advertisements, + type Advertisement as Advertisement, + type AdvertisementEditParams as AdvertisementEditParams, + }; } diff --git a/src/resources/magic-transit/apps.ts b/src/resources/magic-transit/apps.ts index c8e7789f65..b0a4fe6a15 100644 --- a/src/resources/magic-transit/apps.ts +++ b/src/resources/magic-transit/apps.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as AppsAPI from './apps'; import { SinglePage } from '../../pagination'; export class Apps extends APIResource { @@ -10,9 +9,9 @@ export class Apps extends APIResource { * Creates a new App for an account */ create(params: AppCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( - this._client.post(`/accounts/${account_id}/magic/apps`, { body: body, ...options }) as Core.APIPromise<{ + this._client.post(`/accounts/${account_id}/magic/apps`, { body, ...options }) as Core.APIPromise<{ result: AppCreateResponse | null; }> )._thenUnwrap((obj) => obj.result); @@ -26,10 +25,10 @@ export class Apps extends APIResource { params: AppUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( this._client.put(`/accounts/${account_id}/magic/apps/${accountAppId}`, { - body: body, + body, ...options, }) as Core.APIPromise<{ result: AppUpdateResponse | null }> )._thenUnwrap((obj) => obj.result); @@ -222,88 +221,58 @@ export interface AppDeleteResponse { type?: string; } -export type AppCreateParams = AppCreateParams.Hostnames | AppCreateParams.Subnets; +export interface AppCreateParams { + /** + * Path param: Identifier + */ + account_id: string; -export namespace AppCreateParams { - export interface Hostnames { - /** - * Path param: Identifier - */ - account_id: string; + /** + * Body param: Display name for the app. + */ + name: string; - /** - * Body param: - */ - body: unknown; - } + /** + * Body param: Category of the app. + */ + type: string; - export interface Subnets { - /** - * Path param: Identifier - */ - account_id: string; + /** + * Body param: FQDNs to associate with traffic decisions. + */ + hostnames?: Array; - /** - * Body param: - */ - body: unknown; - } + /** + * Body param: CIDRs to associate with traffic decisions. + */ + ip_subnets?: Array; } -export type AppUpdateParams = - | AppUpdateParams.UpdateAppName - | AppUpdateParams.UpdateAppType - | AppUpdateParams.UpdateAppHostnames - | AppUpdateParams.UpdateAppSubnets; - -export namespace AppUpdateParams { - export interface UpdateAppName { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: - */ - body: unknown; - } - - export interface UpdateAppType { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: - */ - body: unknown; - } +export interface AppUpdateParams { + /** + * Path param: Identifier + */ + account_id: string; - export interface UpdateAppHostnames { - /** - * Path param: Identifier - */ - account_id: string; + /** + * Body param: FQDNs to associate with traffic decisions. + */ + hostnames?: Array; - /** - * Body param: - */ - body: unknown; - } + /** + * Body param: CIDRs to associate with traffic decisions. + */ + ip_subnets?: Array; - export interface UpdateAppSubnets { - /** - * Path param: Identifier - */ - account_id: string; + /** + * Body param: Display name for the app. + */ + name?: string; - /** - * Body param: - */ - body: unknown; - } + /** + * Body param: Category of the app. + */ + type?: string; } export interface AppListParams { @@ -320,14 +289,18 @@ export interface AppDeleteParams { account_id: string; } -export namespace Apps { - export import AppCreateResponse = AppsAPI.AppCreateResponse; - export import AppUpdateResponse = AppsAPI.AppUpdateResponse; - export import AppListResponse = AppsAPI.AppListResponse; - export import AppDeleteResponse = AppsAPI.AppDeleteResponse; - export import AppListResponsesSinglePage = AppsAPI.AppListResponsesSinglePage; - export import AppCreateParams = AppsAPI.AppCreateParams; - export import AppUpdateParams = AppsAPI.AppUpdateParams; - export import AppListParams = AppsAPI.AppListParams; - export import AppDeleteParams = AppsAPI.AppDeleteParams; +Apps.AppListResponsesSinglePage = AppListResponsesSinglePage; + +export declare namespace Apps { + export { + type AppCreateResponse as AppCreateResponse, + type AppUpdateResponse as AppUpdateResponse, + type AppListResponse as AppListResponse, + type AppDeleteResponse as AppDeleteResponse, + AppListResponsesSinglePage as AppListResponsesSinglePage, + type AppCreateParams as AppCreateParams, + type AppUpdateParams as AppUpdateParams, + type AppListParams as AppListParams, + type AppDeleteParams as AppDeleteParams, + }; } diff --git a/src/resources/magic-transit/cf-interconnects.ts b/src/resources/magic-transit/cf-interconnects.ts index ccfcb42f5e..824b9afe16 100644 --- a/src/resources/magic-transit/cf-interconnects.ts +++ b/src/resources/magic-transit/cf-interconnects.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as CfInterconnectsAPI from './cf-interconnects'; import * as MagicTransitAPI from './magic-transit'; export class CfInterconnects extends APIResource { @@ -16,11 +15,17 @@ export class CfInterconnects extends APIResource { params: CfInterconnectUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, ...body } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget, ...body } = params; return ( this._client.put(`/accounts/${account_id}/magic/cf_interconnects/${cfInterconnectId}`, { body, ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, }) as Core.APIPromise<{ result: CfInterconnectUpdateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -32,11 +37,41 @@ export class CfInterconnects extends APIResource { params: CfInterconnectListParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( - this._client.get(`/accounts/${account_id}/magic/cf_interconnects`, options) as Core.APIPromise<{ - result: CfInterconnectListResponse; - }> + this._client.get(`/accounts/${account_id}/magic/cf_interconnects`, { + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CfInterconnectListResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Updates multiple interconnects associated with an account. Use + * `?validate_only=true` as an optional query parameter to only run validation + * without persisting changes. + */ + bulkUpdate( + params: CfInterconnectBulkUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, body, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; + return ( + this._client.put(`/accounts/${account_id}/magic/cf_interconnects`, { + body: body, + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CfInterconnectBulkUpdateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -48,12 +83,17 @@ export class CfInterconnects extends APIResource { params: CfInterconnectGetParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( - this._client.get( - `/accounts/${account_id}/magic/cf_interconnects/${cfInterconnectId}`, - options, - ) as Core.APIPromise<{ result: CfInterconnectGetResponse }> + this._client.get(`/accounts/${account_id}/magic/cf_interconnects/${cfInterconnectId}`, { + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CfInterconnectGetResponse }> )._thenUnwrap((obj) => obj.result); } } @@ -61,7 +101,74 @@ export class CfInterconnects extends APIResource { export interface CfInterconnectUpdateResponse { modified?: boolean; - modified_interconnect?: unknown; + modified_interconnect?: CfInterconnectUpdateResponse.ModifiedInterconnect; +} + +export namespace CfInterconnectUpdateResponse { + export interface ModifiedInterconnect { + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * The name of the interconnect. The name cannot share a name with other tunnels. + */ + colo_name?: string; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * An optional description of the interconnect. + */ + description?: string; + + /** + * The configuration specific to GRE interconnects. + */ + gre?: ModifiedInterconnect.GRE; + + health_check?: MagicTransitAPI.HealthCheck; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address?: string; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum + * value is 576. + */ + mtu?: number; + + /** + * The name of the interconnect. The name cannot share a name with other tunnels. + */ + name?: string; + } + + export namespace ModifiedInterconnect { + /** + * The configuration specific to GRE interconnects. + */ + export interface GRE { + /** + * The IP address assigned to the Cloudflare side of the GRE tunnel created as part + * of the Interconnect. + */ + cloudflare_endpoint?: string; + } + } } export interface CfInterconnectListResponse { @@ -95,7 +202,7 @@ export namespace CfInterconnectListResponse { */ gre?: Interconnect.GRE; - health_check?: Interconnect.HealthCheck; + health_check?: MagicTransitAPI.HealthCheck; /** * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side @@ -132,35 +239,151 @@ export namespace CfInterconnectListResponse { */ cloudflare_endpoint?: string; } + } +} - export interface HealthCheck { - /** - * Determines whether to run healthchecks for a tunnel. - */ - enabled?: boolean; +export interface CfInterconnectBulkUpdateResponse { + modified?: boolean; - /** - * How frequent the health check is run. The default value is `mid`. - */ - rate?: MagicTransitAPI.HealthCheckRate; + modified_interconnects?: Array; +} - /** - * The destination address in a request type health check. After the healthcheck is - * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - * to this address. This field defaults to `customer_gre_endpoint address`. - */ - target?: string; +export namespace CfInterconnectBulkUpdateResponse { + export interface ModifiedInterconnect { + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * The name of the interconnect. The name cannot share a name with other tunnels. + */ + colo_name?: string; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * An optional description of the interconnect. + */ + description?: string; + + /** + * The configuration specific to GRE interconnects. + */ + gre?: ModifiedInterconnect.GRE; + + health_check?: MagicTransitAPI.HealthCheck; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address?: string; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + /** + * The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum + * value is 576. + */ + mtu?: number; + + /** + * The name of the interconnect. The name cannot share a name with other tunnels. + */ + name?: string; + } + + export namespace ModifiedInterconnect { + /** + * The configuration specific to GRE interconnects. + */ + export interface GRE { /** - * The type of healthcheck to run, reply or request. The default value is `reply`. + * The IP address assigned to the Cloudflare side of the GRE tunnel created as part + * of the Interconnect. */ - type?: MagicTransitAPI.HealthCheckType; + cloudflare_endpoint?: string; } } } export interface CfInterconnectGetResponse { - interconnect?: unknown; + interconnect?: CfInterconnectGetResponse.Interconnect; +} + +export namespace CfInterconnectGetResponse { + export interface Interconnect { + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * The name of the interconnect. The name cannot share a name with other tunnels. + */ + colo_name?: string; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * An optional description of the interconnect. + */ + description?: string; + + /** + * The configuration specific to GRE interconnects. + */ + gre?: Interconnect.GRE; + + health_check?: MagicTransitAPI.HealthCheck; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address?: string; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * The Maximum Transmission Unit (MTU) in bytes for the interconnect. The minimum + * value is 576. + */ + mtu?: number; + + /** + * The name of the interconnect. The name cannot share a name with other tunnels. + */ + name?: string; + } + + export namespace Interconnect { + /** + * The configuration specific to GRE interconnects. + */ + export interface GRE { + /** + * The IP address assigned to the Cloudflare side of the GRE tunnel created as part + * of the Interconnect. + */ + cloudflare_endpoint?: string; + } + } } export interface CfInterconnectUpdateParams { @@ -182,7 +405,7 @@ export interface CfInterconnectUpdateParams { /** * Body param: */ - health_check?: CfInterconnectUpdateParams.HealthCheck; + health_check?: MagicTransitAPI.HealthCheckParam; /** * Body param: A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for @@ -196,6 +419,12 @@ export interface CfInterconnectUpdateParams { * The minimum value is 576. */ mtu?: number; + + /** + * Header param: If true, the health check target in the request and response + * bodies will be presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } export namespace CfInterconnectUpdateParams { @@ -209,51 +438,61 @@ export namespace CfInterconnectUpdateParams { */ cloudflare_endpoint?: string; } +} - export interface HealthCheck { - /** - * Determines whether to run healthchecks for a tunnel. - */ - enabled?: boolean; - - /** - * How frequent the health check is run. The default value is `mid`. - */ - rate?: MagicTransitAPI.HealthCheckRateParam; - - /** - * The destination address in a request type health check. After the healthcheck is - * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - * to this address. This field defaults to `customer_gre_endpoint address`. - */ - target?: string; +export interface CfInterconnectListParams { + /** + * Path param: Identifier + */ + account_id: string; - /** - * The type of healthcheck to run, reply or request. The default value is `reply`. - */ - type?: MagicTransitAPI.HealthCheckTypeParam; - } + /** + * Header param: If true, the health check target in the response body will be + * presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } -export interface CfInterconnectListParams { +export interface CfInterconnectBulkUpdateParams { /** - * Identifier + * Path param: Identifier */ account_id: string; + + /** + * Body param: + */ + body: unknown; + + /** + * Header param: If true, the health check target in the request and response + * bodies will be presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } export interface CfInterconnectGetParams { /** - * Identifier + * Path param: Identifier */ account_id: string; + + /** + * Header param: If true, the health check target in the response body will be + * presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } -export namespace CfInterconnects { - export import CfInterconnectUpdateResponse = CfInterconnectsAPI.CfInterconnectUpdateResponse; - export import CfInterconnectListResponse = CfInterconnectsAPI.CfInterconnectListResponse; - export import CfInterconnectGetResponse = CfInterconnectsAPI.CfInterconnectGetResponse; - export import CfInterconnectUpdateParams = CfInterconnectsAPI.CfInterconnectUpdateParams; - export import CfInterconnectListParams = CfInterconnectsAPI.CfInterconnectListParams; - export import CfInterconnectGetParams = CfInterconnectsAPI.CfInterconnectGetParams; +export declare namespace CfInterconnects { + export { + type CfInterconnectUpdateResponse as CfInterconnectUpdateResponse, + type CfInterconnectListResponse as CfInterconnectListResponse, + type CfInterconnectBulkUpdateResponse as CfInterconnectBulkUpdateResponse, + type CfInterconnectGetResponse as CfInterconnectGetResponse, + type CfInterconnectUpdateParams as CfInterconnectUpdateParams, + type CfInterconnectListParams as CfInterconnectListParams, + type CfInterconnectBulkUpdateParams as CfInterconnectBulkUpdateParams, + type CfInterconnectGetParams as CfInterconnectGetParams, + }; } diff --git a/src/resources/magic-transit/connectors.ts b/src/resources/magic-transit/connectors.ts index 290d3b21c7..676bb2215f 100644 --- a/src/resources/magic-transit/connectors.ts +++ b/src/resources/magic-transit/connectors.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ConnectorsAPI from './connectors'; import { SinglePage } from '../../pagination'; export class Connectors extends APIResource { @@ -273,14 +272,18 @@ export interface ConnectorGetParams { account_id: string; } -export namespace Connectors { - export import ConnectorUpdateResponse = ConnectorsAPI.ConnectorUpdateResponse; - export import ConnectorListResponse = ConnectorsAPI.ConnectorListResponse; - export import ConnectorEditResponse = ConnectorsAPI.ConnectorEditResponse; - export import ConnectorGetResponse = ConnectorsAPI.ConnectorGetResponse; - export import ConnectorListResponsesSinglePage = ConnectorsAPI.ConnectorListResponsesSinglePage; - export import ConnectorUpdateParams = ConnectorsAPI.ConnectorUpdateParams; - export import ConnectorListParams = ConnectorsAPI.ConnectorListParams; - export import ConnectorEditParams = ConnectorsAPI.ConnectorEditParams; - export import ConnectorGetParams = ConnectorsAPI.ConnectorGetParams; +Connectors.ConnectorListResponsesSinglePage = ConnectorListResponsesSinglePage; + +export declare namespace Connectors { + export { + type ConnectorUpdateResponse as ConnectorUpdateResponse, + type ConnectorListResponse as ConnectorListResponse, + type ConnectorEditResponse as ConnectorEditResponse, + type ConnectorGetResponse as ConnectorGetResponse, + ConnectorListResponsesSinglePage as ConnectorListResponsesSinglePage, + type ConnectorUpdateParams as ConnectorUpdateParams, + type ConnectorListParams as ConnectorListParams, + type ConnectorEditParams as ConnectorEditParams, + type ConnectorGetParams as ConnectorGetParams, + }; } diff --git a/src/resources/magic-transit/gre-tunnels.ts b/src/resources/magic-transit/gre-tunnels.ts index 67276cd33d..119ec7c7d9 100644 --- a/src/resources/magic-transit/gre-tunnels.ts +++ b/src/resources/magic-transit/gre-tunnels.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as GRETunnelsAPI from './gre-tunnels'; import * as MagicTransitAPI from './magic-transit'; export class GRETunnels extends APIResource { @@ -14,11 +13,17 @@ export class GRETunnels extends APIResource { params: GRETunnelCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, body } = params; + const { account_id, body, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( this._client.post(`/accounts/${account_id}/magic/gre_tunnels`, { body: body, ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, }) as Core.APIPromise<{ result: GRETunnelCreateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -32,11 +37,17 @@ export class GRETunnels extends APIResource { params: GRETunnelUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, ...body } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget, ...body } = params; return ( this._client.put(`/accounts/${account_id}/magic/gre_tunnels/${greTunnelId}`, { body, ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, }) as Core.APIPromise<{ result: GRETunnelUpdateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -45,11 +56,17 @@ export class GRETunnels extends APIResource { * Lists GRE tunnels associated with an account. */ list(params: GRETunnelListParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( - this._client.get(`/accounts/${account_id}/magic/gre_tunnels`, options) as Core.APIPromise<{ - result: GRETunnelListResponse; - }> + this._client.get(`/accounts/${account_id}/magic/gre_tunnels`, { + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: GRETunnelListResponse }> )._thenUnwrap((obj) => obj.result); } @@ -62,12 +79,40 @@ export class GRETunnels extends APIResource { params: GRETunnelDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( - this._client.delete( - `/accounts/${account_id}/magic/gre_tunnels/${greTunnelId}`, - options, - ) as Core.APIPromise<{ result: GRETunnelDeleteResponse }> + this._client.delete(`/accounts/${account_id}/magic/gre_tunnels/${greTunnelId}`, { + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: GRETunnelDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Updates multiple GRE tunnels. Use `?validate_only=true` as an optional query + * parameter to only run validation without persisting changes. + */ + bulkUpdate( + params: GRETunnelBulkUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, body, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; + return ( + this._client.put(`/accounts/${account_id}/magic/gre_tunnels`, { + body: body, + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: GRETunnelBulkUpdateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -79,12 +124,17 @@ export class GRETunnels extends APIResource { params: GRETunnelGetParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( - this._client.get( - `/accounts/${account_id}/magic/gre_tunnels/${greTunnelId}`, - options, - ) as Core.APIPromise<{ result: GRETunnelGetResponse }> + this._client.get(`/accounts/${account_id}/magic/gre_tunnels/${greTunnelId}`, { + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: GRETunnelGetResponse }> )._thenUnwrap((obj) => obj.result); } } @@ -133,7 +183,7 @@ export namespace GRETunnelCreateResponse { */ description?: string; - health_check?: MagicTransitAPI.HealthCheck; + health_check?: GRETunnel.HealthCheck; /** * The date and time the tunnel was last modified. @@ -151,12 +201,196 @@ export namespace GRETunnelCreateResponse { */ ttl?: number; } + + export namespace GRETunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } } export interface GRETunnelUpdateResponse { modified?: boolean; - modified_gre_tunnel?: unknown; + modified_gre_tunnel?: GRETunnelUpdateResponse.ModifiedGRETunnel; +} + +export namespace GRETunnelUpdateResponse { + export interface ModifiedGRETunnel { + /** + * The IP address assigned to the Cloudflare side of the GRE tunnel. + */ + cloudflare_gre_endpoint: string; + + /** + * The IP address assigned to the customer side of the GRE tunnel. + */ + customer_gre_endpoint: string; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address: string; + + /** + * The name of the tunnel. The name cannot contain spaces or special characters, + * must be 15 characters or less, and cannot share a name with another GRE tunnel. + */ + name: string; + + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * An optional description of the GRE tunnel. + */ + description?: string; + + health_check?: ModifiedGRETunnel.HealthCheck; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + * is 576. + */ + mtu?: number; + + /** + * Time To Live (TTL) in number of hops of the GRE tunnel. + */ + ttl?: number; + } + + export namespace ModifiedGRETunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } } export interface GRETunnelListResponse { @@ -203,7 +437,7 @@ export namespace GRETunnelListResponse { */ description?: string; - health_check?: MagicTransitAPI.HealthCheck; + health_check?: GRETunnel.HealthCheck; /** * The date and time the tunnel was last modified. @@ -221,16 +455,450 @@ export namespace GRETunnelListResponse { */ ttl?: number; } + + export namespace GRETunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } } export interface GRETunnelDeleteResponse { deleted?: boolean; - deleted_gre_tunnel?: unknown; + deleted_gre_tunnel?: GRETunnelDeleteResponse.DeletedGRETunnel; +} + +export namespace GRETunnelDeleteResponse { + export interface DeletedGRETunnel { + /** + * The IP address assigned to the Cloudflare side of the GRE tunnel. + */ + cloudflare_gre_endpoint: string; + + /** + * The IP address assigned to the customer side of the GRE tunnel. + */ + customer_gre_endpoint: string; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address: string; + + /** + * The name of the tunnel. The name cannot contain spaces or special characters, + * must be 15 characters or less, and cannot share a name with another GRE tunnel. + */ + name: string; + + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * An optional description of the GRE tunnel. + */ + description?: string; + + health_check?: DeletedGRETunnel.HealthCheck; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + * is 576. + */ + mtu?: number; + + /** + * Time To Live (TTL) in number of hops of the GRE tunnel. + */ + ttl?: number; + } + + export namespace DeletedGRETunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } +} + +export interface GRETunnelBulkUpdateResponse { + modified?: boolean; + + modified_gre_tunnels?: Array; +} + +export namespace GRETunnelBulkUpdateResponse { + export interface ModifiedGRETunnel { + /** + * The IP address assigned to the Cloudflare side of the GRE tunnel. + */ + cloudflare_gre_endpoint: string; + + /** + * The IP address assigned to the customer side of the GRE tunnel. + */ + customer_gre_endpoint: string; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address: string; + + /** + * The name of the tunnel. The name cannot contain spaces or special characters, + * must be 15 characters or less, and cannot share a name with another GRE tunnel. + */ + name: string; + + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * An optional description of the GRE tunnel. + */ + description?: string; + + health_check?: ModifiedGRETunnel.HealthCheck; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + * is 576. + */ + mtu?: number; + + /** + * Time To Live (TTL) in number of hops of the GRE tunnel. + */ + ttl?: number; + } + + export namespace ModifiedGRETunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } } export interface GRETunnelGetResponse { - gre_tunnel?: unknown; + gre_tunnel?: GRETunnelGetResponse.GRETunnel; +} + +export namespace GRETunnelGetResponse { + export interface GRETunnel { + /** + * The IP address assigned to the Cloudflare side of the GRE tunnel. + */ + cloudflare_gre_endpoint: string; + + /** + * The IP address assigned to the customer side of the GRE tunnel. + */ + customer_gre_endpoint: string; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address: string; + + /** + * The name of the tunnel. The name cannot contain spaces or special characters, + * must be 15 characters or less, and cannot share a name with another GRE tunnel. + */ + name: string; + + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * An optional description of the GRE tunnel. + */ + description?: string; + + health_check?: GRETunnel.HealthCheck; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The minimum value + * is 576. + */ + mtu?: number; + + /** + * Time To Live (TTL) in number of hops of the GRE tunnel. + */ + ttl?: number; + } + + export namespace GRETunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } } export interface GRETunnelCreateParams { @@ -243,6 +911,12 @@ export interface GRETunnelCreateParams { * Body param: */ body: unknown; + + /** + * Header param: If true, the health check target in the request and response + * bodies will be presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } export interface GRETunnelUpdateParams { @@ -283,7 +957,7 @@ export interface GRETunnelUpdateParams { /** * Body param: */ - health_check?: MagicTransitAPI.HealthCheckParam; + health_check?: GRETunnelUpdateParams.HealthCheck; /** * Body param: Maximum Transmission Unit (MTU) in bytes for the GRE tunnel. The @@ -295,38 +969,139 @@ export interface GRETunnelUpdateParams { * Body param: Time To Live (TTL) in number of hops of the GRE tunnel. */ ttl?: number; + + /** + * Header param: If true, the health check target in the request and response + * bodies will be presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; +} + +export namespace GRETunnelUpdateParams { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRateParam; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckTypeParam; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } } export interface GRETunnelListParams { /** - * Identifier + * Path param: Identifier */ account_id: string; + + /** + * Header param: If true, the health check target in the response body will be + * presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } export interface GRETunnelDeleteParams { /** - * Identifier + * Path param: Identifier */ account_id: string; + + /** + * Header param: If true, the health check target in the response body will be + * presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; +} + +export interface GRETunnelBulkUpdateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: + */ + body: unknown; + + /** + * Header param: If true, the health check target in the request and response + * bodies will be presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } export interface GRETunnelGetParams { /** - * Identifier + * Path param: Identifier */ account_id: string; + + /** + * Header param: If true, the health check target in the response body will be + * presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } -export namespace GRETunnels { - export import GRETunnelCreateResponse = GRETunnelsAPI.GRETunnelCreateResponse; - export import GRETunnelUpdateResponse = GRETunnelsAPI.GRETunnelUpdateResponse; - export import GRETunnelListResponse = GRETunnelsAPI.GRETunnelListResponse; - export import GRETunnelDeleteResponse = GRETunnelsAPI.GRETunnelDeleteResponse; - export import GRETunnelGetResponse = GRETunnelsAPI.GRETunnelGetResponse; - export import GRETunnelCreateParams = GRETunnelsAPI.GRETunnelCreateParams; - export import GRETunnelUpdateParams = GRETunnelsAPI.GRETunnelUpdateParams; - export import GRETunnelListParams = GRETunnelsAPI.GRETunnelListParams; - export import GRETunnelDeleteParams = GRETunnelsAPI.GRETunnelDeleteParams; - export import GRETunnelGetParams = GRETunnelsAPI.GRETunnelGetParams; +export declare namespace GRETunnels { + export { + type GRETunnelCreateResponse as GRETunnelCreateResponse, + type GRETunnelUpdateResponse as GRETunnelUpdateResponse, + type GRETunnelListResponse as GRETunnelListResponse, + type GRETunnelDeleteResponse as GRETunnelDeleteResponse, + type GRETunnelBulkUpdateResponse as GRETunnelBulkUpdateResponse, + type GRETunnelGetResponse as GRETunnelGetResponse, + type GRETunnelCreateParams as GRETunnelCreateParams, + type GRETunnelUpdateParams as GRETunnelUpdateParams, + type GRETunnelListParams as GRETunnelListParams, + type GRETunnelDeleteParams as GRETunnelDeleteParams, + type GRETunnelBulkUpdateParams as GRETunnelBulkUpdateParams, + type GRETunnelGetParams as GRETunnelGetParams, + }; } diff --git a/src/resources/magic-transit/index.ts b/src/resources/magic-transit/index.ts index e8710f4ca0..fde6118759 100644 --- a/src/resources/magic-transit/index.ts +++ b/src/resources/magic-transit/index.ts @@ -1,93 +1,113 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AppCreateResponse, - AppUpdateResponse, - AppListResponse, - AppDeleteResponse, - AppCreateParams, - AppUpdateParams, - AppListParams, - AppDeleteParams, AppListResponsesSinglePage, Apps, + type AppCreateResponse, + type AppUpdateResponse, + type AppListResponse, + type AppDeleteResponse, + type AppCreateParams, + type AppUpdateParams, + type AppListParams, + type AppDeleteParams, } from './apps'; export { - CfInterconnectUpdateResponse, - CfInterconnectListResponse, - CfInterconnectGetResponse, - CfInterconnectUpdateParams, - CfInterconnectListParams, - CfInterconnectGetParams, CfInterconnects, + type CfInterconnectUpdateResponse, + type CfInterconnectListResponse, + type CfInterconnectBulkUpdateResponse, + type CfInterconnectGetResponse, + type CfInterconnectUpdateParams, + type CfInterconnectListParams, + type CfInterconnectBulkUpdateParams, + type CfInterconnectGetParams, } from './cf-interconnects'; export { - ConnectorUpdateResponse, - ConnectorListResponse, - ConnectorEditResponse, - ConnectorGetResponse, - ConnectorUpdateParams, - ConnectorListParams, - ConnectorEditParams, - ConnectorGetParams, ConnectorListResponsesSinglePage, Connectors, + type ConnectorUpdateResponse, + type ConnectorListResponse, + type ConnectorEditResponse, + type ConnectorGetResponse, + type ConnectorUpdateParams, + type ConnectorListParams, + type ConnectorEditParams, + type ConnectorGetParams, } from './connectors'; export { - GRETunnelCreateResponse, - GRETunnelUpdateResponse, - GRETunnelListResponse, - GRETunnelDeleteResponse, - GRETunnelGetResponse, - GRETunnelCreateParams, - GRETunnelUpdateParams, - GRETunnelListParams, - GRETunnelDeleteParams, - GRETunnelGetParams, GRETunnels, + type GRETunnelCreateResponse, + type GRETunnelUpdateResponse, + type GRETunnelListResponse, + type GRETunnelDeleteResponse, + type GRETunnelBulkUpdateResponse, + type GRETunnelGetResponse, + type GRETunnelCreateParams, + type GRETunnelUpdateParams, + type GRETunnelListParams, + type GRETunnelDeleteParams, + type GRETunnelBulkUpdateParams, + type GRETunnelGetParams, } from './gre-tunnels'; -export { MagicTransit } from './magic-transit'; export { - PSKMetadata, - IPSECTunnelCreateResponse, - IPSECTunnelUpdateResponse, - IPSECTunnelListResponse, - IPSECTunnelDeleteResponse, - IPSECTunnelGetResponse, - IPSECTunnelPSKGenerateResponse, - IPSECTunnelCreateParams, - IPSECTunnelUpdateParams, - IPSECTunnelListParams, - IPSECTunnelDeleteParams, - IPSECTunnelGetParams, - IPSECTunnelPSKGenerateParams, IPSECTunnels, + type PSKMetadata, + type IPSECTunnelCreateResponse, + type IPSECTunnelUpdateResponse, + type IPSECTunnelListResponse, + type IPSECTunnelDeleteResponse, + type IPSECTunnelBulkUpdateResponse, + type IPSECTunnelGetResponse, + type IPSECTunnelPSKGenerateResponse, + type IPSECTunnelCreateParams, + type IPSECTunnelUpdateParams, + type IPSECTunnelListParams, + type IPSECTunnelDeleteParams, + type IPSECTunnelBulkUpdateParams, + type IPSECTunnelGetParams, + type IPSECTunnelPSKGenerateParams, } from './ipsec-tunnels'; +export { MagicTransit } from './magic-transit'; +export { + PCAPListResponsesSinglePage, + PCAPs, + type PCAP, + type PCAPFilter, + type PCAPCreateResponse, + type PCAPListResponse, + type PCAPGetResponse, + type PCAPCreateParams, + type PCAPListParams, + type PCAPGetParams, +} from './pcaps/index'; export { - Scope, - RouteCreateResponse, - RouteUpdateResponse, - RouteListResponse, - RouteDeleteResponse, - RouteEmptyResponse, - RouteGetResponse, - RouteCreateParams, - RouteUpdateParams, - RouteListParams, - RouteDeleteParams, - RouteEmptyParams, - RouteGetParams, Routes, + type Scope, + type RouteCreateResponse, + type RouteUpdateResponse, + type RouteListResponse, + type RouteDeleteResponse, + type RouteBulkUpdateResponse, + type RouteEmptyResponse, + type RouteGetResponse, + type RouteCreateParams, + type RouteUpdateParams, + type RouteListParams, + type RouteDeleteParams, + type RouteBulkUpdateParams, + type RouteEmptyParams, + type RouteGetParams, } from './routes'; export { - Site, - SiteLocation, - SiteCreateParams, - SiteUpdateParams, - SiteListParams, - SiteDeleteParams, - SiteEditParams, - SiteGetParams, SitesSinglePage, Sites, + type Site, + type SiteLocation, + type SiteCreateParams, + type SiteUpdateParams, + type SiteListParams, + type SiteDeleteParams, + type SiteEditParams, + type SiteGetParams, } from './sites/index'; diff --git a/src/resources/magic-transit/ipsec-tunnels.ts b/src/resources/magic-transit/ipsec-tunnels.ts index f018871a94..132570f9bb 100644 --- a/src/resources/magic-transit/ipsec-tunnels.ts +++ b/src/resources/magic-transit/ipsec-tunnels.ts @@ -15,11 +15,17 @@ export class IPSECTunnels extends APIResource { params: IPSECTunnelCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, ...body } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget, ...body } = params; return ( this._client.post(`/accounts/${account_id}/magic/ipsec_tunnels`, { body, ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, }) as Core.APIPromise<{ result: IPSECTunnelCreateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -34,11 +40,17 @@ export class IPSECTunnels extends APIResource { params: IPSECTunnelUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, ...body } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget, ...body } = params; return ( this._client.put(`/accounts/${account_id}/magic/ipsec_tunnels/${ipsecTunnelId}`, { body, ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, }) as Core.APIPromise<{ result: IPSECTunnelUpdateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -50,11 +62,17 @@ export class IPSECTunnels extends APIResource { params: IPSECTunnelListParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( - this._client.get(`/accounts/${account_id}/magic/ipsec_tunnels`, options) as Core.APIPromise<{ - result: IPSECTunnelListResponse; - }> + this._client.get(`/accounts/${account_id}/magic/ipsec_tunnels`, { + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: IPSECTunnelListResponse }> )._thenUnwrap((obj) => obj.result); } @@ -68,12 +86,41 @@ export class IPSECTunnels extends APIResource { params: IPSECTunnelDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; + return ( + this._client.delete(`/accounts/${account_id}/magic/ipsec_tunnels/${ipsecTunnelId}`, { + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: IPSECTunnelDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update multiple IPsec tunnels associated with an account. Use + * `?validate_only=true` as an optional query parameter to only run validation + * without persisting changes. + */ + bulkUpdate( + params: IPSECTunnelBulkUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, body, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( - this._client.delete( - `/accounts/${account_id}/magic/ipsec_tunnels/${ipsecTunnelId}`, - options, - ) as Core.APIPromise<{ result: IPSECTunnelDeleteResponse }> + this._client.put(`/accounts/${account_id}/magic/ipsec_tunnels`, { + body: body, + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: IPSECTunnelBulkUpdateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -85,12 +132,17 @@ export class IPSECTunnels extends APIResource { params: IPSECTunnelGetParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( - this._client.get( - `/accounts/${account_id}/magic/ipsec_tunnels/${ipsecTunnelId}`, - options, - ) as Core.APIPromise<{ result: IPSECTunnelGetResponse }> + this._client.get(`/accounts/${account_id}/magic/ipsec_tunnels/${ipsecTunnelId}`, { + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: IPSECTunnelGetResponse }> )._thenUnwrap((obj) => obj.result); } @@ -176,6 +228,8 @@ export namespace IPSECTunnelCreateResponse { */ description?: string; + health_check?: IPSECTunnel.HealthCheck; + /** * The date and time the tunnel was last modified. */ @@ -191,12 +245,18 @@ export namespace IPSECTunnelCreateResponse { * Cloudflare-to-customer direction. */ replay_protection?: boolean; - - tunnel_health_check?: IPSECTunnel.TunnelHealthCheck; } export namespace IPSECTunnel { - export interface TunnelHealthCheck { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + /** * Determines whether to run healthchecks for a tunnel. */ @@ -210,22 +270,178 @@ export namespace IPSECTunnelCreateResponse { /** * The destination address in a request type health check. After the healthcheck is * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - * to this address. This field defaults to `customer_gre_endpoint address`. + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. */ - target?: string; + target?: HealthCheck.MagicHealthCheckTarget | string; /** * The type of healthcheck to run, reply or request. The default value is `reply`. */ type?: MagicTransitAPI.HealthCheckType; } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } } } export interface IPSECTunnelUpdateResponse { modified?: boolean; - modified_ipsec_tunnel?: unknown; + modified_ipsec_tunnel?: IPSECTunnelUpdateResponse.ModifiedIPSECTunnel; +} + +export namespace IPSECTunnelUpdateResponse { + export interface ModifiedIPSECTunnel { + /** + * The IP address assigned to the Cloudflare side of the IPsec tunnel. + */ + cloudflare_endpoint: string; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address: string; + + /** + * The name of the IPsec tunnel. The name cannot share a name with other tunnels. + */ + name: string; + + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel + * (Phase 2). + */ + allow_null_cipher?: boolean; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * The IP address assigned to the customer side of the IPsec tunnel. Not required, + * but must be set for proactive traceroutes to work. + */ + customer_endpoint?: string; + + /** + * An optional description forthe IPsec tunnel. + */ + description?: string; + + health_check?: ModifiedIPSECTunnel.HealthCheck; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * The PSK metadata that includes when the PSK was generated. + */ + psk_metadata?: IPSECTunnelsAPI.PSKMetadata; + + /** + * If `true`, then IPsec replay protection will be supported in the + * Cloudflare-to-customer direction. + */ + replay_protection?: boolean; + } + + export namespace ModifiedIPSECTunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } } export interface IPSECTunnelListResponse { @@ -278,6 +494,8 @@ export namespace IPSECTunnelListResponse { */ description?: string; + health_check?: IPSECTunnel.HealthCheck; + /** * The date and time the tunnel was last modified. */ @@ -293,12 +511,18 @@ export namespace IPSECTunnelListResponse { * Cloudflare-to-customer direction. */ replay_protection?: boolean; - - tunnel_health_check?: IPSECTunnel.TunnelHealthCheck; } export namespace IPSECTunnel { - export interface TunnelHealthCheck { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + /** * Determines whether to run healthchecks for a tunnel. */ @@ -312,26 +536,444 @@ export namespace IPSECTunnelListResponse { /** * The destination address in a request type health check. After the healthcheck is * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded - * to this address. This field defaults to `customer_gre_endpoint address`. + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. */ - target?: string; + target?: HealthCheck.MagicHealthCheckTarget | string; /** * The type of healthcheck to run, reply or request. The default value is `reply`. */ type?: MagicTransitAPI.HealthCheckType; } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } } } export interface IPSECTunnelDeleteResponse { deleted?: boolean; - deleted_ipsec_tunnel?: unknown; + deleted_ipsec_tunnel?: IPSECTunnelDeleteResponse.DeletedIPSECTunnel; +} + +export namespace IPSECTunnelDeleteResponse { + export interface DeletedIPSECTunnel { + /** + * The IP address assigned to the Cloudflare side of the IPsec tunnel. + */ + cloudflare_endpoint: string; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address: string; + + /** + * The name of the IPsec tunnel. The name cannot share a name with other tunnels. + */ + name: string; + + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel + * (Phase 2). + */ + allow_null_cipher?: boolean; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * The IP address assigned to the customer side of the IPsec tunnel. Not required, + * but must be set for proactive traceroutes to work. + */ + customer_endpoint?: string; + + /** + * An optional description forthe IPsec tunnel. + */ + description?: string; + + health_check?: DeletedIPSECTunnel.HealthCheck; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * The PSK metadata that includes when the PSK was generated. + */ + psk_metadata?: IPSECTunnelsAPI.PSKMetadata; + + /** + * If `true`, then IPsec replay protection will be supported in the + * Cloudflare-to-customer direction. + */ + replay_protection?: boolean; + } + + export namespace DeletedIPSECTunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } +} + +export interface IPSECTunnelBulkUpdateResponse { + modified?: boolean; + + modified_ipsec_tunnels?: Array; +} + +export namespace IPSECTunnelBulkUpdateResponse { + export interface ModifiedIPSECTunnel { + /** + * The IP address assigned to the Cloudflare side of the IPsec tunnel. + */ + cloudflare_endpoint: string; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address: string; + + /** + * The name of the IPsec tunnel. The name cannot share a name with other tunnels. + */ + name: string; + + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel + * (Phase 2). + */ + allow_null_cipher?: boolean; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * The IP address assigned to the customer side of the IPsec tunnel. Not required, + * but must be set for proactive traceroutes to work. + */ + customer_endpoint?: string; + + /** + * An optional description forthe IPsec tunnel. + */ + description?: string; + + health_check?: ModifiedIPSECTunnel.HealthCheck; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * The PSK metadata that includes when the PSK was generated. + */ + psk_metadata?: IPSECTunnelsAPI.PSKMetadata; + + /** + * If `true`, then IPsec replay protection will be supported in the + * Cloudflare-to-customer direction. + */ + replay_protection?: boolean; + } + + export namespace ModifiedIPSECTunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } } export interface IPSECTunnelGetResponse { - ipsec_tunnel?: unknown; + ipsec_tunnel?: IPSECTunnelGetResponse.IPSECTunnel; +} + +export namespace IPSECTunnelGetResponse { + export interface IPSECTunnel { + /** + * The IP address assigned to the Cloudflare side of the IPsec tunnel. + */ + cloudflare_endpoint: string; + + /** + * A 31-bit prefix (/31 in CIDR notation) supporting two hosts, one for each side + * of the tunnel. Select the subnet from the following private IP space: + * 10.0.0.0–10.255.255.255, 172.16.0.0–172.31.255.255, 192.168.0.0–192.168.255.255. + */ + interface_address: string; + + /** + * The name of the IPsec tunnel. The name cannot share a name with other tunnels. + */ + name: string; + + /** + * Tunnel identifier tag. + */ + id?: string; + + /** + * When `true`, the tunnel can use a null-cipher (`ENCR_NULL`) in the ESP tunnel + * (Phase 2). + */ + allow_null_cipher?: boolean; + + /** + * The date and time the tunnel was created. + */ + created_on?: string; + + /** + * The IP address assigned to the customer side of the IPsec tunnel. Not required, + * but must be set for proactive traceroutes to work. + */ + customer_endpoint?: string; + + /** + * An optional description forthe IPsec tunnel. + */ + description?: string; + + health_check?: IPSECTunnel.HealthCheck; + + /** + * The date and time the tunnel was last modified. + */ + modified_on?: string; + + /** + * The PSK metadata that includes when the PSK was generated. + */ + psk_metadata?: IPSECTunnelsAPI.PSKMetadata; + + /** + * If `true`, then IPsec replay protection will be supported in the + * Cloudflare-to-customer direction. + */ + replay_protection?: boolean; + } + + export namespace IPSECTunnel { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRate; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckType; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } + } } export interface IPSECTunnelPSKGenerateResponse { @@ -389,7 +1031,7 @@ export interface IPSECTunnelCreateParams { /** * Body param: */ - health_check?: MagicTransitAPI.HealthCheckParam; + health_check?: IPSECTunnelCreateParams.HealthCheck; /** * Body param: A randomly generated or provided string for use in the IPsec tunnel. @@ -401,6 +1043,67 @@ export interface IPSECTunnelCreateParams { * Cloudflare-to-customer direction. */ replay_protection?: boolean; + + /** + * Header param: If true, the health check target in the request and response + * bodies will be presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; +} + +export namespace IPSECTunnelCreateParams { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRateParam; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckTypeParam; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } } export interface IPSECTunnelUpdateParams { @@ -441,7 +1144,7 @@ export interface IPSECTunnelUpdateParams { /** * Body param: */ - health_check?: MagicTransitAPI.HealthCheckParam; + health_check?: IPSECTunnelUpdateParams.HealthCheck; /** * Body param: A randomly generated or provided string for use in the IPsec tunnel. @@ -453,27 +1156,124 @@ export interface IPSECTunnelUpdateParams { * Cloudflare-to-customer direction. */ replay_protection?: boolean; + + /** + * Header param: If true, the health check target in the request and response + * bodies will be presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; +} + +export namespace IPSECTunnelUpdateParams { + export interface HealthCheck { + /** + * The direction of the flow of the healthcheck. Either unidirectional, where the + * probe comes to you via the tunnel and the result comes back to Cloudflare via + * the open Internet, or bidirectional where both the probe and result come and go + * via the tunnel. + */ + direction?: 'unidirectional' | 'bidirectional'; + + /** + * Determines whether to run healthchecks for a tunnel. + */ + enabled?: boolean; + + /** + * How frequent the health check is run. The default value is `mid`. + */ + rate?: MagicTransitAPI.HealthCheckRateParam; + + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. + */ + target?: HealthCheck.MagicHealthCheckTarget | string; + + /** + * The type of healthcheck to run, reply or request. The default value is `reply`. + */ + type?: MagicTransitAPI.HealthCheckTypeParam; + } + + export namespace HealthCheck { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } + } } export interface IPSECTunnelListParams { /** - * Identifier + * Path param: Identifier */ account_id: string; + + /** + * Header param: If true, the health check target in the response body will be + * presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } export interface IPSECTunnelDeleteParams { /** - * Identifier + * Path param: Identifier */ account_id: string; + + /** + * Header param: If true, the health check target in the response body will be + * presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; +} + +export interface IPSECTunnelBulkUpdateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: + */ + body: unknown; + + /** + * Header param: If true, the health check target in the request and response + * bodies will be presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } export interface IPSECTunnelGetParams { /** - * Identifier + * Path param: Identifier */ account_id: string; + + /** + * Header param: If true, the health check target in the response body will be + * presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } export interface IPSECTunnelPSKGenerateParams { @@ -488,18 +1288,22 @@ export interface IPSECTunnelPSKGenerateParams { body: unknown; } -export namespace IPSECTunnels { - export import PSKMetadata = IPSECTunnelsAPI.PSKMetadata; - export import IPSECTunnelCreateResponse = IPSECTunnelsAPI.IPSECTunnelCreateResponse; - export import IPSECTunnelUpdateResponse = IPSECTunnelsAPI.IPSECTunnelUpdateResponse; - export import IPSECTunnelListResponse = IPSECTunnelsAPI.IPSECTunnelListResponse; - export import IPSECTunnelDeleteResponse = IPSECTunnelsAPI.IPSECTunnelDeleteResponse; - export import IPSECTunnelGetResponse = IPSECTunnelsAPI.IPSECTunnelGetResponse; - export import IPSECTunnelPSKGenerateResponse = IPSECTunnelsAPI.IPSECTunnelPSKGenerateResponse; - export import IPSECTunnelCreateParams = IPSECTunnelsAPI.IPSECTunnelCreateParams; - export import IPSECTunnelUpdateParams = IPSECTunnelsAPI.IPSECTunnelUpdateParams; - export import IPSECTunnelListParams = IPSECTunnelsAPI.IPSECTunnelListParams; - export import IPSECTunnelDeleteParams = IPSECTunnelsAPI.IPSECTunnelDeleteParams; - export import IPSECTunnelGetParams = IPSECTunnelsAPI.IPSECTunnelGetParams; - export import IPSECTunnelPSKGenerateParams = IPSECTunnelsAPI.IPSECTunnelPSKGenerateParams; +export declare namespace IPSECTunnels { + export { + type PSKMetadata as PSKMetadata, + type IPSECTunnelCreateResponse as IPSECTunnelCreateResponse, + type IPSECTunnelUpdateResponse as IPSECTunnelUpdateResponse, + type IPSECTunnelListResponse as IPSECTunnelListResponse, + type IPSECTunnelDeleteResponse as IPSECTunnelDeleteResponse, + type IPSECTunnelBulkUpdateResponse as IPSECTunnelBulkUpdateResponse, + type IPSECTunnelGetResponse as IPSECTunnelGetResponse, + type IPSECTunnelPSKGenerateResponse as IPSECTunnelPSKGenerateResponse, + type IPSECTunnelCreateParams as IPSECTunnelCreateParams, + type IPSECTunnelUpdateParams as IPSECTunnelUpdateParams, + type IPSECTunnelListParams as IPSECTunnelListParams, + type IPSECTunnelDeleteParams as IPSECTunnelDeleteParams, + type IPSECTunnelBulkUpdateParams as IPSECTunnelBulkUpdateParams, + type IPSECTunnelGetParams as IPSECTunnelGetParams, + type IPSECTunnelPSKGenerateParams as IPSECTunnelPSKGenerateParams, + }; } diff --git a/src/resources/magic-transit/magic-transit.ts b/src/resources/magic-transit/magic-transit.ts index 91007679c4..f03a6dcb50 100644 --- a/src/resources/magic-transit/magic-transit.ts +++ b/src/resources/magic-transit/magic-transit.ts @@ -2,12 +2,123 @@ import { APIResource } from '../../resource'; import * as AppsAPI from './apps'; +import { + AppCreateParams, + AppCreateResponse, + AppDeleteParams, + AppDeleteResponse, + AppListParams, + AppListResponse, + AppListResponsesSinglePage, + AppUpdateParams, + AppUpdateResponse, + Apps, +} from './apps'; import * as CfInterconnectsAPI from './cf-interconnects'; +import { + CfInterconnectBulkUpdateParams, + CfInterconnectBulkUpdateResponse, + CfInterconnectGetParams, + CfInterconnectGetResponse, + CfInterconnectListParams, + CfInterconnectListResponse, + CfInterconnectUpdateParams, + CfInterconnectUpdateResponse, + CfInterconnects, +} from './cf-interconnects'; import * as ConnectorsAPI from './connectors'; +import { + ConnectorEditParams, + ConnectorEditResponse, + ConnectorGetParams, + ConnectorGetResponse, + ConnectorListParams, + ConnectorListResponse, + ConnectorListResponsesSinglePage, + ConnectorUpdateParams, + ConnectorUpdateResponse, + Connectors, +} from './connectors'; import * as GRETunnelsAPI from './gre-tunnels'; +import { + GRETunnelBulkUpdateParams, + GRETunnelBulkUpdateResponse, + GRETunnelCreateParams, + GRETunnelCreateResponse, + GRETunnelDeleteParams, + GRETunnelDeleteResponse, + GRETunnelGetParams, + GRETunnelGetResponse, + GRETunnelListParams, + GRETunnelListResponse, + GRETunnelUpdateParams, + GRETunnelUpdateResponse, + GRETunnels, +} from './gre-tunnels'; import * as IPSECTunnelsAPI from './ipsec-tunnels'; +import { + IPSECTunnelBulkUpdateParams, + IPSECTunnelBulkUpdateResponse, + IPSECTunnelCreateParams, + IPSECTunnelCreateResponse, + IPSECTunnelDeleteParams, + IPSECTunnelDeleteResponse, + IPSECTunnelGetParams, + IPSECTunnelGetResponse, + IPSECTunnelListParams, + IPSECTunnelListResponse, + IPSECTunnelPSKGenerateParams, + IPSECTunnelPSKGenerateResponse, + IPSECTunnelUpdateParams, + IPSECTunnelUpdateResponse, + IPSECTunnels, + PSKMetadata, +} from './ipsec-tunnels'; import * as RoutesAPI from './routes'; +import { + RouteBulkUpdateParams, + RouteBulkUpdateResponse, + RouteCreateParams, + RouteCreateResponse, + RouteDeleteParams, + RouteDeleteResponse, + RouteEmptyParams, + RouteEmptyResponse, + RouteGetParams, + RouteGetResponse, + RouteListParams, + RouteListResponse, + RouteUpdateParams, + RouteUpdateResponse, + Routes, + Scope, +} from './routes'; +import * as PCAPsAPI from './pcaps/pcaps'; +import { + PCAP, + PCAPCreateParams, + PCAPCreateResponse, + PCAPFilter, + PCAPGetParams, + PCAPGetResponse, + PCAPListParams, + PCAPListResponse, + PCAPListResponsesSinglePage, + PCAPs, +} from './pcaps/pcaps'; import * as SitesAPI from './sites/sites'; +import { + Site, + SiteCreateParams, + SiteDeleteParams, + SiteEditParams, + SiteGetParams, + SiteListParams, + SiteLocation, + SiteUpdateParams, + Sites, + SitesSinglePage, +} from './sites/sites'; export class MagicTransit extends APIResource { apps: AppsAPI.Apps = new AppsAPI.Apps(this._client); @@ -17,19 +128,10 @@ export class MagicTransit extends APIResource { routes: RoutesAPI.Routes = new RoutesAPI.Routes(this._client); sites: SitesAPI.Sites = new SitesAPI.Sites(this._client); connectors: ConnectorsAPI.Connectors = new ConnectorsAPI.Connectors(this._client); + pcaps: PCAPsAPI.PCAPs = new PCAPsAPI.PCAPs(this._client); } export interface HealthCheck { - /** - * The direction of the flow of the healthcheck. Either unidirectional, where the - * probe comes to you via the tunnel and the result comes back to Cloudflare via - * the open Internet, or bidirectional where both the probe and result come and go - * via the tunnel. Note in the case of bidirecitonal healthchecks, the target field - * in health_check is ignored as the interface_address is used to send traffic into - * the tunnel. - */ - direction?: 'unidirectional' | 'bidirectional'; - /** * Determines whether to run healthchecks for a tunnel. */ @@ -45,9 +147,11 @@ export interface HealthCheck { * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded * to this address. This field defaults to `customer_gre_endpoint address`. This * field is ignored for bidirectional healthchecks as the interface_address (not - * assigned to the Cloudflare side of the tunnel) is used as the target. + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. */ - target?: string; + target?: HealthCheck.MagicHealthCheckTarget | string; /** * The type of healthcheck to run, reply or request. The default value is `reply`. @@ -55,17 +159,31 @@ export interface HealthCheck { type?: HealthCheckType; } -export interface HealthCheckParam { +export namespace HealthCheck { /** - * The direction of the flow of the healthcheck. Either unidirectional, where the - * probe comes to you via the tunnel and the result comes back to Cloudflare via - * the open Internet, or bidirectional where both the probe and result come and go - * via the tunnel. Note in the case of bidirecitonal healthchecks, the target field - * in health_check is ignored as the interface_address is used to send traffic into - * the tunnel. + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. */ - direction?: 'unidirectional' | 'bidirectional'; + export interface MagicHealthCheckTarget { + /** + * The effective health check target. If 'saved' is empty, then this field will be + * populated with the calculated default value on GET requests. Ignored in POST, + * PUT, and PATCH requests. + */ + effective?: string; + + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } +} +export interface HealthCheckParam { /** * Determines whether to run healthchecks for a tunnel. */ @@ -81,9 +199,11 @@ export interface HealthCheckParam { * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded * to this address. This field defaults to `customer_gre_endpoint address`. This * field is ignored for bidirectional healthchecks as the interface_address (not - * assigned to the Cloudflare side of the tunnel) is used as the target. + * assigned to the Cloudflare side of the tunnel) is used as the target. Must be in + * object form if the x-magic-new-hc-target header is set to true and string form + * if x-magic-new-hc-target is absent or set to false. */ - target?: string; + target?: HealthCheckParam.MagicHealthCheckTarget | string; /** * The type of healthcheck to run, reply or request. The default value is `reply`. @@ -91,6 +211,23 @@ export interface HealthCheckParam { type?: HealthCheckTypeParam; } +export namespace HealthCheckParam { + /** + * The destination address in a request type health check. After the healthcheck is + * decapsulated at the customer end of the tunnel, the ICMP echo will be forwarded + * to this address. This field defaults to `customer_gre_endpoint address`. This + * field is ignored for bidirectional healthchecks as the interface_address (not + * assigned to the Cloudflare side of the tunnel) is used as the target. + */ + export interface MagicHealthCheckTarget { + /** + * The saved health check target. Setting the value to the empty string indicates + * that the calculated default value will be used. + */ + saved?: string; + } +} + /** * How frequent the health check is run. The default value is `mid`. */ @@ -111,81 +248,135 @@ export type HealthCheckType = 'reply' | 'request'; */ export type HealthCheckTypeParam = 'reply' | 'request'; -export namespace MagicTransit { - export import Apps = AppsAPI.Apps; - export import AppCreateResponse = AppsAPI.AppCreateResponse; - export import AppUpdateResponse = AppsAPI.AppUpdateResponse; - export import AppListResponse = AppsAPI.AppListResponse; - export import AppDeleteResponse = AppsAPI.AppDeleteResponse; - export import AppListResponsesSinglePage = AppsAPI.AppListResponsesSinglePage; - export import AppCreateParams = AppsAPI.AppCreateParams; - export import AppUpdateParams = AppsAPI.AppUpdateParams; - export import AppListParams = AppsAPI.AppListParams; - export import AppDeleteParams = AppsAPI.AppDeleteParams; - export import CfInterconnects = CfInterconnectsAPI.CfInterconnects; - export import CfInterconnectUpdateResponse = CfInterconnectsAPI.CfInterconnectUpdateResponse; - export import CfInterconnectListResponse = CfInterconnectsAPI.CfInterconnectListResponse; - export import CfInterconnectGetResponse = CfInterconnectsAPI.CfInterconnectGetResponse; - export import CfInterconnectUpdateParams = CfInterconnectsAPI.CfInterconnectUpdateParams; - export import CfInterconnectListParams = CfInterconnectsAPI.CfInterconnectListParams; - export import CfInterconnectGetParams = CfInterconnectsAPI.CfInterconnectGetParams; - export import GRETunnels = GRETunnelsAPI.GRETunnels; - export import GRETunnelCreateResponse = GRETunnelsAPI.GRETunnelCreateResponse; - export import GRETunnelUpdateResponse = GRETunnelsAPI.GRETunnelUpdateResponse; - export import GRETunnelListResponse = GRETunnelsAPI.GRETunnelListResponse; - export import GRETunnelDeleteResponse = GRETunnelsAPI.GRETunnelDeleteResponse; - export import GRETunnelGetResponse = GRETunnelsAPI.GRETunnelGetResponse; - export import GRETunnelCreateParams = GRETunnelsAPI.GRETunnelCreateParams; - export import GRETunnelUpdateParams = GRETunnelsAPI.GRETunnelUpdateParams; - export import GRETunnelListParams = GRETunnelsAPI.GRETunnelListParams; - export import GRETunnelDeleteParams = GRETunnelsAPI.GRETunnelDeleteParams; - export import GRETunnelGetParams = GRETunnelsAPI.GRETunnelGetParams; - export import IPSECTunnels = IPSECTunnelsAPI.IPSECTunnels; - export import PSKMetadata = IPSECTunnelsAPI.PSKMetadata; - export import IPSECTunnelCreateResponse = IPSECTunnelsAPI.IPSECTunnelCreateResponse; - export import IPSECTunnelUpdateResponse = IPSECTunnelsAPI.IPSECTunnelUpdateResponse; - export import IPSECTunnelListResponse = IPSECTunnelsAPI.IPSECTunnelListResponse; - export import IPSECTunnelDeleteResponse = IPSECTunnelsAPI.IPSECTunnelDeleteResponse; - export import IPSECTunnelGetResponse = IPSECTunnelsAPI.IPSECTunnelGetResponse; - export import IPSECTunnelPSKGenerateResponse = IPSECTunnelsAPI.IPSECTunnelPSKGenerateResponse; - export import IPSECTunnelCreateParams = IPSECTunnelsAPI.IPSECTunnelCreateParams; - export import IPSECTunnelUpdateParams = IPSECTunnelsAPI.IPSECTunnelUpdateParams; - export import IPSECTunnelListParams = IPSECTunnelsAPI.IPSECTunnelListParams; - export import IPSECTunnelDeleteParams = IPSECTunnelsAPI.IPSECTunnelDeleteParams; - export import IPSECTunnelGetParams = IPSECTunnelsAPI.IPSECTunnelGetParams; - export import IPSECTunnelPSKGenerateParams = IPSECTunnelsAPI.IPSECTunnelPSKGenerateParams; - export import Routes = RoutesAPI.Routes; - export import Scope = RoutesAPI.Scope; - export import RouteCreateResponse = RoutesAPI.RouteCreateResponse; - export import RouteUpdateResponse = RoutesAPI.RouteUpdateResponse; - export import RouteListResponse = RoutesAPI.RouteListResponse; - export import RouteDeleteResponse = RoutesAPI.RouteDeleteResponse; - export import RouteEmptyResponse = RoutesAPI.RouteEmptyResponse; - export import RouteGetResponse = RoutesAPI.RouteGetResponse; - export import RouteCreateParams = RoutesAPI.RouteCreateParams; - export import RouteUpdateParams = RoutesAPI.RouteUpdateParams; - export import RouteListParams = RoutesAPI.RouteListParams; - export import RouteDeleteParams = RoutesAPI.RouteDeleteParams; - export import RouteEmptyParams = RoutesAPI.RouteEmptyParams; - export import RouteGetParams = RoutesAPI.RouteGetParams; - export import Sites = SitesAPI.Sites; - export import Site = SitesAPI.Site; - export import SiteLocation = SitesAPI.SiteLocation; - export import SitesSinglePage = SitesAPI.SitesSinglePage; - export import SiteCreateParams = SitesAPI.SiteCreateParams; - export import SiteUpdateParams = SitesAPI.SiteUpdateParams; - export import SiteListParams = SitesAPI.SiteListParams; - export import SiteDeleteParams = SitesAPI.SiteDeleteParams; - export import SiteEditParams = SitesAPI.SiteEditParams; - export import SiteGetParams = SitesAPI.SiteGetParams; - export import Connectors = ConnectorsAPI.Connectors; - export import ConnectorUpdateResponse = ConnectorsAPI.ConnectorUpdateResponse; - export import ConnectorListResponse = ConnectorsAPI.ConnectorListResponse; - export import ConnectorEditResponse = ConnectorsAPI.ConnectorEditResponse; - export import ConnectorGetResponse = ConnectorsAPI.ConnectorGetResponse; - export import ConnectorListResponsesSinglePage = ConnectorsAPI.ConnectorListResponsesSinglePage; - export import ConnectorUpdateParams = ConnectorsAPI.ConnectorUpdateParams; - export import ConnectorListParams = ConnectorsAPI.ConnectorListParams; - export import ConnectorEditParams = ConnectorsAPI.ConnectorEditParams; - export import ConnectorGetParams = ConnectorsAPI.ConnectorGetParams; +MagicTransit.Apps = Apps; +MagicTransit.AppListResponsesSinglePage = AppListResponsesSinglePage; +MagicTransit.CfInterconnects = CfInterconnects; +MagicTransit.GRETunnels = GRETunnels; +MagicTransit.IPSECTunnels = IPSECTunnels; +MagicTransit.Routes = Routes; +MagicTransit.Sites = Sites; +MagicTransit.SitesSinglePage = SitesSinglePage; +MagicTransit.Connectors = Connectors; +MagicTransit.ConnectorListResponsesSinglePage = ConnectorListResponsesSinglePage; +MagicTransit.PCAPs = PCAPs; +MagicTransit.PCAPListResponsesSinglePage = PCAPListResponsesSinglePage; + +export declare namespace MagicTransit { + export { + Apps as Apps, + type AppCreateResponse as AppCreateResponse, + type AppUpdateResponse as AppUpdateResponse, + type AppListResponse as AppListResponse, + type AppDeleteResponse as AppDeleteResponse, + AppListResponsesSinglePage as AppListResponsesSinglePage, + type AppCreateParams as AppCreateParams, + type AppUpdateParams as AppUpdateParams, + type AppListParams as AppListParams, + type AppDeleteParams as AppDeleteParams, + }; + + export { + CfInterconnects as CfInterconnects, + type CfInterconnectUpdateResponse as CfInterconnectUpdateResponse, + type CfInterconnectListResponse as CfInterconnectListResponse, + type CfInterconnectBulkUpdateResponse as CfInterconnectBulkUpdateResponse, + type CfInterconnectGetResponse as CfInterconnectGetResponse, + type CfInterconnectUpdateParams as CfInterconnectUpdateParams, + type CfInterconnectListParams as CfInterconnectListParams, + type CfInterconnectBulkUpdateParams as CfInterconnectBulkUpdateParams, + type CfInterconnectGetParams as CfInterconnectGetParams, + }; + + export { + GRETunnels as GRETunnels, + type GRETunnelCreateResponse as GRETunnelCreateResponse, + type GRETunnelUpdateResponse as GRETunnelUpdateResponse, + type GRETunnelListResponse as GRETunnelListResponse, + type GRETunnelDeleteResponse as GRETunnelDeleteResponse, + type GRETunnelBulkUpdateResponse as GRETunnelBulkUpdateResponse, + type GRETunnelGetResponse as GRETunnelGetResponse, + type GRETunnelCreateParams as GRETunnelCreateParams, + type GRETunnelUpdateParams as GRETunnelUpdateParams, + type GRETunnelListParams as GRETunnelListParams, + type GRETunnelDeleteParams as GRETunnelDeleteParams, + type GRETunnelBulkUpdateParams as GRETunnelBulkUpdateParams, + type GRETunnelGetParams as GRETunnelGetParams, + }; + + export { + IPSECTunnels as IPSECTunnels, + type PSKMetadata as PSKMetadata, + type IPSECTunnelCreateResponse as IPSECTunnelCreateResponse, + type IPSECTunnelUpdateResponse as IPSECTunnelUpdateResponse, + type IPSECTunnelListResponse as IPSECTunnelListResponse, + type IPSECTunnelDeleteResponse as IPSECTunnelDeleteResponse, + type IPSECTunnelBulkUpdateResponse as IPSECTunnelBulkUpdateResponse, + type IPSECTunnelGetResponse as IPSECTunnelGetResponse, + type IPSECTunnelPSKGenerateResponse as IPSECTunnelPSKGenerateResponse, + type IPSECTunnelCreateParams as IPSECTunnelCreateParams, + type IPSECTunnelUpdateParams as IPSECTunnelUpdateParams, + type IPSECTunnelListParams as IPSECTunnelListParams, + type IPSECTunnelDeleteParams as IPSECTunnelDeleteParams, + type IPSECTunnelBulkUpdateParams as IPSECTunnelBulkUpdateParams, + type IPSECTunnelGetParams as IPSECTunnelGetParams, + type IPSECTunnelPSKGenerateParams as IPSECTunnelPSKGenerateParams, + }; + + export { + Routes as Routes, + type Scope as Scope, + type RouteCreateResponse as RouteCreateResponse, + type RouteUpdateResponse as RouteUpdateResponse, + type RouteListResponse as RouteListResponse, + type RouteDeleteResponse as RouteDeleteResponse, + type RouteBulkUpdateResponse as RouteBulkUpdateResponse, + type RouteEmptyResponse as RouteEmptyResponse, + type RouteGetResponse as RouteGetResponse, + type RouteCreateParams as RouteCreateParams, + type RouteUpdateParams as RouteUpdateParams, + type RouteListParams as RouteListParams, + type RouteDeleteParams as RouteDeleteParams, + type RouteBulkUpdateParams as RouteBulkUpdateParams, + type RouteEmptyParams as RouteEmptyParams, + type RouteGetParams as RouteGetParams, + }; + + export { + Sites as Sites, + type Site as Site, + type SiteLocation as SiteLocation, + SitesSinglePage as SitesSinglePage, + type SiteCreateParams as SiteCreateParams, + type SiteUpdateParams as SiteUpdateParams, + type SiteListParams as SiteListParams, + type SiteDeleteParams as SiteDeleteParams, + type SiteEditParams as SiteEditParams, + type SiteGetParams as SiteGetParams, + }; + + export { + Connectors as Connectors, + type ConnectorUpdateResponse as ConnectorUpdateResponse, + type ConnectorListResponse as ConnectorListResponse, + type ConnectorEditResponse as ConnectorEditResponse, + type ConnectorGetResponse as ConnectorGetResponse, + ConnectorListResponsesSinglePage as ConnectorListResponsesSinglePage, + type ConnectorUpdateParams as ConnectorUpdateParams, + type ConnectorListParams as ConnectorListParams, + type ConnectorEditParams as ConnectorEditParams, + type ConnectorGetParams as ConnectorGetParams, + }; + + export { + PCAPs as PCAPs, + type PCAP as PCAP, + type PCAPFilter as PCAPFilter, + type PCAPCreateResponse as PCAPCreateResponse, + type PCAPListResponse as PCAPListResponse, + type PCAPGetResponse as PCAPGetResponse, + PCAPListResponsesSinglePage as PCAPListResponsesSinglePage, + type PCAPCreateParams as PCAPCreateParams, + type PCAPListParams as PCAPListParams, + type PCAPGetParams as PCAPGetParams, + }; } diff --git a/src/resources/pcaps/download.ts b/src/resources/magic-transit/pcaps/download.ts similarity index 65% rename from src/resources/pcaps/download.ts rename to src/resources/magic-transit/pcaps/download.ts index 9e001f1fe2..ac50f6fafa 100644 --- a/src/resources/pcaps/download.ts +++ b/src/resources/magic-transit/pcaps/download.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as DownloadAPI from './download'; -import { type Response } from '../../_shims/index'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { type Response } from '../../../_shims/index'; export class Download extends APIResource { /** @@ -13,6 +12,7 @@ export class Download extends APIResource { const { account_id } = params; return this._client.get(`/accounts/${account_id}/pcaps/${pcapId}/download`, { ...options, + headers: { Accept: 'application/vnd.tcpdump.pcap', ...options?.headers }, __binaryResponse: true, }); } @@ -25,6 +25,6 @@ export interface DownloadGetParams { account_id: string; } -export namespace Download { - export import DownloadGetParams = DownloadAPI.DownloadGetParams; +export declare namespace Download { + export { type DownloadGetParams as DownloadGetParams }; } diff --git a/src/resources/magic-transit/pcaps/index.ts b/src/resources/magic-transit/pcaps/index.ts new file mode 100644 index 0000000000..dfcfe14b82 --- /dev/null +++ b/src/resources/magic-transit/pcaps/index.ts @@ -0,0 +1,24 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Download, type DownloadGetParams } from './download'; +export { + OwnershipResource, + type Ownership, + type OwnershipGetResponse, + type OwnershipCreateParams, + type OwnershipDeleteParams, + type OwnershipGetParams, + type OwnershipValidateParams, +} from './ownership'; +export { + PCAPListResponsesSinglePage, + PCAPs, + type PCAP, + type PCAPFilter, + type PCAPCreateResponse, + type PCAPListResponse, + type PCAPGetResponse, + type PCAPCreateParams, + type PCAPListParams, + type PCAPGetParams, +} from './pcaps'; diff --git a/src/resources/pcaps/ownership.ts b/src/resources/magic-transit/pcaps/ownership.ts similarity index 85% rename from src/resources/pcaps/ownership.ts rename to src/resources/magic-transit/pcaps/ownership.ts index 1b67e20f2d..63ebe6d17e 100644 --- a/src/resources/pcaps/ownership.ts +++ b/src/resources/magic-transit/pcaps/ownership.ts @@ -1,8 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as OwnershipAPI from './ownership'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; export class OwnershipResource extends APIResource { /** @@ -140,11 +139,13 @@ export interface OwnershipValidateParams { ownership_challenge: string; } -export namespace OwnershipResource { - export import Ownership = OwnershipAPI.Ownership; - export import OwnershipGetResponse = OwnershipAPI.OwnershipGetResponse; - export import OwnershipCreateParams = OwnershipAPI.OwnershipCreateParams; - export import OwnershipDeleteParams = OwnershipAPI.OwnershipDeleteParams; - export import OwnershipGetParams = OwnershipAPI.OwnershipGetParams; - export import OwnershipValidateParams = OwnershipAPI.OwnershipValidateParams; +export declare namespace OwnershipResource { + export { + type Ownership as Ownership, + type OwnershipGetResponse as OwnershipGetResponse, + type OwnershipCreateParams as OwnershipCreateParams, + type OwnershipDeleteParams as OwnershipDeleteParams, + type OwnershipGetParams as OwnershipGetParams, + type OwnershipValidateParams as OwnershipValidateParams, + }; } diff --git a/src/resources/pcaps/pcaps.ts b/src/resources/magic-transit/pcaps/pcaps.ts similarity index 84% rename from src/resources/pcaps/pcaps.ts rename to src/resources/magic-transit/pcaps/pcaps.ts index f92aa8754a..932036f5cc 100644 --- a/src/resources/pcaps/pcaps.ts +++ b/src/resources/magic-transit/pcaps/pcaps.ts @@ -1,11 +1,21 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; import * as PCAPsAPI from './pcaps'; import * as DownloadAPI from './download'; +import { Download, DownloadGetParams } from './download'; import * as OwnershipAPI from './ownership'; -import { SinglePage } from '../../pagination'; +import { + Ownership, + OwnershipCreateParams, + OwnershipDeleteParams, + OwnershipGetParams, + OwnershipGetResponse, + OwnershipResource, + OwnershipValidateParams, +} from './ownership'; +import { SinglePage } from '../../../pagination'; export class PCAPs extends APIResource { ownership: OwnershipAPI.OwnershipResource = new OwnershipAPI.OwnershipResource(this._client); @@ -159,10 +169,10 @@ export interface PCAPFilterParam { source_port?: number; } -export type PCAPCreateResponse = PCAP | PCAPCreateResponse.MagicVisibilityPCAPsResponseFull; +export type PCAPCreateResponse = PCAP | PCAPCreateResponse.MagicVisibilityPCAPsPCAPsResponseFull; export namespace PCAPCreateResponse { - export interface MagicVisibilityPCAPsResponseFull { + export interface MagicVisibilityPCAPsPCAPsResponseFull { /** * The ID for the packet capture. */ @@ -233,10 +243,10 @@ export namespace PCAPCreateResponse { } } -export type PCAPListResponse = PCAP | PCAPListResponse.MagicVisibilityPCAPsResponseFull; +export type PCAPListResponse = PCAP | PCAPListResponse.MagicVisibilityPCAPsPCAPsResponseFull; export namespace PCAPListResponse { - export interface MagicVisibilityPCAPsResponseFull { + export interface MagicVisibilityPCAPsPCAPsResponseFull { /** * The ID for the packet capture. */ @@ -307,10 +317,10 @@ export namespace PCAPListResponse { } } -export type PCAPGetResponse = PCAP | PCAPGetResponse.MagicVisibilityPCAPsResponseFull; +export type PCAPGetResponse = PCAP | PCAPGetResponse.MagicVisibilityPCAPsPCAPsResponseFull; export namespace PCAPGetResponse { - export interface MagicVisibilityPCAPsResponseFull { + export interface MagicVisibilityPCAPsPCAPsResponseFull { /** * The ID for the packet capture. */ @@ -382,11 +392,11 @@ export namespace PCAPGetResponse { } export type PCAPCreateParams = - | PCAPCreateParams.MagicVisibilityPCAPsRequestSimple - | PCAPCreateParams.MagicVisibilityPCAPsRequestFull; + | PCAPCreateParams.MagicVisibilityPCAPsPCAPsRequestSimple + | PCAPCreateParams.MagicVisibilityPCAPsPCAPsRequestFull; -export namespace PCAPCreateParams { - export interface MagicVisibilityPCAPsRequestSimple { +export declare namespace PCAPCreateParams { + export interface MagicVisibilityPCAPsPCAPsRequestSimple { /** * Path param: Identifier */ @@ -420,7 +430,7 @@ export namespace PCAPCreateParams { filter_v1?: PCAPFilterParam; } - export interface MagicVisibilityPCAPsRequestFull { + export interface MagicVisibilityPCAPsPCAPsRequestFull { /** * Path param: Identifier */ @@ -488,14 +498,32 @@ export interface PCAPGetParams { account_id: string; } -export namespace PCAPs { - export import OwnershipResource = OwnershipAPI.OwnershipResource; - export import Ownership = OwnershipAPI.Ownership; - export import OwnershipGetResponse = OwnershipAPI.OwnershipGetResponse; - export import OwnershipCreateParams = OwnershipAPI.OwnershipCreateParams; - export import OwnershipDeleteParams = OwnershipAPI.OwnershipDeleteParams; - export import OwnershipGetParams = OwnershipAPI.OwnershipGetParams; - export import OwnershipValidateParams = OwnershipAPI.OwnershipValidateParams; - export import Download = DownloadAPI.Download; - export import DownloadGetParams = DownloadAPI.DownloadGetParams; +PCAPs.PCAPListResponsesSinglePage = PCAPListResponsesSinglePage; +PCAPs.OwnershipResource = OwnershipResource; +PCAPs.Download = Download; + +export declare namespace PCAPs { + export { + type PCAP as PCAP, + type PCAPFilter as PCAPFilter, + type PCAPCreateResponse as PCAPCreateResponse, + type PCAPListResponse as PCAPListResponse, + type PCAPGetResponse as PCAPGetResponse, + PCAPListResponsesSinglePage as PCAPListResponsesSinglePage, + type PCAPCreateParams as PCAPCreateParams, + type PCAPListParams as PCAPListParams, + type PCAPGetParams as PCAPGetParams, + }; + + export { + OwnershipResource as OwnershipResource, + type Ownership as Ownership, + type OwnershipGetResponse as OwnershipGetResponse, + type OwnershipCreateParams as OwnershipCreateParams, + type OwnershipDeleteParams as OwnershipDeleteParams, + type OwnershipGetParams as OwnershipGetParams, + type OwnershipValidateParams as OwnershipValidateParams, + }; + + export { Download as Download, type DownloadGetParams as DownloadGetParams }; } diff --git a/src/resources/magic-transit/routes.ts b/src/resources/magic-transit/routes.ts index 0eb6604507..841f3aaf9d 100644 --- a/src/resources/magic-transit/routes.ts +++ b/src/resources/magic-transit/routes.ts @@ -65,6 +65,23 @@ export class Routes extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Update multiple Magic static routes. Use `?validate_only=true` as an optional + * query parameter to run validation only without persisting changes. Only fields + * for a route that need to be changed need be provided. + */ + bulkUpdate( + params: RouteBulkUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/magic/routes`, { body, ...options }) as Core.APIPromise<{ + result: RouteBulkUpdateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + /** * Delete multiple Magic static routes. */ @@ -180,7 +197,56 @@ export namespace RouteCreateResponse { export interface RouteUpdateResponse { modified?: boolean; - modified_route?: unknown; + modified_route?: RouteUpdateResponse.ModifiedRoute; +} + +export namespace RouteUpdateResponse { + export interface ModifiedRoute { + /** + * The next-hop IP Address for the static route. + */ + nexthop: string; + + /** + * IP Prefix in Classless Inter-Domain Routing format. + */ + prefix: string; + + /** + * Priority of the static route. + */ + priority: number; + + /** + * Identifier + */ + id?: string; + + /** + * When the route was created. + */ + created_on?: string; + + /** + * An optional human provided description of the static route. + */ + description?: string; + + /** + * When the route was last modified. + */ + modified_on?: string; + + /** + * Used only for ECMP routes. + */ + scope?: RoutesAPI.Scope; + + /** + * Optional weight of the ECMP scope - if provided. + */ + weight?: number; + } } export interface RouteListResponse { @@ -239,17 +305,219 @@ export namespace RouteListResponse { export interface RouteDeleteResponse { deleted?: boolean; - deleted_route?: unknown; + deleted_route?: RouteDeleteResponse.DeletedRoute; +} + +export namespace RouteDeleteResponse { + export interface DeletedRoute { + /** + * The next-hop IP Address for the static route. + */ + nexthop: string; + + /** + * IP Prefix in Classless Inter-Domain Routing format. + */ + prefix: string; + + /** + * Priority of the static route. + */ + priority: number; + + /** + * Identifier + */ + id?: string; + + /** + * When the route was created. + */ + created_on?: string; + + /** + * An optional human provided description of the static route. + */ + description?: string; + + /** + * When the route was last modified. + */ + modified_on?: string; + + /** + * Used only for ECMP routes. + */ + scope?: RoutesAPI.Scope; + + /** + * Optional weight of the ECMP scope - if provided. + */ + weight?: number; + } +} + +export interface RouteBulkUpdateResponse { + modified?: boolean; + + modified_routes?: Array; +} + +export namespace RouteBulkUpdateResponse { + export interface ModifiedRoute { + /** + * The next-hop IP Address for the static route. + */ + nexthop: string; + + /** + * IP Prefix in Classless Inter-Domain Routing format. + */ + prefix: string; + + /** + * Priority of the static route. + */ + priority: number; + + /** + * Identifier + */ + id?: string; + + /** + * When the route was created. + */ + created_on?: string; + + /** + * An optional human provided description of the static route. + */ + description?: string; + + /** + * When the route was last modified. + */ + modified_on?: string; + + /** + * Used only for ECMP routes. + */ + scope?: RoutesAPI.Scope; + + /** + * Optional weight of the ECMP scope - if provided. + */ + weight?: number; + } } export interface RouteEmptyResponse { deleted?: boolean; - deleted_routes?: unknown; + deleted_routes?: Array; +} + +export namespace RouteEmptyResponse { + export interface DeletedRoute { + /** + * The next-hop IP Address for the static route. + */ + nexthop: string; + + /** + * IP Prefix in Classless Inter-Domain Routing format. + */ + prefix: string; + + /** + * Priority of the static route. + */ + priority: number; + + /** + * Identifier + */ + id?: string; + + /** + * When the route was created. + */ + created_on?: string; + + /** + * An optional human provided description of the static route. + */ + description?: string; + + /** + * When the route was last modified. + */ + modified_on?: string; + + /** + * Used only for ECMP routes. + */ + scope?: RoutesAPI.Scope; + + /** + * Optional weight of the ECMP scope - if provided. + */ + weight?: number; + } } export interface RouteGetResponse { - route?: unknown; + route?: RouteGetResponse.Route; +} + +export namespace RouteGetResponse { + export interface Route { + /** + * The next-hop IP Address for the static route. + */ + nexthop: string; + + /** + * IP Prefix in Classless Inter-Domain Routing format. + */ + prefix: string; + + /** + * Priority of the static route. + */ + priority: number; + + /** + * Identifier + */ + id?: string; + + /** + * When the route was created. + */ + created_on?: string; + + /** + * An optional human provided description of the static route. + */ + description?: string; + + /** + * When the route was last modified. + */ + modified_on?: string; + + /** + * Used only for ECMP routes. + */ + scope?: RoutesAPI.Scope; + + /** + * Optional weight of the ECMP scope - if provided. + */ + weight?: number; + } } export interface RouteCreateParams { @@ -315,6 +583,57 @@ export interface RouteDeleteParams { account_id: string; } +export interface RouteBulkUpdateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: + */ + routes: Array; +} + +export namespace RouteBulkUpdateParams { + export interface Route { + /** + * Identifier + */ + id: string; + + /** + * The next-hop IP Address for the static route. + */ + nexthop: string; + + /** + * IP Prefix in Classless Inter-Domain Routing format. + */ + prefix: string; + + /** + * Priority of the static route. + */ + priority: number; + + /** + * An optional human provided description of the static route. + */ + description?: string; + + /** + * Used only for ECMP routes. + */ + scope?: RoutesAPI.ScopeParam; + + /** + * Optional weight of the ECMP scope - if provided. + */ + weight?: number; + } +} + export interface RouteEmptyParams { /** * Identifier @@ -329,18 +648,22 @@ export interface RouteGetParams { account_id: string; } -export namespace Routes { - export import Scope = RoutesAPI.Scope; - export import RouteCreateResponse = RoutesAPI.RouteCreateResponse; - export import RouteUpdateResponse = RoutesAPI.RouteUpdateResponse; - export import RouteListResponse = RoutesAPI.RouteListResponse; - export import RouteDeleteResponse = RoutesAPI.RouteDeleteResponse; - export import RouteEmptyResponse = RoutesAPI.RouteEmptyResponse; - export import RouteGetResponse = RoutesAPI.RouteGetResponse; - export import RouteCreateParams = RoutesAPI.RouteCreateParams; - export import RouteUpdateParams = RoutesAPI.RouteUpdateParams; - export import RouteListParams = RoutesAPI.RouteListParams; - export import RouteDeleteParams = RoutesAPI.RouteDeleteParams; - export import RouteEmptyParams = RoutesAPI.RouteEmptyParams; - export import RouteGetParams = RoutesAPI.RouteGetParams; +export declare namespace Routes { + export { + type Scope as Scope, + type RouteCreateResponse as RouteCreateResponse, + type RouteUpdateResponse as RouteUpdateResponse, + type RouteListResponse as RouteListResponse, + type RouteDeleteResponse as RouteDeleteResponse, + type RouteBulkUpdateResponse as RouteBulkUpdateResponse, + type RouteEmptyResponse as RouteEmptyResponse, + type RouteGetResponse as RouteGetResponse, + type RouteCreateParams as RouteCreateParams, + type RouteUpdateParams as RouteUpdateParams, + type RouteListParams as RouteListParams, + type RouteDeleteParams as RouteDeleteParams, + type RouteBulkUpdateParams as RouteBulkUpdateParams, + type RouteEmptyParams as RouteEmptyParams, + type RouteGetParams as RouteGetParams, + }; } diff --git a/src/resources/magic-transit/sites/acls.ts b/src/resources/magic-transit/sites/acls.ts index 5eafeb1a53..05e9cf87ac 100644 --- a/src/resources/magic-transit/sites/acls.ts +++ b/src/resources/magic-transit/sites/acls.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ACLsAPI from './acls'; import { SinglePage } from '../../../pagination'; export class ACLs extends APIResource { @@ -207,12 +206,12 @@ export type AllowedProtocolParam = 'tcp' | 'udp' | 'icmp'; /** * A valid IPv4 address. */ -export type Subnet = string | string; +export type Subnet = string; /** * A valid IPv4 address. */ -export type SubnetParam = string | string; +export type SubnetParam = string; export interface ACLCreateParams { /** @@ -355,16 +354,20 @@ export interface ACLGetParams { account_id: string; } -export namespace ACLs { - export import ACL = ACLsAPI.ACL; - export import ACLConfiguration = ACLsAPI.ACLConfiguration; - export import AllowedProtocol = ACLsAPI.AllowedProtocol; - export import Subnet = ACLsAPI.Subnet; - export import ACLsSinglePage = ACLsAPI.ACLsSinglePage; - export import ACLCreateParams = ACLsAPI.ACLCreateParams; - export import ACLUpdateParams = ACLsAPI.ACLUpdateParams; - export import ACLListParams = ACLsAPI.ACLListParams; - export import ACLDeleteParams = ACLsAPI.ACLDeleteParams; - export import ACLEditParams = ACLsAPI.ACLEditParams; - export import ACLGetParams = ACLsAPI.ACLGetParams; +ACLs.ACLsSinglePage = ACLsSinglePage; + +export declare namespace ACLs { + export { + type ACL as ACL, + type ACLConfiguration as ACLConfiguration, + type AllowedProtocol as AllowedProtocol, + type Subnet as Subnet, + ACLsSinglePage as ACLsSinglePage, + type ACLCreateParams as ACLCreateParams, + type ACLUpdateParams as ACLUpdateParams, + type ACLListParams as ACLListParams, + type ACLDeleteParams as ACLDeleteParams, + type ACLEditParams as ACLEditParams, + type ACLGetParams as ACLGetParams, + }; } diff --git a/src/resources/magic-transit/sites/index.ts b/src/resources/magic-transit/sites/index.ts index d401e52d54..05d15dab06 100644 --- a/src/resources/magic-transit/sites/index.ts +++ b/src/resources/magic-transit/sites/index.ts @@ -1,58 +1,58 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - ACL, - ACLConfiguration, - AllowedProtocol, - Subnet, - ACLCreateParams, - ACLUpdateParams, - ACLListParams, - ACLDeleteParams, - ACLEditParams, - ACLGetParams, ACLsSinglePage, ACLs, + type ACL, + type ACLConfiguration, + type AllowedProtocol, + type Subnet, + type ACLCreateParams, + type ACLUpdateParams, + type ACLListParams, + type ACLDeleteParams, + type ACLEditParams, + type ACLGetParams, } from './acls'; export { - DHCPRelay, - DHCPServer, - LAN, - LANStaticAddressing, - Nat, - RoutedSubnet, - LANCreateResponse, - LANCreateParams, - LANUpdateParams, - LANListParams, - LANDeleteParams, - LANEditParams, - LANGetParams, LANsSinglePage, LANs, + type DHCPRelay, + type DHCPServer, + type LAN, + type LANStaticAddressing, + type Nat, + type RoutedSubnet, + type LANCreateResponse, + type LANCreateParams, + type LANUpdateParams, + type LANListParams, + type LANDeleteParams, + type LANEditParams, + type LANGetParams, } from './lans'; export { - Site, - SiteLocation, - SiteCreateParams, - SiteUpdateParams, - SiteListParams, - SiteDeleteParams, - SiteEditParams, - SiteGetParams, SitesSinglePage, Sites, + type Site, + type SiteLocation, + type SiteCreateParams, + type SiteUpdateParams, + type SiteListParams, + type SiteDeleteParams, + type SiteEditParams, + type SiteGetParams, } from './sites'; export { - WAN, - WANStaticAddressing, - WANCreateResponse, - WANCreateParams, - WANUpdateParams, - WANListParams, - WANDeleteParams, - WANEditParams, - WANGetParams, WANsSinglePage, WANs, + type WAN, + type WANStaticAddressing, + type WANCreateResponse, + type WANCreateParams, + type WANUpdateParams, + type WANListParams, + type WANDeleteParams, + type WANEditParams, + type WANGetParams, } from './wans'; diff --git a/src/resources/magic-transit/sites/lans.ts b/src/resources/magic-transit/sites/lans.ts index 25a3dce314..681f5aca4e 100644 --- a/src/resources/magic-transit/sites/lans.ts +++ b/src/resources/magic-transit/sites/lans.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as LANsAPI from './lans'; import { SinglePage } from '../../../pagination'; export class LANs extends APIResource { @@ -454,19 +453,23 @@ export interface LANGetParams { account_id: string; } -export namespace LANs { - export import DHCPRelay = LANsAPI.DHCPRelay; - export import DHCPServer = LANsAPI.DHCPServer; - export import LAN = LANsAPI.LAN; - export import LANStaticAddressing = LANsAPI.LANStaticAddressing; - export import Nat = LANsAPI.Nat; - export import RoutedSubnet = LANsAPI.RoutedSubnet; - export import LANCreateResponse = LANsAPI.LANCreateResponse; - export import LANsSinglePage = LANsAPI.LANsSinglePage; - export import LANCreateParams = LANsAPI.LANCreateParams; - export import LANUpdateParams = LANsAPI.LANUpdateParams; - export import LANListParams = LANsAPI.LANListParams; - export import LANDeleteParams = LANsAPI.LANDeleteParams; - export import LANEditParams = LANsAPI.LANEditParams; - export import LANGetParams = LANsAPI.LANGetParams; +LANs.LANsSinglePage = LANsSinglePage; + +export declare namespace LANs { + export { + type DHCPRelay as DHCPRelay, + type DHCPServer as DHCPServer, + type LAN as LAN, + type LANStaticAddressing as LANStaticAddressing, + type Nat as Nat, + type RoutedSubnet as RoutedSubnet, + type LANCreateResponse as LANCreateResponse, + LANsSinglePage as LANsSinglePage, + type LANCreateParams as LANCreateParams, + type LANUpdateParams as LANUpdateParams, + type LANListParams as LANListParams, + type LANDeleteParams as LANDeleteParams, + type LANEditParams as LANEditParams, + type LANGetParams as LANGetParams, + }; } diff --git a/src/resources/magic-transit/sites/sites.ts b/src/resources/magic-transit/sites/sites.ts index 50ad637c44..00484b3abc 100644 --- a/src/resources/magic-transit/sites/sites.ts +++ b/src/resources/magic-transit/sites/sites.ts @@ -2,10 +2,53 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as SitesAPI from './sites'; import * as ACLsAPI from './acls'; +import { + ACL, + ACLConfiguration, + ACLCreateParams, + ACLDeleteParams, + ACLEditParams, + ACLGetParams, + ACLListParams, + ACLUpdateParams, + ACLs, + ACLsSinglePage, + AllowedProtocol, + Subnet, +} from './acls'; import * as LANsAPI from './lans'; +import { + DHCPRelay, + DHCPServer, + LAN, + LANCreateParams, + LANCreateResponse, + LANDeleteParams, + LANEditParams, + LANGetParams, + LANListParams, + LANStaticAddressing, + LANUpdateParams, + LANs, + LANsSinglePage, + Nat, + RoutedSubnet, +} from './lans'; import * as WANsAPI from './wans'; +import { + WAN, + WANCreateParams, + WANCreateResponse, + WANDeleteParams, + WANEditParams, + WANGetParams, + WANListParams, + WANStaticAddressing, + WANUpdateParams, + WANs, + WANsSinglePage, +} from './wans'; import { SinglePage } from '../../../pagination'; export class Sites extends APIResource { @@ -80,11 +123,17 @@ export class Sites extends APIResource { * Get a specific Site. */ get(siteId: string, params: SiteGetParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; + const { account_id, 'x-magic-new-hc-target': xMagicNewHcTarget } = params; return ( - this._client.get(`/accounts/${account_id}/magic/sites/${siteId}`, options) as Core.APIPromise<{ - result: Site; - }> + this._client.get(`/accounts/${account_id}/magic/sites/${siteId}`, { + ...options, + headers: { + ...(xMagicNewHcTarget?.toString() != null ? + { 'x-magic-new-hc-target': xMagicNewHcTarget?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: Site }> )._thenUnwrap((obj) => obj.result); } } @@ -282,57 +331,82 @@ export interface SiteEditParams { export interface SiteGetParams { /** - * Identifier + * Path param: Identifier */ account_id: string; + + /** + * Header param: If true, the health check target in the response body will be + * presented using the new object format. Defaults to false. + */ + 'x-magic-new-hc-target'?: boolean; } -export namespace Sites { - export import Site = SitesAPI.Site; - export import SiteLocation = SitesAPI.SiteLocation; - export import SitesSinglePage = SitesAPI.SitesSinglePage; - export import SiteCreateParams = SitesAPI.SiteCreateParams; - export import SiteUpdateParams = SitesAPI.SiteUpdateParams; - export import SiteListParams = SitesAPI.SiteListParams; - export import SiteDeleteParams = SitesAPI.SiteDeleteParams; - export import SiteEditParams = SitesAPI.SiteEditParams; - export import SiteGetParams = SitesAPI.SiteGetParams; - export import ACLs = ACLsAPI.ACLs; - export import ACL = ACLsAPI.ACL; - export import ACLConfiguration = ACLsAPI.ACLConfiguration; - export import AllowedProtocol = ACLsAPI.AllowedProtocol; - export import Subnet = ACLsAPI.Subnet; - export import ACLsSinglePage = ACLsAPI.ACLsSinglePage; - export import ACLCreateParams = ACLsAPI.ACLCreateParams; - export import ACLUpdateParams = ACLsAPI.ACLUpdateParams; - export import ACLListParams = ACLsAPI.ACLListParams; - export import ACLDeleteParams = ACLsAPI.ACLDeleteParams; - export import ACLEditParams = ACLsAPI.ACLEditParams; - export import ACLGetParams = ACLsAPI.ACLGetParams; - export import LANs = LANsAPI.LANs; - export import DHCPRelay = LANsAPI.DHCPRelay; - export import DHCPServer = LANsAPI.DHCPServer; - export import LAN = LANsAPI.LAN; - export import LANStaticAddressing = LANsAPI.LANStaticAddressing; - export import Nat = LANsAPI.Nat; - export import RoutedSubnet = LANsAPI.RoutedSubnet; - export import LANCreateResponse = LANsAPI.LANCreateResponse; - export import LANsSinglePage = LANsAPI.LANsSinglePage; - export import LANCreateParams = LANsAPI.LANCreateParams; - export import LANUpdateParams = LANsAPI.LANUpdateParams; - export import LANListParams = LANsAPI.LANListParams; - export import LANDeleteParams = LANsAPI.LANDeleteParams; - export import LANEditParams = LANsAPI.LANEditParams; - export import LANGetParams = LANsAPI.LANGetParams; - export import WANs = WANsAPI.WANs; - export import WAN = WANsAPI.WAN; - export import WANStaticAddressing = WANsAPI.WANStaticAddressing; - export import WANCreateResponse = WANsAPI.WANCreateResponse; - export import WANsSinglePage = WANsAPI.WANsSinglePage; - export import WANCreateParams = WANsAPI.WANCreateParams; - export import WANUpdateParams = WANsAPI.WANUpdateParams; - export import WANListParams = WANsAPI.WANListParams; - export import WANDeleteParams = WANsAPI.WANDeleteParams; - export import WANEditParams = WANsAPI.WANEditParams; - export import WANGetParams = WANsAPI.WANGetParams; +Sites.SitesSinglePage = SitesSinglePage; +Sites.ACLs = ACLs; +Sites.ACLsSinglePage = ACLsSinglePage; +Sites.LANs = LANs; +Sites.LANsSinglePage = LANsSinglePage; +Sites.WANs = WANs; +Sites.WANsSinglePage = WANsSinglePage; + +export declare namespace Sites { + export { + type Site as Site, + type SiteLocation as SiteLocation, + SitesSinglePage as SitesSinglePage, + type SiteCreateParams as SiteCreateParams, + type SiteUpdateParams as SiteUpdateParams, + type SiteListParams as SiteListParams, + type SiteDeleteParams as SiteDeleteParams, + type SiteEditParams as SiteEditParams, + type SiteGetParams as SiteGetParams, + }; + + export { + ACLs as ACLs, + type ACL as ACL, + type ACLConfiguration as ACLConfiguration, + type AllowedProtocol as AllowedProtocol, + type Subnet as Subnet, + ACLsSinglePage as ACLsSinglePage, + type ACLCreateParams as ACLCreateParams, + type ACLUpdateParams as ACLUpdateParams, + type ACLListParams as ACLListParams, + type ACLDeleteParams as ACLDeleteParams, + type ACLEditParams as ACLEditParams, + type ACLGetParams as ACLGetParams, + }; + + export { + LANs as LANs, + type DHCPRelay as DHCPRelay, + type DHCPServer as DHCPServer, + type LAN as LAN, + type LANStaticAddressing as LANStaticAddressing, + type Nat as Nat, + type RoutedSubnet as RoutedSubnet, + type LANCreateResponse as LANCreateResponse, + LANsSinglePage as LANsSinglePage, + type LANCreateParams as LANCreateParams, + type LANUpdateParams as LANUpdateParams, + type LANListParams as LANListParams, + type LANDeleteParams as LANDeleteParams, + type LANEditParams as LANEditParams, + type LANGetParams as LANGetParams, + }; + + export { + WANs as WANs, + type WAN as WAN, + type WANStaticAddressing as WANStaticAddressing, + type WANCreateResponse as WANCreateResponse, + WANsSinglePage as WANsSinglePage, + type WANCreateParams as WANCreateParams, + type WANUpdateParams as WANUpdateParams, + type WANListParams as WANListParams, + type WANDeleteParams as WANDeleteParams, + type WANEditParams as WANEditParams, + type WANGetParams as WANGetParams, + }; } diff --git a/src/resources/magic-transit/sites/wans.ts b/src/resources/magic-transit/sites/wans.ts index c11e1c51ed..e94147aa1e 100644 --- a/src/resources/magic-transit/sites/wans.ts +++ b/src/resources/magic-transit/sites/wans.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as WANsAPI from './wans'; import { SinglePage } from '../../../pagination'; export class WANs extends APIResource { @@ -120,6 +119,12 @@ export interface WAN { */ id?: string; + /** + * Magic WAN health check rate for tunnels created on this link. The default value + * is `mid`. + */ + health_check_rate?: 'low' | 'mid' | 'high'; + name?: string; physport?: number; @@ -310,15 +315,19 @@ export interface WANGetParams { account_id: string; } -export namespace WANs { - export import WAN = WANsAPI.WAN; - export import WANStaticAddressing = WANsAPI.WANStaticAddressing; - export import WANCreateResponse = WANsAPI.WANCreateResponse; - export import WANsSinglePage = WANsAPI.WANsSinglePage; - export import WANCreateParams = WANsAPI.WANCreateParams; - export import WANUpdateParams = WANsAPI.WANUpdateParams; - export import WANListParams = WANsAPI.WANListParams; - export import WANDeleteParams = WANsAPI.WANDeleteParams; - export import WANEditParams = WANsAPI.WANEditParams; - export import WANGetParams = WANsAPI.WANGetParams; +WANs.WANsSinglePage = WANsSinglePage; + +export declare namespace WANs { + export { + type WAN as WAN, + type WANStaticAddressing as WANStaticAddressing, + type WANCreateResponse as WANCreateResponse, + WANsSinglePage as WANsSinglePage, + type WANCreateParams as WANCreateParams, + type WANUpdateParams as WANUpdateParams, + type WANListParams as WANListParams, + type WANDeleteParams as WANDeleteParams, + type WANEditParams as WANEditParams, + type WANGetParams as WANGetParams, + }; } diff --git a/src/resources/managed-headers.ts b/src/resources/managed-headers.ts deleted file mode 100644 index 145f245242..0000000000 --- a/src/resources/managed-headers.ts +++ /dev/null @@ -1,124 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../resource'; -import * as Core from '../core'; - -export class ManagedHeaders extends APIResource { - /** - * Fetches a list of all Managed Transforms. - */ - list( - params: ManagedHeaderListParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id } = params; - return this._client.get(`/zones/${zone_id}/managed_headers`, options); - } - - /** - * Updates the status of one or more Managed Transforms. - */ - edit( - params: ManagedHeaderEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id, ...body } = params; - return this._client.patch(`/zones/${zone_id}/managed_headers`, { body, ...options }); - } -} - -export interface RequestModel { - /** - * Human-readable identifier of the Managed Transform. - */ - id?: string; - - /** - * When true, the Managed Transform is enabled. - */ - enabled?: boolean; -} - -export interface RequestModelParam { - /** - * Human-readable identifier of the Managed Transform. - */ - id?: string; - - /** - * When true, the Managed Transform is enabled. - */ - enabled?: boolean; -} - -export interface ManagedHeaderListResponse { - managed_request_headers?: Array; - - managed_response_headers?: Array; -} - -export interface ManagedHeaderEditResponse { - managed_request_headers?: Array; - - managed_response_headers?: Array; -} - -export namespace ManagedHeaderEditResponse { - export interface ManagedRequestHeader { - /** - * Human-readable identifier of the Managed Transform. - */ - id?: string; - - /** - * When true, the Managed Transform is available in the current Cloudflare plan. - */ - available?: boolean; - - /** - * When true, the Managed Transform is enabled. - */ - enabled?: boolean; - } - - export interface ManagedResponseHeader { - /** - * Human-readable identifier of the Managed Transform. - */ - id?: string; - - /** - * When true, the Managed Transform is available in the current Cloudflare plan. - */ - available?: boolean; - - /** - * When true, the Managed Transform is enabled. - */ - enabled?: boolean; - } -} - -export interface ManagedHeaderListParams { - /** - * Identifier - */ - zone_id: string; -} - -export interface ManagedHeaderEditParams { - /** - * Path param: Identifier - */ - zone_id: string; - - /** - * Body param: - */ - managed_request_headers: Array; - - /** - * Body param: - */ - managed_response_headers: Array; -} diff --git a/src/resources/managed-transforms.ts b/src/resources/managed-transforms.ts new file mode 100644 index 0000000000..846003dc4b --- /dev/null +++ b/src/resources/managed-transforms.ts @@ -0,0 +1,248 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../resource'; +import * as Core from '../core'; + +export class ManagedTransforms extends APIResource { + /** + * Fetches a list of all Managed Transforms. + */ + list( + params: ManagedTransformListParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/managed_headers`, options) as Core.APIPromise<{ + result: ManagedTransformListResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Disables all Managed Transforms. + */ + delete(params: ManagedTransformDeleteParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return this._client.delete(`/zones/${zone_id}/managed_headers`, { + ...options, + headers: { Accept: '*/*', ...options?.headers }, + }); + } + + /** + * Updates the status of one or more Managed Transforms. + */ + edit( + params: ManagedTransformEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.patch(`/zones/${zone_id}/managed_headers`, { body, ...options }) as Core.APIPromise<{ + result: ManagedTransformEditResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * A result. + */ +export interface ManagedTransformListResponse { + /** + * The list of Managed Request Transforms. + */ + managed_request_headers: Array; + + /** + * The list of Managed Response Transforms. + */ + managed_response_headers: Array; +} + +export namespace ManagedTransformListResponse { + /** + * A Managed Transform object. + */ + export interface ManagedRequestHeader { + /** + * The human-readable identifier of the Managed Transform. + */ + id: string; + + /** + * Whether the Managed Transform is enabled. + */ + enabled: boolean; + + /** + * Whether the Managed Transform conflicts with the currently-enabled Managed + * Transforms. + */ + has_conflict: boolean; + + /** + * The Managed Transforms that this Managed Transform conflicts with. + */ + conflicts_with?: Array; + } + + /** + * A Managed Transform object. + */ + export interface ManagedResponseHeader { + /** + * The human-readable identifier of the Managed Transform. + */ + id: string; + + /** + * Whether the Managed Transform is enabled. + */ + enabled: boolean; + + /** + * Whether the Managed Transform conflicts with the currently-enabled Managed + * Transforms. + */ + has_conflict: boolean; + + /** + * The Managed Transforms that this Managed Transform conflicts with. + */ + conflicts_with?: Array; + } +} + +/** + * A result. + */ +export interface ManagedTransformEditResponse { + /** + * The list of Managed Request Transforms. + */ + managed_request_headers: Array; + + /** + * The list of Managed Response Transforms. + */ + managed_response_headers: Array; +} + +export namespace ManagedTransformEditResponse { + /** + * A Managed Transform object. + */ + export interface ManagedRequestHeader { + /** + * The human-readable identifier of the Managed Transform. + */ + id: string; + + /** + * Whether the Managed Transform is enabled. + */ + enabled: boolean; + + /** + * Whether the Managed Transform conflicts with the currently-enabled Managed + * Transforms. + */ + has_conflict: boolean; + + /** + * The Managed Transforms that this Managed Transform conflicts with. + */ + conflicts_with?: Array; + } + + /** + * A Managed Transform object. + */ + export interface ManagedResponseHeader { + /** + * The human-readable identifier of the Managed Transform. + */ + id: string; + + /** + * Whether the Managed Transform is enabled. + */ + enabled: boolean; + + /** + * Whether the Managed Transform conflicts with the currently-enabled Managed + * Transforms. + */ + has_conflict: boolean; + + /** + * The Managed Transforms that this Managed Transform conflicts with. + */ + conflicts_with?: Array; + } +} + +export interface ManagedTransformListParams { + /** + * The unique ID of the zone. + */ + zone_id: string; +} + +export interface ManagedTransformDeleteParams { + /** + * The unique ID of the zone. + */ + zone_id: string; +} + +export interface ManagedTransformEditParams { + /** + * Path param: The unique ID of the zone. + */ + zone_id: string; + + /** + * Body param: The list of Managed Request Transforms. + */ + managed_request_headers: Array; + + /** + * Body param: The list of Managed Response Transforms. + */ + managed_response_headers: Array; +} + +export namespace ManagedTransformEditParams { + /** + * A Managed Transform object. + */ + export interface ManagedRequestHeader { + /** + * The human-readable identifier of the Managed Transform. + */ + id: string; + + /** + * Whether the Managed Transform is enabled. + */ + enabled: boolean; + } + + /** + * A Managed Transform object. + */ + export interface ManagedResponseHeader { + /** + * The human-readable identifier of the Managed Transform. + */ + id: string; + + /** + * Whether the Managed Transform is enabled. + */ + enabled: boolean; + } +} diff --git a/src/resources/memberships.ts b/src/resources/memberships.ts index 3d939cff86..1f851d6f85 100644 --- a/src/resources/memberships.ts +++ b/src/resources/memberships.ts @@ -86,7 +86,7 @@ export interface Membership { permissions?: Membership.Permissions; /** - * List of role names for the user at the account. + * List of role names the membership has for this account. */ roles?: Array; @@ -152,7 +152,7 @@ export interface MembershipUpdateResponse { policies?: Array; /** - * List of role names for the user at the account. + * List of role names the membership has for this account. */ roles?: Array; @@ -228,7 +228,7 @@ export namespace MembershipUpdateResponse { /** * Attributes associated to the permission group. */ - meta?: unknown; + meta?: PermissionGroup.Meta; /** * Name of the group. @@ -236,6 +236,17 @@ export namespace MembershipUpdateResponse { name?: string; } + export namespace PermissionGroup { + /** + * Attributes associated to the permission group. + */ + export interface Meta { + key?: string; + + value?: string; + } + } + /** * A group of scoped resources. */ @@ -253,7 +264,7 @@ export namespace MembershipUpdateResponse { /** * Attributes associated to the resource group. */ - meta?: unknown; + meta?: ResourceGroup.Meta; /** * Name of the resource group. @@ -291,6 +302,15 @@ export namespace MembershipUpdateResponse { key: string; } } + + /** + * Attributes associated to the resource group. + */ + export interface Meta { + key?: string; + + value?: string; + } } } } @@ -327,7 +347,7 @@ export interface MembershipGetResponse { policies?: Array; /** - * List of role names for the user at the account. + * List of role names the membership has for this account. */ roles?: Array; @@ -403,7 +423,7 @@ export namespace MembershipGetResponse { /** * Attributes associated to the permission group. */ - meta?: unknown; + meta?: PermissionGroup.Meta; /** * Name of the group. @@ -411,6 +431,17 @@ export namespace MembershipGetResponse { name?: string; } + export namespace PermissionGroup { + /** + * Attributes associated to the permission group. + */ + export interface Meta { + key?: string; + + value?: string; + } + } + /** * A group of scoped resources. */ @@ -428,7 +459,7 @@ export namespace MembershipGetResponse { /** * Attributes associated to the resource group. */ - meta?: unknown; + meta?: ResourceGroup.Meta; /** * Name of the resource group. @@ -466,6 +497,15 @@ export namespace MembershipGetResponse { key: string; } } + + /** + * Attributes associated to the resource group. + */ + export interface Meta { + key?: string; + + value?: string; + } } } } diff --git a/src/resources/mtls-certificates/associations.ts b/src/resources/mtls-certificates/associations.ts index 52e6cc8d62..2911f21991 100644 --- a/src/resources/mtls-certificates/associations.ts +++ b/src/resources/mtls-certificates/associations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as AssociationsAPI from './associations'; export class Associations extends APIResource { /** @@ -12,13 +11,13 @@ export class Associations extends APIResource { mtlsCertificateId: string, params: AssociationGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get( `/accounts/${account_id}/mtls_certificates/${mtlsCertificateId}/associations`, options, - ) as Core.APIPromise<{ result: AssociationGetResponse | null }> + ) as Core.APIPromise<{ result: AssociationGetResponse }> )._thenUnwrap((obj) => obj.result); } } @@ -44,8 +43,10 @@ export interface AssociationGetParams { account_id: string; } -export namespace Associations { - export import CertificateAsssociation = AssociationsAPI.CertificateAsssociation; - export import AssociationGetResponse = AssociationsAPI.AssociationGetResponse; - export import AssociationGetParams = AssociationsAPI.AssociationGetParams; +export declare namespace Associations { + export { + type CertificateAsssociation as CertificateAsssociation, + type AssociationGetResponse as AssociationGetResponse, + type AssociationGetParams as AssociationGetParams, + }; } diff --git a/src/resources/mtls-certificates/index.ts b/src/resources/mtls-certificates/index.ts index 882977d36a..6be2b62a6c 100644 --- a/src/resources/mtls-certificates/index.ts +++ b/src/resources/mtls-certificates/index.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - CertificateAsssociation, - AssociationGetResponse, - AssociationGetParams, Associations, + type CertificateAsssociation, + type AssociationGetResponse, + type AssociationGetParams, } from './associations'; export { MTLSCertificates } from './mtls-certificates'; diff --git a/src/resources/mtls-certificates/mtls-certificates.ts b/src/resources/mtls-certificates/mtls-certificates.ts index 081b6726b9..c19ddc74ce 100644 --- a/src/resources/mtls-certificates/mtls-certificates.ts +++ b/src/resources/mtls-certificates/mtls-certificates.ts @@ -3,6 +3,12 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as AssociationsAPI from './associations'; +import { + AssociationGetParams, + AssociationGetResponse, + Associations, + CertificateAsssociation, +} from './associations'; import { SinglePage } from '../../pagination'; export class MTLSCertificates extends APIResource { @@ -225,9 +231,13 @@ export interface MTLSCertificateGetParams { account_id: string; } -export namespace MTLSCertificates { - export import Associations = AssociationsAPI.Associations; - export import CertificateAsssociation = AssociationsAPI.CertificateAsssociation; - export import AssociationGetResponse = AssociationsAPI.AssociationGetResponse; - export import AssociationGetParams = AssociationsAPI.AssociationGetParams; +MTLSCertificates.Associations = Associations; + +export declare namespace MTLSCertificates { + export { + Associations as Associations, + type CertificateAsssociation as CertificateAsssociation, + type AssociationGetResponse as AssociationGetResponse, + type AssociationGetParams as AssociationGetParams, + }; } diff --git a/src/resources/origin-ca-certificates.ts b/src/resources/origin-ca-certificates.ts index dfc9ebc0bf..7943184e7f 100644 --- a/src/resources/origin-ca-certificates.ts +++ b/src/resources/origin-ca-certificates.ts @@ -9,23 +9,23 @@ import { SinglePage } from '../pagination'; export class OriginCACertificates extends APIResource { /** - * Create an Origin CA certificate. Use your Origin CA Key as your User Service Key - * when calling this endpoint ([see above](#requests)). + * Create an Origin CA certificate. You can use an Origin CA Key as your User + * Service Key or an API token when calling this endpoint ([see above](#requests)). */ create( body: OriginCACertificateCreateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { return ( this._client.post('/certificates', { body, ...options }) as Core.APIPromise<{ - result: OriginCACertificateCreateResponse; + result: OriginCACertificate; }> )._thenUnwrap((obj) => obj.result); } /** - * List all existing Origin CA certificates for a given zone. Use your Origin CA - * Key as your User Service Key when calling this endpoint + * List all existing Origin CA certificates for a given zone. You can use an Origin + * CA Key as your User Service Key or an API token when calling this endpoint * ([see above](#requests)). */ list( @@ -44,9 +44,9 @@ export class OriginCACertificates extends APIResource { } /** - * Revoke an existing Origin CA certificate by its serial number. Use your Origin - * CA Key as your User Service Key when calling this endpoint - * ([see above](#requests)). + * Revoke an existing Origin CA certificate by its serial number. You can use an + * Origin CA Key as your User Service Key or an API token when calling this + * endpoint ([see above](#requests)). */ delete( certificateId: string, @@ -60,14 +60,14 @@ export class OriginCACertificates extends APIResource { } /** - * Get an existing Origin CA certificate by its serial number. Use your Origin CA - * Key as your User Service Key when calling this endpoint - * ([see above](#requests)). + * Get an existing Origin CA certificate by its serial number. You can use an + * Origin CA Key as your User Service Key or an API token when calling this + * endpoint ([see above](#requests)). */ - get(certificateId: string, options?: Core.RequestOptions): Core.APIPromise { + get(certificateId: string, options?: Core.RequestOptions): Core.APIPromise { return ( this._client.get(`/certificates/${certificateId}`, options) as Core.APIPromise<{ - result: OriginCACertificateGetResponse; + result: OriginCACertificate; }> )._thenUnwrap((obj) => obj.result); } @@ -85,7 +85,7 @@ export interface OriginCACertificate { * Array of hostnames or wildcard names (e.g., \*.example.com) bound to the * certificate. */ - hostnames: Array; + hostnames: Array; /** * Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), @@ -114,16 +114,17 @@ export interface OriginCACertificate { expires_on?: string; } -export type OriginCACertificateCreateResponse = unknown | string | null; - export interface OriginCACertificateDeleteResponse { /** * Identifier */ id?: string; -} -export type OriginCACertificateGetResponse = unknown | string | null; + /** + * When the certificate was revoked. + */ + revoked_at?: string; +} export interface OriginCACertificateCreateParams { /** @@ -135,7 +136,7 @@ export interface OriginCACertificateCreateParams { * Array of hostnames or wildcard names (e.g., \*.example.com) bound to the * certificate. */ - hostnames?: Array; + hostnames?: Array; /** * Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), diff --git a/src/resources/origin-post-quantum-encryption.ts b/src/resources/origin-post-quantum-encryption.ts index 21d625df12..1e98d6ffd1 100644 --- a/src/resources/origin-post-quantum-encryption.ts +++ b/src/resources/origin-post-quantum-encryption.ts @@ -46,9 +46,49 @@ export class OriginPostQuantumEncryption extends APIResource { } } -export type OriginPostQuantumEncryptionUpdateResponse = unknown | string | null; +export interface OriginPostQuantumEncryptionUpdateResponse { + /** + * Value of the zone setting. + */ + id: 'origin_pqe'; + + /** + * Whether the setting is editable + */ + editable: boolean; + + /** + * The value of the feature + */ + value: 'preferred' | 'supported' | 'off'; + + /** + * Last time this setting was modified. + */ + modified_on?: string | null; +} -export type OriginPostQuantumEncryptionGetResponse = unknown | string | null; +export interface OriginPostQuantumEncryptionGetResponse { + /** + * Value of the zone setting. + */ + id: 'origin_pqe'; + + /** + * Whether the setting is editable + */ + editable: boolean; + + /** + * The value of the feature + */ + value: 'preferred' | 'supported' | 'off'; + + /** + * Last time this setting was modified. + */ + modified_on?: string | null; +} export interface OriginPostQuantumEncryptionUpdateParams { /** diff --git a/src/resources/origin-tls-client-auth/hostnames/certificates.ts b/src/resources/origin-tls-client-auth/hostnames/certificates.ts index d4375c1989..64f8e3d28b 100644 --- a/src/resources/origin-tls-client-auth/hostnames/certificates.ts +++ b/src/resources/origin-tls-client-auth/hostnames/certificates.ts @@ -2,9 +2,8 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as CertificatesAPI from './certificates'; import * as HostnamesAPI from './hostnames'; -import { AuthenticatedOriginPullsSinglePage } from './hostnames'; +import { SinglePage } from '../../../pagination'; export class Certificates extends APIResource { /** @@ -30,11 +29,11 @@ export class Certificates extends APIResource { list( params: CertificateListParams, options?: Core.RequestOptions, - ): Core.PagePromise { + ): Core.PagePromise { const { zone_id } = params; return this._client.getAPIList( `/zones/${zone_id}/origin_tls_client_auth/hostnames/certificates`, - AuthenticatedOriginPullsSinglePage, + CertificateListResponsesSinglePage, options, ); } @@ -74,6 +73,8 @@ export class Certificates extends APIResource { } } +export class CertificateListResponsesSinglePage extends SinglePage {} + export interface Certificate { /** * Identifier @@ -172,6 +173,40 @@ export interface CertificateCreateResponse { uploaded_on?: string; } +export interface CertificateListResponse extends HostnamesAPI.AuthenticatedOriginPull { + /** + * Identifier + */ + id?: string; + + /** + * Identifier + */ + cert_id?: string; + + /** + * The hostname certificate. + */ + certificate?: string; + + /** + * Indicates whether hostname-level authenticated origin pulls is enabled. A null + * value voids the association. + */ + enabled?: boolean | null; + + /** + * The hostname on the origin for which the client certificate uploaded will be + * used. + */ + hostname?: string; + + /** + * The hostname certificate's private key. + */ + private_key?: string; +} + export interface CertificateDeleteResponse { /** * Identifier @@ -308,15 +343,19 @@ export interface CertificateGetParams { zone_id: string; } -export namespace Certificates { - export import Certificate = CertificatesAPI.Certificate; - export import CertificateCreateResponse = CertificatesAPI.CertificateCreateResponse; - export import CertificateDeleteResponse = CertificatesAPI.CertificateDeleteResponse; - export import CertificateGetResponse = CertificatesAPI.CertificateGetResponse; - export import CertificateCreateParams = CertificatesAPI.CertificateCreateParams; - export import CertificateListParams = CertificatesAPI.CertificateListParams; - export import CertificateDeleteParams = CertificatesAPI.CertificateDeleteParams; - export import CertificateGetParams = CertificatesAPI.CertificateGetParams; +Certificates.CertificateListResponsesSinglePage = CertificateListResponsesSinglePage; + +export declare namespace Certificates { + export { + type Certificate as Certificate, + type CertificateCreateResponse as CertificateCreateResponse, + type CertificateListResponse as CertificateListResponse, + type CertificateDeleteResponse as CertificateDeleteResponse, + type CertificateGetResponse as CertificateGetResponse, + CertificateListResponsesSinglePage as CertificateListResponsesSinglePage, + type CertificateCreateParams as CertificateCreateParams, + type CertificateListParams as CertificateListParams, + type CertificateDeleteParams as CertificateDeleteParams, + type CertificateGetParams as CertificateGetParams, + }; } - -export { AuthenticatedOriginPullsSinglePage }; diff --git a/src/resources/origin-tls-client-auth/hostnames/hostnames.ts b/src/resources/origin-tls-client-auth/hostnames/hostnames.ts index 2bd8a0bd91..54f8424b38 100644 --- a/src/resources/origin-tls-client-auth/hostnames/hostnames.ts +++ b/src/resources/origin-tls-client-auth/hostnames/hostnames.ts @@ -4,7 +4,19 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; import * as HostnamesAPI from './hostnames'; import * as CertificatesAPI from './certificates'; -import { SinglePage } from '../../../pagination'; +import { + Certificate, + CertificateCreateParams, + CertificateCreateResponse, + CertificateDeleteParams, + CertificateDeleteResponse, + CertificateGetParams, + CertificateGetResponse, + CertificateListParams, + CertificateListResponse, + CertificateListResponsesSinglePage, + Certificates, +} from './certificates'; export class Hostnames extends APIResource { certificates: CertificatesAPI.Certificates = new CertificatesAPI.Certificates(this._client); @@ -19,13 +31,13 @@ export class Hostnames extends APIResource { update( params: HostnameUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return ( this._client.put(`/zones/${zone_id}/origin_tls_client_auth/hostnames`, { body, ...options, - }) as Core.APIPromise<{ result: HostnameUpdateResponse | null }> + }) as Core.APIPromise<{ result: HostnameUpdateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -47,8 +59,6 @@ export class Hostnames extends APIResource { } } -export class AuthenticatedOriginPullsSinglePage extends SinglePage {} - export interface AuthenticatedOriginPull { /** * Identifier @@ -137,7 +147,43 @@ export interface AuthenticatedOriginPull { updated_at?: string; } -export type HostnameUpdateResponse = Array; +export type HostnameUpdateResponse = Array; + +export namespace HostnameUpdateResponse { + export interface HostnameUpdateResponseItem extends HostnamesAPI.AuthenticatedOriginPull { + /** + * Identifier + */ + id?: string; + + /** + * Identifier + */ + cert_id?: string; + + /** + * The hostname certificate. + */ + certificate?: string; + + /** + * Indicates whether hostname-level authenticated origin pulls is enabled. A null + * value voids the association. + */ + enabled?: boolean | null; + + /** + * The hostname on the origin for which the client certificate uploaded will be + * used. + */ + hostname?: string; + + /** + * The hostname certificate's private key. + */ + private_key?: string; + } +} export interface HostnameUpdateParams { /** @@ -179,18 +225,28 @@ export interface HostnameGetParams { zone_id: string; } -export namespace Hostnames { - export import AuthenticatedOriginPull = HostnamesAPI.AuthenticatedOriginPull; - export import HostnameUpdateResponse = HostnamesAPI.HostnameUpdateResponse; - export import HostnameUpdateParams = HostnamesAPI.HostnameUpdateParams; - export import HostnameGetParams = HostnamesAPI.HostnameGetParams; - export import Certificates = CertificatesAPI.Certificates; - export import Certificate = CertificatesAPI.Certificate; - export import CertificateCreateResponse = CertificatesAPI.CertificateCreateResponse; - export import CertificateDeleteResponse = CertificatesAPI.CertificateDeleteResponse; - export import CertificateGetResponse = CertificatesAPI.CertificateGetResponse; - export import CertificateCreateParams = CertificatesAPI.CertificateCreateParams; - export import CertificateListParams = CertificatesAPI.CertificateListParams; - export import CertificateDeleteParams = CertificatesAPI.CertificateDeleteParams; - export import CertificateGetParams = CertificatesAPI.CertificateGetParams; +Hostnames.Certificates = Certificates; +Hostnames.CertificateListResponsesSinglePage = CertificateListResponsesSinglePage; + +export declare namespace Hostnames { + export { + type AuthenticatedOriginPull as AuthenticatedOriginPull, + type HostnameUpdateResponse as HostnameUpdateResponse, + type HostnameUpdateParams as HostnameUpdateParams, + type HostnameGetParams as HostnameGetParams, + }; + + export { + Certificates as Certificates, + type Certificate as Certificate, + type CertificateCreateResponse as CertificateCreateResponse, + type CertificateListResponse as CertificateListResponse, + type CertificateDeleteResponse as CertificateDeleteResponse, + type CertificateGetResponse as CertificateGetResponse, + CertificateListResponsesSinglePage as CertificateListResponsesSinglePage, + type CertificateCreateParams as CertificateCreateParams, + type CertificateListParams as CertificateListParams, + type CertificateDeleteParams as CertificateDeleteParams, + type CertificateGetParams as CertificateGetParams, + }; } diff --git a/src/resources/origin-tls-client-auth/hostnames/index.ts b/src/resources/origin-tls-client-auth/hostnames/index.ts index 94a2484f02..44addae209 100644 --- a/src/resources/origin-tls-client-auth/hostnames/index.ts +++ b/src/resources/origin-tls-client-auth/hostnames/index.ts @@ -1,21 +1,22 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AuthenticatedOriginPull, - HostnameUpdateResponse, - HostnameUpdateParams, - HostnameGetParams, - AuthenticatedOriginPullsSinglePage, - Hostnames, -} from './hostnames'; -export { - Certificate, - CertificateCreateResponse, - CertificateDeleteResponse, - CertificateGetResponse, - CertificateCreateParams, - CertificateListParams, - CertificateDeleteParams, - CertificateGetParams, + CertificateListResponsesSinglePage, Certificates, + type Certificate, + type CertificateCreateResponse, + type CertificateListResponse, + type CertificateDeleteResponse, + type CertificateGetResponse, + type CertificateCreateParams, + type CertificateListParams, + type CertificateDeleteParams, + type CertificateGetParams, } from './certificates'; +export { + Hostnames, + type AuthenticatedOriginPull, + type HostnameUpdateResponse, + type HostnameUpdateParams, + type HostnameGetParams, +} from './hostnames'; diff --git a/src/resources/origin-tls-client-auth/index.ts b/src/resources/origin-tls-client-auth/index.ts index 5a4d6f8bd9..3806aff718 100644 --- a/src/resources/origin-tls-client-auth/index.ts +++ b/src/resources/origin-tls-client-auth/index.ts @@ -1,18 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - AuthenticatedOriginPull, - HostnameUpdateResponse, - HostnameUpdateParams, - HostnameGetParams, - AuthenticatedOriginPullsSinglePage, Hostnames, + type AuthenticatedOriginPull, + type HostnameUpdateResponse, + type HostnameUpdateParams, + type HostnameGetParams, } from './hostnames/index'; export { OriginTLSClientAuth } from './origin-tls-client-auth'; export { - SettingUpdateResponse, - SettingGetResponse, - SettingUpdateParams, - SettingGetParams, Settings, + type SettingUpdateResponse, + type SettingGetResponse, + type SettingUpdateParams, + type SettingGetParams, } from './settings'; diff --git a/src/resources/origin-tls-client-auth/origin-tls-client-auth.ts b/src/resources/origin-tls-client-auth/origin-tls-client-auth.ts index 328c67bd8f..3383db1e90 100644 --- a/src/resources/origin-tls-client-auth/origin-tls-client-auth.ts +++ b/src/resources/origin-tls-client-auth/origin-tls-client-auth.ts @@ -3,7 +3,21 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as SettingsAPI from './settings'; +import { + SettingGetParams, + SettingGetResponse, + SettingUpdateParams, + SettingUpdateResponse, + Settings, +} from './settings'; import * as HostnamesAPI from './hostnames/hostnames'; +import { + AuthenticatedOriginPull, + HostnameGetParams, + HostnameUpdateParams, + HostnameUpdateResponse, + Hostnames, +} from './hostnames/hostnames'; import { SinglePage } from '../../pagination'; export class OriginTLSClientAuth extends APIResource { @@ -35,11 +49,11 @@ export class OriginTLSClientAuth extends APIResource { list( params: OriginTLSClientAuthListParams, options?: Core.RequestOptions, - ): Core.PagePromise { + ): Core.PagePromise { const { zone_id } = params; return this._client.getAPIList( `/zones/${zone_id}/origin_tls_client_auth`, - ZoneAuthenticatedOriginPullsSinglePage, + OriginTLSClientAuthListResponsesSinglePage, options, ); } @@ -79,7 +93,7 @@ export class OriginTLSClientAuth extends APIResource { } } -export class ZoneAuthenticatedOriginPullsSinglePage extends SinglePage {} +export class OriginTLSClientAuthListResponsesSinglePage extends SinglePage {} export interface ZoneAuthenticatedOriginPull { /** @@ -125,11 +139,93 @@ export interface ZoneAuthenticatedOriginPull { uploaded_on?: string; } -export type OriginTLSClientAuthCreateResponse = unknown | string | null; +export interface OriginTLSClientAuthCreateResponse extends ZoneAuthenticatedOriginPull { + /** + * Identifier + */ + id?: string; + + /** + * The zone's leaf certificate. + */ + certificate?: string; + + /** + * Indicates whether zone-level authenticated origin pulls is enabled. + */ + enabled?: boolean; + + /** + * The zone's private key. + */ + private_key?: string; +} + +export interface OriginTLSClientAuthListResponse extends ZoneAuthenticatedOriginPull { + /** + * Identifier + */ + id?: string; -export type OriginTLSClientAuthDeleteResponse = unknown | string | null; + /** + * The zone's leaf certificate. + */ + certificate?: string; -export type OriginTLSClientAuthGetResponse = unknown | string | null; + /** + * Indicates whether zone-level authenticated origin pulls is enabled. + */ + enabled?: boolean; + + /** + * The zone's private key. + */ + private_key?: string; +} + +export interface OriginTLSClientAuthDeleteResponse extends ZoneAuthenticatedOriginPull { + /** + * Identifier + */ + id?: string; + + /** + * The zone's leaf certificate. + */ + certificate?: string; + + /** + * Indicates whether zone-level authenticated origin pulls is enabled. + */ + enabled?: boolean; + + /** + * The zone's private key. + */ + private_key?: string; +} + +export interface OriginTLSClientAuthGetResponse extends ZoneAuthenticatedOriginPull { + /** + * Identifier + */ + id?: string; + + /** + * The zone's leaf certificate. + */ + certificate?: string; + + /** + * Indicates whether zone-level authenticated origin pulls is enabled. + */ + enabled?: boolean; + + /** + * The zone's private key. + */ + private_key?: string; +} export interface OriginTLSClientAuthCreateParams { /** @@ -169,15 +265,23 @@ export interface OriginTLSClientAuthGetParams { zone_id: string; } -export namespace OriginTLSClientAuth { - export import Hostnames = HostnamesAPI.Hostnames; - export import AuthenticatedOriginPull = HostnamesAPI.AuthenticatedOriginPull; - export import HostnameUpdateResponse = HostnamesAPI.HostnameUpdateResponse; - export import HostnameUpdateParams = HostnamesAPI.HostnameUpdateParams; - export import HostnameGetParams = HostnamesAPI.HostnameGetParams; - export import Settings = SettingsAPI.Settings; - export import SettingUpdateResponse = SettingsAPI.SettingUpdateResponse; - export import SettingGetResponse = SettingsAPI.SettingGetResponse; - export import SettingUpdateParams = SettingsAPI.SettingUpdateParams; - export import SettingGetParams = SettingsAPI.SettingGetParams; +OriginTLSClientAuth.Hostnames = Hostnames; +OriginTLSClientAuth.Settings = Settings; + +export declare namespace OriginTLSClientAuth { + export { + Hostnames as Hostnames, + type AuthenticatedOriginPull as AuthenticatedOriginPull, + type HostnameUpdateResponse as HostnameUpdateResponse, + type HostnameUpdateParams as HostnameUpdateParams, + type HostnameGetParams as HostnameGetParams, + }; + + export { + Settings as Settings, + type SettingUpdateResponse as SettingUpdateResponse, + type SettingGetResponse as SettingGetResponse, + type SettingUpdateParams as SettingUpdateParams, + type SettingGetParams as SettingGetParams, + }; } diff --git a/src/resources/origin-tls-client-auth/settings.ts b/src/resources/origin-tls-client-auth/settings.ts index 072e4afe87..39f6d5a9ab 100644 --- a/src/resources/origin-tls-client-auth/settings.ts +++ b/src/resources/origin-tls-client-auth/settings.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SettingsAPI from './settings'; export class Settings extends APIResource { /** @@ -67,9 +66,11 @@ export interface SettingGetParams { zone_id: string; } -export namespace Settings { - export import SettingUpdateResponse = SettingsAPI.SettingUpdateResponse; - export import SettingGetResponse = SettingsAPI.SettingGetResponse; - export import SettingUpdateParams = SettingsAPI.SettingUpdateParams; - export import SettingGetParams = SettingsAPI.SettingGetParams; +export declare namespace Settings { + export { + type SettingUpdateResponse as SettingUpdateResponse, + type SettingGetResponse as SettingGetResponse, + type SettingUpdateParams as SettingUpdateParams, + type SettingGetParams as SettingGetParams, + }; } diff --git a/src/resources/page-rules.ts b/src/resources/page-rules.ts new file mode 100644 index 0000000000..dc3d566d5d --- /dev/null +++ b/src/resources/page-rules.ts @@ -0,0 +1,1856 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../resource'; +import * as Core from '../core'; +import * as SettingsAPI from './zones/settings'; + +export class PageRules extends APIResource { + /** + * Creates a new Page Rule. + */ + create(params: PageRuleCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/pagerules`, { body, ...options }) as Core.APIPromise<{ + result: PageRule; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Replaces the configuration of an existing Page Rule. The configuration of the + * updated Page Rule will exactly match the data passed in the API request. + */ + update( + pageruleId: string, + params: PageRuleUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.put(`/zones/${zone_id}/pagerules/${pageruleId}`, { body, ...options }) as Core.APIPromise<{ + result: PageRule; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetches Page Rules in a zone. + */ + list(params: PageRuleListParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...query } = params; + return ( + this._client.get(`/zones/${zone_id}/pagerules`, { query, ...options }) as Core.APIPromise<{ + result: PageRuleListResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Deletes an existing Page Rule. + */ + delete( + pageruleId: string, + params: PageRuleDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.delete(`/zones/${zone_id}/pagerules/${pageruleId}`, options) as Core.APIPromise<{ + result: PageRuleDeleteResponse | null; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Updates one or more fields of an existing Page Rule. + */ + edit( + pageruleId: string, + params: PageRuleEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.patch(`/zones/${zone_id}/pagerules/${pageruleId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: PageRule }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetches the details of a Page Rule. + */ + get( + pageruleId: string, + params: PageRuleGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/pagerules/${pageruleId}`, options) as Core.APIPromise<{ + result: PageRule; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface PageRule { + /** + * Identifier + */ + id: string; + + /** + * The set of actions to perform if the targets of this rule match the request. + * Actions can redirect to another URL or override settings, but not both. + */ + actions: Array< + | SettingsAPI.AlwaysUseHTTPS + | SettingsAPI.AutomaticHTTPSRewrites + | SettingsAPI.BrowserCacheTTL + | SettingsAPI.BrowserCheck + | PageRule.BypassCacheOnCookie + | PageRule.CacheByDeviceType + | PageRule.CacheDeceptionArmor + | PageRule.CacheKeyFields + | SettingsAPI.CacheLevel + | PageRule.CacheOnCookie + | PageRule.CacheTTLByStatus + | PageRule.DisableApps + | PageRule.DisablePerformance + | PageRule.DisableSecurity + | PageRule.DisableZaraz + | PageRule.EdgeCacheTTL + | SettingsAPI.EmailObfuscation + | PageRule.ExplicitCacheControl + | PageRule.ForwardingURL + | PageRule.HostHeaderOverride + | SettingsAPI.IPGeolocation + | SettingsAPI.Mirage + | SettingsAPI.OpportunisticEncryption + | SettingsAPI.OriginErrorPagePassThru + | SettingsAPI.Polish + | PageRule.ResolveOverride + | PageRule.RespectStrongEtag + | SettingsAPI.ResponseBuffering + | SettingsAPI.RocketLoader + | SettingsAPI.SecurityLevel + | SettingsAPI.SortQueryStringForCache + | SettingsAPI.SSL + | SettingsAPI.TrueClientIPHeader + | SettingsAPI.WAF + >; + + /** + * The timestamp of when the Page Rule was created. + */ + created_on: string; + + /** + * The timestamp of when the Page Rule was last modified. + */ + modified_on: string; + + /** + * The priority of the rule, used to define which Page Rule is processed over + * another. A higher number indicates a higher priority. For example, if you have a + * catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to + * take precedence (rule B: `/images/special/*`), specify a higher priority for + * rule B so it overrides rule A. + */ + priority: number; + + /** + * The status of the Page Rule. + */ + status: 'active' | 'disabled'; + + /** + * The rule targets to evaluate on each request. + */ + targets: Array; +} + +export namespace PageRule { + export interface BypassCacheOnCookie { + /** + * Bypass cache and fetch resources from the origin server if a regular expression + * matches against a cookie name present in the request. + */ + id?: 'bypass_cache_on_cookie'; + + /** + * The regular expression to use for matching cookie names in the request. Refer to + * [Bypass Cache on Cookie setting](https://developers.cloudflare.com/rules/page-rules/reference/additional-reference/#bypass-cache-on-cookie-setting) + * to learn about limited regular expression support. + */ + value?: string; + } + + export interface CacheByDeviceType { + /** + * Separate cached content based on the visitor's device type. + */ + id?: 'cache_by_device_type'; + + /** + * The status of Cache By Device Type. + */ + value?: 'on' | 'off'; + } + + export interface CacheDeceptionArmor { + /** + * Protect from web cache deception attacks while still allowing static assets to + * be cached. This setting verifies that the URL's extension matches the returned + * `Content-Type`. + */ + id?: 'cache_deception_armor'; + + /** + * The status of Cache Deception Armor. + */ + value?: 'on' | 'off'; + } + + export interface CacheKeyFields { + /** + * Control specifically what variables to include when deciding which resources to + * cache. This allows customers to determine what to cache based on something other + * than just the URL. + */ + id?: 'cache_key_fields'; + + value?: CacheKeyFields.Value; + } + + export namespace CacheKeyFields { + export interface Value { + /** + * Controls which cookies appear in the Cache Key. + */ + cookie?: Value.Cookie; + + /** + * Controls which headers go into the Cache Key. Exactly one of `include` or + * `exclude` is expected. + */ + header?: Value.Header; + + /** + * Determines which host header to include in the Cache Key. + */ + host?: Value.Host; + + /** + * Controls which URL query string parameters go into the Cache Key. Exactly one of + * `include` or `exclude` is expected. + */ + query_string?: Value.QueryString; + + /** + * Feature fields to add features about the end-user (client) into the Cache Key. + */ + user?: Value.User; + } + + export namespace Value { + /** + * Controls which cookies appear in the Cache Key. + */ + export interface Cookie { + /** + * A list of cookies to check for the presence of, without including their actual + * values. + */ + check_presence?: Array; + + /** + * A list of cookies to include. + */ + include?: Array; + } + + /** + * Controls which headers go into the Cache Key. Exactly one of `include` or + * `exclude` is expected. + */ + export interface Header { + /** + * A list of headers to check for the presence of, without including their actual + * values. + */ + check_presence?: Array; + + /** + * A list of headers to ignore. + */ + exclude?: Array; + + /** + * A list of headers to include. + */ + include?: Array; + } + + /** + * Determines which host header to include in the Cache Key. + */ + export interface Host { + /** + * Whether to include the Host header in the HTTP request sent to the origin. + */ + resolved?: boolean; + } + + /** + * Controls which URL query string parameters go into the Cache Key. Exactly one of + * `include` or `exclude` is expected. + */ + export interface QueryString { + /** + * Ignore all query string parameters. + */ + exclude?: '*' | Array; + + /** + * Include all query string parameters. + */ + include?: '*' | Array; + } + + /** + * Feature fields to add features about the end-user (client) into the Cache Key. + */ + export interface User { + /** + * Classifies a request as `mobile`, `desktop`, or `tablet` based on the User + * Agent. + */ + device_type?: boolean; + + /** + * Includes the client's country, derived from the IP address. + */ + geo?: boolean; + + /** + * Includes the first language code contained in the `Accept-Language` header sent + * by the client. + */ + lang?: boolean; + } + } + } + + export interface CacheOnCookie { + /** + * Apply the Cache Everything option (Cache Level setting) based on a regular + * expression match against a cookie name. + */ + id?: 'cache_on_cookie'; + + /** + * The regular expression to use for matching cookie names in the request. + */ + value?: string; + } + + export interface CacheTTLByStatus { + /** + * Enterprise customers can set cache time-to-live (TTL) based on the response + * status from the origin web server. Cache TTL refers to the duration of a + * resource in the Cloudflare network before being marked as stale or discarded + * from cache. Status codes are returned by a resource's origin. Setting cache TTL + * based on response status overrides the default cache behavior (standard caching) + * for static files and overrides cache instructions sent by the origin web server. + * To cache non-static assets, set a Cache Level of Cache Everything using a Page + * Rule. Setting no-store Cache-Control or a low TTL (using `max-age`/`s-maxage`) + * increases requests to origin web servers and decreases performance. + */ + id?: 'cache_ttl_by_status'; + + /** + * A JSON object containing status codes and their corresponding TTLs. Each + * key-value pair in the cache TTL by status cache rule has the following syntax + * + * - `status_code`: An integer value such as 200 or 500. status_code matches the + * exact status code from the origin web server. Valid status codes are between + * 100-999. + * - `status_code_range`: Integer values for from and to. status_code_range matches + * any status code from the origin web server within the specified range. + * - `value`: An integer value that defines the duration an asset is valid in + * seconds or one of the following strings: no-store (equivalent to -1), no-cache + * (equivalent to 0). + */ + value?: Record; + } + + export interface DisableApps { + /** + * Turn off all active + * [Cloudflare Apps](https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-apps/) + * (deprecated). + */ + id?: 'disable_apps'; + } + + export interface DisablePerformance { + /** + * Turn off + * [Rocket Loader](https://developers.cloudflare.com/speed/optimization/content/rocket-loader/), + * [Mirage](https://developers.cloudflare.com/speed/optimization/images/mirage/), + * and [Polish](https://developers.cloudflare.com/images/polish/). + */ + id?: 'disable_performance'; + } + + export interface DisableSecurity { + /** + * Turn off + * [Email Obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/), + * [Rate Limiting (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/), + * [Scrape Shield](https://developers.cloudflare.com/waf/tools/scrape-shield/), + * [URL (Zone) Lockdown](https://developers.cloudflare.com/waf/tools/zone-lockdown/), + * and + * [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). + */ + id?: 'disable_security'; + } + + export interface DisableZaraz { + /** + * Turn off [Zaraz](https://developers.cloudflare.com/zaraz/). + */ + id?: 'disable_zaraz'; + } + + export interface EdgeCacheTTL { + /** + * Specify how long to cache a resource in the Cloudflare global network. _Edge + * Cache TTL_ is not visible in response headers. + */ + id?: 'edge_cache_ttl'; + + value?: number; + } + + export interface ExplicitCacheControl { + /** + * Origin Cache Control is enabled by default for Free, Pro, and Business domains + * and disabled by default for Enterprise domains. + */ + id?: 'explicit_cache_control'; + + /** + * The status of Origin Cache Control. + */ + value?: 'on' | 'off'; + } + + export interface ForwardingURL { + /** + * Redirects one URL to another using an `HTTP 301/302` redirect. Refer to + * [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + */ + id?: 'forwarding_url'; + + value?: ForwardingURL.Value; + } + + export namespace ForwardingURL { + export interface Value { + /** + * The status code to use for the URL redirect. 301 is a permanent redirect. 302 is + * a temporary redirect. + */ + status_code?: 301 | 302; + + /** + * The URL to redirect the request to. Notes: ${num} refers to the position of '\*' + * in the constraint value. + */ + url?: string; + } + } + + export interface HostHeaderOverride { + /** + * Apply a specific host header. + */ + id?: 'host_header_override'; + + /** + * The hostname to use in the `Host` header + */ + value?: string; + } + + export interface ResolveOverride { + /** + * Change the origin address to the value specified in this setting. + */ + id?: 'resolve_override'; + + /** + * The origin address you want to override with. + */ + value?: string; + } + + export interface RespectStrongEtag { + /** + * Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and + * the origin server. + */ + id?: 'respect_strong_etag'; + + /** + * The status of Respect Strong ETags + */ + value?: 'on' | 'off'; + } +} + +/** + * URL target. + */ +export interface Target { + /** + * String constraint. + */ + constraint?: Target.Constraint; + + /** + * A target based on the URL of the request. + */ + target?: 'url'; +} + +export namespace Target { + /** + * String constraint. + */ + export interface Constraint { + /** + * The matches operator can use asterisks and pipes as wildcard and 'or' operators. + */ + operator: 'matches' | 'contains' | 'equals' | 'not_equal' | 'not_contain'; + + /** + * The URL pattern to match against the current request. The pattern may contain up + * to four asterisks ('\*') as placeholders. + */ + value: string; + } +} + +/** + * URL target. + */ +export interface TargetParam { + /** + * String constraint. + */ + constraint?: TargetParam.Constraint; + + /** + * A target based on the URL of the request. + */ + target?: 'url'; +} + +export namespace TargetParam { + /** + * String constraint. + */ + export interface Constraint { + /** + * The matches operator can use asterisks and pipes as wildcard and 'or' operators. + */ + operator: 'matches' | 'contains' | 'equals' | 'not_equal' | 'not_contain'; + + /** + * The URL pattern to match against the current request. The pattern may contain up + * to four asterisks ('\*') as placeholders. + */ + value: string; + } +} + +export type PageRuleListResponse = Array; + +export interface PageRuleDeleteResponse { + /** + * Identifier + */ + id: string; +} + +export interface PageRuleCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The set of actions to perform if the targets of this rule match the + * request. Actions can redirect to another URL or override settings, but not both. + */ + actions: Array< + | SettingsAPI.AlwaysUseHTTPSParam + | SettingsAPI.AutomaticHTTPSRewritesParam + | SettingsAPI.BrowserCacheTTLParam + | SettingsAPI.BrowserCheckParam + | PageRuleCreateParams.BypassCacheOnCookie + | PageRuleCreateParams.CacheByDeviceType + | PageRuleCreateParams.CacheDeceptionArmor + | PageRuleCreateParams.CacheKeyFields + | SettingsAPI.CacheLevelParam + | PageRuleCreateParams.CacheOnCookie + | PageRuleCreateParams.CacheTTLByStatus + | PageRuleCreateParams.DisableApps + | PageRuleCreateParams.DisablePerformance + | PageRuleCreateParams.DisableSecurity + | PageRuleCreateParams.DisableZaraz + | PageRuleCreateParams.EdgeCacheTTL + | SettingsAPI.EmailObfuscationParam + | PageRuleCreateParams.ExplicitCacheControl + | PageRuleCreateParams.ForwardingURL + | PageRuleCreateParams.HostHeaderOverride + | SettingsAPI.IPGeolocationParam + | SettingsAPI.MirageParam + | SettingsAPI.OpportunisticEncryptionParam + | SettingsAPI.OriginErrorPagePassThruParam + | SettingsAPI.PolishParam + | PageRuleCreateParams.ResolveOverride + | PageRuleCreateParams.RespectStrongEtag + | SettingsAPI.ResponseBufferingParam + | SettingsAPI.RocketLoaderParam + | SettingsAPI.SecurityLevelParam + | SettingsAPI.SortQueryStringForCacheParam + | SettingsAPI.SSLParam + | SettingsAPI.TrueClientIPHeaderParam + | SettingsAPI.WAFParam + >; + + /** + * Body param: The rule targets to evaluate on each request. + */ + targets: Array; + + /** + * Body param: The priority of the rule, used to define which Page Rule is + * processed over another. A higher number indicates a higher priority. For + * example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more + * specific Page Rule to take precedence (rule B: `/images/special/*`), specify a + * higher priority for rule B so it overrides rule A. + */ + priority?: number; + + /** + * Body param: The status of the Page Rule. + */ + status?: 'active' | 'disabled'; +} + +export namespace PageRuleCreateParams { + export interface BypassCacheOnCookie { + /** + * Bypass cache and fetch resources from the origin server if a regular expression + * matches against a cookie name present in the request. + */ + id?: 'bypass_cache_on_cookie'; + + /** + * The regular expression to use for matching cookie names in the request. Refer to + * [Bypass Cache on Cookie setting](https://developers.cloudflare.com/rules/page-rules/reference/additional-reference/#bypass-cache-on-cookie-setting) + * to learn about limited regular expression support. + */ + value?: string; + } + + export interface CacheByDeviceType { + /** + * Separate cached content based on the visitor's device type. + */ + id?: 'cache_by_device_type'; + + /** + * The status of Cache By Device Type. + */ + value?: 'on' | 'off'; + } + + export interface CacheDeceptionArmor { + /** + * Protect from web cache deception attacks while still allowing static assets to + * be cached. This setting verifies that the URL's extension matches the returned + * `Content-Type`. + */ + id?: 'cache_deception_armor'; + + /** + * The status of Cache Deception Armor. + */ + value?: 'on' | 'off'; + } + + export interface CacheKeyFields { + /** + * Control specifically what variables to include when deciding which resources to + * cache. This allows customers to determine what to cache based on something other + * than just the URL. + */ + id?: 'cache_key_fields'; + + value?: CacheKeyFields.Value; + } + + export namespace CacheKeyFields { + export interface Value { + /** + * Controls which cookies appear in the Cache Key. + */ + cookie?: Value.Cookie; + + /** + * Controls which headers go into the Cache Key. Exactly one of `include` or + * `exclude` is expected. + */ + header?: Value.Header; + + /** + * Determines which host header to include in the Cache Key. + */ + host?: Value.Host; + + /** + * Controls which URL query string parameters go into the Cache Key. Exactly one of + * `include` or `exclude` is expected. + */ + query_string?: Value.QueryString; + + /** + * Feature fields to add features about the end-user (client) into the Cache Key. + */ + user?: Value.User; + } + + export namespace Value { + /** + * Controls which cookies appear in the Cache Key. + */ + export interface Cookie { + /** + * A list of cookies to check for the presence of, without including their actual + * values. + */ + check_presence?: Array; + + /** + * A list of cookies to include. + */ + include?: Array; + } + + /** + * Controls which headers go into the Cache Key. Exactly one of `include` or + * `exclude` is expected. + */ + export interface Header { + /** + * A list of headers to check for the presence of, without including their actual + * values. + */ + check_presence?: Array; + + /** + * A list of headers to ignore. + */ + exclude?: Array; + + /** + * A list of headers to include. + */ + include?: Array; + } + + /** + * Determines which host header to include in the Cache Key. + */ + export interface Host { + /** + * Whether to include the Host header in the HTTP request sent to the origin. + */ + resolved?: boolean; + } + + /** + * Controls which URL query string parameters go into the Cache Key. Exactly one of + * `include` or `exclude` is expected. + */ + export interface QueryString { + /** + * Ignore all query string parameters. + */ + exclude?: '*' | Array; + + /** + * Include all query string parameters. + */ + include?: '*' | Array; + } + + /** + * Feature fields to add features about the end-user (client) into the Cache Key. + */ + export interface User { + /** + * Classifies a request as `mobile`, `desktop`, or `tablet` based on the User + * Agent. + */ + device_type?: boolean; + + /** + * Includes the client's country, derived from the IP address. + */ + geo?: boolean; + + /** + * Includes the first language code contained in the `Accept-Language` header sent + * by the client. + */ + lang?: boolean; + } + } + } + + export interface CacheOnCookie { + /** + * Apply the Cache Everything option (Cache Level setting) based on a regular + * expression match against a cookie name. + */ + id?: 'cache_on_cookie'; + + /** + * The regular expression to use for matching cookie names in the request. + */ + value?: string; + } + + export interface CacheTTLByStatus { + /** + * Enterprise customers can set cache time-to-live (TTL) based on the response + * status from the origin web server. Cache TTL refers to the duration of a + * resource in the Cloudflare network before being marked as stale or discarded + * from cache. Status codes are returned by a resource's origin. Setting cache TTL + * based on response status overrides the default cache behavior (standard caching) + * for static files and overrides cache instructions sent by the origin web server. + * To cache non-static assets, set a Cache Level of Cache Everything using a Page + * Rule. Setting no-store Cache-Control or a low TTL (using `max-age`/`s-maxage`) + * increases requests to origin web servers and decreases performance. + */ + id?: 'cache_ttl_by_status'; + + /** + * A JSON object containing status codes and their corresponding TTLs. Each + * key-value pair in the cache TTL by status cache rule has the following syntax + * + * - `status_code`: An integer value such as 200 or 500. status_code matches the + * exact status code from the origin web server. Valid status codes are between + * 100-999. + * - `status_code_range`: Integer values for from and to. status_code_range matches + * any status code from the origin web server within the specified range. + * - `value`: An integer value that defines the duration an asset is valid in + * seconds or one of the following strings: no-store (equivalent to -1), no-cache + * (equivalent to 0). + */ + value?: Record; + } + + export interface DisableApps { + /** + * Turn off all active + * [Cloudflare Apps](https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-apps/) + * (deprecated). + */ + id?: 'disable_apps'; + } + + export interface DisablePerformance { + /** + * Turn off + * [Rocket Loader](https://developers.cloudflare.com/speed/optimization/content/rocket-loader/), + * [Mirage](https://developers.cloudflare.com/speed/optimization/images/mirage/), + * and [Polish](https://developers.cloudflare.com/images/polish/). + */ + id?: 'disable_performance'; + } + + export interface DisableSecurity { + /** + * Turn off + * [Email Obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/), + * [Rate Limiting (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/), + * [Scrape Shield](https://developers.cloudflare.com/waf/tools/scrape-shield/), + * [URL (Zone) Lockdown](https://developers.cloudflare.com/waf/tools/zone-lockdown/), + * and + * [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). + */ + id?: 'disable_security'; + } + + export interface DisableZaraz { + /** + * Turn off [Zaraz](https://developers.cloudflare.com/zaraz/). + */ + id?: 'disable_zaraz'; + } + + export interface EdgeCacheTTL { + /** + * Specify how long to cache a resource in the Cloudflare global network. _Edge + * Cache TTL_ is not visible in response headers. + */ + id?: 'edge_cache_ttl'; + + value?: number; + } + + export interface ExplicitCacheControl { + /** + * Origin Cache Control is enabled by default for Free, Pro, and Business domains + * and disabled by default for Enterprise domains. + */ + id?: 'explicit_cache_control'; + + /** + * The status of Origin Cache Control. + */ + value?: 'on' | 'off'; + } + + export interface ForwardingURL { + /** + * Redirects one URL to another using an `HTTP 301/302` redirect. Refer to + * [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + */ + id?: 'forwarding_url'; + + value?: ForwardingURL.Value; + } + + export namespace ForwardingURL { + export interface Value { + /** + * The status code to use for the URL redirect. 301 is a permanent redirect. 302 is + * a temporary redirect. + */ + status_code?: 301 | 302; + + /** + * The URL to redirect the request to. Notes: ${num} refers to the position of '\*' + * in the constraint value. + */ + url?: string; + } + } + + export interface HostHeaderOverride { + /** + * Apply a specific host header. + */ + id?: 'host_header_override'; + + /** + * The hostname to use in the `Host` header + */ + value?: string; + } + + export interface ResolveOverride { + /** + * Change the origin address to the value specified in this setting. + */ + id?: 'resolve_override'; + + /** + * The origin address you want to override with. + */ + value?: string; + } + + export interface RespectStrongEtag { + /** + * Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and + * the origin server. + */ + id?: 'respect_strong_etag'; + + /** + * The status of Respect Strong ETags + */ + value?: 'on' | 'off'; + } +} + +export interface PageRuleUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The set of actions to perform if the targets of this rule match the + * request. Actions can redirect to another URL or override settings, but not both. + */ + actions: Array< + | SettingsAPI.AlwaysUseHTTPSParam + | SettingsAPI.AutomaticHTTPSRewritesParam + | SettingsAPI.BrowserCacheTTLParam + | SettingsAPI.BrowserCheckParam + | PageRuleUpdateParams.BypassCacheOnCookie + | PageRuleUpdateParams.CacheByDeviceType + | PageRuleUpdateParams.CacheDeceptionArmor + | PageRuleUpdateParams.CacheKeyFields + | SettingsAPI.CacheLevelParam + | PageRuleUpdateParams.CacheOnCookie + | PageRuleUpdateParams.CacheTTLByStatus + | PageRuleUpdateParams.DisableApps + | PageRuleUpdateParams.DisablePerformance + | PageRuleUpdateParams.DisableSecurity + | PageRuleUpdateParams.DisableZaraz + | PageRuleUpdateParams.EdgeCacheTTL + | SettingsAPI.EmailObfuscationParam + | PageRuleUpdateParams.ExplicitCacheControl + | PageRuleUpdateParams.ForwardingURL + | PageRuleUpdateParams.HostHeaderOverride + | SettingsAPI.IPGeolocationParam + | SettingsAPI.MirageParam + | SettingsAPI.OpportunisticEncryptionParam + | SettingsAPI.OriginErrorPagePassThruParam + | SettingsAPI.PolishParam + | PageRuleUpdateParams.ResolveOverride + | PageRuleUpdateParams.RespectStrongEtag + | SettingsAPI.ResponseBufferingParam + | SettingsAPI.RocketLoaderParam + | SettingsAPI.SecurityLevelParam + | SettingsAPI.SortQueryStringForCacheParam + | SettingsAPI.SSLParam + | SettingsAPI.TrueClientIPHeaderParam + | SettingsAPI.WAFParam + >; + + /** + * Body param: The rule targets to evaluate on each request. + */ + targets: Array; + + /** + * Body param: The priority of the rule, used to define which Page Rule is + * processed over another. A higher number indicates a higher priority. For + * example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more + * specific Page Rule to take precedence (rule B: `/images/special/*`), specify a + * higher priority for rule B so it overrides rule A. + */ + priority?: number; + + /** + * Body param: The status of the Page Rule. + */ + status?: 'active' | 'disabled'; +} + +export namespace PageRuleUpdateParams { + export interface BypassCacheOnCookie { + /** + * Bypass cache and fetch resources from the origin server if a regular expression + * matches against a cookie name present in the request. + */ + id?: 'bypass_cache_on_cookie'; + + /** + * The regular expression to use for matching cookie names in the request. Refer to + * [Bypass Cache on Cookie setting](https://developers.cloudflare.com/rules/page-rules/reference/additional-reference/#bypass-cache-on-cookie-setting) + * to learn about limited regular expression support. + */ + value?: string; + } + + export interface CacheByDeviceType { + /** + * Separate cached content based on the visitor's device type. + */ + id?: 'cache_by_device_type'; + + /** + * The status of Cache By Device Type. + */ + value?: 'on' | 'off'; + } + + export interface CacheDeceptionArmor { + /** + * Protect from web cache deception attacks while still allowing static assets to + * be cached. This setting verifies that the URL's extension matches the returned + * `Content-Type`. + */ + id?: 'cache_deception_armor'; + + /** + * The status of Cache Deception Armor. + */ + value?: 'on' | 'off'; + } + + export interface CacheKeyFields { + /** + * Control specifically what variables to include when deciding which resources to + * cache. This allows customers to determine what to cache based on something other + * than just the URL. + */ + id?: 'cache_key_fields'; + + value?: CacheKeyFields.Value; + } + + export namespace CacheKeyFields { + export interface Value { + /** + * Controls which cookies appear in the Cache Key. + */ + cookie?: Value.Cookie; + + /** + * Controls which headers go into the Cache Key. Exactly one of `include` or + * `exclude` is expected. + */ + header?: Value.Header; + + /** + * Determines which host header to include in the Cache Key. + */ + host?: Value.Host; + + /** + * Controls which URL query string parameters go into the Cache Key. Exactly one of + * `include` or `exclude` is expected. + */ + query_string?: Value.QueryString; + + /** + * Feature fields to add features about the end-user (client) into the Cache Key. + */ + user?: Value.User; + } + + export namespace Value { + /** + * Controls which cookies appear in the Cache Key. + */ + export interface Cookie { + /** + * A list of cookies to check for the presence of, without including their actual + * values. + */ + check_presence?: Array; + + /** + * A list of cookies to include. + */ + include?: Array; + } + + /** + * Controls which headers go into the Cache Key. Exactly one of `include` or + * `exclude` is expected. + */ + export interface Header { + /** + * A list of headers to check for the presence of, without including their actual + * values. + */ + check_presence?: Array; + + /** + * A list of headers to ignore. + */ + exclude?: Array; + + /** + * A list of headers to include. + */ + include?: Array; + } + + /** + * Determines which host header to include in the Cache Key. + */ + export interface Host { + /** + * Whether to include the Host header in the HTTP request sent to the origin. + */ + resolved?: boolean; + } + + /** + * Controls which URL query string parameters go into the Cache Key. Exactly one of + * `include` or `exclude` is expected. + */ + export interface QueryString { + /** + * Ignore all query string parameters. + */ + exclude?: '*' | Array; + + /** + * Include all query string parameters. + */ + include?: '*' | Array; + } + + /** + * Feature fields to add features about the end-user (client) into the Cache Key. + */ + export interface User { + /** + * Classifies a request as `mobile`, `desktop`, or `tablet` based on the User + * Agent. + */ + device_type?: boolean; + + /** + * Includes the client's country, derived from the IP address. + */ + geo?: boolean; + + /** + * Includes the first language code contained in the `Accept-Language` header sent + * by the client. + */ + lang?: boolean; + } + } + } + + export interface CacheOnCookie { + /** + * Apply the Cache Everything option (Cache Level setting) based on a regular + * expression match against a cookie name. + */ + id?: 'cache_on_cookie'; + + /** + * The regular expression to use for matching cookie names in the request. + */ + value?: string; + } + + export interface CacheTTLByStatus { + /** + * Enterprise customers can set cache time-to-live (TTL) based on the response + * status from the origin web server. Cache TTL refers to the duration of a + * resource in the Cloudflare network before being marked as stale or discarded + * from cache. Status codes are returned by a resource's origin. Setting cache TTL + * based on response status overrides the default cache behavior (standard caching) + * for static files and overrides cache instructions sent by the origin web server. + * To cache non-static assets, set a Cache Level of Cache Everything using a Page + * Rule. Setting no-store Cache-Control or a low TTL (using `max-age`/`s-maxage`) + * increases requests to origin web servers and decreases performance. + */ + id?: 'cache_ttl_by_status'; + + /** + * A JSON object containing status codes and their corresponding TTLs. Each + * key-value pair in the cache TTL by status cache rule has the following syntax + * + * - `status_code`: An integer value such as 200 or 500. status_code matches the + * exact status code from the origin web server. Valid status codes are between + * 100-999. + * - `status_code_range`: Integer values for from and to. status_code_range matches + * any status code from the origin web server within the specified range. + * - `value`: An integer value that defines the duration an asset is valid in + * seconds or one of the following strings: no-store (equivalent to -1), no-cache + * (equivalent to 0). + */ + value?: Record; + } + + export interface DisableApps { + /** + * Turn off all active + * [Cloudflare Apps](https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-apps/) + * (deprecated). + */ + id?: 'disable_apps'; + } + + export interface DisablePerformance { + /** + * Turn off + * [Rocket Loader](https://developers.cloudflare.com/speed/optimization/content/rocket-loader/), + * [Mirage](https://developers.cloudflare.com/speed/optimization/images/mirage/), + * and [Polish](https://developers.cloudflare.com/images/polish/). + */ + id?: 'disable_performance'; + } + + export interface DisableSecurity { + /** + * Turn off + * [Email Obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/), + * [Rate Limiting (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/), + * [Scrape Shield](https://developers.cloudflare.com/waf/tools/scrape-shield/), + * [URL (Zone) Lockdown](https://developers.cloudflare.com/waf/tools/zone-lockdown/), + * and + * [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). + */ + id?: 'disable_security'; + } + + export interface DisableZaraz { + /** + * Turn off [Zaraz](https://developers.cloudflare.com/zaraz/). + */ + id?: 'disable_zaraz'; + } + + export interface EdgeCacheTTL { + /** + * Specify how long to cache a resource in the Cloudflare global network. _Edge + * Cache TTL_ is not visible in response headers. + */ + id?: 'edge_cache_ttl'; + + value?: number; + } + + export interface ExplicitCacheControl { + /** + * Origin Cache Control is enabled by default for Free, Pro, and Business domains + * and disabled by default for Enterprise domains. + */ + id?: 'explicit_cache_control'; + + /** + * The status of Origin Cache Control. + */ + value?: 'on' | 'off'; + } + + export interface ForwardingURL { + /** + * Redirects one URL to another using an `HTTP 301/302` redirect. Refer to + * [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + */ + id?: 'forwarding_url'; + + value?: ForwardingURL.Value; + } + + export namespace ForwardingURL { + export interface Value { + /** + * The status code to use for the URL redirect. 301 is a permanent redirect. 302 is + * a temporary redirect. + */ + status_code?: 301 | 302; + + /** + * The URL to redirect the request to. Notes: ${num} refers to the position of '\*' + * in the constraint value. + */ + url?: string; + } + } + + export interface HostHeaderOverride { + /** + * Apply a specific host header. + */ + id?: 'host_header_override'; + + /** + * The hostname to use in the `Host` header + */ + value?: string; + } + + export interface ResolveOverride { + /** + * Change the origin address to the value specified in this setting. + */ + id?: 'resolve_override'; + + /** + * The origin address you want to override with. + */ + value?: string; + } + + export interface RespectStrongEtag { + /** + * Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and + * the origin server. + */ + id?: 'respect_strong_etag'; + + /** + * The status of Respect Strong ETags + */ + value?: 'on' | 'off'; + } +} + +export interface PageRuleListParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: The direction used to sort returned Page Rules. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: When set to `all`, all the search requirements must match. When set + * to `any`, only one of the search requirements has to match. + */ + match?: 'any' | 'all'; + + /** + * Query param: The field used to sort returned Page Rules. + */ + order?: 'status' | 'priority'; + + /** + * Query param: The status of the Page Rule. + */ + status?: 'active' | 'disabled'; +} + +export interface PageRuleDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface PageRuleEditParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The set of actions to perform if the targets of this rule match the + * request. Actions can redirect to another URL or override settings, but not both. + */ + actions?: Array< + | SettingsAPI.AlwaysUseHTTPSParam + | SettingsAPI.AutomaticHTTPSRewritesParam + | SettingsAPI.BrowserCacheTTLParam + | SettingsAPI.BrowserCheckParam + | PageRuleEditParams.BypassCacheOnCookie + | PageRuleEditParams.CacheByDeviceType + | PageRuleEditParams.CacheDeceptionArmor + | PageRuleEditParams.CacheKeyFields + | SettingsAPI.CacheLevelParam + | PageRuleEditParams.CacheOnCookie + | PageRuleEditParams.CacheTTLByStatus + | PageRuleEditParams.DisableApps + | PageRuleEditParams.DisablePerformance + | PageRuleEditParams.DisableSecurity + | PageRuleEditParams.DisableZaraz + | PageRuleEditParams.EdgeCacheTTL + | SettingsAPI.EmailObfuscationParam + | PageRuleEditParams.ExplicitCacheControl + | PageRuleEditParams.ForwardingURL + | PageRuleEditParams.HostHeaderOverride + | SettingsAPI.IPGeolocationParam + | SettingsAPI.MirageParam + | SettingsAPI.OpportunisticEncryptionParam + | SettingsAPI.OriginErrorPagePassThruParam + | SettingsAPI.PolishParam + | PageRuleEditParams.ResolveOverride + | PageRuleEditParams.RespectStrongEtag + | SettingsAPI.ResponseBufferingParam + | SettingsAPI.RocketLoaderParam + | SettingsAPI.SecurityLevelParam + | SettingsAPI.SortQueryStringForCacheParam + | SettingsAPI.SSLParam + | SettingsAPI.TrueClientIPHeaderParam + | SettingsAPI.WAFParam + >; + + /** + * Body param: The priority of the rule, used to define which Page Rule is + * processed over another. A higher number indicates a higher priority. For + * example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more + * specific Page Rule to take precedence (rule B: `/images/special/*`), specify a + * higher priority for rule B so it overrides rule A. + */ + priority?: number; + + /** + * Body param: The status of the Page Rule. + */ + status?: 'active' | 'disabled'; + + /** + * Body param: The rule targets to evaluate on each request. + */ + targets?: Array; +} + +export namespace PageRuleEditParams { + export interface BypassCacheOnCookie { + /** + * Bypass cache and fetch resources from the origin server if a regular expression + * matches against a cookie name present in the request. + */ + id?: 'bypass_cache_on_cookie'; + + /** + * The regular expression to use for matching cookie names in the request. Refer to + * [Bypass Cache on Cookie setting](https://developers.cloudflare.com/rules/page-rules/reference/additional-reference/#bypass-cache-on-cookie-setting) + * to learn about limited regular expression support. + */ + value?: string; + } + + export interface CacheByDeviceType { + /** + * Separate cached content based on the visitor's device type. + */ + id?: 'cache_by_device_type'; + + /** + * The status of Cache By Device Type. + */ + value?: 'on' | 'off'; + } + + export interface CacheDeceptionArmor { + /** + * Protect from web cache deception attacks while still allowing static assets to + * be cached. This setting verifies that the URL's extension matches the returned + * `Content-Type`. + */ + id?: 'cache_deception_armor'; + + /** + * The status of Cache Deception Armor. + */ + value?: 'on' | 'off'; + } + + export interface CacheKeyFields { + /** + * Control specifically what variables to include when deciding which resources to + * cache. This allows customers to determine what to cache based on something other + * than just the URL. + */ + id?: 'cache_key_fields'; + + value?: CacheKeyFields.Value; + } + + export namespace CacheKeyFields { + export interface Value { + /** + * Controls which cookies appear in the Cache Key. + */ + cookie?: Value.Cookie; + + /** + * Controls which headers go into the Cache Key. Exactly one of `include` or + * `exclude` is expected. + */ + header?: Value.Header; + + /** + * Determines which host header to include in the Cache Key. + */ + host?: Value.Host; + + /** + * Controls which URL query string parameters go into the Cache Key. Exactly one of + * `include` or `exclude` is expected. + */ + query_string?: Value.QueryString; + + /** + * Feature fields to add features about the end-user (client) into the Cache Key. + */ + user?: Value.User; + } + + export namespace Value { + /** + * Controls which cookies appear in the Cache Key. + */ + export interface Cookie { + /** + * A list of cookies to check for the presence of, without including their actual + * values. + */ + check_presence?: Array; + + /** + * A list of cookies to include. + */ + include?: Array; + } + + /** + * Controls which headers go into the Cache Key. Exactly one of `include` or + * `exclude` is expected. + */ + export interface Header { + /** + * A list of headers to check for the presence of, without including their actual + * values. + */ + check_presence?: Array; + + /** + * A list of headers to ignore. + */ + exclude?: Array; + + /** + * A list of headers to include. + */ + include?: Array; + } + + /** + * Determines which host header to include in the Cache Key. + */ + export interface Host { + /** + * Whether to include the Host header in the HTTP request sent to the origin. + */ + resolved?: boolean; + } + + /** + * Controls which URL query string parameters go into the Cache Key. Exactly one of + * `include` or `exclude` is expected. + */ + export interface QueryString { + /** + * Ignore all query string parameters. + */ + exclude?: '*' | Array; + + /** + * Include all query string parameters. + */ + include?: '*' | Array; + } + + /** + * Feature fields to add features about the end-user (client) into the Cache Key. + */ + export interface User { + /** + * Classifies a request as `mobile`, `desktop`, or `tablet` based on the User + * Agent. + */ + device_type?: boolean; + + /** + * Includes the client's country, derived from the IP address. + */ + geo?: boolean; + + /** + * Includes the first language code contained in the `Accept-Language` header sent + * by the client. + */ + lang?: boolean; + } + } + } + + export interface CacheOnCookie { + /** + * Apply the Cache Everything option (Cache Level setting) based on a regular + * expression match against a cookie name. + */ + id?: 'cache_on_cookie'; + + /** + * The regular expression to use for matching cookie names in the request. + */ + value?: string; + } + + export interface CacheTTLByStatus { + /** + * Enterprise customers can set cache time-to-live (TTL) based on the response + * status from the origin web server. Cache TTL refers to the duration of a + * resource in the Cloudflare network before being marked as stale or discarded + * from cache. Status codes are returned by a resource's origin. Setting cache TTL + * based on response status overrides the default cache behavior (standard caching) + * for static files and overrides cache instructions sent by the origin web server. + * To cache non-static assets, set a Cache Level of Cache Everything using a Page + * Rule. Setting no-store Cache-Control or a low TTL (using `max-age`/`s-maxage`) + * increases requests to origin web servers and decreases performance. + */ + id?: 'cache_ttl_by_status'; + + /** + * A JSON object containing status codes and their corresponding TTLs. Each + * key-value pair in the cache TTL by status cache rule has the following syntax + * + * - `status_code`: An integer value such as 200 or 500. status_code matches the + * exact status code from the origin web server. Valid status codes are between + * 100-999. + * - `status_code_range`: Integer values for from and to. status_code_range matches + * any status code from the origin web server within the specified range. + * - `value`: An integer value that defines the duration an asset is valid in + * seconds or one of the following strings: no-store (equivalent to -1), no-cache + * (equivalent to 0). + */ + value?: Record; + } + + export interface DisableApps { + /** + * Turn off all active + * [Cloudflare Apps](https://developers.cloudflare.com/support/more-dashboard-apps/cloudflare-apps/) + * (deprecated). + */ + id?: 'disable_apps'; + } + + export interface DisablePerformance { + /** + * Turn off + * [Rocket Loader](https://developers.cloudflare.com/speed/optimization/content/rocket-loader/), + * [Mirage](https://developers.cloudflare.com/speed/optimization/images/mirage/), + * and [Polish](https://developers.cloudflare.com/images/polish/). + */ + id?: 'disable_performance'; + } + + export interface DisableSecurity { + /** + * Turn off + * [Email Obfuscation](https://developers.cloudflare.com/waf/tools/scrape-shield/email-address-obfuscation/), + * [Rate Limiting (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-rate-limiting/), + * [Scrape Shield](https://developers.cloudflare.com/waf/tools/scrape-shield/), + * [URL (Zone) Lockdown](https://developers.cloudflare.com/waf/tools/zone-lockdown/), + * and + * [WAF managed rules (previous version, deprecated)](https://developers.cloudflare.com/waf/reference/legacy/old-waf-managed-rules/). + */ + id?: 'disable_security'; + } + + export interface DisableZaraz { + /** + * Turn off [Zaraz](https://developers.cloudflare.com/zaraz/). + */ + id?: 'disable_zaraz'; + } + + export interface EdgeCacheTTL { + /** + * Specify how long to cache a resource in the Cloudflare global network. _Edge + * Cache TTL_ is not visible in response headers. + */ + id?: 'edge_cache_ttl'; + + value?: number; + } + + export interface ExplicitCacheControl { + /** + * Origin Cache Control is enabled by default for Free, Pro, and Business domains + * and disabled by default for Enterprise domains. + */ + id?: 'explicit_cache_control'; + + /** + * The status of Origin Cache Control. + */ + value?: 'on' | 'off'; + } + + export interface ForwardingURL { + /** + * Redirects one URL to another using an `HTTP 301/302` redirect. Refer to + * [Wildcard matching and referencing](https://developers.cloudflare.com/rules/page-rules/reference/wildcard-matching/). + */ + id?: 'forwarding_url'; + + value?: ForwardingURL.Value; + } + + export namespace ForwardingURL { + export interface Value { + /** + * The status code to use for the URL redirect. 301 is a permanent redirect. 302 is + * a temporary redirect. + */ + status_code?: 301 | 302; + + /** + * The URL to redirect the request to. Notes: ${num} refers to the position of '\*' + * in the constraint value. + */ + url?: string; + } + } + + export interface HostHeaderOverride { + /** + * Apply a specific host header. + */ + id?: 'host_header_override'; + + /** + * The hostname to use in the `Host` header + */ + value?: string; + } + + export interface ResolveOverride { + /** + * Change the origin address to the value specified in this setting. + */ + id?: 'resolve_override'; + + /** + * The origin address you want to override with. + */ + value?: string; + } + + export interface RespectStrongEtag { + /** + * Turn on or off byte-for-byte equivalency checks between the Cloudflare cache and + * the origin server. + */ + id?: 'respect_strong_etag'; + + /** + * The status of Respect Strong ETags + */ + value?: 'on' | 'off'; + } +} + +export interface PageRuleGetParams { + /** + * Identifier + */ + zone_id: string; +} diff --git a/src/resources/page-shield/connections.ts b/src/resources/page-shield/connections.ts index abd89a815e..ce3b22ba9e 100644 --- a/src/resources/page-shield/connections.ts +++ b/src/resources/page-shield/connections.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ConnectionsAPI from './connections'; import { SinglePage } from '../../pagination'; export class Connections extends APIResource { @@ -95,8 +94,7 @@ export interface ConnectionListParams { exclude_urls?: string; /** - * Query param: Export the list of connections as a file. Cannot be used with - * per_page or page options. + * Query param: Export the list of connections as a file. */ export?: 'csv'; @@ -119,10 +117,9 @@ export interface ConnectionListParams { * Query param: The current page number of the paginated results. * * We additionally support a special value "all". When "all" is used, the API will - * return all the connections with the applied filters in a single page. - * Additionally, when using this value, the API will not return the categorisation - * data for the URL and domain of the connections. This feature is best-effort and - * it may only work for zones with a low number of connections + * return all the connections with the applied filters in a single page. This + * feature is best-effort and it may only work for zones with a low number of + * connections */ page?: string; @@ -168,9 +165,13 @@ export interface ConnectionGetParams { zone_id: string; } -export namespace Connections { - export import Connection = ConnectionsAPI.Connection; - export import ConnectionsSinglePage = ConnectionsAPI.ConnectionsSinglePage; - export import ConnectionListParams = ConnectionsAPI.ConnectionListParams; - export import ConnectionGetParams = ConnectionsAPI.ConnectionGetParams; +Connections.ConnectionsSinglePage = ConnectionsSinglePage; + +export declare namespace Connections { + export { + type Connection as Connection, + ConnectionsSinglePage as ConnectionsSinglePage, + type ConnectionListParams as ConnectionListParams, + type ConnectionGetParams as ConnectionGetParams, + }; } diff --git a/src/resources/page-shield/cookies.ts b/src/resources/page-shield/cookies.ts index 660825e7a7..d4bf8b8437 100644 --- a/src/resources/page-shield/cookies.ts +++ b/src/resources/page-shield/cookies.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as CookiesAPI from './cookies'; import { SinglePage } from '../../pagination'; export class Cookies extends APIResource { @@ -123,8 +122,7 @@ export interface CookieListParams { domain?: string; /** - * Query param: Export the list of cookies as a file. Cannot be used with per_page - * or page options. + * Query param: Export the list of cookies as a file. */ export?: 'csv'; @@ -157,6 +155,10 @@ export interface CookieListParams { /** * Query param: The current page number of the paginated results. + * + * We additionally support a special value "all". When "all" is used, the API will + * return all the cookies with the applied filters in a single page. This feature + * is best-effort and it may only work for zones with a low number of cookies */ page?: string; @@ -206,10 +208,14 @@ export interface CookieGetParams { zone_id: string; } -export namespace Cookies { - export import CookieListResponse = CookiesAPI.CookieListResponse; - export import CookieGetResponse = CookiesAPI.CookieGetResponse; - export import CookieListResponsesSinglePage = CookiesAPI.CookieListResponsesSinglePage; - export import CookieListParams = CookiesAPI.CookieListParams; - export import CookieGetParams = CookiesAPI.CookieGetParams; +Cookies.CookieListResponsesSinglePage = CookieListResponsesSinglePage; + +export declare namespace Cookies { + export { + type CookieListResponse as CookieListResponse, + type CookieGetResponse as CookieGetResponse, + CookieListResponsesSinglePage as CookieListResponsesSinglePage, + type CookieListParams as CookieListParams, + type CookieGetParams as CookieGetParams, + }; } diff --git a/src/resources/page-shield/index.ts b/src/resources/page-shield/index.ts index a631e0d533..bf92a68b75 100644 --- a/src/resources/page-shield/index.ts +++ b/src/resources/page-shield/index.ts @@ -1,40 +1,40 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Connection, - ConnectionListParams, - ConnectionGetParams, ConnectionsSinglePage, Connections, + type Connection, + type ConnectionListParams, + type ConnectionGetParams, } from './connections'; export { - CookieListResponse, - CookieGetResponse, - CookieListParams, - CookieGetParams, CookieListResponsesSinglePage, Cookies, + type CookieListResponse, + type CookieGetResponse, + type CookieListParams, + type CookieGetParams, } from './cookies'; export { PageShield } from './page-shield'; export { - Policy, - PolicyCreateResponse, - PolicyUpdateResponse, - PolicyListResponse, - PolicyGetResponse, - PolicyCreateParams, - PolicyUpdateParams, - PolicyListParams, - PolicyDeleteParams, - PolicyGetParams, PolicyListResponsesSinglePage, Policies, + type Policy, + type PolicyCreateResponse, + type PolicyUpdateResponse, + type PolicyListResponse, + type PolicyGetResponse, + type PolicyCreateParams, + type PolicyUpdateParams, + type PolicyListParams, + type PolicyDeleteParams, + type PolicyGetParams, } from './policies'; export { - Script, - ScriptGetResponse, - ScriptListParams, - ScriptGetParams, ScriptsSinglePage, Scripts, + type Script, + type ScriptGetResponse, + type ScriptListParams, + type ScriptGetParams, } from './scripts'; diff --git a/src/resources/page-shield/page-shield.ts b/src/resources/page-shield/page-shield.ts index ee7ccd4dc3..8c3c9a9393 100644 --- a/src/resources/page-shield/page-shield.ts +++ b/src/resources/page-shield/page-shield.ts @@ -3,9 +3,46 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as ConnectionsAPI from './connections'; +import { + Connection, + ConnectionGetParams, + ConnectionListParams, + Connections, + ConnectionsSinglePage, +} from './connections'; import * as CookiesAPI from './cookies'; +import { + CookieGetParams, + CookieGetResponse, + CookieListParams, + CookieListResponse, + CookieListResponsesSinglePage, + Cookies, +} from './cookies'; import * as PoliciesAPI from './policies'; +import { + Policies, + Policy, + PolicyCreateParams, + PolicyCreateResponse, + PolicyDeleteParams, + PolicyGetParams, + PolicyGetResponse, + PolicyListParams, + PolicyListResponse, + PolicyListResponsesSinglePage, + PolicyUpdateParams, + PolicyUpdateResponse, +} from './policies'; import * as ScriptsAPI from './scripts'; +import { + Script, + ScriptGetParams, + ScriptGetResponse, + ScriptListParams, + Scripts, + ScriptsSinglePage, +} from './scripts'; export class PageShield extends APIResource { policies: PoliciesAPI.Policies = new PoliciesAPI.Policies(this._client); @@ -118,34 +155,54 @@ export interface PageShieldGetParams { zone_id: string; } -export namespace PageShield { - export import Policies = PoliciesAPI.Policies; - export import Policy = PoliciesAPI.Policy; - export import PolicyCreateResponse = PoliciesAPI.PolicyCreateResponse; - export import PolicyUpdateResponse = PoliciesAPI.PolicyUpdateResponse; - export import PolicyListResponse = PoliciesAPI.PolicyListResponse; - export import PolicyGetResponse = PoliciesAPI.PolicyGetResponse; - export import PolicyListResponsesSinglePage = PoliciesAPI.PolicyListResponsesSinglePage; - export import PolicyCreateParams = PoliciesAPI.PolicyCreateParams; - export import PolicyUpdateParams = PoliciesAPI.PolicyUpdateParams; - export import PolicyListParams = PoliciesAPI.PolicyListParams; - export import PolicyDeleteParams = PoliciesAPI.PolicyDeleteParams; - export import PolicyGetParams = PoliciesAPI.PolicyGetParams; - export import Connections = ConnectionsAPI.Connections; - export import Connection = ConnectionsAPI.Connection; - export import ConnectionsSinglePage = ConnectionsAPI.ConnectionsSinglePage; - export import ConnectionListParams = ConnectionsAPI.ConnectionListParams; - export import ConnectionGetParams = ConnectionsAPI.ConnectionGetParams; - export import Scripts = ScriptsAPI.Scripts; - export import Script = ScriptsAPI.Script; - export import ScriptGetResponse = ScriptsAPI.ScriptGetResponse; - export import ScriptsSinglePage = ScriptsAPI.ScriptsSinglePage; - export import ScriptListParams = ScriptsAPI.ScriptListParams; - export import ScriptGetParams = ScriptsAPI.ScriptGetParams; - export import Cookies = CookiesAPI.Cookies; - export import CookieListResponse = CookiesAPI.CookieListResponse; - export import CookieGetResponse = CookiesAPI.CookieGetResponse; - export import CookieListResponsesSinglePage = CookiesAPI.CookieListResponsesSinglePage; - export import CookieListParams = CookiesAPI.CookieListParams; - export import CookieGetParams = CookiesAPI.CookieGetParams; +PageShield.Policies = Policies; +PageShield.PolicyListResponsesSinglePage = PolicyListResponsesSinglePage; +PageShield.Connections = Connections; +PageShield.ConnectionsSinglePage = ConnectionsSinglePage; +PageShield.Scripts = Scripts; +PageShield.ScriptsSinglePage = ScriptsSinglePage; +PageShield.Cookies = Cookies; +PageShield.CookieListResponsesSinglePage = CookieListResponsesSinglePage; + +export declare namespace PageShield { + export { + Policies as Policies, + type Policy as Policy, + type PolicyCreateResponse as PolicyCreateResponse, + type PolicyUpdateResponse as PolicyUpdateResponse, + type PolicyListResponse as PolicyListResponse, + type PolicyGetResponse as PolicyGetResponse, + PolicyListResponsesSinglePage as PolicyListResponsesSinglePage, + type PolicyCreateParams as PolicyCreateParams, + type PolicyUpdateParams as PolicyUpdateParams, + type PolicyListParams as PolicyListParams, + type PolicyDeleteParams as PolicyDeleteParams, + type PolicyGetParams as PolicyGetParams, + }; + + export { + Connections as Connections, + type Connection as Connection, + ConnectionsSinglePage as ConnectionsSinglePage, + type ConnectionListParams as ConnectionListParams, + type ConnectionGetParams as ConnectionGetParams, + }; + + export { + Scripts as Scripts, + type Script as Script, + type ScriptGetResponse as ScriptGetResponse, + ScriptsSinglePage as ScriptsSinglePage, + type ScriptListParams as ScriptListParams, + type ScriptGetParams as ScriptGetParams, + }; + + export { + Cookies as Cookies, + type CookieListResponse as CookieListResponse, + type CookieGetResponse as CookieGetResponse, + CookieListResponsesSinglePage as CookieListResponsesSinglePage, + type CookieListParams as CookieListParams, + type CookieGetParams as CookieGetParams, + }; } diff --git a/src/resources/page-shield/policies.ts b/src/resources/page-shield/policies.ts index 2451235529..4d9b853f4c 100644 --- a/src/resources/page-shield/policies.ts +++ b/src/resources/page-shield/policies.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as PoliciesAPI from './policies'; import { SinglePage } from '../../pagination'; export class Policies extends APIResource { @@ -330,16 +329,20 @@ export interface PolicyGetParams { zone_id: string; } -export namespace Policies { - export import Policy = PoliciesAPI.Policy; - export import PolicyCreateResponse = PoliciesAPI.PolicyCreateResponse; - export import PolicyUpdateResponse = PoliciesAPI.PolicyUpdateResponse; - export import PolicyListResponse = PoliciesAPI.PolicyListResponse; - export import PolicyGetResponse = PoliciesAPI.PolicyGetResponse; - export import PolicyListResponsesSinglePage = PoliciesAPI.PolicyListResponsesSinglePage; - export import PolicyCreateParams = PoliciesAPI.PolicyCreateParams; - export import PolicyUpdateParams = PoliciesAPI.PolicyUpdateParams; - export import PolicyListParams = PoliciesAPI.PolicyListParams; - export import PolicyDeleteParams = PoliciesAPI.PolicyDeleteParams; - export import PolicyGetParams = PoliciesAPI.PolicyGetParams; +Policies.PolicyListResponsesSinglePage = PolicyListResponsesSinglePage; + +export declare namespace Policies { + export { + type Policy as Policy, + type PolicyCreateResponse as PolicyCreateResponse, + type PolicyUpdateResponse as PolicyUpdateResponse, + type PolicyListResponse as PolicyListResponse, + type PolicyGetResponse as PolicyGetResponse, + PolicyListResponsesSinglePage as PolicyListResponsesSinglePage, + type PolicyCreateParams as PolicyCreateParams, + type PolicyUpdateParams as PolicyUpdateParams, + type PolicyListParams as PolicyListParams, + type PolicyDeleteParams as PolicyDeleteParams, + type PolicyGetParams as PolicyGetParams, + }; } diff --git a/src/resources/page-shield/scripts.ts b/src/resources/page-shield/scripts.ts index 53d81c26dd..b46260d62e 100644 --- a/src/resources/page-shield/scripts.ts +++ b/src/resources/page-shield/scripts.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ScriptsAPI from './scripts'; import { SinglePage } from '../../pagination'; export class Scripts extends APIResource { @@ -54,6 +53,11 @@ export interface Script { url_contains_cdn_cgi_path: boolean; + /** + * The cryptomining score of the JavaScript content. + */ + cryptomining_score?: number | null; + /** * The dataflow score of the JavaScript content. */ @@ -78,10 +82,20 @@ export interface Script { */ js_integrity_score?: number | null; + /** + * The magecart score of the JavaScript content. + */ + magecart_score?: number | null; + malicious_domain_categories?: Array; malicious_url_categories?: Array; + /** + * The malware score of the JavaScript content. + */ + malware_score?: number | null; + /** * The obfuscation score of the JavaScript content. */ @@ -110,6 +124,11 @@ export interface ScriptGetResponse { url_contains_cdn_cgi_path: boolean; + /** + * The cryptomining score of the JavaScript content. + */ + cryptomining_score?: number | null; + /** * The dataflow score of the JavaScript content. */ @@ -134,10 +153,20 @@ export interface ScriptGetResponse { */ js_integrity_score?: number | null; + /** + * The magecart score of the JavaScript content. + */ + magecart_score?: number | null; + malicious_domain_categories?: Array; malicious_url_categories?: Array; + /** + * The malware score of the JavaScript content. + */ + malware_score?: number | null; + /** * The obfuscation score of the JavaScript content. */ @@ -155,6 +184,11 @@ export namespace ScriptGetResponse { * The version of the analyzed script. */ export interface Version { + /** + * The cryptomining score of the JavaScript content. + */ + cryptomining_score?: number | null; + /** * The dataflow score of the JavaScript content. */ @@ -175,6 +209,16 @@ export namespace ScriptGetResponse { */ js_integrity_score?: number | null; + /** + * The magecart score of the JavaScript content. + */ + magecart_score?: number | null; + + /** + * The malware score of the JavaScript content. + */ + malware_score?: number | null; + /** * The obfuscation score of the JavaScript content. */ @@ -214,8 +258,7 @@ export interface ScriptListParams { exclude_urls?: string; /** - * Query param: Export the list of scripts as a file. Cannot be used with per_page - * or page options. + * Query param: Export the list of scripts as a file. */ export?: 'csv'; @@ -238,10 +281,8 @@ export interface ScriptListParams { * Query param: The current page number of the paginated results. * * We additionally support a special value "all". When "all" is used, the API will - * return all the scripts with the applied filters in a single page. Additionally, - * when using this value, the API will not return the script versions or - * categorisation data for the URL and domain of the scripts. This feature is - * best-effort and it may only work for zones with a low number of scripts + * return all the scripts with the applied filters in a single page. This feature + * is best-effort and it may only work for zones with a low number of scripts */ page?: string; @@ -286,10 +327,14 @@ export interface ScriptGetParams { zone_id: string; } -export namespace Scripts { - export import Script = ScriptsAPI.Script; - export import ScriptGetResponse = ScriptsAPI.ScriptGetResponse; - export import ScriptsSinglePage = ScriptsAPI.ScriptsSinglePage; - export import ScriptListParams = ScriptsAPI.ScriptListParams; - export import ScriptGetParams = ScriptsAPI.ScriptGetParams; +Scripts.ScriptsSinglePage = ScriptsSinglePage; + +export declare namespace Scripts { + export { + type Script as Script, + type ScriptGetResponse as ScriptGetResponse, + ScriptsSinglePage as ScriptsSinglePage, + type ScriptListParams as ScriptListParams, + type ScriptGetParams as ScriptGetParams, + }; } diff --git a/src/resources/pagerules/index.ts b/src/resources/pagerules/index.ts deleted file mode 100644 index f215e9d6c3..0000000000 --- a/src/resources/pagerules/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { Pagerules } from './pagerules'; -export { SettingListResponse, SettingListParams, Settings } from './settings'; diff --git a/src/resources/pagerules/pagerules.ts b/src/resources/pagerules/pagerules.ts deleted file mode 100644 index 491a711027..0000000000 --- a/src/resources/pagerules/pagerules.ts +++ /dev/null @@ -1,436 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as SettingsAPI from './settings'; - -export class Pagerules extends APIResource { - settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); - - /** - * Creates a new Page Rule. - * - * @deprecated The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details. - */ - create( - params: PageruleCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id, ...body } = params; - return ( - this._client.post(`/zones/${zone_id}/pagerules`, { body, ...options }) as Core.APIPromise<{ - result: PageruleCreateResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Replaces the configuration of an existing Page Rule. The configuration of the - * updated Page Rule will exactly match the data passed in the API request. - * - * @deprecated The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details. - */ - update( - pageruleId: string, - params: PageruleUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id, ...body } = params; - return ( - this._client.put(`/zones/${zone_id}/pagerules/${pageruleId}`, { body, ...options }) as Core.APIPromise<{ - result: PageruleUpdateResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches Page Rules in a zone. - * - * @deprecated The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details. - */ - list(params: PageruleListParams, options?: Core.RequestOptions): Core.APIPromise { - const { zone_id, ...query } = params; - return ( - this._client.get(`/zones/${zone_id}/pagerules`, { query, ...options }) as Core.APIPromise<{ - result: PageruleListResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Deletes an existing Page Rule. - * - * @deprecated The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details. - */ - delete( - pageruleId: string, - params: PageruleDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id } = params; - return ( - this._client.delete(`/zones/${zone_id}/pagerules/${pageruleId}`, options) as Core.APIPromise<{ - result: PageruleDeleteResponse | null; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Updates one or more fields of an existing Page Rule. - * - * @deprecated The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details. - */ - edit( - pageruleId: string, - params: PageruleEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id, ...body } = params; - return ( - this._client.patch(`/zones/${zone_id}/pagerules/${pageruleId}`, { - body, - ...options, - }) as Core.APIPromise<{ result: PageruleEditResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetches the details of a Page Rule. - * - * @deprecated The Page Rules API is deprecated in favour of the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#page-rules for full details. - */ - get( - pageruleId: string, - params: PageruleGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id } = params; - return ( - this._client.get(`/zones/${zone_id}/pagerules/${pageruleId}`, options) as Core.APIPromise<{ - result: PageruleGetResponse; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export interface PageRule { - /** - * Identifier - */ - id: string; - - /** - * The set of actions to perform if the targets of this rule match the request. - * Actions can redirect to another URL or override settings, but not both. - */ - actions: Array; - - /** - * The timestamp of when the Page Rule was created. - */ - created_on: string; - - /** - * The timestamp of when the Page Rule was last modified. - */ - modified_on: string; - - /** - * The priority of the rule, used to define which Page Rule is processed over - * another. A higher number indicates a higher priority. For example, if you have a - * catch-all Page Rule (rule A: `/images/*`) but want a more specific Page Rule to - * take precedence (rule B: `/images/special/*`), specify a higher priority for - * rule B so it overrides rule A. - */ - priority: number; - - /** - * The status of the Page Rule. - */ - status: 'active' | 'disabled'; - - /** - * The rule targets to evaluate on each request. - */ - targets: Array; -} - -export interface Route { - /** - * The timestamp of when the override was last modified. - */ - modified_on?: string; - - /** - * The type of route. - */ - name?: 'forward_url'; - - value?: Route.Value; -} - -export namespace Route { - export interface Value { - /** - * The response type for the URL redirect. - */ - type?: 'temporary' | 'permanent'; - - /** - * The URL to redirect the request to. Notes: ${num} refers to the position of '\*' - * in the constraint value. - */ - url?: string; - } -} - -export interface RouteParam { - /** - * The type of route. - */ - name?: 'forward_url'; - - value?: RouteParam.Value; -} - -export namespace RouteParam { - export interface Value { - /** - * The response type for the URL redirect. - */ - type?: 'temporary' | 'permanent'; - - /** - * The URL to redirect the request to. Notes: ${num} refers to the position of '\*' - * in the constraint value. - */ - url?: string; - } -} - -/** - * URL target. - */ -export interface Target { - /** - * String constraint. - */ - constraint?: Target.Constraint; - - /** - * A target based on the URL of the request. - */ - target?: 'url'; -} - -export namespace Target { - /** - * String constraint. - */ - export interface Constraint { - /** - * The matches operator can use asterisks and pipes as wildcard and 'or' operators. - */ - operator: 'matches' | 'contains' | 'equals' | 'not_equal' | 'not_contain'; - - /** - * The URL pattern to match against the current request. The pattern may contain up - * to four asterisks ('\*') as placeholders. - */ - value: string; - } -} - -/** - * URL target. - */ -export interface TargetParam { - /** - * String constraint. - */ - constraint?: TargetParam.Constraint; - - /** - * A target based on the URL of the request. - */ - target?: 'url'; -} - -export namespace TargetParam { - /** - * String constraint. - */ - export interface Constraint { - /** - * The matches operator can use asterisks and pipes as wildcard and 'or' operators. - */ - operator: 'matches' | 'contains' | 'equals' | 'not_equal' | 'not_contain'; - - /** - * The URL pattern to match against the current request. The pattern may contain up - * to four asterisks ('\*') as placeholders. - */ - value: string; - } -} - -export type PageruleCreateResponse = unknown | string | null; - -export type PageruleUpdateResponse = unknown | string | null; - -export type PageruleListResponse = Array; - -export interface PageruleDeleteResponse { - /** - * Identifier - */ - id: string; -} - -export type PageruleEditResponse = unknown | string | null; - -export type PageruleGetResponse = unknown | string | null; - -export interface PageruleCreateParams { - /** - * Path param: Identifier - */ - zone_id: string; - - /** - * Body param: The set of actions to perform if the targets of this rule match the - * request. Actions can redirect to another URL or override settings, but not both. - */ - actions: Array; - - /** - * Body param: The rule targets to evaluate on each request. - */ - targets: Array; - - /** - * Body param: The priority of the rule, used to define which Page Rule is - * processed over another. A higher number indicates a higher priority. For - * example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more - * specific Page Rule to take precedence (rule B: `/images/special/*`), specify a - * higher priority for rule B so it overrides rule A. - */ - priority?: number; - - /** - * Body param: The status of the Page Rule. - */ - status?: 'active' | 'disabled'; -} - -export interface PageruleUpdateParams { - /** - * Path param: Identifier - */ - zone_id: string; - - /** - * Body param: The set of actions to perform if the targets of this rule match the - * request. Actions can redirect to another URL or override settings, but not both. - */ - actions: Array; - - /** - * Body param: The rule targets to evaluate on each request. - */ - targets: Array; - - /** - * Body param: The priority of the rule, used to define which Page Rule is - * processed over another. A higher number indicates a higher priority. For - * example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more - * specific Page Rule to take precedence (rule B: `/images/special/*`), specify a - * higher priority for rule B so it overrides rule A. - */ - priority?: number; - - /** - * Body param: The status of the Page Rule. - */ - status?: 'active' | 'disabled'; -} - -export interface PageruleListParams { - /** - * Path param: Identifier - */ - zone_id: string; - - /** - * Query param: The direction used to sort returned Page Rules. - */ - direction?: 'asc' | 'desc'; - - /** - * Query param: When set to `all`, all the search requirements must match. When set - * to `any`, only one of the search requirements has to match. - */ - match?: 'any' | 'all'; - - /** - * Query param: The field used to sort returned Page Rules. - */ - order?: 'status' | 'priority'; - - /** - * Query param: The status of the Page Rule. - */ - status?: 'active' | 'disabled'; -} - -export interface PageruleDeleteParams { - /** - * Identifier - */ - zone_id: string; -} - -export interface PageruleEditParams { - /** - * Path param: Identifier - */ - zone_id: string; - - /** - * Body param: The set of actions to perform if the targets of this rule match the - * request. Actions can redirect to another URL or override settings, but not both. - */ - actions?: Array; - - /** - * Body param: The priority of the rule, used to define which Page Rule is - * processed over another. A higher number indicates a higher priority. For - * example, if you have a catch-all Page Rule (rule A: `/images/*`) but want a more - * specific Page Rule to take precedence (rule B: `/images/special/*`), specify a - * higher priority for rule B so it overrides rule A. - */ - priority?: number; - - /** - * Body param: The status of the Page Rule. - */ - status?: 'active' | 'disabled'; - - /** - * Body param: The rule targets to evaluate on each request. - */ - targets?: Array; -} - -export interface PageruleGetParams { - /** - * Identifier - */ - zone_id: string; -} - -export namespace Pagerules { - export import Settings = SettingsAPI.Settings; - export import SettingListResponse = SettingsAPI.SettingListResponse; - export import SettingListParams = SettingsAPI.SettingListParams; -} diff --git a/src/resources/pagerules/settings.ts b/src/resources/pagerules/settings.ts deleted file mode 100644 index dea5891eee..0000000000 --- a/src/resources/pagerules/settings.ts +++ /dev/null @@ -1,37 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as SettingsAPI from './settings'; - -export class Settings extends APIResource { - /** - * Returns a list of settings (and their details) that Page Rules can apply to - * matching requests. - */ - list(params: SettingListParams, options?: Core.RequestOptions): Core.APIPromise { - const { zone_id } = params; - return ( - this._client.get(`/zones/${zone_id}/pagerules/settings`, options) as Core.APIPromise<{ - result: SettingListResponse; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -/** - * Settings available for the zone. - */ -export type SettingListResponse = Array; - -export interface SettingListParams { - /** - * Identifier - */ - zone_id: string; -} - -export namespace Settings { - export import SettingListResponse = SettingsAPI.SettingListResponse; - export import SettingListParams = SettingsAPI.SettingListParams; -} diff --git a/src/resources/pages/index.ts b/src/resources/pages/index.ts index 194be95605..2b2862b5c1 100644 --- a/src/resources/pages/index.ts +++ b/src/resources/pages/index.ts @@ -1,20 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Deployment, - Project, - Stage, - ProjectCreateResponse, - ProjectDeleteResponse, - ProjectEditResponse, - ProjectPurgeBuildCacheResponse, - ProjectCreateParams, - ProjectListParams, - ProjectDeleteParams, - ProjectEditParams, - ProjectGetParams, - ProjectPurgeBuildCacheParams, DeploymentsSinglePage, Projects, + type Deployment, + type Project, + type Stage, + type ProjectDeleteResponse, + type ProjectPurgeBuildCacheResponse, + type ProjectCreateParams, + type ProjectListParams, + type ProjectDeleteParams, + type ProjectEditParams, + type ProjectGetParams, + type ProjectPurgeBuildCacheParams, } from './projects/index'; export { Pages } from './pages'; diff --git a/src/resources/pages/pages.ts b/src/resources/pages/pages.ts index 4e351fdce8..e92779690f 100644 --- a/src/resources/pages/pages.ts +++ b/src/resources/pages/pages.ts @@ -2,25 +2,43 @@ import { APIResource } from '../../resource'; import * as ProjectsAPI from './projects/projects'; +import { + Deployment, + DeploymentsSinglePage, + Project, + ProjectCreateParams, + ProjectDeleteParams, + ProjectDeleteResponse, + ProjectEditParams, + ProjectGetParams, + ProjectListParams, + ProjectPurgeBuildCacheParams, + ProjectPurgeBuildCacheResponse, + Projects, + Stage, +} from './projects/projects'; export class Pages extends APIResource { projects: ProjectsAPI.Projects = new ProjectsAPI.Projects(this._client); } -export namespace Pages { - export import Projects = ProjectsAPI.Projects; - export import Deployment = ProjectsAPI.Deployment; - export import Project = ProjectsAPI.Project; - export import Stage = ProjectsAPI.Stage; - export import ProjectCreateResponse = ProjectsAPI.ProjectCreateResponse; - export import ProjectDeleteResponse = ProjectsAPI.ProjectDeleteResponse; - export import ProjectEditResponse = ProjectsAPI.ProjectEditResponse; - export import ProjectPurgeBuildCacheResponse = ProjectsAPI.ProjectPurgeBuildCacheResponse; - export import DeploymentsSinglePage = ProjectsAPI.DeploymentsSinglePage; - export import ProjectCreateParams = ProjectsAPI.ProjectCreateParams; - export import ProjectListParams = ProjectsAPI.ProjectListParams; - export import ProjectDeleteParams = ProjectsAPI.ProjectDeleteParams; - export import ProjectEditParams = ProjectsAPI.ProjectEditParams; - export import ProjectGetParams = ProjectsAPI.ProjectGetParams; - export import ProjectPurgeBuildCacheParams = ProjectsAPI.ProjectPurgeBuildCacheParams; +Pages.Projects = Projects; +Pages.DeploymentsSinglePage = DeploymentsSinglePage; + +export declare namespace Pages { + export { + Projects as Projects, + type Deployment as Deployment, + type Project as Project, + type Stage as Stage, + type ProjectDeleteResponse as ProjectDeleteResponse, + type ProjectPurgeBuildCacheResponse as ProjectPurgeBuildCacheResponse, + DeploymentsSinglePage as DeploymentsSinglePage, + type ProjectCreateParams as ProjectCreateParams, + type ProjectListParams as ProjectListParams, + type ProjectDeleteParams as ProjectDeleteParams, + type ProjectEditParams as ProjectEditParams, + type ProjectGetParams as ProjectGetParams, + type ProjectPurgeBuildCacheParams as ProjectPurgeBuildCacheParams, + }; } diff --git a/src/resources/pages/projects/deployments/deployments.ts b/src/resources/pages/projects/deployments/deployments.ts index fe06366998..6d5c149ff2 100644 --- a/src/resources/pages/projects/deployments/deployments.ts +++ b/src/resources/pages/projects/deployments/deployments.ts @@ -2,10 +2,10 @@ import { APIResource } from '../../../../resource'; import * as Core from '../../../../core'; -import * as DeploymentsAPI from './deployments'; import * as ProjectsAPI from '../projects'; import { DeploymentsSinglePage } from '../projects'; import * as HistoryAPI from './history/history'; +import { History } from './history/history'; export class Deployments extends APIResource { history: HistoryAPI.History = new HistoryAPI.History(this._client); @@ -52,12 +52,14 @@ export class Deployments extends APIResource { deploymentId: string, params: DeploymentDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return this._client.delete( - `/accounts/${account_id}/pages/projects/${projectName}/deployments/${deploymentId}`, - options, - ); + return ( + this._client.delete( + `/accounts/${account_id}/pages/projects/${projectName}/deployments/${deploymentId}`, + options, + ) as Core.APIPromise<{ result: DeploymentDeleteResponse | null }> + )._thenUnwrap((obj) => obj.result); } /** @@ -181,15 +183,20 @@ export interface DeploymentRollbackParams { body: unknown; } -export namespace Deployments { - export import DeploymentDeleteResponse = DeploymentsAPI.DeploymentDeleteResponse; - export import DeploymentCreateParams = DeploymentsAPI.DeploymentCreateParams; - export import DeploymentListParams = DeploymentsAPI.DeploymentListParams; - export import DeploymentDeleteParams = DeploymentsAPI.DeploymentDeleteParams; - export import DeploymentGetParams = DeploymentsAPI.DeploymentGetParams; - export import DeploymentRetryParams = DeploymentsAPI.DeploymentRetryParams; - export import DeploymentRollbackParams = DeploymentsAPI.DeploymentRollbackParams; - export import History = HistoryAPI.History; +Deployments.History = History; + +export declare namespace Deployments { + export { + type DeploymentDeleteResponse as DeploymentDeleteResponse, + type DeploymentCreateParams as DeploymentCreateParams, + type DeploymentListParams as DeploymentListParams, + type DeploymentDeleteParams as DeploymentDeleteParams, + type DeploymentGetParams as DeploymentGetParams, + type DeploymentRetryParams as DeploymentRetryParams, + type DeploymentRollbackParams as DeploymentRollbackParams, + }; + + export { History as History }; } export { DeploymentsSinglePage }; diff --git a/src/resources/pages/projects/deployments/history/history.ts b/src/resources/pages/projects/deployments/history/history.ts index e174423465..24977c4ae9 100644 --- a/src/resources/pages/projects/deployments/history/history.ts +++ b/src/resources/pages/projects/deployments/history/history.ts @@ -2,13 +2,14 @@ import { APIResource } from '../../../../../resource'; import * as LogsAPI from './logs'; +import { LogGetParams, LogGetResponse, Logs } from './logs'; export class History extends APIResource { logs: LogsAPI.Logs = new LogsAPI.Logs(this._client); } -export namespace History { - export import Logs = LogsAPI.Logs; - export import LogGetResponse = LogsAPI.LogGetResponse; - export import LogGetParams = LogsAPI.LogGetParams; +History.Logs = Logs; + +export declare namespace History { + export { Logs as Logs, type LogGetResponse as LogGetResponse, type LogGetParams as LogGetParams }; } diff --git a/src/resources/pages/projects/deployments/history/index.ts b/src/resources/pages/projects/deployments/history/index.ts index bf9496576a..a48342acad 100644 --- a/src/resources/pages/projects/deployments/history/index.ts +++ b/src/resources/pages/projects/deployments/history/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { History } from './history'; -export { LogGetResponse, LogGetParams, Logs } from './logs'; +export { Logs, type LogGetResponse, type LogGetParams } from './logs'; diff --git a/src/resources/pages/projects/deployments/history/logs.ts b/src/resources/pages/projects/deployments/history/logs.ts index afab8faafc..ef1d33024d 100644 --- a/src/resources/pages/projects/deployments/history/logs.ts +++ b/src/resources/pages/projects/deployments/history/logs.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../../../resource'; import * as Core from '../../../../../core'; -import * as LogsAPI from './logs'; export class Logs extends APIResource { /** @@ -24,7 +23,21 @@ export class Logs extends APIResource { } } -export type LogGetResponse = unknown | Array | string; +export interface LogGetResponse { + data?: Array; + + includes_container_logs?: boolean; + + total?: number; +} + +export namespace LogGetResponse { + export interface Data { + line?: string; + + ts?: string; + } +} export interface LogGetParams { /** @@ -33,7 +46,6 @@ export interface LogGetParams { account_id: string; } -export namespace Logs { - export import LogGetResponse = LogsAPI.LogGetResponse; - export import LogGetParams = LogsAPI.LogGetParams; +export declare namespace Logs { + export { type LogGetResponse as LogGetResponse, type LogGetParams as LogGetParams }; } diff --git a/src/resources/pages/projects/deployments/index.ts b/src/resources/pages/projects/deployments/index.ts index 20871897dd..e111d2b387 100644 --- a/src/resources/pages/projects/deployments/index.ts +++ b/src/resources/pages/projects/deployments/index.ts @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - DeploymentDeleteResponse, - DeploymentCreateParams, - DeploymentListParams, - DeploymentDeleteParams, - DeploymentGetParams, - DeploymentRetryParams, - DeploymentRollbackParams, Deployments, + type DeploymentDeleteResponse, + type DeploymentCreateParams, + type DeploymentListParams, + type DeploymentDeleteParams, + type DeploymentGetParams, + type DeploymentRetryParams, + type DeploymentRollbackParams, } from './deployments'; export { History } from './history/index'; diff --git a/src/resources/pages/projects/domains.ts b/src/resources/pages/projects/domains.ts index f4efe5fc28..ff5377248b 100644 --- a/src/resources/pages/projects/domains.ts +++ b/src/resources/pages/projects/domains.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as DomainsAPI from './domains'; import { SinglePage } from '../../../pagination'; export class Domains extends APIResource { @@ -14,10 +13,10 @@ export class Domains extends APIResource { params: DomainCreateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, body } = params; + const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/pages/projects/${projectName}/domains`, { - body: body, + body, ...options, }) as Core.APIPromise<{ result: DomainCreateResponse | null }> )._thenUnwrap((obj) => obj.result); @@ -47,12 +46,14 @@ export class Domains extends APIResource { domainName: string, params: DomainDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return this._client.delete( - `/accounts/${account_id}/pages/projects/${projectName}/domains/${domainName}`, - options, - ); + return ( + this._client.delete( + `/accounts/${account_id}/pages/projects/${projectName}/domains/${domainName}`, + options, + ) as Core.APIPromise<{ result: DomainDeleteResponse | null }> + )._thenUnwrap((obj) => obj.result); } /** @@ -94,15 +95,167 @@ export class Domains extends APIResource { export class DomainListResponsesSinglePage extends SinglePage {} -export type DomainCreateResponse = unknown | Array | string; +export interface DomainCreateResponse { + id?: string; + + certificate_authority?: 'google' | 'lets_encrypt'; + + created_on?: string; + + domain_id?: string; + + name?: string; + + status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + + validation_data?: DomainCreateResponse.ValidationData; + + verification_data?: DomainCreateResponse.VerificationData; + + zone_tag?: string; +} + +export namespace DomainCreateResponse { + export interface ValidationData { + error_message?: string; + + method?: 'http' | 'txt'; + + status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; + + txt_name?: string; + + txt_value?: string; + } + + export interface VerificationData { + error_message?: string; + + status?: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + } +} + +export interface DomainListResponse { + id?: string; + + certificate_authority?: 'google' | 'lets_encrypt'; + + created_on?: string; + + domain_id?: string; + + name?: string; + + status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + + validation_data?: DomainListResponse.ValidationData; + + verification_data?: DomainListResponse.VerificationData; + + zone_tag?: string; +} + +export namespace DomainListResponse { + export interface ValidationData { + error_message?: string; + + method?: 'http' | 'txt'; + + status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; + + txt_name?: string; + + txt_value?: string; + } + + export interface VerificationData { + error_message?: string; -export type DomainListResponse = unknown; + status?: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + } +} export type DomainDeleteResponse = unknown; -export type DomainEditResponse = unknown | Array | string; +export interface DomainEditResponse { + id?: string; + + certificate_authority?: 'google' | 'lets_encrypt'; + + created_on?: string; + + domain_id?: string; + + name?: string; + + status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + + validation_data?: DomainEditResponse.ValidationData; + + verification_data?: DomainEditResponse.VerificationData; + + zone_tag?: string; +} + +export namespace DomainEditResponse { + export interface ValidationData { + error_message?: string; + + method?: 'http' | 'txt'; + + status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; + + txt_name?: string; + + txt_value?: string; + } + + export interface VerificationData { + error_message?: string; + + status?: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + } +} -export type DomainGetResponse = unknown | Array | string; +export interface DomainGetResponse { + id?: string; + + certificate_authority?: 'google' | 'lets_encrypt'; + + created_on?: string; + + domain_id?: string; + + name?: string; + + status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + + validation_data?: DomainGetResponse.ValidationData; + + verification_data?: DomainGetResponse.VerificationData; + + zone_tag?: string; +} + +export namespace DomainGetResponse { + export interface ValidationData { + error_message?: string; + + method?: 'http' | 'txt'; + + status?: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error'; + + txt_name?: string; + + txt_value?: string; + } + + export interface VerificationData { + error_message?: string; + + status?: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error'; + } +} export interface DomainCreateParams { /** @@ -113,7 +266,7 @@ export interface DomainCreateParams { /** * Body param: */ - body: unknown; + name?: string; } export interface DomainListParams { @@ -149,16 +302,20 @@ export interface DomainGetParams { account_id: string; } -export namespace Domains { - export import DomainCreateResponse = DomainsAPI.DomainCreateResponse; - export import DomainListResponse = DomainsAPI.DomainListResponse; - export import DomainDeleteResponse = DomainsAPI.DomainDeleteResponse; - export import DomainEditResponse = DomainsAPI.DomainEditResponse; - export import DomainGetResponse = DomainsAPI.DomainGetResponse; - export import DomainListResponsesSinglePage = DomainsAPI.DomainListResponsesSinglePage; - export import DomainCreateParams = DomainsAPI.DomainCreateParams; - export import DomainListParams = DomainsAPI.DomainListParams; - export import DomainDeleteParams = DomainsAPI.DomainDeleteParams; - export import DomainEditParams = DomainsAPI.DomainEditParams; - export import DomainGetParams = DomainsAPI.DomainGetParams; +Domains.DomainListResponsesSinglePage = DomainListResponsesSinglePage; + +export declare namespace Domains { + export { + type DomainCreateResponse as DomainCreateResponse, + type DomainListResponse as DomainListResponse, + type DomainDeleteResponse as DomainDeleteResponse, + type DomainEditResponse as DomainEditResponse, + type DomainGetResponse as DomainGetResponse, + DomainListResponsesSinglePage as DomainListResponsesSinglePage, + type DomainCreateParams as DomainCreateParams, + type DomainListParams as DomainListParams, + type DomainDeleteParams as DomainDeleteParams, + type DomainEditParams as DomainEditParams, + type DomainGetParams as DomainGetParams, + }; } diff --git a/src/resources/pages/projects/index.ts b/src/resources/pages/projects/index.ts index b5abbeca7b..a40f121ec5 100644 --- a/src/resources/pages/projects/index.ts +++ b/src/resources/pages/projects/index.ts @@ -1,43 +1,41 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Deployment, - Project, - Stage, - ProjectCreateResponse, - ProjectDeleteResponse, - ProjectEditResponse, - ProjectPurgeBuildCacheResponse, - ProjectCreateParams, - ProjectListParams, - ProjectDeleteParams, - ProjectEditParams, - ProjectGetParams, - ProjectPurgeBuildCacheParams, + Deployments, + type DeploymentDeleteResponse, + type DeploymentCreateParams, + type DeploymentListParams, + type DeploymentDeleteParams, + type DeploymentGetParams, + type DeploymentRetryParams, + type DeploymentRollbackParams, +} from './deployments/index'; +export { DeploymentsSinglePage, Projects, + type Deployment, + type Project, + type Stage, + type ProjectDeleteResponse, + type ProjectPurgeBuildCacheResponse, + type ProjectCreateParams, + type ProjectListParams, + type ProjectDeleteParams, + type ProjectEditParams, + type ProjectGetParams, + type ProjectPurgeBuildCacheParams, } from './projects'; export { - DeploymentDeleteResponse, - DeploymentCreateParams, - DeploymentListParams, - DeploymentDeleteParams, - DeploymentGetParams, - DeploymentRetryParams, - DeploymentRollbackParams, - Deployments, -} from './deployments/index'; -export { - DomainCreateResponse, - DomainListResponse, - DomainDeleteResponse, - DomainEditResponse, - DomainGetResponse, - DomainCreateParams, - DomainListParams, - DomainDeleteParams, - DomainEditParams, - DomainGetParams, DomainListResponsesSinglePage, Domains, + type DomainCreateResponse, + type DomainListResponse, + type DomainDeleteResponse, + type DomainEditResponse, + type DomainGetResponse, + type DomainCreateParams, + type DomainListParams, + type DomainDeleteParams, + type DomainEditParams, + type DomainGetParams, } from './domains'; diff --git a/src/resources/pages/projects/projects.ts b/src/resources/pages/projects/projects.ts index 7c3ac064d6..d4c4cb02ae 100644 --- a/src/resources/pages/projects/projects.ts +++ b/src/resources/pages/projects/projects.ts @@ -2,9 +2,32 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ProjectsAPI from './projects'; import * as DomainsAPI from './domains'; +import { + DomainCreateParams, + DomainCreateResponse, + DomainDeleteParams, + DomainDeleteResponse, + DomainEditParams, + DomainEditResponse, + DomainGetParams, + DomainGetResponse, + DomainListParams, + DomainListResponse, + DomainListResponsesSinglePage, + Domains, +} from './domains'; import * as DeploymentsAPI from './deployments/deployments'; +import { + DeploymentCreateParams, + DeploymentDeleteParams, + DeploymentDeleteResponse, + DeploymentGetParams, + DeploymentListParams, + DeploymentRetryParams, + DeploymentRollbackParams, + Deployments, +} from './deployments/deployments'; import { SinglePage } from '../../../pagination'; export class Projects extends APIResource { @@ -14,11 +37,11 @@ export class Projects extends APIResource { /** * Create a new project. */ - create(params: ProjectCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(params: ProjectCreateParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/pages/projects`, { body, ...options }) as Core.APIPromise<{ - result: ProjectCreateResponse; + result: Project; }> )._thenUnwrap((obj) => obj.result); } @@ -41,9 +64,14 @@ export class Projects extends APIResource { projectName: string, params: ProjectDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return this._client.delete(`/accounts/${account_id}/pages/projects/${projectName}`, options); + return ( + this._client.delete( + `/accounts/${account_id}/pages/projects/${projectName}`, + options, + ) as Core.APIPromise<{ result: ProjectDeleteResponse | null }> + )._thenUnwrap((obj) => obj.result); } /** @@ -54,13 +82,13 @@ export class Projects extends APIResource { projectName: string, params: ProjectEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, body } = params; + ): Core.APIPromise { + const { account_id, ...body } = params; return ( this._client.patch(`/accounts/${account_id}/pages/projects/${projectName}`, { - body: body, + body, ...options, - }) as Core.APIPromise<{ result: ProjectEditResponse }> + }) as Core.APIPromise<{ result: Project }> )._thenUnwrap((obj) => obj.result); } @@ -87,12 +115,14 @@ export class Projects extends APIResource { projectName: string, params: ProjectPurgeBuildCacheParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return this._client.post( - `/accounts/${account_id}/pages/projects/${projectName}/purge_build_cache`, - options, - ); + return ( + this._client.post( + `/accounts/${account_id}/pages/projects/${projectName}/purge_build_cache`, + options, + ) as Core.APIPromise<{ result: ProjectPurgeBuildCacheResponse | null }> + )._thenUnwrap((obj) => obj.result); } } @@ -107,9 +137,12 @@ export interface Deployment { /** * A list of alias URLs pointing to this deployment. */ - aliases?: Array | null; + aliases?: Array | null; - build_config?: unknown; + /** + * Configs for the project build process. + */ + build_config?: Deployment.BuildConfig; /** * When the deployment was created. @@ -124,7 +157,7 @@ export interface Deployment { /** * A dict of env variables to build this deploy. */ - env_vars?: unknown; + env_vars?: Record; /** * Type of deploy. @@ -136,7 +169,10 @@ export interface Deployment { */ is_skipped?: boolean; - latest_stage?: unknown; + /** + * The status of the deployment. + */ + latest_stage?: Stage; /** * When the deployment was last modified. @@ -158,7 +194,7 @@ export interface Deployment { */ short_id?: string; - source?: unknown; + source?: Deployment.Source; /** * List of past stages. @@ -172,6 +208,41 @@ export interface Deployment { } export namespace Deployment { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + + /** + * The classifying tag for analytics. + */ + web_analytics_tag?: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token?: string | null; + } + /** * Info about what caused the deployment. */ @@ -208,9 +279,54 @@ export namespace Deployment { commit_message?: string; } } -} -export interface DeploymentParam {} + /** + * Environment variable. + */ + export interface EnvVars { + /** + * Environment variable value. + */ + value: string; + + /** + * The type of environment variable. + */ + type?: string; + } + + export interface Source { + config?: Source.Config; + + type?: string; + } + + export namespace Source { + export interface Config { + deployments_enabled?: boolean; + + owner?: string; + + path_excludes?: Array; + + path_includes?: Array; + + pr_comments_enabled?: boolean; + + preview_branch_excludes?: Array; + + preview_branch_includes?: Array; + + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + production_branch?: string; + + production_deployments_enabled?: boolean; + + repo_name?: string; + } + } +} export interface Project { /** @@ -223,7 +339,10 @@ export interface Project { */ build_config?: Project.BuildConfig; - canonical_deployment?: Deployment; + /** + * Most recent deployment to the repo. + */ + canonical_deployment?: Deployment | null; /** * When the project was created. @@ -238,9 +357,12 @@ export interface Project { /** * A list of associated custom domains for the project. */ - domains?: Array; + domains?: Array; - latest_deployment?: Deployment; + /** + * Most recent deployment to the repo. + */ + latest_deployment?: Deployment | null; /** * Name of the project. @@ -252,7 +374,7 @@ export interface Project { */ production_branch?: string; - source?: unknown; + source?: Project.Source; /** * The Cloudflare subdomain associated with the project. @@ -319,17 +441,17 @@ export namespace Project { /** * Constellation bindings used for Pages Functions. */ - ai_bindings?: Preview.AIBindings | null; + ai_bindings?: Record | null; /** * Analytics Engine bindings used for Pages Functions. */ - analytics_engine_datasets?: Preview.AnalyticsEngineDatasets | null; + analytics_engine_datasets?: Record | null; /** * Browser bindings used for Pages Functions. */ - browsers?: Preview.Browsers | null; + browsers?: Record | null; /** * Compatibility date used for Pages Functions. @@ -339,37 +461,37 @@ export namespace Project { /** * Compatibility flags used for Pages Functions. */ - compatibility_flags?: Array; + compatibility_flags?: Array; /** * D1 databases used for Pages Functions. */ - d1_databases?: Preview.D1Databases | null; + d1_databases?: Record | null; /** * Durabble Object namespaces used for Pages Functions. */ - durable_object_namespaces?: Preview.DurableObjectNamespaces | null; + durable_object_namespaces?: Record | null; /** * Environment variables for build configs. */ - env_vars?: Preview.EnvVars | null; + env_vars?: Record | null; /** * Hyperdrive bindings used for Pages Functions. */ - hyperdrive_bindings?: Preview.HyperdriveBindings | null; + hyperdrive_bindings?: Record | null; /** * KV namespaces used for Pages Functions. */ - kv_namespaces?: Preview.KVNamespaces; + kv_namespaces?: Record | null; /** * mTLS bindings used for Pages Functions. */ - mtls_certificates?: Preview.MTLSCertificates | null; + mtls_certificates?: Record | null; /** * Placement setting used for Pages Functions. @@ -379,205 +501,104 @@ export namespace Project { /** * Queue Producer bindings used for Pages Functions. */ - queue_producers?: Preview.QueueProducers | null; + queue_producers?: Record | null; /** * R2 buckets used for Pages Functions. */ - r2_buckets?: Preview.R2Buckets | null; + r2_buckets?: Record | null; /** * Services used for Pages Functions. */ - services?: Preview.Services | null; + services?: Record | null; /** * Vectorize bindings used for Pages Functions. */ - vectorize_bindings?: Preview.VectorizeBindings | null; + vectorize_bindings?: Record | null; } export namespace Preview { /** - * Constellation bindings used for Pages Functions. + * AI binding. */ export interface AIBindings { - /** - * AI binding. - */ - AI_BINDING?: AIBindings.AIBinding; - } - - export namespace AIBindings { - /** - * AI binding. - */ - export interface AIBinding { - project_id?: unknown; - } + project_id?: string; } /** - * Analytics Engine bindings used for Pages Functions. + * Analytics Engine binding. */ export interface AnalyticsEngineDatasets { /** - * Analytics Engine binding. - */ - ANALYTICS_ENGINE_BINDING?: AnalyticsEngineDatasets.AnalyticsEngineBinding; - } - - export namespace AnalyticsEngineDatasets { - /** - * Analytics Engine binding. + * Name of the dataset. */ - export interface AnalyticsEngineBinding { - /** - * Name of the dataset. - */ - dataset?: string; - } + dataset?: string; } /** - * Browser bindings used for Pages Functions. + * Browser binding. */ - export interface Browsers { - /** - * Browser binding. - */ - BROWSER?: unknown; - } + export interface Browsers {} /** - * D1 databases used for Pages Functions. + * D1 binding. */ export interface D1Databases { /** - * D1 binding. + * UUID of the D1 database. */ - D1_BINDING?: D1Databases.D1Binding; - } - - export namespace D1Databases { - /** - * D1 binding. - */ - export interface D1Binding { - /** - * UUID of the D1 database. - */ - id?: string; - } + id?: string; } /** - * Durabble Object namespaces used for Pages Functions. + * Durabble Object binding. */ export interface DurableObjectNamespaces { /** - * Durabble Object binding. - */ - DO_BINDING?: DurableObjectNamespaces.DoBinding; - } - - export namespace DurableObjectNamespaces { - /** - * Durabble Object binding. + * ID of the Durabble Object namespace. */ - export interface DoBinding { - /** - * ID of the Durabble Object namespace. - */ - namespace_id?: string; - } + namespace_id?: string; } /** - * Environment variables for build configs. + * Environment variable. */ export interface EnvVars { /** - * Environment variable. + * Environment variable value. */ - ENVIRONMENT_VARIABLE?: EnvVars.EnvironmentVariable; - } + value: string; - export namespace EnvVars { /** - * Environment variable. + * The type of environment variable. */ - export interface EnvironmentVariable { - /** - * The type of environment variable (plain text or secret) - */ - type?: 'plain_text' | 'secret_text'; - - /** - * Environment variable value. - */ - value?: string; - } + type?: 'plain_text' | 'secret_text'; } /** - * Hyperdrive bindings used for Pages Functions. + * Hyperdrive binding. */ export interface HyperdriveBindings { - /** - * Hyperdrive binding. - */ - HYPERDRIVE?: HyperdriveBindings.Hyperdrive; - } - - export namespace HyperdriveBindings { - /** - * Hyperdrive binding. - */ - export interface Hyperdrive { - id?: string; - } + id?: string; } /** - * KV namespaces used for Pages Functions. + * KV namespace binding. */ export interface KVNamespaces { /** - * KV binding. - */ - KV_BINDING?: KVNamespaces.KVBinding; - } - - export namespace KVNamespaces { - /** - * KV binding. + * ID of the KV namespace. */ - export interface KVBinding { - /** - * ID of the KV namespace. - */ - namespace_id?: string; - } + namespace_id?: string; } /** - * mTLS bindings used for Pages Functions. + * mTLS binding. */ export interface MTLSCertificates { - /** - * mTLS binding. - */ - MTLS?: MTLSCertificates.MTLS; - } - - export namespace MTLSCertificates { - /** - * mTLS binding. - */ - export interface MTLS { - certificate_id?: string; - } + certificate_id?: string; } /** @@ -591,103 +612,55 @@ export namespace Project { } /** - * Queue Producer bindings used for Pages Functions. + * Queue Producer binding. */ export interface QueueProducers { /** - * Queue Producer binding. + * Name of the Queue. */ - QUEUE_PRODUCER_BINDING?: QueueProducers.QueueProducerBinding; - } - - export namespace QueueProducers { - /** - * Queue Producer binding. - */ - export interface QueueProducerBinding { - /** - * Name of the Queue. - */ - name?: string; - } + name?: string; } /** - * R2 buckets used for Pages Functions. + * R2 binding. */ export interface R2Buckets { /** - * R2 binding. + * Jurisdiction of the R2 bucket. */ - R2_BINDING?: R2Buckets.R2Binding; - } + jurisdiction?: string | null; - export namespace R2Buckets { /** - * R2 binding. + * Name of the R2 bucket. */ - export interface R2Binding { - /** - * Jurisdiction of the R2 bucket. - */ - jurisdiction?: string | null; - - /** - * Name of the R2 bucket. - */ - name?: string; - } + name?: string; } /** - * Services used for Pages Functions. + * Service binding. */ export interface Services { /** - * Service binding. + * The entrypoint to bind to. */ - SERVICE_BINDING?: Services.ServiceBinding; - } + entrypoint?: string | null; - export namespace Services { /** - * Service binding. + * The Service environment. */ - export interface ServiceBinding { - /** - * The entrypoint to bind to. - */ - entrypoint?: string | null; - - /** - * The Service environment. - */ - environment?: string; + environment?: string; - /** - * The Service name. - */ - service?: string; - } + /** + * The Service name. + */ + service?: string; } /** - * Vectorize bindings used for Pages Functions. + * Vectorize binding. */ export interface VectorizeBindings { - /** - * Vectorize binding. - */ - VECTORIZE?: VectorizeBindings.Vectorize; - } - - export namespace VectorizeBindings { - /** - * Vectorize binding. - */ - export interface Vectorize { - index_name?: string; - } + index_name?: string; } } @@ -698,17 +671,17 @@ export namespace Project { /** * Constellation bindings used for Pages Functions. */ - ai_bindings?: Production.AIBindings | null; + ai_bindings?: Record | null; /** * Analytics Engine bindings used for Pages Functions. */ - analytics_engine_datasets?: Production.AnalyticsEngineDatasets | null; + analytics_engine_datasets?: Record | null; /** * Browser bindings used for Pages Functions. */ - browsers?: Production.Browsers | null; + browsers?: Record | null; /** * Compatibility date used for Pages Functions. @@ -718,37 +691,37 @@ export namespace Project { /** * Compatibility flags used for Pages Functions. */ - compatibility_flags?: Array; + compatibility_flags?: Array; /** * D1 databases used for Pages Functions. */ - d1_databases?: Production.D1Databases | null; + d1_databases?: Record | null; /** * Durabble Object namespaces used for Pages Functions. */ - durable_object_namespaces?: Production.DurableObjectNamespaces | null; + durable_object_namespaces?: Record | null; /** * Environment variables for build configs. */ - env_vars?: Production.EnvVars | null; + env_vars?: Record | null; /** * Hyperdrive bindings used for Pages Functions. */ - hyperdrive_bindings?: Production.HyperdriveBindings | null; + hyperdrive_bindings?: Record | null; /** * KV namespaces used for Pages Functions. */ - kv_namespaces?: Production.KVNamespaces; + kv_namespaces?: Record | null; /** * mTLS bindings used for Pages Functions. */ - mtls_certificates?: Production.MTLSCertificates | null; + mtls_certificates?: Record | null; /** * Placement setting used for Pages Functions. @@ -758,205 +731,104 @@ export namespace Project { /** * Queue Producer bindings used for Pages Functions. */ - queue_producers?: Production.QueueProducers | null; + queue_producers?: Record | null; /** * R2 buckets used for Pages Functions. */ - r2_buckets?: Production.R2Buckets | null; + r2_buckets?: Record | null; /** * Services used for Pages Functions. */ - services?: Production.Services | null; + services?: Record | null; /** * Vectorize bindings used for Pages Functions. */ - vectorize_bindings?: Production.VectorizeBindings | null; + vectorize_bindings?: Record | null; } export namespace Production { /** - * Constellation bindings used for Pages Functions. + * AI binding. */ export interface AIBindings { - /** - * AI binding. - */ - AI_BINDING?: AIBindings.AIBinding; - } - - export namespace AIBindings { - /** - * AI binding. - */ - export interface AIBinding { - project_id?: unknown; - } + project_id?: string; } /** - * Analytics Engine bindings used for Pages Functions. + * Analytics Engine binding. */ export interface AnalyticsEngineDatasets { /** - * Analytics Engine binding. - */ - ANALYTICS_ENGINE_BINDING?: AnalyticsEngineDatasets.AnalyticsEngineBinding; - } - - export namespace AnalyticsEngineDatasets { - /** - * Analytics Engine binding. + * Name of the dataset. */ - export interface AnalyticsEngineBinding { - /** - * Name of the dataset. - */ - dataset?: string; - } + dataset?: string; } /** - * Browser bindings used for Pages Functions. + * Browser binding. */ - export interface Browsers { - /** - * Browser binding. - */ - BROWSER?: unknown; - } + export interface Browsers {} /** - * D1 databases used for Pages Functions. + * D1 binding. */ export interface D1Databases { /** - * D1 binding. - */ - D1_BINDING?: D1Databases.D1Binding; - } - - export namespace D1Databases { - /** - * D1 binding. + * UUID of the D1 database. */ - export interface D1Binding { - /** - * UUID of the D1 database. - */ - id?: string; - } + id?: string; } /** - * Durabble Object namespaces used for Pages Functions. + * Durabble Object binding. */ export interface DurableObjectNamespaces { /** - * Durabble Object binding. - */ - DO_BINDING?: DurableObjectNamespaces.DoBinding; - } - - export namespace DurableObjectNamespaces { - /** - * Durabble Object binding. + * ID of the Durabble Object namespace. */ - export interface DoBinding { - /** - * ID of the Durabble Object namespace. - */ - namespace_id?: string; - } + namespace_id?: string; } /** - * Environment variables for build configs. + * Environment variable. */ export interface EnvVars { /** - * Environment variable. + * Environment variable value. */ - ENVIRONMENT_VARIABLE?: EnvVars.EnvironmentVariable; - } + value: string; - export namespace EnvVars { /** - * Environment variable. + * The type of environment variable. */ - export interface EnvironmentVariable { - /** - * The type of environment variable (plain text or secret) - */ - type?: 'plain_text' | 'secret_text'; - - /** - * Environment variable value. - */ - value?: string; - } + type?: 'plain_text' | 'secret_text'; } /** - * Hyperdrive bindings used for Pages Functions. + * Hyperdrive binding. */ export interface HyperdriveBindings { - /** - * Hyperdrive binding. - */ - HYPERDRIVE?: HyperdriveBindings.Hyperdrive; - } - - export namespace HyperdriveBindings { - /** - * Hyperdrive binding. - */ - export interface Hyperdrive { - id?: string; - } + id?: string; } /** - * KV namespaces used for Pages Functions. + * KV namespace binding. */ export interface KVNamespaces { /** - * KV binding. + * ID of the KV namespace. */ - KV_BINDING?: KVNamespaces.KVBinding; - } - - export namespace KVNamespaces { - /** - * KV binding. - */ - export interface KVBinding { - /** - * ID of the KV namespace. - */ - namespace_id?: string; - } + namespace_id?: string; } /** - * mTLS bindings used for Pages Functions. + * mTLS binding. */ export interface MTLSCertificates { - /** - * mTLS binding. - */ - MTLS?: MTLSCertificates.MTLS; - } - - export namespace MTLSCertificates { - /** - * mTLS binding. - */ - export interface MTLS { - certificate_id?: string; - } + certificate_id?: string; } /** @@ -970,104 +842,88 @@ export namespace Project { } /** - * Queue Producer bindings used for Pages Functions. + * Queue Producer binding. */ export interface QueueProducers { /** - * Queue Producer binding. - */ - QUEUE_PRODUCER_BINDING?: QueueProducers.QueueProducerBinding; - } - - export namespace QueueProducers { - /** - * Queue Producer binding. + * Name of the Queue. */ - export interface QueueProducerBinding { - /** - * Name of the Queue. - */ - name?: string; - } + name?: string; } /** - * R2 buckets used for Pages Functions. + * R2 binding. */ export interface R2Buckets { /** - * R2 binding. + * Jurisdiction of the R2 bucket. */ - R2_BINDING?: R2Buckets.R2Binding; - } + jurisdiction?: string | null; - export namespace R2Buckets { /** - * R2 binding. + * Name of the R2 bucket. */ - export interface R2Binding { - /** - * Jurisdiction of the R2 bucket. - */ - jurisdiction?: string | null; - - /** - * Name of the R2 bucket. - */ - name?: string; - } + name?: string; } /** - * Services used for Pages Functions. + * Service binding. */ export interface Services { /** - * Service binding. + * The entrypoint to bind to. */ - SERVICE_BINDING?: Services.ServiceBinding; - } + entrypoint?: string | null; - export namespace Services { /** - * Service binding. + * The Service environment. */ - export interface ServiceBinding { - /** - * The entrypoint to bind to. - */ - entrypoint?: string | null; - - /** - * The Service environment. - */ - environment?: string; + environment?: string; - /** - * The Service name. - */ - service?: string; - } + /** + * The Service name. + */ + service?: string; } /** - * Vectorize bindings used for Pages Functions. + * Vectorize binding. */ export interface VectorizeBindings { - /** - * Vectorize binding. - */ - VECTORIZE?: VectorizeBindings.Vectorize; + index_name?: string; } + } + } - export namespace VectorizeBindings { - /** - * Vectorize binding. - */ - export interface Vectorize { - index_name?: string; - } - } + export interface Source { + config?: Source.Config; + + type?: string; + } + + export namespace Source { + export interface Config { + deployments_enabled?: boolean; + + owner?: string; + + path_excludes?: Array; + + path_includes?: Array; + + pr_comments_enabled?: boolean; + + preview_branch_excludes?: Array; + + preview_branch_includes?: Array; + + preview_deployment_setting?: 'all' | 'none' | 'custom'; + + production_branch?: string; + + production_deployments_enabled?: boolean; + + repo_name?: string; } } } @@ -1097,22 +953,8 @@ export interface Stage { status?: string; } -/** - * The status of the deployment. - */ -export interface StageParam { - /** - * The current build stage. - */ - name?: string; -} - -export type ProjectCreateResponse = unknown | Array | string; - export type ProjectDeleteResponse = unknown; -export type ProjectEditResponse = unknown | Array | string; - export type ProjectPurgeBuildCacheResponse = unknown; export interface ProjectCreateParams { @@ -1126,21 +968,11 @@ export interface ProjectCreateParams { */ build_config?: ProjectCreateParams.BuildConfig; - /** - * Body param: - */ - canonical_deployment?: DeploymentParam; - /** * Body param: Configs for deployments in a project. */ deployment_configs?: ProjectCreateParams.DeploymentConfigs; - /** - * Body param: - */ - latest_deployment?: DeploymentParam; - /** * Body param: Name of the project. */ @@ -1212,17 +1044,17 @@ export namespace ProjectCreateParams { /** * Constellation bindings used for Pages Functions. */ - ai_bindings?: Preview.AIBindings | null; + ai_bindings?: Record | null; /** * Analytics Engine bindings used for Pages Functions. */ - analytics_engine_datasets?: Preview.AnalyticsEngineDatasets | null; + analytics_engine_datasets?: Record | null; /** * Browser bindings used for Pages Functions. */ - browsers?: Preview.Browsers | null; + browsers?: Record | null; /** * Compatibility date used for Pages Functions. @@ -1232,37 +1064,37 @@ export namespace ProjectCreateParams { /** * Compatibility flags used for Pages Functions. */ - compatibility_flags?: Array; + compatibility_flags?: Array; /** * D1 databases used for Pages Functions. */ - d1_databases?: Preview.D1Databases | null; + d1_databases?: Record | null; /** * Durabble Object namespaces used for Pages Functions. */ - durable_object_namespaces?: Preview.DurableObjectNamespaces | null; + durable_object_namespaces?: Record | null; /** * Environment variables for build configs. */ - env_vars?: Preview.EnvVars | null; + env_vars?: Record | null; /** * Hyperdrive bindings used for Pages Functions. */ - hyperdrive_bindings?: Preview.HyperdriveBindings | null; + hyperdrive_bindings?: Record | null; /** * KV namespaces used for Pages Functions. */ - kv_namespaces?: Preview.KVNamespaces; + kv_namespaces?: Record | null; /** * mTLS bindings used for Pages Functions. */ - mtls_certificates?: Preview.MTLSCertificates | null; + mtls_certificates?: Record | null; /** * Placement setting used for Pages Functions. @@ -1272,205 +1104,334 @@ export namespace ProjectCreateParams { /** * Queue Producer bindings used for Pages Functions. */ - queue_producers?: Preview.QueueProducers | null; + queue_producers?: Record | null; /** * R2 buckets used for Pages Functions. */ - r2_buckets?: Preview.R2Buckets | null; + r2_buckets?: Record | null; /** * Services used for Pages Functions. */ - services?: Preview.Services | null; + services?: Record | null; /** * Vectorize bindings used for Pages Functions. */ - vectorize_bindings?: Preview.VectorizeBindings | null; + vectorize_bindings?: Record | null; } export namespace Preview { /** - * Constellation bindings used for Pages Functions. + * AI binding. */ export interface AIBindings { - /** - * AI binding. - */ - AI_BINDING?: AIBindings.AIBinding; - } - - export namespace AIBindings { - /** - * AI binding. - */ - export interface AIBinding { - project_id?: unknown; - } + project_id?: string; } /** - * Analytics Engine bindings used for Pages Functions. + * Analytics Engine binding. */ export interface AnalyticsEngineDatasets { /** - * Analytics Engine binding. + * Name of the dataset. */ - ANALYTICS_ENGINE_BINDING?: AnalyticsEngineDatasets.AnalyticsEngineBinding; + dataset?: string; } - export namespace AnalyticsEngineDatasets { - /** - * Analytics Engine binding. + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { + /** + * UUID of the D1 database. */ - export interface AnalyticsEngineBinding { - /** - * Name of the dataset. - */ - dataset?: string; - } + id?: string; } /** - * Browser bindings used for Pages Functions. + * Durabble Object binding. */ - export interface Browsers { + export interface DurableObjectNamespaces { /** - * Browser binding. + * ID of the Durabble Object namespace. */ - BROWSER?: unknown; + namespace_id?: string; } /** - * D1 databases used for Pages Functions. + * Environment variable. */ - export interface D1Databases { + export interface EnvVars { /** - * D1 binding. + * Environment variable value. */ - D1_BINDING?: D1Databases.D1Binding; - } + value: string; - export namespace D1Databases { /** - * D1 binding. + * The type of environment variable. */ - export interface D1Binding { - /** - * UUID of the D1 database. - */ - id?: string; - } + type?: 'plain_text' | 'secret_text'; } /** - * Durabble Object namespaces used for Pages Functions. + * Hyperdrive binding. */ - export interface DurableObjectNamespaces { + export interface HyperdriveBindings { + id?: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { /** - * Durabble Object binding. + * ID of the KV namespace. */ - DO_BINDING?: DurableObjectNamespaces.DoBinding; + namespace_id?: string; } - export namespace DurableObjectNamespaces { + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id?: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { /** - * Durabble Object binding. + * Placement mode. */ - export interface DoBinding { - /** - * ID of the Durabble Object namespace. - */ - namespace_id?: string; - } + mode?: string; } /** - * Environment variables for build configs. + * Queue Producer binding. */ - export interface EnvVars { + export interface QueueProducers { /** - * Environment variable. + * Name of the Queue. */ - ENVIRONMENT_VARIABLE?: EnvVars.EnvironmentVariable; + name?: string; } - export namespace EnvVars { + /** + * R2 binding. + */ + export interface R2Buckets { /** - * Environment variable. + * Jurisdiction of the R2 bucket. */ - export interface EnvironmentVariable { - /** - * The type of environment variable (plain text or secret) - */ - type?: 'plain_text' | 'secret_text'; + jurisdiction?: string | null; - /** - * Environment variable value. - */ - value?: string; - } + /** + * Name of the R2 bucket. + */ + name?: string; } /** - * Hyperdrive bindings used for Pages Functions. + * Service binding. */ - export interface HyperdriveBindings { + export interface Services { /** - * Hyperdrive binding. + * The entrypoint to bind to. */ - HYPERDRIVE?: HyperdriveBindings.Hyperdrive; - } + entrypoint?: string | null; + + /** + * The Service environment. + */ + environment?: string; - export namespace HyperdriveBindings { /** - * Hyperdrive binding. + * The Service name. */ - export interface Hyperdrive { - id?: string; - } + service?: string; } + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name?: string; + } + } + + /** + * Configs for production deploys. + */ + export interface Production { + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: Record | null; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: Record | null; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: Record | null; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date?: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags?: Array; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: Record | null; + + /** + * Durabble Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: Record | null; + + /** + * Environment variables for build configs. + */ + env_vars?: Record | null; + + /** + * Hyperdrive bindings used for Pages Functions. + */ + hyperdrive_bindings?: Record | null; + /** * KV namespaces used for Pages Functions. */ - export interface KVNamespaces { + kv_namespaces?: Record | null; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: Record | null; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Production.Placement | null; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: Record | null; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: Record | null; + + /** + * Services used for Pages Functions. + */ + services?: Record | null; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: Record | null; + } + + export namespace Production { + /** + * AI binding. + */ + export interface AIBindings { + project_id?: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { /** - * KV binding. + * Name of the dataset. */ - KV_BINDING?: KVNamespaces.KVBinding; + dataset?: string; } - export namespace KVNamespaces { + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { /** - * KV binding. + * UUID of the D1 database. */ - export interface KVBinding { - /** - * ID of the KV namespace. - */ - namespace_id?: string; - } + id?: string; } /** - * mTLS bindings used for Pages Functions. + * Durabble Object binding. */ - export interface MTLSCertificates { + export interface DurableObjectNamespaces { /** - * mTLS binding. + * ID of the Durabble Object namespace. */ - MTLS?: MTLSCertificates.MTLS; + namespace_id?: string; } - export namespace MTLSCertificates { + /** + * Environment variable. + */ + export interface EnvVars { + /** + * Environment variable value. + */ + value: string; + /** - * mTLS binding. + * The type of environment variable. */ - export interface MTLS { - certificate_id?: string; - } + type?: 'plain_text' | 'secret_text'; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id?: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { + /** + * ID of the KV namespace. + */ + namespace_id?: string; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id?: string; } /** @@ -1484,124 +1445,172 @@ export namespace ProjectCreateParams { } /** - * Queue Producer bindings used for Pages Functions. + * Queue Producer binding. */ export interface QueueProducers { /** - * Queue Producer binding. + * Name of the Queue. */ - QUEUE_PRODUCER_BINDING?: QueueProducers.QueueProducerBinding; - } - - export namespace QueueProducers { - /** - * Queue Producer binding. - */ - export interface QueueProducerBinding { - /** - * Name of the Queue. - */ - name?: string; - } + name?: string; } /** - * R2 buckets used for Pages Functions. + * R2 binding. */ export interface R2Buckets { /** - * R2 binding. + * Jurisdiction of the R2 bucket. */ - R2_BINDING?: R2Buckets.R2Binding; - } + jurisdiction?: string | null; - export namespace R2Buckets { /** - * R2 binding. + * Name of the R2 bucket. */ - export interface R2Binding { - /** - * Jurisdiction of the R2 bucket. - */ - jurisdiction?: string | null; - - /** - * Name of the R2 bucket. - */ - name?: string; - } + name?: string; } /** - * Services used for Pages Functions. + * Service binding. */ export interface Services { /** - * Service binding. + * The entrypoint to bind to. */ - SERVICE_BINDING?: Services.ServiceBinding; - } + entrypoint?: string | null; - export namespace Services { /** - * Service binding. + * The Service environment. */ - export interface ServiceBinding { - /** - * The entrypoint to bind to. - */ - entrypoint?: string | null; + environment?: string; - /** - * The Service environment. - */ - environment?: string; - - /** - * The Service name. - */ - service?: string; - } + /** + * The Service name. + */ + service?: string; } /** - * Vectorize bindings used for Pages Functions. + * Vectorize binding. */ export interface VectorizeBindings { - /** - * Vectorize binding. - */ - VECTORIZE?: VectorizeBindings.Vectorize; - } - - export namespace VectorizeBindings { - /** - * Vectorize binding. - */ - export interface Vectorize { - index_name?: string; - } + index_name?: string; } } + } +} + +export interface ProjectListParams { + /** + * Identifier + */ + account_id: string; +} + +export interface ProjectDeleteParams { + /** + * Identifier + */ + account_id: string; +} + +export interface ProjectEditParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: Configs for the project build process. + */ + build_config?: ProjectEditParams.BuildConfig; + + /** + * Body param: Configs for deployments in a project. + */ + deployment_configs?: ProjectEditParams.DeploymentConfigs; + + /** + * Body param: Name of the project. + */ + name?: string; + + /** + * Body param: Production branch of the project. Used to identify production + * deployments. + */ + production_branch?: string; +} + +export namespace ProjectEditParams { + /** + * Configs for the project build process. + */ + export interface BuildConfig { + /** + * Enable build caching for the project. + */ + build_caching?: boolean | null; + + /** + * Command used to build project. + */ + build_command?: string | null; + + /** + * Output directory of the build. + */ + destination_dir?: string | null; + + /** + * Directory to run the command. + */ + root_dir?: string | null; + + /** + * The classifying tag for analytics. + */ + web_analytics_tag?: string | null; + + /** + * The auth token for analytics. + */ + web_analytics_token?: string | null; + } + + /** + * Configs for deployments in a project. + */ + export interface DeploymentConfigs { + /** + * Configs for preview deploys. + */ + preview?: DeploymentConfigs.Preview; /** * Configs for production deploys. */ - export interface Production { + production?: DeploymentConfigs.Production; + } + + export namespace DeploymentConfigs { + /** + * Configs for preview deploys. + */ + export interface Preview { /** * Constellation bindings used for Pages Functions. */ - ai_bindings?: Production.AIBindings | null; + ai_bindings?: Record | null; /** * Analytics Engine bindings used for Pages Functions. */ - analytics_engine_datasets?: Production.AnalyticsEngineDatasets | null; + analytics_engine_datasets?: Record | null; /** * Browser bindings used for Pages Functions. */ - browsers?: Production.Browsers | null; + browsers?: Record | null; /** * Compatibility date used for Pages Functions. @@ -1611,245 +1620,374 @@ export namespace ProjectCreateParams { /** * Compatibility flags used for Pages Functions. */ - compatibility_flags?: Array; + compatibility_flags?: Array; /** * D1 databases used for Pages Functions. */ - d1_databases?: Production.D1Databases | null; + d1_databases?: Record | null; /** * Durabble Object namespaces used for Pages Functions. */ - durable_object_namespaces?: Production.DurableObjectNamespaces | null; + durable_object_namespaces?: Record | null; /** * Environment variables for build configs. */ - env_vars?: Production.EnvVars | null; + env_vars?: Record | null; /** * Hyperdrive bindings used for Pages Functions. */ - hyperdrive_bindings?: Production.HyperdriveBindings | null; + hyperdrive_bindings?: Record | null; /** * KV namespaces used for Pages Functions. */ - kv_namespaces?: Production.KVNamespaces; + kv_namespaces?: Record | null; /** * mTLS bindings used for Pages Functions. */ - mtls_certificates?: Production.MTLSCertificates | null; + mtls_certificates?: Record | null; /** * Placement setting used for Pages Functions. */ - placement?: Production.Placement | null; + placement?: Preview.Placement | null; /** * Queue Producer bindings used for Pages Functions. */ - queue_producers?: Production.QueueProducers | null; + queue_producers?: Record | null; /** * R2 buckets used for Pages Functions. */ - r2_buckets?: Production.R2Buckets | null; + r2_buckets?: Record | null; /** * Services used for Pages Functions. */ - services?: Production.Services | null; + services?: Record | null; /** * Vectorize bindings used for Pages Functions. */ - vectorize_bindings?: Production.VectorizeBindings | null; + vectorize_bindings?: Record | null; } - export namespace Production { + export namespace Preview { /** - * Constellation bindings used for Pages Functions. + * AI binding. */ export interface AIBindings { + project_id?: string; + } + + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { /** - * AI binding. + * Name of the dataset. */ - AI_BINDING?: AIBindings.AIBinding; + dataset?: string; } - export namespace AIBindings { + /** + * Browser binding. + */ + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { /** - * AI binding. + * UUID of the D1 database. */ - export interface AIBinding { - project_id?: unknown; - } + id?: string; } /** - * Analytics Engine bindings used for Pages Functions. + * Durabble Object binding. */ - export interface AnalyticsEngineDatasets { + export interface DurableObjectNamespaces { /** - * Analytics Engine binding. + * ID of the Durabble Object namespace. */ - ANALYTICS_ENGINE_BINDING?: AnalyticsEngineDatasets.AnalyticsEngineBinding; + namespace_id?: string; } - export namespace AnalyticsEngineDatasets { + /** + * Environment variable. + */ + export interface EnvVars { /** - * Analytics Engine binding. + * Environment variable value. */ - export interface AnalyticsEngineBinding { - /** - * Name of the dataset. - */ - dataset?: string; - } + value: string; + + /** + * The type of environment variable. + */ + type?: 'plain_text' | 'secret_text'; } /** - * Browser bindings used for Pages Functions. + * Hyperdrive binding. */ - export interface Browsers { + export interface HyperdriveBindings { + id?: string; + } + + /** + * KV namespace binding. + */ + export interface KVNamespaces { /** - * Browser binding. + * ID of the KV namespace. */ - BROWSER?: unknown; + namespace_id?: string; } /** - * D1 databases used for Pages Functions. + * mTLS binding. */ - export interface D1Databases { + export interface MTLSCertificates { + certificate_id?: string; + } + + /** + * Placement setting used for Pages Functions. + */ + export interface Placement { /** - * D1 binding. + * Placement mode. */ - D1_BINDING?: D1Databases.D1Binding; + mode?: string; } - export namespace D1Databases { + /** + * Queue Producer binding. + */ + export interface QueueProducers { /** - * D1 binding. + * Name of the Queue. */ - export interface D1Binding { - /** - * UUID of the D1 database. - */ - id?: string; - } + name?: string; } /** - * Durabble Object namespaces used for Pages Functions. + * R2 binding. */ - export interface DurableObjectNamespaces { + export interface R2Buckets { /** - * Durabble Object binding. + * Jurisdiction of the R2 bucket. */ - DO_BINDING?: DurableObjectNamespaces.DoBinding; - } + jurisdiction?: string | null; - export namespace DurableObjectNamespaces { /** - * Durabble Object binding. + * Name of the R2 bucket. */ - export interface DoBinding { - /** - * ID of the Durabble Object namespace. - */ - namespace_id?: string; - } + name?: string; } /** - * Environment variables for build configs. + * Service binding. */ - export interface EnvVars { + export interface Services { /** - * Environment variable. + * The entrypoint to bind to. */ - ENVIRONMENT_VARIABLE?: EnvVars.EnvironmentVariable; - } + entrypoint?: string | null; - export namespace EnvVars { /** - * Environment variable. + * The Service environment. */ - export interface EnvironmentVariable { - /** - * The type of environment variable (plain text or secret) - */ - type?: 'plain_text' | 'secret_text'; + environment?: string; - /** - * Environment variable value. - */ - value?: string; - } + /** + * The Service name. + */ + service?: string; } + /** + * Vectorize binding. + */ + export interface VectorizeBindings { + index_name?: string; + } + } + + /** + * Configs for production deploys. + */ + export interface Production { + /** + * Constellation bindings used for Pages Functions. + */ + ai_bindings?: Record | null; + + /** + * Analytics Engine bindings used for Pages Functions. + */ + analytics_engine_datasets?: Record | null; + + /** + * Browser bindings used for Pages Functions. + */ + browsers?: Record | null; + + /** + * Compatibility date used for Pages Functions. + */ + compatibility_date?: string; + + /** + * Compatibility flags used for Pages Functions. + */ + compatibility_flags?: Array; + + /** + * D1 databases used for Pages Functions. + */ + d1_databases?: Record | null; + + /** + * Durabble Object namespaces used for Pages Functions. + */ + durable_object_namespaces?: Record | null; + + /** + * Environment variables for build configs. + */ + env_vars?: Record | null; + /** * Hyperdrive bindings used for Pages Functions. */ - export interface HyperdriveBindings { - /** - * Hyperdrive binding. - */ - HYPERDRIVE?: HyperdriveBindings.Hyperdrive; + hyperdrive_bindings?: Record | null; + + /** + * KV namespaces used for Pages Functions. + */ + kv_namespaces?: Record | null; + + /** + * mTLS bindings used for Pages Functions. + */ + mtls_certificates?: Record | null; + + /** + * Placement setting used for Pages Functions. + */ + placement?: Production.Placement | null; + + /** + * Queue Producer bindings used for Pages Functions. + */ + queue_producers?: Record | null; + + /** + * R2 buckets used for Pages Functions. + */ + r2_buckets?: Record | null; + + /** + * Services used for Pages Functions. + */ + services?: Record | null; + + /** + * Vectorize bindings used for Pages Functions. + */ + vectorize_bindings?: Record | null; + } + + export namespace Production { + /** + * AI binding. + */ + export interface AIBindings { + project_id?: string; } - export namespace HyperdriveBindings { + /** + * Analytics Engine binding. + */ + export interface AnalyticsEngineDatasets { /** - * Hyperdrive binding. + * Name of the dataset. */ - export interface Hyperdrive { - id?: string; - } + dataset?: string; } /** - * KV namespaces used for Pages Functions. + * Browser binding. */ - export interface KVNamespaces { + export interface Browsers {} + + /** + * D1 binding. + */ + export interface D1Databases { /** - * KV binding. + * UUID of the D1 database. */ - KV_BINDING?: KVNamespaces.KVBinding; + id?: string; } - export namespace KVNamespaces { + /** + * Durabble Object binding. + */ + export interface DurableObjectNamespaces { /** - * KV binding. + * ID of the Durabble Object namespace. */ - export interface KVBinding { - /** - * ID of the KV namespace. - */ - namespace_id?: string; - } + namespace_id?: string; } /** - * mTLS bindings used for Pages Functions. + * Environment variable. */ - export interface MTLSCertificates { + export interface EnvVars { + /** + * Environment variable value. + */ + value: string; + /** - * mTLS binding. + * The type of environment variable. */ - MTLS?: MTLSCertificates.MTLS; + type?: 'plain_text' | 'secret_text'; + } + + /** + * Hyperdrive binding. + */ + export interface HyperdriveBindings { + id?: string; } - export namespace MTLSCertificates { + /** + * KV namespace binding. + */ + export interface KVNamespaces { /** - * mTLS binding. + * ID of the KV namespace. */ - export interface MTLS { - certificate_id?: string; - } + namespace_id?: string; + } + + /** + * mTLS binding. + */ + export interface MTLSCertificates { + certificate_id?: string; } /** @@ -1863,134 +2001,60 @@ export namespace ProjectCreateParams { } /** - * Queue Producer bindings used for Pages Functions. + * Queue Producer binding. */ export interface QueueProducers { /** - * Queue Producer binding. - */ - QUEUE_PRODUCER_BINDING?: QueueProducers.QueueProducerBinding; - } - - export namespace QueueProducers { - /** - * Queue Producer binding. + * Name of the Queue. */ - export interface QueueProducerBinding { - /** - * Name of the Queue. - */ - name?: string; - } + name?: string; } /** - * R2 buckets used for Pages Functions. + * R2 binding. */ export interface R2Buckets { /** - * R2 binding. + * Jurisdiction of the R2 bucket. */ - R2_BINDING?: R2Buckets.R2Binding; - } + jurisdiction?: string | null; - export namespace R2Buckets { /** - * R2 binding. + * Name of the R2 bucket. */ - export interface R2Binding { - /** - * Jurisdiction of the R2 bucket. - */ - jurisdiction?: string | null; - - /** - * Name of the R2 bucket. - */ - name?: string; - } + name?: string; } /** - * Services used for Pages Functions. + * Service binding. */ export interface Services { /** - * Service binding. + * The entrypoint to bind to. */ - SERVICE_BINDING?: Services.ServiceBinding; - } + entrypoint?: string | null; - export namespace Services { /** - * Service binding. + * The Service environment. */ - export interface ServiceBinding { - /** - * The entrypoint to bind to. - */ - entrypoint?: string | null; - - /** - * The Service environment. - */ - environment?: string; + environment?: string; - /** - * The Service name. - */ - service?: string; - } + /** + * The Service name. + */ + service?: string; } /** - * Vectorize bindings used for Pages Functions. + * Vectorize binding. */ export interface VectorizeBindings { - /** - * Vectorize binding. - */ - VECTORIZE?: VectorizeBindings.Vectorize; - } - - export namespace VectorizeBindings { - /** - * Vectorize binding. - */ - export interface Vectorize { - index_name?: string; - } + index_name?: string; } } } } -export interface ProjectListParams { - /** - * Identifier - */ - account_id: string; -} - -export interface ProjectDeleteParams { - /** - * Identifier - */ - account_id: string; -} - -export interface ProjectEditParams { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: - */ - body: unknown; -} - export interface ProjectGetParams { /** * Identifier @@ -2005,39 +2069,50 @@ export interface ProjectPurgeBuildCacheParams { account_id: string; } -export namespace Projects { - export import Deployment = ProjectsAPI.Deployment; - export import Project = ProjectsAPI.Project; - export import Stage = ProjectsAPI.Stage; - export import ProjectCreateResponse = ProjectsAPI.ProjectCreateResponse; - export import ProjectDeleteResponse = ProjectsAPI.ProjectDeleteResponse; - export import ProjectEditResponse = ProjectsAPI.ProjectEditResponse; - export import ProjectPurgeBuildCacheResponse = ProjectsAPI.ProjectPurgeBuildCacheResponse; - export import DeploymentsSinglePage = ProjectsAPI.DeploymentsSinglePage; - export import ProjectCreateParams = ProjectsAPI.ProjectCreateParams; - export import ProjectListParams = ProjectsAPI.ProjectListParams; - export import ProjectDeleteParams = ProjectsAPI.ProjectDeleteParams; - export import ProjectEditParams = ProjectsAPI.ProjectEditParams; - export import ProjectGetParams = ProjectsAPI.ProjectGetParams; - export import ProjectPurgeBuildCacheParams = ProjectsAPI.ProjectPurgeBuildCacheParams; - export import Deployments = DeploymentsAPI.Deployments; - export import DeploymentDeleteResponse = DeploymentsAPI.DeploymentDeleteResponse; - export import DeploymentCreateParams = DeploymentsAPI.DeploymentCreateParams; - export import DeploymentListParams = DeploymentsAPI.DeploymentListParams; - export import DeploymentDeleteParams = DeploymentsAPI.DeploymentDeleteParams; - export import DeploymentGetParams = DeploymentsAPI.DeploymentGetParams; - export import DeploymentRetryParams = DeploymentsAPI.DeploymentRetryParams; - export import DeploymentRollbackParams = DeploymentsAPI.DeploymentRollbackParams; - export import Domains = DomainsAPI.Domains; - export import DomainCreateResponse = DomainsAPI.DomainCreateResponse; - export import DomainListResponse = DomainsAPI.DomainListResponse; - export import DomainDeleteResponse = DomainsAPI.DomainDeleteResponse; - export import DomainEditResponse = DomainsAPI.DomainEditResponse; - export import DomainGetResponse = DomainsAPI.DomainGetResponse; - export import DomainListResponsesSinglePage = DomainsAPI.DomainListResponsesSinglePage; - export import DomainCreateParams = DomainsAPI.DomainCreateParams; - export import DomainListParams = DomainsAPI.DomainListParams; - export import DomainDeleteParams = DomainsAPI.DomainDeleteParams; - export import DomainEditParams = DomainsAPI.DomainEditParams; - export import DomainGetParams = DomainsAPI.DomainGetParams; +Projects.DeploymentsSinglePage = DeploymentsSinglePage; +Projects.Deployments = Deployments; +Projects.Domains = Domains; +Projects.DomainListResponsesSinglePage = DomainListResponsesSinglePage; + +export declare namespace Projects { + export { + type Deployment as Deployment, + type Project as Project, + type Stage as Stage, + type ProjectDeleteResponse as ProjectDeleteResponse, + type ProjectPurgeBuildCacheResponse as ProjectPurgeBuildCacheResponse, + DeploymentsSinglePage as DeploymentsSinglePage, + type ProjectCreateParams as ProjectCreateParams, + type ProjectListParams as ProjectListParams, + type ProjectDeleteParams as ProjectDeleteParams, + type ProjectEditParams as ProjectEditParams, + type ProjectGetParams as ProjectGetParams, + type ProjectPurgeBuildCacheParams as ProjectPurgeBuildCacheParams, + }; + + export { + Deployments as Deployments, + type DeploymentDeleteResponse as DeploymentDeleteResponse, + type DeploymentCreateParams as DeploymentCreateParams, + type DeploymentListParams as DeploymentListParams, + type DeploymentDeleteParams as DeploymentDeleteParams, + type DeploymentGetParams as DeploymentGetParams, + type DeploymentRetryParams as DeploymentRetryParams, + type DeploymentRollbackParams as DeploymentRollbackParams, + }; + + export { + Domains as Domains, + type DomainCreateResponse as DomainCreateResponse, + type DomainListResponse as DomainListResponse, + type DomainDeleteResponse as DomainDeleteResponse, + type DomainEditResponse as DomainEditResponse, + type DomainGetResponse as DomainGetResponse, + DomainListResponsesSinglePage as DomainListResponsesSinglePage, + type DomainCreateParams as DomainCreateParams, + type DomainListParams as DomainListParams, + type DomainDeleteParams as DomainDeleteParams, + type DomainEditParams as DomainEditParams, + type DomainGetParams as DomainGetParams, + }; } diff --git a/src/resources/pcaps/index.ts b/src/resources/pcaps/index.ts deleted file mode 100644 index 416c8b86b4..0000000000 --- a/src/resources/pcaps/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { DownloadGetParams, Download } from './download'; -export { - Ownership, - OwnershipGetResponse, - OwnershipCreateParams, - OwnershipDeleteParams, - OwnershipGetParams, - OwnershipValidateParams, - OwnershipResource, -} from './ownership'; -export { PCAPs } from './pcaps'; diff --git a/src/resources/queues/consumers.ts b/src/resources/queues/consumers.ts index 52da5916cf..79f7ba9d7f 100644 --- a/src/resources/queues/consumers.ts +++ b/src/resources/queues/consumers.ts @@ -2,23 +2,23 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ConsumersAPI from './consumers'; +import * as Shared from '../shared'; export class Consumers extends APIResource { /** - * Creates a new consumer for a queue. + * Creates a new consumer for a Queue */ create( queueId: string, params: ConsumerCreateParams, options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, body } = params; + ): Core.APIPromise { + const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/queues/${queueId}/consumers`, { - body: body, + body, ...options, - }) as Core.APIPromise<{ result: ConsumerCreateResponse | null }> + }) as Core.APIPromise<{ result: Consumer }> )._thenUnwrap((obj) => obj.result); } @@ -30,13 +30,13 @@ export class Consumers extends APIResource { consumerId: string, params: ConsumerUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, body } = params; + ): Core.APIPromise { + const { account_id, ...body } = params; return ( this._client.put(`/accounts/${account_id}/queues/${queueId}/consumers/${consumerId}`, { - body: body, + body, ...options, - }) as Core.APIPromise<{ result: ConsumerUpdateResponse | null }> + }) as Core.APIPromise<{ result: Consumer }> )._thenUnwrap((obj) => obj.result); } @@ -48,159 +48,392 @@ export class Consumers extends APIResource { consumerId: string, params: ConsumerDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/queues/${queueId}/consumers/${consumerId}`, - options, - ) as Core.APIPromise<{ result: ConsumerDeleteResponse | null }> - )._thenUnwrap((obj) => obj.result); + return this._client.delete(`/accounts/${account_id}/queues/${queueId}/consumers/${consumerId}`, options); } /** - * Returns the consumers for a queue. + * Returns the consumers for a Queue */ get( queueId: string, params: ConsumerGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.get(`/accounts/${account_id}/queues/${queueId}/consumers`, options) as Core.APIPromise<{ - result: ConsumerGetResponse | null; + result: ConsumerGetResponse; }> )._thenUnwrap((obj) => obj.result); } } -export interface Consumer { - created_on?: unknown; +export type Consumer = Consumer.MqWorkerConsumer | Consumer.MqHTTPConsumer; - environment?: unknown; +export namespace Consumer { + export interface MqWorkerConsumer { + /** + * A Resource identifier. + */ + consumer_id?: string; - queue_name?: unknown; + created_on?: string; - service?: unknown; + /** + * A Resource identifier. + */ + queue_id?: string; - settings?: Consumer.Settings; -} + /** + * Name of a Worker + */ + script?: string; -export namespace Consumer { - export interface Settings { + settings?: MqWorkerConsumer.Settings; + + type?: 'worker'; + } + + export namespace MqWorkerConsumer { + export interface Settings { + /** + * The maximum number of messages to include in a batch. + */ + batch_size?: number; + + /** + * Maximum number of concurrent consumers that may consume from this Queue. Set to + * `null` to automatically opt in to the platform's maximum (recommended). + */ + max_concurrency?: number; + + /** + * The maximum number of retries + */ + max_retries?: number; + + /** + * The number of milliseconds to wait for a batch to fill up before attempting to + * deliver it + */ + max_wait_time_ms?: number; + + /** + * The number of seconds to delay before making the message available for another + * attempt. + */ + retry_delay?: number; + } + } + + export interface MqHTTPConsumer { /** - * The maximum number of messages to include in a batch + * A Resource identifier. */ - batch_size?: number; + consumer_id?: string; + + created_on?: string; - max_retries?: number; + /** + * A Resource identifier. + */ + queue_id?: string; + + settings?: MqHTTPConsumer.Settings; + + type?: 'http_pull'; + } - max_wait_time_ms?: number; + export namespace MqHTTPConsumer { + export interface Settings { + /** + * The maximum number of messages to include in a batch. + */ + batch_size?: number; + + /** + * The maximum number of retries + */ + max_retries?: number; + + /** + * The number of seconds to delay before making the message available for another + * attempt. + */ + retry_delay?: number; + + /** + * The number of milliseconds that a message is exclusively leased. After the + * timeout, the message becomes available for another attempt. + */ + visibility_timeout_ms?: number; + } } } -export interface ConsumerCreateResponse { - created_on?: unknown; +export interface ConsumerDeleteResponse { + errors?: Array; - dead_letter_queue?: string; + messages?: Array; - environment?: unknown; + /** + * Indicates if the API call was successful or not. + */ + success?: true; +} - queue_name?: unknown; +export type ConsumerGetResponse = Array; - script_name?: unknown; +export type ConsumerCreateParams = + | ConsumerCreateParams.MqWorkerConsumer + | ConsumerCreateParams.MqHTTPConsumer; - settings?: ConsumerCreateResponse.Settings; -} +export declare namespace ConsumerCreateParams { + export interface MqWorkerConsumer { + /** + * Path param: A Resource identifier. + */ + account_id: string; -export namespace ConsumerCreateResponse { - export interface Settings { /** - * The maximum number of messages to include in a batch + * Body param: */ - batch_size?: number; + dead_letter_queue?: string; - max_retries?: number; + /** + * Body param: Name of a Worker + */ + script_name?: string; - max_wait_time_ms?: number; + /** + * Body param: + */ + settings?: ConsumerCreateParams.MqWorkerConsumer.Settings; + + /** + * Body param: + */ + type?: 'worker'; } -} -export interface ConsumerUpdateResponse { - created_on?: unknown; + export namespace MqWorkerConsumer { + export interface Settings { + /** + * The maximum number of messages to include in a batch. + */ + batch_size?: number; + + /** + * Maximum number of concurrent consumers that may consume from this Queue. Set to + * `null` to automatically opt in to the platform's maximum (recommended). + */ + max_concurrency?: number; + + /** + * The maximum number of retries + */ + max_retries?: number; + + /** + * The number of milliseconds to wait for a batch to fill up before attempting to + * deliver it + */ + max_wait_time_ms?: number; + + /** + * The number of seconds to delay before making the message available for another + * attempt. + */ + retry_delay?: number; + } + } - dead_letter_queue?: string; + export interface MqHTTPConsumer { + /** + * Path param: A Resource identifier. + */ + account_id: string; - environment?: unknown; + /** + * Body param: + */ + dead_letter_queue?: string; - queue_name?: unknown; + /** + * Body param: + */ + settings?: ConsumerCreateParams.MqHTTPConsumer.Settings; - script_name?: unknown; + /** + * Body param: + */ + type?: 'http_pull'; + } - settings?: ConsumerUpdateResponse.Settings; + export namespace MqHTTPConsumer { + export interface Settings { + /** + * The maximum number of messages to include in a batch. + */ + batch_size?: number; + + /** + * The maximum number of retries + */ + max_retries?: number; + + /** + * The number of seconds to delay before making the message available for another + * attempt. + */ + retry_delay?: number; + + /** + * The number of milliseconds that a message is exclusively leased. After the + * timeout, the message becomes available for another attempt. + */ + visibility_timeout_ms?: number; + } + } } -export namespace ConsumerUpdateResponse { - export interface Settings { - batch_size?: number; +export type ConsumerUpdateParams = + | ConsumerUpdateParams.MqWorkerConsumer + | ConsumerUpdateParams.MqHTTPConsumer; - max_retries?: number; +export declare namespace ConsumerUpdateParams { + export interface MqWorkerConsumer { + /** + * Path param: A Resource identifier. + */ + account_id: string; - max_wait_time_ms?: number; + /** + * Body param: + */ + dead_letter_queue?: string; + + /** + * Body param: Name of a Worker + */ + script_name?: string; + + /** + * Body param: + */ + settings?: ConsumerUpdateParams.MqWorkerConsumer.Settings; + + /** + * Body param: + */ + type?: 'worker'; } -} -export type ConsumerDeleteResponse = unknown | Array | string; + export namespace MqWorkerConsumer { + export interface Settings { + /** + * The maximum number of messages to include in a batch. + */ + batch_size?: number; + + /** + * Maximum number of concurrent consumers that may consume from this Queue. Set to + * `null` to automatically opt in to the platform's maximum (recommended). + */ + max_concurrency?: number; + + /** + * The maximum number of retries + */ + max_retries?: number; + + /** + * The number of milliseconds to wait for a batch to fill up before attempting to + * deliver it + */ + max_wait_time_ms?: number; + + /** + * The number of seconds to delay before making the message available for another + * attempt. + */ + retry_delay?: number; + } + } -export type ConsumerGetResponse = Array; + export interface MqHTTPConsumer { + /** + * Path param: A Resource identifier. + */ + account_id: string; -export interface ConsumerCreateParams { - /** - * Path param: Identifier - */ - account_id: string; + /** + * Body param: + */ + dead_letter_queue?: string; - /** - * Body param: - */ - body: unknown; -} + /** + * Body param: + */ + settings?: ConsumerUpdateParams.MqHTTPConsumer.Settings; -export interface ConsumerUpdateParams { - /** - * Path param: Identifier - */ - account_id: string; + /** + * Body param: + */ + type?: 'http_pull'; + } - /** - * Body param: - */ - body: unknown; + export namespace MqHTTPConsumer { + export interface Settings { + /** + * The maximum number of messages to include in a batch. + */ + batch_size?: number; + + /** + * The maximum number of retries + */ + max_retries?: number; + + /** + * The number of seconds to delay before making the message available for another + * attempt. + */ + retry_delay?: number; + + /** + * The number of milliseconds that a message is exclusively leased. After the + * timeout, the message becomes available for another attempt. + */ + visibility_timeout_ms?: number; + } + } } export interface ConsumerDeleteParams { /** - * Identifier + * A Resource identifier. */ account_id: string; } export interface ConsumerGetParams { /** - * Identifier + * A Resource identifier. */ account_id: string; } -export namespace Consumers { - export import Consumer = ConsumersAPI.Consumer; - export import ConsumerCreateResponse = ConsumersAPI.ConsumerCreateResponse; - export import ConsumerUpdateResponse = ConsumersAPI.ConsumerUpdateResponse; - export import ConsumerDeleteResponse = ConsumersAPI.ConsumerDeleteResponse; - export import ConsumerGetResponse = ConsumersAPI.ConsumerGetResponse; - export import ConsumerCreateParams = ConsumersAPI.ConsumerCreateParams; - export import ConsumerUpdateParams = ConsumersAPI.ConsumerUpdateParams; - export import ConsumerDeleteParams = ConsumersAPI.ConsumerDeleteParams; - export import ConsumerGetParams = ConsumersAPI.ConsumerGetParams; +export declare namespace Consumers { + export { + type Consumer as Consumer, + type ConsumerDeleteResponse as ConsumerDeleteResponse, + type ConsumerGetResponse as ConsumerGetResponse, + type ConsumerCreateParams as ConsumerCreateParams, + type ConsumerUpdateParams as ConsumerUpdateParams, + type ConsumerDeleteParams as ConsumerDeleteParams, + type ConsumerGetParams as ConsumerGetParams, + }; } diff --git a/src/resources/queues/index.ts b/src/resources/queues/index.ts index a152604a51..dd45a34efc 100644 --- a/src/resources/queues/index.ts +++ b/src/resources/queues/index.ts @@ -1,22 +1,20 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Consumer, - ConsumerCreateResponse, - ConsumerUpdateResponse, - ConsumerDeleteResponse, - ConsumerGetResponse, - ConsumerCreateParams, - ConsumerUpdateParams, - ConsumerDeleteParams, - ConsumerGetParams, Consumers, + type Consumer, + type ConsumerDeleteResponse, + type ConsumerGetResponse, + type ConsumerCreateParams, + type ConsumerUpdateParams, + type ConsumerDeleteParams, + type ConsumerGetParams, } from './consumers'; export { - MessageAckResponse, - MessagePullResponse, - MessageAckParams, - MessagePullParams, Messages, + type MessageAckResponse, + type MessagePullResponse, + type MessageAckParams, + type MessagePullParams, } from './messages'; export { Queues } from './queues'; diff --git a/src/resources/queues/messages.ts b/src/resources/queues/messages.ts index 9f2b0309e3..cab0149def 100644 --- a/src/resources/queues/messages.ts +++ b/src/resources/queues/messages.ts @@ -2,52 +2,51 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as MessagesAPI from './messages'; export class Messages extends APIResource { /** - * Acknowledge + Retry messages from a Queue. + * Acknowledge + Retry messages from a Queue */ ack( queueId: string, params: MessageAckParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/queues/${queueId}/messages/ack`, { body, ...options, - }) as Core.APIPromise<{ result: MessageAckResponse | null }> + }) as Core.APIPromise<{ result: MessageAckResponse }> )._thenUnwrap((obj) => obj.result); } /** - * Pull a batch of messages from a Queue. + * Pull a batch of messages from a Queue */ pull( queueId: string, params: MessagePullParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/queues/${queueId}/messages/pull`, { body, ...options, - }) as Core.APIPromise<{ result: MessagePullResponse | null }> + }) as Core.APIPromise<{ result: MessagePullResponse }> )._thenUnwrap((obj) => obj.result); } } export interface MessageAckResponse { /** - * The number of messages that were succesfully acknowledged + * The number of messages that were succesfully acknowledged. */ ackCount?: number; /** - * The number of messages that were succesfully retried + * The number of messages that were succesfully retried. */ retryCount?: number; @@ -64,6 +63,10 @@ export namespace MessagePullResponse { body?: string; + /** + * An ID that represents an "in-flight" message that has been pulled from a Queue. + * You must hold on to this ID and use it to acknowledge this message. + */ lease_id?: string; metadata?: unknown; @@ -74,7 +77,7 @@ export namespace MessagePullResponse { export interface MessageAckParams { /** - * Path param: Identifier + * Path param: A Resource identifier. */ account_id: string; @@ -92,7 +95,8 @@ export interface MessageAckParams { export namespace MessageAckParams { export interface Ack { /** - * Lease ID for a message to acknowledge. + * An ID that represents an "in-flight" message that has been pulled from a Queue. + * You must hold on to this ID and use it to acknowledge this message. */ lease_id?: string; } @@ -105,7 +109,8 @@ export namespace MessageAckParams { delay_seconds?: number; /** - * Lease ID for a message to retry. + * An ID that represents an "in-flight" message that has been pulled from a Queue. + * You must hold on to this ID and use it to acknowledge this message. */ lease_id?: string; } @@ -113,12 +118,12 @@ export namespace MessageAckParams { export interface MessagePullParams { /** - * Path param: Identifier + * Path param: A Resource identifier. */ account_id: string; /** - * Body param: The maximum number of messages to include in a batch + * Body param: The maximum number of messages to include in a batch. */ batch_size?: number; @@ -129,9 +134,11 @@ export interface MessagePullParams { visibility_timeout_ms?: number; } -export namespace Messages { - export import MessageAckResponse = MessagesAPI.MessageAckResponse; - export import MessagePullResponse = MessagesAPI.MessagePullResponse; - export import MessageAckParams = MessagesAPI.MessageAckParams; - export import MessagePullParams = MessagesAPI.MessagePullParams; +export declare namespace Messages { + export { + type MessageAckResponse as MessageAckResponse, + type MessagePullResponse as MessagePullResponse, + type MessageAckParams as MessageAckParams, + type MessagePullParams as MessagePullParams, + }; } diff --git a/src/resources/queues/queues.ts b/src/resources/queues/queues.ts index acbb704628..e94587b929 100644 --- a/src/resources/queues/queues.ts +++ b/src/resources/queues/queues.ts @@ -2,8 +2,26 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; +import * as Shared from '../shared'; import * as ConsumersAPI from './consumers'; +import { + Consumer, + ConsumerCreateParams, + ConsumerDeleteParams, + ConsumerDeleteResponse, + ConsumerGetParams, + ConsumerGetResponse, + ConsumerUpdateParams, + Consumers, +} from './consumers'; import * as MessagesAPI from './messages'; +import { + MessageAckParams, + MessageAckResponse, + MessagePullParams, + MessagePullResponse, + Messages, +} from './messages'; import { SinglePage } from '../../pagination'; export class Queues extends APIResource { @@ -11,31 +29,28 @@ export class Queues extends APIResource { messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); /** - * Creates a new queue. + * Create a new queue */ - create(params: QueueCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, body } = params; + create(params: QueueCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; return ( - this._client.post(`/accounts/${account_id}/queues`, { body: body, ...options }) as Core.APIPromise<{ - result: QueueCreated | null; + this._client.post(`/accounts/${account_id}/queues`, { body, ...options }) as Core.APIPromise<{ + result: Queue; }> )._thenUnwrap((obj) => obj.result); } /** - * Updates a queue. + * Updates a Queue. Note that this endpoint does not support partial updates. If + * successful, the Queue's configuration is overwritten with the supplied + * configuration. */ - update( - queueId: string, - params: QueueUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, body } = params; + update(queueId: string, params: QueueUpdateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; return ( - this._client.put(`/accounts/${account_id}/queues/${queueId}`, { - body: body, - ...options, - }) as Core.APIPromise<{ result: QueueUpdated | null }> + this._client.put(`/accounts/${account_id}/queues/${queueId}`, { body, ...options }) as Core.APIPromise<{ + result: Queue; + }> )._thenUnwrap((obj) => obj.result); } @@ -48,29 +63,25 @@ export class Queues extends APIResource { } /** - * Deletes a queue. + * Deletes a queue */ delete( queueId: string, params: QueueDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; - return ( - this._client.delete(`/accounts/${account_id}/queues/${queueId}`, options) as Core.APIPromise<{ - result: QueueDeleteResponse | null; - }> - )._thenUnwrap((obj) => obj.result); + return this._client.delete(`/accounts/${account_id}/queues/${queueId}`, options); } /** - * Get information about a specific queue. + * Get details about a specific queue. */ - get(queueId: string, params: QueueGetParams, options?: Core.RequestOptions): Core.APIPromise { + get(queueId: string, params: QueueGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id } = params; return ( this._client.get(`/accounts/${account_id}/queues/${queueId}`, options) as Core.APIPromise<{ - result: Queue | null; + result: Queue; }> )._thenUnwrap((obj) => obj.result); } @@ -79,104 +90,146 @@ export class Queues extends APIResource { export class QueuesSinglePage extends SinglePage {} export interface Queue { - consumers?: unknown; + consumers?: Array; - consumers_total_count?: unknown; + consumers_total_count?: number; - created_on?: unknown; + created_on?: string; - modified_on?: unknown; + modified_on?: string; - producers?: unknown; + producers?: Array; - producers_total_count?: unknown; + producers_total_count?: number; queue_id?: string; queue_name?: string; + + settings?: Queue.Settings; } -export interface QueueCreated { - created_on?: unknown; +export namespace Queue { + export interface MqWorkerProducer { + script?: string; - modified_on?: unknown; + type?: 'worker'; + } - queue_id?: string; + export interface MqR2Producer { + bucket_name?: string; - queue_name?: string; -} + type?: 'r2_bucket'; + } + + export interface Settings { + /** + * Number of seconds to delay delivery of all messages to consumers. + */ + delivery_delay?: number; -export interface QueueUpdated { - created_on?: unknown; + /** + * Number of seconds after which an unconsumed message will be delayed. + */ + message_retention_period?: number; + } +} - modified_on?: unknown; +export interface QueueDeleteResponse { + errors?: Array; - queue_id?: string; + messages?: Array; - queue_name?: string; + /** + * Indicates if the API call was successful or not. + */ + success?: true; } -export type QueueDeleteResponse = unknown | Array | string; - export interface QueueCreateParams { /** - * Path param: Identifier + * Path param: A Resource identifier. */ account_id: string; /** * Body param: */ - body: unknown; + queue_name: string; } export interface QueueUpdateParams { /** - * Path param: Identifier + * Path param: A Resource identifier. */ account_id: string; /** * Body param: */ - body: unknown; + queue_name?: string; + + /** + * Body param: + */ + settings?: QueueUpdateParams.Settings; +} + +export namespace QueueUpdateParams { + export interface Settings { + /** + * Number of seconds to delay delivery of all messages to consumers. + */ + delivery_delay?: number; + + /** + * Number of seconds after which an unconsumed message will be delayed. + */ + message_retention_period?: number; + } } export interface QueueListParams { /** - * Identifier + * A Resource identifier. */ account_id: string; } export interface QueueDeleteParams { /** - * Identifier + * A Resource identifier. */ account_id: string; } export interface QueueGetParams { /** - * Identifier + * A Resource identifier. */ account_id: string; } -export namespace Queues { - export import Consumers = ConsumersAPI.Consumers; - export import Consumer = ConsumersAPI.Consumer; - export import ConsumerCreateResponse = ConsumersAPI.ConsumerCreateResponse; - export import ConsumerUpdateResponse = ConsumersAPI.ConsumerUpdateResponse; - export import ConsumerDeleteResponse = ConsumersAPI.ConsumerDeleteResponse; - export import ConsumerGetResponse = ConsumersAPI.ConsumerGetResponse; - export import ConsumerCreateParams = ConsumersAPI.ConsumerCreateParams; - export import ConsumerUpdateParams = ConsumersAPI.ConsumerUpdateParams; - export import ConsumerDeleteParams = ConsumersAPI.ConsumerDeleteParams; - export import ConsumerGetParams = ConsumersAPI.ConsumerGetParams; - export import Messages = MessagesAPI.Messages; - export import MessageAckResponse = MessagesAPI.MessageAckResponse; - export import MessagePullResponse = MessagesAPI.MessagePullResponse; - export import MessageAckParams = MessagesAPI.MessageAckParams; - export import MessagePullParams = MessagesAPI.MessagePullParams; +Queues.Consumers = Consumers; +Queues.Messages = Messages; + +export declare namespace Queues { + export { + Consumers as Consumers, + type Consumer as Consumer, + type ConsumerDeleteResponse as ConsumerDeleteResponse, + type ConsumerGetResponse as ConsumerGetResponse, + type ConsumerCreateParams as ConsumerCreateParams, + type ConsumerUpdateParams as ConsumerUpdateParams, + type ConsumerDeleteParams as ConsumerDeleteParams, + type ConsumerGetParams as ConsumerGetParams, + }; + + export { + Messages as Messages, + type MessageAckResponse as MessageAckResponse, + type MessagePullResponse as MessagePullResponse, + type MessageAckParams as MessageAckParams, + type MessagePullParams as MessagePullParams, + }; } diff --git a/src/resources/r2/buckets.ts b/src/resources/r2/buckets.ts deleted file mode 100644 index 3f1b2b9d25..0000000000 --- a/src/resources/r2/buckets.ts +++ /dev/null @@ -1,167 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as BucketsAPI from './buckets'; -import { CursorPagination, type CursorPaginationParams } from '../../pagination'; - -export class Buckets extends APIResource { - /** - * Creates a new R2 bucket. - */ - create(params: BucketCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.post(`/accounts/${account_id}/r2/buckets`, { body, ...options }) as Core.APIPromise<{ - result: Bucket; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Lists all R2 buckets on your account - */ - list( - params: BucketListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { - const { account_id, ...query } = params; - return this._client.getAPIList(`/accounts/${account_id}/r2/buckets`, BucketsCursorPagination, { - query, - ...options, - }); - } - - /** - * Deletes an existing R2 bucket. - */ - delete( - bucketName: string, - params: BucketDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.delete(`/accounts/${account_id}/r2/buckets/${bucketName}`, options) as Core.APIPromise<{ - result: BucketDeleteResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Gets metadata for an existing R2 bucket. - */ - get(bucketName: string, params: BucketGetParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}`, options) as Core.APIPromise<{ - result: Bucket; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class BucketsCursorPagination extends CursorPagination {} - -/** - * A single R2 bucket - */ -export interface Bucket { - /** - * Creation timestamp - */ - creation_date?: string; - - /** - * Location of the bucket - */ - location?: 'apac' | 'eeur' | 'enam' | 'weur' | 'wnam'; - - /** - * Name of the bucket - */ - name?: string; - - /** - * Storage class for newly uploaded objects, unless specified otherwise. - */ - storage_class?: 'Standard' | 'InfrequentAccess'; -} - -export type BucketDeleteResponse = unknown; - -export interface BucketCreateParams { - /** - * Path param: Account ID - */ - account_id: string; - - /** - * Body param: Name of the bucket - */ - name: string; - - /** - * Body param: Location of the bucket - */ - locationHint?: 'apac' | 'eeur' | 'enam' | 'weur' | 'wnam'; - - /** - * Body param: Storage class for newly uploaded objects, unless specified - * otherwise. - */ - storageClass?: 'Standard' | 'InfrequentAccess'; -} - -export interface BucketListParams extends CursorPaginationParams { - /** - * Path param: Account ID - */ - account_id: string; - - /** - * Query param: Direction to order buckets - */ - direction?: 'asc' | 'desc'; - - /** - * Query param: Bucket names to filter by. Only buckets with this phrase in their - * name will be returned. - */ - name_contains?: string; - - /** - * Query param: Field to order buckets by - */ - order?: 'name'; - - /** - * Query param: Bucket name to start searching after. Buckets are ordered - * lexicographically. - */ - start_after?: string; -} - -export interface BucketDeleteParams { - /** - * Account ID - */ - account_id: string; -} - -export interface BucketGetParams { - /** - * Account ID - */ - account_id: string; -} - -export namespace Buckets { - export import Bucket = BucketsAPI.Bucket; - export import BucketDeleteResponse = BucketsAPI.BucketDeleteResponse; - export import BucketsCursorPagination = BucketsAPI.BucketsCursorPagination; - export import BucketCreateParams = BucketsAPI.BucketCreateParams; - export import BucketListParams = BucketsAPI.BucketListParams; - export import BucketDeleteParams = BucketsAPI.BucketDeleteParams; - export import BucketGetParams = BucketsAPI.BucketGetParams; -} diff --git a/src/resources/r2/buckets/buckets.ts b/src/resources/r2/buckets/buckets.ts new file mode 100644 index 0000000000..15c4a3362a --- /dev/null +++ b/src/resources/r2/buckets/buckets.ts @@ -0,0 +1,302 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as CORSAPI from './cors'; +import { + CORS, + CORSDeleteParams, + CORSDeleteResponse, + CORSGetParams, + CORSGetResponse, + CORSUpdateParams, + CORSUpdateResponse, +} from './cors'; +import * as LifecycleAPI from './lifecycle'; +import { + Lifecycle, + LifecycleGetParams, + LifecycleGetResponse, + LifecycleUpdateParams, + LifecycleUpdateResponse, +} from './lifecycle'; +import * as SippyAPI from './sippy'; +import { + Provider, + Sippy, + SippyDeleteParams, + SippyDeleteResponse, + SippyGetParams, + SippyResource, + SippyUpdateParams, +} from './sippy'; +import * as DomainsAPI from './domains/domains'; +import { Domains } from './domains/domains'; +import * as EventNotificationsAPI from './event-notifications/event-notifications'; +import { EventNotifications } from './event-notifications/event-notifications'; + +export class Buckets extends APIResource { + lifecycle: LifecycleAPI.Lifecycle = new LifecycleAPI.Lifecycle(this._client); + cors: CORSAPI.CORS = new CORSAPI.CORS(this._client); + domains: DomainsAPI.Domains = new DomainsAPI.Domains(this._client); + eventNotifications: EventNotificationsAPI.EventNotifications = new EventNotificationsAPI.EventNotifications( + this._client, + ); + sippy: SippyAPI.SippyResource = new SippyAPI.SippyResource(this._client); + + /** + * Creates a new R2 bucket. + */ + create(params: BucketCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, jurisdiction, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/r2/buckets`, { + body, + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: Bucket }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Lists all R2 buckets on your account + */ + list(params: BucketListParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, jurisdiction, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/r2/buckets`, { + query, + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: BucketListResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Deletes an existing R2 bucket. + */ + delete( + bucketName: string, + params: BucketDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.delete(`/accounts/${account_id}/r2/buckets/${bucketName}`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: BucketDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Gets metadata for an existing R2 bucket. + */ + get(bucketName: string, params: BucketGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: Bucket }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * A single R2 bucket + */ +export interface Bucket { + /** + * Creation timestamp + */ + creation_date?: string; + + /** + * Location of the bucket + */ + location?: 'apac' | 'eeur' | 'enam' | 'weur' | 'wnam'; + + /** + * Name of the bucket + */ + name?: string; + + /** + * Storage class for newly uploaded objects, unless specified otherwise. + */ + storage_class?: 'Standard' | 'InfrequentAccess'; +} + +export interface BucketListResponse { + buckets?: Array; +} + +export type BucketDeleteResponse = unknown; + +export interface BucketCreateParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Body param: Name of the bucket + */ + name: string; + + /** + * Body param: Location of the bucket + */ + locationHint?: 'apac' | 'eeur' | 'enam' | 'weur' | 'wnam'; + + /** + * Body param: Storage class for newly uploaded objects, unless specified + * otherwise. + */ + storageClass?: 'Standard' | 'InfrequentAccess'; + + /** + * Header param: Creates the bucket in the provided jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface BucketListParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Query param: Pagination cursor received during the last List Buckets call. R2 + * buckets are paginated using cursors instead of page numbers. + */ + cursor?: string; + + /** + * Query param: Direction to order buckets + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: Bucket names to filter by. Only buckets with this phrase in their + * name will be returned. + */ + name_contains?: string; + + /** + * Query param: Field to order buckets by + */ + order?: 'name'; + + /** + * Query param: Maximum number of buckets to return in a single call + */ + per_page?: number; + + /** + * Query param: Bucket name to start searching after. Buckets are ordered + * lexicographically. + */ + start_after?: string; + + /** + * Header param: Lists buckets in the provided jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface BucketDeleteParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface BucketGetParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +Buckets.Lifecycle = Lifecycle; +Buckets.CORS = CORS; +Buckets.Domains = Domains; +Buckets.EventNotifications = EventNotifications; +Buckets.SippyResource = SippyResource; + +export declare namespace Buckets { + export { + type Bucket as Bucket, + type BucketListResponse as BucketListResponse, + type BucketDeleteResponse as BucketDeleteResponse, + type BucketCreateParams as BucketCreateParams, + type BucketListParams as BucketListParams, + type BucketDeleteParams as BucketDeleteParams, + type BucketGetParams as BucketGetParams, + }; + + export { + Lifecycle as Lifecycle, + type LifecycleUpdateResponse as LifecycleUpdateResponse, + type LifecycleGetResponse as LifecycleGetResponse, + type LifecycleUpdateParams as LifecycleUpdateParams, + type LifecycleGetParams as LifecycleGetParams, + }; + + export { + CORS as CORS, + type CORSUpdateResponse as CORSUpdateResponse, + type CORSDeleteResponse as CORSDeleteResponse, + type CORSGetResponse as CORSGetResponse, + type CORSUpdateParams as CORSUpdateParams, + type CORSDeleteParams as CORSDeleteParams, + type CORSGetParams as CORSGetParams, + }; + + export { Domains as Domains }; + + export { EventNotifications as EventNotifications }; + + export { + SippyResource as SippyResource, + type Provider as Provider, + type Sippy as Sippy, + type SippyDeleteResponse as SippyDeleteResponse, + type SippyUpdateParams as SippyUpdateParams, + type SippyDeleteParams as SippyDeleteParams, + type SippyGetParams as SippyGetParams, + }; +} diff --git a/src/resources/r2/buckets/cors.ts b/src/resources/r2/buckets/cors.ts new file mode 100644 index 0000000000..9f160a9d7d --- /dev/null +++ b/src/resources/r2/buckets/cors.ts @@ -0,0 +1,245 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class CORS extends APIResource { + /** + * Set the CORS policy for a bucket + */ + update( + bucketName: string, + params: CORSUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/r2/buckets/${bucketName}/cors`, { + body, + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CORSUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Delete the CORS policy for a bucket + */ + delete( + bucketName: string, + params: CORSDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.delete(`/accounts/${account_id}/r2/buckets/${bucketName}/cors`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CORSDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get the CORS policy for a bucket + */ + get( + bucketName: string, + params: CORSGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/cors`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CORSGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type CORSUpdateResponse = unknown; + +export type CORSDeleteResponse = unknown; + +export interface CORSGetResponse { + rules?: Array; +} + +export namespace CORSGetResponse { + export interface Rule { + /** + * Object specifying allowed origins, methods and headers for this CORS rule. + */ + allowed: Rule.Allowed; + + /** + * Identifier for this rule + */ + id?: string; + + /** + * Specifies the headers that can be exposed back, and accessed by, the JavaScript + * making the cross-origin request. If you need to access headers beyond the + * safelisted response headers, such as Content-Encoding or cf-cache-status, you + * must specify it here. + */ + exposeHeaders?: Array; + + /** + * Specifies the amount of time (in seconds) browsers are allowed to cache CORS + * preflight responses. Browsers may limit this to 2 hours or less, even if the + * maximum value (86400) is specified. + */ + maxAgeSeconds?: number; + } + + export namespace Rule { + /** + * Object specifying allowed origins, methods and headers for this CORS rule. + */ + export interface Allowed { + /** + * Specifies the value for the Access-Control-Allow-Methods header R2 sets when + * requesting objects in a bucket from a browser. + */ + methods: Array<'GET' | 'PUT' | 'POST' | 'DELETE' | 'HEAD'>; + + /** + * Specifies the value for the Access-Control-Allow-Origin header R2 sets when + * requesting objects in a bucket from a browser. + */ + origins: Array; + + /** + * Specifies the value for the Access-Control-Allow-Headers header R2 sets when + * requesting objects in this bucket from a browser. Cross-origin requests that + * include custom headers (e.g. x-user-id) should specify these headers as + * AllowedHeaders. + */ + headers?: Array; + } + } +} + +export interface CORSUpdateParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Body param: + */ + rules?: Array; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export namespace CORSUpdateParams { + export interface Rule { + /** + * Object specifying allowed origins, methods and headers for this CORS rule. + */ + allowed: Rule.Allowed; + + /** + * Identifier for this rule + */ + id?: string; + + /** + * Specifies the headers that can be exposed back, and accessed by, the JavaScript + * making the cross-origin request. If you need to access headers beyond the + * safelisted response headers, such as Content-Encoding or cf-cache-status, you + * must specify it here. + */ + exposeHeaders?: Array; + + /** + * Specifies the amount of time (in seconds) browsers are allowed to cache CORS + * preflight responses. Browsers may limit this to 2 hours or less, even if the + * maximum value (86400) is specified. + */ + maxAgeSeconds?: number; + } + + export namespace Rule { + /** + * Object specifying allowed origins, methods and headers for this CORS rule. + */ + export interface Allowed { + /** + * Specifies the value for the Access-Control-Allow-Methods header R2 sets when + * requesting objects in a bucket from a browser. + */ + methods: Array<'GET' | 'PUT' | 'POST' | 'DELETE' | 'HEAD'>; + + /** + * Specifies the value for the Access-Control-Allow-Origin header R2 sets when + * requesting objects in a bucket from a browser. + */ + origins: Array; + + /** + * Specifies the value for the Access-Control-Allow-Headers header R2 sets when + * requesting objects in this bucket from a browser. Cross-origin requests that + * include custom headers (e.g. x-user-id) should specify these headers as + * AllowedHeaders. + */ + headers?: Array; + } + } +} + +export interface CORSDeleteParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface CORSGetParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export declare namespace CORS { + export { + type CORSUpdateResponse as CORSUpdateResponse, + type CORSDeleteResponse as CORSDeleteResponse, + type CORSGetResponse as CORSGetResponse, + type CORSUpdateParams as CORSUpdateParams, + type CORSDeleteParams as CORSDeleteParams, + type CORSGetParams as CORSGetParams, + }; +} diff --git a/src/resources/r2/buckets/domains/custom.ts b/src/resources/r2/buckets/domains/custom.ts new file mode 100644 index 0000000000..c947622e1d --- /dev/null +++ b/src/resources/r2/buckets/domains/custom.ts @@ -0,0 +1,367 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; + +export class Custom extends APIResource { + /** + * Register a new custom domain for an existing R2 bucket. + */ + create( + bucketName: string, + params: CustomCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom`, { + body, + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CustomCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Edit the configuration for a custom domain on an existing R2 bucket. + */ + update( + bucketName: string, + domainName: string, + params: CustomUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom/${domainName}`, { + body, + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CustomUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Gets a list of all custom domains registered with an existing R2 bucket. + */ + list( + bucketName: string, + params: CustomListParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CustomListResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Remove custom domain registration from an existing R2 bucket + */ + delete( + bucketName: string, + domainName: string, + params: CustomDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.delete(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom/${domainName}`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CustomDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get the configuration for a custom domain on an existing R2 bucket. + */ + get( + bucketName: string, + domainName: string, + params: CustomGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/custom/${domainName}`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: CustomGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface CustomCreateResponse { + /** + * Domain name of the affected custom domain + */ + domain: string; + + /** + * Whether this bucket is publicly accessible at the specified custom domain + */ + enabled: boolean; + + /** + * Minimum TLS Version the custom domain will accept for incoming connections. If + * not set, defaults to 1.0. + */ + minTLS?: '1.0' | '1.1' | '1.2' | '1.3'; +} + +export interface CustomUpdateResponse { + /** + * Domain name of the affected custom domain + */ + domain: string; + + /** + * Whether this bucket is publicly accessible at the specified custom domain + */ + enabled?: boolean; + + /** + * Minimum TLS Version the custom domain will accept for incoming connections. If + * not set, defaults to 1.0. + */ + minTLS?: '1.0' | '1.1' | '1.2' | '1.3'; +} + +export interface CustomListResponse { + domains: Array; +} + +export namespace CustomListResponse { + export interface Domain { + /** + * Domain name of the custom domain to be added + */ + domain: string; + + /** + * Whether this bucket is publicly accessible at the specified custom domain + */ + enabled: boolean; + + status: Domain.Status; + + /** + * Minimum TLS Version the custom domain will accept for incoming connections. If + * not set, defaults to 1.0. + */ + minTLS?: '1.0' | '1.1' | '1.2' | '1.3'; + + /** + * Zone ID of the custom domain resides in + */ + zoneId?: string; + + /** + * Zone that the custom domain resides in + */ + zoneName?: string; + } + + export namespace Domain { + export interface Status { + /** + * Ownership status of the domain + */ + ownership: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error' | 'unknown'; + + /** + * SSL certificate status + */ + ssl: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error' | 'unknown'; + } + } +} + +export interface CustomDeleteResponse { + /** + * Name of the removed custom domain + */ + domain: string; +} + +export interface CustomGetResponse { + /** + * Domain name of the custom domain to be added + */ + domain: string; + + /** + * Whether this bucket is publicly accessible at the specified custom domain + */ + enabled: boolean; + + status: CustomGetResponse.Status; + + /** + * Minimum TLS Version the custom domain will accept for incoming connections. If + * not set, defaults to 1.0. + */ + minTLS?: '1.0' | '1.1' | '1.2' | '1.3'; + + /** + * Zone ID of the custom domain resides in + */ + zoneId?: string; + + /** + * Zone that the custom domain resides in + */ + zoneName?: string; +} + +export namespace CustomGetResponse { + export interface Status { + /** + * Ownership status of the domain + */ + ownership: 'pending' | 'active' | 'deactivated' | 'blocked' | 'error' | 'unknown'; + + /** + * SSL certificate status + */ + ssl: 'initializing' | 'pending' | 'active' | 'deactivated' | 'error' | 'unknown'; + } +} + +export interface CustomCreateParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Body param: Name of the custom domain to be added + */ + domain: string; + + /** + * Body param: Whether to enable public bucket access at the custom domain. If + * undefined, the domain will be enabled. + */ + enabled: boolean; + + /** + * Body param: Zone ID of the custom domain + */ + zoneId: string; + + /** + * Body param: Minimum TLS Version the custom domain will accept for incoming + * connections. If not set, defaults to 1.0. + */ + minTLS?: '1.0' | '1.1' | '1.2' | '1.3'; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface CustomUpdateParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Body param: Whether to enable public bucket access at the specified custom + * domain + */ + enabled?: boolean; + + /** + * Body param: Minimum TLS Version the custom domain will accept for incoming + * connections. If not set, defaults to previous value. + */ + minTLS?: '1.0' | '1.1' | '1.2' | '1.3'; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface CustomListParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface CustomDeleteParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface CustomGetParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export declare namespace Custom { + export { + type CustomCreateResponse as CustomCreateResponse, + type CustomUpdateResponse as CustomUpdateResponse, + type CustomListResponse as CustomListResponse, + type CustomDeleteResponse as CustomDeleteResponse, + type CustomGetResponse as CustomGetResponse, + type CustomCreateParams as CustomCreateParams, + type CustomUpdateParams as CustomUpdateParams, + type CustomListParams as CustomListParams, + type CustomDeleteParams as CustomDeleteParams, + type CustomGetParams as CustomGetParams, + }; +} diff --git a/src/resources/r2/buckets/domains/domains.ts b/src/resources/r2/buckets/domains/domains.ts new file mode 100644 index 0000000000..ba63e09fc2 --- /dev/null +++ b/src/resources/r2/buckets/domains/domains.ts @@ -0,0 +1,57 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as CustomAPI from './custom'; +import { + Custom, + CustomCreateParams, + CustomCreateResponse, + CustomDeleteParams, + CustomDeleteResponse, + CustomGetParams, + CustomGetResponse, + CustomListParams, + CustomListResponse, + CustomUpdateParams, + CustomUpdateResponse, +} from './custom'; +import * as ManagedAPI from './managed'; +import { + Managed, + ManagedListParams, + ManagedListResponse, + ManagedUpdateParams, + ManagedUpdateResponse, +} from './managed'; + +export class Domains extends APIResource { + custom: CustomAPI.Custom = new CustomAPI.Custom(this._client); + managed: ManagedAPI.Managed = new ManagedAPI.Managed(this._client); +} + +Domains.Custom = Custom; +Domains.Managed = Managed; + +export declare namespace Domains { + export { + Custom as Custom, + type CustomCreateResponse as CustomCreateResponse, + type CustomUpdateResponse as CustomUpdateResponse, + type CustomListResponse as CustomListResponse, + type CustomDeleteResponse as CustomDeleteResponse, + type CustomGetResponse as CustomGetResponse, + type CustomCreateParams as CustomCreateParams, + type CustomUpdateParams as CustomUpdateParams, + type CustomListParams as CustomListParams, + type CustomDeleteParams as CustomDeleteParams, + type CustomGetParams as CustomGetParams, + }; + + export { + Managed as Managed, + type ManagedUpdateResponse as ManagedUpdateResponse, + type ManagedListResponse as ManagedListResponse, + type ManagedUpdateParams as ManagedUpdateParams, + type ManagedListParams as ManagedListParams, + }; +} diff --git a/src/resources/r2/buckets/domains/index.ts b/src/resources/r2/buckets/domains/index.ts new file mode 100644 index 0000000000..e92ade95a2 --- /dev/null +++ b/src/resources/r2/buckets/domains/index.ts @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Custom, + type CustomCreateResponse, + type CustomUpdateResponse, + type CustomListResponse, + type CustomDeleteResponse, + type CustomGetResponse, + type CustomCreateParams, + type CustomUpdateParams, + type CustomListParams, + type CustomDeleteParams, + type CustomGetParams, +} from './custom'; +export { Domains } from './domains'; +export { + Managed, + type ManagedUpdateResponse, + type ManagedListResponse, + type ManagedUpdateParams, + type ManagedListParams, +} from './managed'; diff --git a/src/resources/r2/buckets/domains/managed.ts b/src/resources/r2/buckets/domains/managed.ts new file mode 100644 index 0000000000..94b9942bda --- /dev/null +++ b/src/resources/r2/buckets/domains/managed.ts @@ -0,0 +1,123 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; + +export class Managed extends APIResource { + /** + * Updates state of public access over the bucket's R2-managed (r2.dev) domain. + */ + update( + bucketName: string, + params: ManagedUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/managed`, { + body, + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: ManagedUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Gets state of public access over the bucket's R2-managed (r2.dev) domain. + */ + list( + bucketName: string, + params: ManagedListParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/domains/managed`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: ManagedListResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ManagedUpdateResponse { + /** + * Bucket ID + */ + bucketId: string; + + /** + * Domain name of the bucket's r2.dev domain + */ + domain: string; + + /** + * Whether this bucket is publicly accessible at the r2.dev domain + */ + enabled: boolean; +} + +export interface ManagedListResponse { + /** + * Bucket ID + */ + bucketId: string; + + /** + * Domain name of the bucket's r2.dev domain + */ + domain: string; + + /** + * Whether this bucket is publicly accessible at the r2.dev domain + */ + enabled: boolean; +} + +export interface ManagedUpdateParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Body param: Whether to enable public bucket access at the r2.dev domain + */ + enabled: boolean; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface ManagedListParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export declare namespace Managed { + export { + type ManagedUpdateResponse as ManagedUpdateResponse, + type ManagedListResponse as ManagedListResponse, + type ManagedUpdateParams as ManagedUpdateParams, + type ManagedListParams as ManagedListParams, + }; +} diff --git a/src/resources/r2/buckets/event-notifications/configuration/configuration.ts b/src/resources/r2/buckets/event-notifications/configuration/configuration.ts new file mode 100644 index 0000000000..6d465fe3f2 --- /dev/null +++ b/src/resources/r2/buckets/event-notifications/configuration/configuration.ts @@ -0,0 +1,132 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; +import * as QueuesAPI from './queues'; +import { + QueueDeleteParams, + QueueDeleteResponse, + QueueUpdateParams, + QueueUpdateResponse, + Queues, +} from './queues'; + +export class Configuration extends APIResource { + queues: QueuesAPI.Queues = new QueuesAPI.Queues(this._client); + + /** + * List all event notification rules for a bucket. + */ + get( + bucketName: string, + params: ConfigurationGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.get(`/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: ConfigurationGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ConfigurationGetResponse { + /** + * Name of the bucket. + */ + bucketName?: string; + + /** + * List of queues associated with the bucket. + */ + queues?: Array; +} + +export namespace ConfigurationGetResponse { + export interface Queue { + /** + * Queue ID + */ + queueId?: string; + + /** + * Name of the queue + */ + queueName?: string; + + rules?: Array; + } + + export namespace Queue { + export interface Rule { + /** + * Array of R2 object actions that will trigger notifications + */ + actions: Array< + 'PutObject' | 'CopyObject' | 'DeleteObject' | 'CompleteMultipartUpload' | 'LifecycleDeletion' + >; + + /** + * Timestamp when the rule was created + */ + createdAt?: string; + + /** + * A description that can be used to identify the event notification rule after + * creation + */ + description?: string; + + /** + * Notifications will be sent only for objects with this prefix + */ + prefix?: string; + + /** + * Rule ID + */ + ruleId?: string; + + /** + * Notifications will be sent only for objects with this suffix + */ + suffix?: string; + } + } +} + +export interface ConfigurationGetParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +Configuration.Queues = Queues; + +export declare namespace Configuration { + export { + type ConfigurationGetResponse as ConfigurationGetResponse, + type ConfigurationGetParams as ConfigurationGetParams, + }; + + export { + Queues as Queues, + type QueueUpdateResponse as QueueUpdateResponse, + type QueueDeleteResponse as QueueDeleteResponse, + type QueueUpdateParams as QueueUpdateParams, + type QueueDeleteParams as QueueDeleteParams, + }; +} diff --git a/src/resources/r2/buckets/event-notifications/configuration/index.ts b/src/resources/r2/buckets/event-notifications/configuration/index.ts new file mode 100644 index 0000000000..2196710c84 --- /dev/null +++ b/src/resources/r2/buckets/event-notifications/configuration/index.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Configuration, type ConfigurationGetResponse, type ConfigurationGetParams } from './configuration'; +export { + Queues, + type QueueUpdateResponse, + type QueueDeleteResponse, + type QueueUpdateParams, + type QueueDeleteParams, +} from './queues'; diff --git a/src/resources/event-notifications/r2/configuration/queues.ts b/src/resources/r2/buckets/event-notifications/configuration/queues.ts similarity index 50% rename from src/resources/event-notifications/r2/configuration/queues.ts rename to src/resources/r2/buckets/event-notifications/configuration/queues.ts index db0a7091a1..7aa632d8fb 100644 --- a/src/resources/event-notifications/r2/configuration/queues.ts +++ b/src/resources/r2/buckets/event-notifications/configuration/queues.ts @@ -1,13 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../../resource'; -import * as Core from '../../../../core'; -import * as QueuesAPI from './queues'; +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; export class Queues extends APIResource { /** - * Define the rules for a given queue which will determine event notification - * production. + * Create event notification rule. */ update( bucketName: string, @@ -15,18 +13,27 @@ export class Queues extends APIResource { params: QueueUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, ...body } = params; + const { account_id, jurisdiction, ...body } = params; return ( this._client.put( `/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration/queues/${queueId}`, - { body, ...options }, + { + body, + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }, ) as Core.APIPromise<{ result: QueueUpdateResponse }> )._thenUnwrap((obj) => obj.result); } /** - * Turn off all event notifications configured for delivery to a given queue. No - * further notifications will be produced for the queue once complete. + * Delete an event notification rule. **If no body is provided, all rules for + * specified queue will be deleted**. */ delete( bucketName: string, @@ -34,25 +41,31 @@ export class Queues extends APIResource { params: QueueDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, jurisdiction } = params; return ( this._client.delete( `/accounts/${account_id}/event_notifications/r2/${bucketName}/configuration/queues/${queueId}`, - options, + { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }, ) as Core.APIPromise<{ result: QueueDeleteResponse }> )._thenUnwrap((obj) => obj.result); } } -export interface QueueUpdateResponse { - event_notification_detail_id?: string; -} +export type QueueUpdateResponse = unknown; -export type QueueDeleteResponse = unknown | Array | string; +export type QueueDeleteResponse = unknown; export interface QueueUpdateParams { /** - * Path param: Identifier + * Path param: Account ID */ account_id: string; @@ -60,6 +73,11 @@ export interface QueueUpdateParams { * Body param: Array of rules to drive notifications */ rules?: Array; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; } export namespace QueueUpdateParams { @@ -68,9 +86,15 @@ export namespace QueueUpdateParams { * Array of R2 object actions that will trigger notifications */ actions: Array< - 'PutObject' | 'CopyObject' | 'DeleteObject' | 'CompleteMultipartUpload' | 'AbortMultipartUpload' + 'PutObject' | 'CopyObject' | 'DeleteObject' | 'CompleteMultipartUpload' | 'LifecycleDeletion' >; + /** + * A description that can be used to identify the event notification rule after + * creation + */ + description?: string; + /** * Notifications will be sent only for objects with this prefix */ @@ -85,14 +109,21 @@ export namespace QueueUpdateParams { export interface QueueDeleteParams { /** - * Identifier + * Path param: Account ID */ account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; } -export namespace Queues { - export import QueueUpdateResponse = QueuesAPI.QueueUpdateResponse; - export import QueueDeleteResponse = QueuesAPI.QueueDeleteResponse; - export import QueueUpdateParams = QueuesAPI.QueueUpdateParams; - export import QueueDeleteParams = QueuesAPI.QueueDeleteParams; +export declare namespace Queues { + export { + type QueueUpdateResponse as QueueUpdateResponse, + type QueueDeleteResponse as QueueDeleteResponse, + type QueueUpdateParams as QueueUpdateParams, + type QueueDeleteParams as QueueDeleteParams, + }; } diff --git a/src/resources/r2/buckets/event-notifications/event-notifications.ts b/src/resources/r2/buckets/event-notifications/event-notifications.ts new file mode 100644 index 0000000000..e1c7cb46f7 --- /dev/null +++ b/src/resources/r2/buckets/event-notifications/event-notifications.ts @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as ConfigurationAPI from './configuration/configuration'; +import { + Configuration, + ConfigurationGetParams, + ConfigurationGetResponse, +} from './configuration/configuration'; + +export class EventNotifications extends APIResource { + configuration: ConfigurationAPI.Configuration = new ConfigurationAPI.Configuration(this._client); +} + +EventNotifications.Configuration = Configuration; + +export declare namespace EventNotifications { + export { + Configuration as Configuration, + type ConfigurationGetResponse as ConfigurationGetResponse, + type ConfigurationGetParams as ConfigurationGetParams, + }; +} diff --git a/src/resources/event-notifications/index.ts b/src/resources/r2/buckets/event-notifications/index.ts similarity index 54% rename from src/resources/event-notifications/index.ts rename to src/resources/r2/buckets/event-notifications/index.ts index 656e57f2d2..275552048d 100644 --- a/src/resources/event-notifications/index.ts +++ b/src/resources/r2/buckets/event-notifications/index.ts @@ -1,4 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { + Configuration, + type ConfigurationGetResponse, + type ConfigurationGetParams, +} from './configuration/index'; export { EventNotifications } from './event-notifications'; -export { R2 } from './r2/index'; diff --git a/src/resources/r2/buckets/index.ts b/src/resources/r2/buckets/index.ts new file mode 100644 index 0000000000..6ce4fe1860 --- /dev/null +++ b/src/resources/r2/buckets/index.ts @@ -0,0 +1,39 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Buckets, + type Bucket, + type BucketListResponse, + type BucketDeleteResponse, + type BucketCreateParams, + type BucketListParams, + type BucketDeleteParams, + type BucketGetParams, +} from './buckets'; +export { + CORS, + type CORSUpdateResponse, + type CORSDeleteResponse, + type CORSGetResponse, + type CORSUpdateParams, + type CORSDeleteParams, + type CORSGetParams, +} from './cors'; +export { Domains } from './domains/index'; +export { EventNotifications } from './event-notifications/index'; +export { + Lifecycle, + type LifecycleUpdateResponse, + type LifecycleGetResponse, + type LifecycleUpdateParams, + type LifecycleGetParams, +} from './lifecycle'; +export { + SippyResource, + type Provider, + type Sippy, + type SippyDeleteResponse, + type SippyUpdateParams, + type SippyDeleteParams, + type SippyGetParams, +} from './sippy'; diff --git a/src/resources/r2/buckets/lifecycle.ts b/src/resources/r2/buckets/lifecycle.ts new file mode 100644 index 0000000000..d18db68abf --- /dev/null +++ b/src/resources/r2/buckets/lifecycle.ts @@ -0,0 +1,371 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class Lifecycle extends APIResource { + /** + * Set the object lifecycle rules for a bucket + */ + update( + bucketName: string, + params: LifecycleUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/r2/buckets/${bucketName}/lifecycle`, { + body, + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: LifecycleUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get object lifecycle rules for a bucket + */ + get( + bucketName: string, + params: LifecycleGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/lifecycle`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: LifecycleGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type LifecycleUpdateResponse = unknown; + +export interface LifecycleGetResponse { + rules?: Array; +} + +export namespace LifecycleGetResponse { + export interface Rule { + /** + * Unique identifier for this rule + */ + id: string; + + /** + * Conditions that apply to all transitions of this rule + */ + conditions: Rule.Conditions; + + /** + * Whether or not this rule is in effect + */ + enabled: boolean; + + /** + * Transition to abort ongoing multipart uploads + */ + abortMultipartUploadsTransition?: Rule.AbortMultipartUploadsTransition; + + /** + * Transition to delete objects + */ + deleteObjectsTransition?: Rule.DeleteObjectsTransition; + + /** + * Transitions to change the storage class of objects + */ + storageClassTransitions?: Array; + } + + export namespace Rule { + /** + * Conditions that apply to all transitions of this rule + */ + export interface Conditions { + /** + * Transitions will only apply to objects/uploads in the bucket that start with the + * given prefix, an empty prefix can be provided to scope rule to all + * objects/uploads + */ + prefix: string; + } + + /** + * Transition to abort ongoing multipart uploads + */ + export interface AbortMultipartUploadsTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + condition?: AbortMultipartUploadsTransition.Condition; + } + + export namespace AbortMultipartUploadsTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + export interface Condition { + maxAge: number; + + type: 'Age'; + } + } + + /** + * Transition to delete objects + */ + export interface DeleteObjectsTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + condition?: + | DeleteObjectsTransition.R2LifecycleAgeCondition + | DeleteObjectsTransition.R2LifecycleDateCondition; + } + + export namespace DeleteObjectsTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + export interface R2LifecycleAgeCondition { + maxAge: number; + + type: 'Age'; + } + + /** + * Condition for lifecycle transitions to apply on a specific date + */ + export interface R2LifecycleDateCondition { + date: string; + + type: 'Date'; + } + } + + export interface StorageClassTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + condition: + | StorageClassTransition.R2LifecycleAgeCondition + | StorageClassTransition.R2LifecycleDateCondition; + + storageClass: 'InfrequentAccess'; + } + + export namespace StorageClassTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + export interface R2LifecycleAgeCondition { + maxAge: number; + + type: 'Age'; + } + + /** + * Condition for lifecycle transitions to apply on a specific date + */ + export interface R2LifecycleDateCondition { + date: string; + + type: 'Date'; + } + } + } +} + +export interface LifecycleUpdateParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Body param: + */ + rules?: Array; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export namespace LifecycleUpdateParams { + export interface Rule { + /** + * Unique identifier for this rule + */ + id: string; + + /** + * Conditions that apply to all transitions of this rule + */ + conditions: Rule.Conditions; + + /** + * Whether or not this rule is in effect + */ + enabled: boolean; + + /** + * Transition to abort ongoing multipart uploads + */ + abortMultipartUploadsTransition?: Rule.AbortMultipartUploadsTransition; + + /** + * Transition to delete objects + */ + deleteObjectsTransition?: Rule.DeleteObjectsTransition; + + /** + * Transitions to change the storage class of objects + */ + storageClassTransitions?: Array; + } + + export namespace Rule { + /** + * Conditions that apply to all transitions of this rule + */ + export interface Conditions { + /** + * Transitions will only apply to objects/uploads in the bucket that start with the + * given prefix, an empty prefix can be provided to scope rule to all + * objects/uploads + */ + prefix: string; + } + + /** + * Transition to abort ongoing multipart uploads + */ + export interface AbortMultipartUploadsTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + condition?: AbortMultipartUploadsTransition.Condition; + } + + export namespace AbortMultipartUploadsTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + export interface Condition { + maxAge: number; + + type: 'Age'; + } + } + + /** + * Transition to delete objects + */ + export interface DeleteObjectsTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + condition?: + | DeleteObjectsTransition.R2LifecycleAgeCondition + | DeleteObjectsTransition.R2LifecycleDateCondition; + } + + export namespace DeleteObjectsTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + export interface R2LifecycleAgeCondition { + maxAge: number; + + type: 'Age'; + } + + /** + * Condition for lifecycle transitions to apply on a specific date + */ + export interface R2LifecycleDateCondition { + date: string; + + type: 'Date'; + } + } + + export interface StorageClassTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + condition: + | StorageClassTransition.R2LifecycleAgeCondition + | StorageClassTransition.R2LifecycleDateCondition; + + storageClass: 'InfrequentAccess'; + } + + export namespace StorageClassTransition { + /** + * Condition for lifecycle transitions to apply after an object reaches an age in + * seconds + */ + export interface R2LifecycleAgeCondition { + maxAge: number; + + type: 'Age'; + } + + /** + * Condition for lifecycle transitions to apply on a specific date + */ + export interface R2LifecycleDateCondition { + date: string; + + type: 'Date'; + } + } + } +} + +export interface LifecycleGetParams { + /** + * Path param: Account ID + */ + account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export declare namespace Lifecycle { + export { + type LifecycleUpdateResponse as LifecycleUpdateResponse, + type LifecycleGetResponse as LifecycleGetResponse, + type LifecycleUpdateParams as LifecycleUpdateParams, + type LifecycleGetParams as LifecycleGetParams, + }; +} diff --git a/src/resources/r2/sippy.ts b/src/resources/r2/buckets/sippy.ts similarity index 76% rename from src/resources/r2/sippy.ts rename to src/resources/r2/buckets/sippy.ts index 2924e8c7de..46d185c7fd 100644 --- a/src/resources/r2/sippy.ts +++ b/src/resources/r2/buckets/sippy.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; import * as SippyAPI from './sippy'; export class SippyResource extends APIResource { @@ -13,11 +13,17 @@ export class SippyResource extends APIResource { params: SippyUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id, ...body } = params; + const { account_id, jurisdiction, ...body } = params; return ( this._client.put(`/accounts/${account_id}/r2/buckets/${bucketName}/sippy`, { body, ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, }) as Core.APIPromise<{ result: Sippy }> )._thenUnwrap((obj) => obj.result); } @@ -30,12 +36,17 @@ export class SippyResource extends APIResource { params: SippyDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, jurisdiction } = params; return ( - this._client.delete( - `/accounts/${account_id}/r2/buckets/${bucketName}/sippy`, - options, - ) as Core.APIPromise<{ result: SippyDeleteResponse }> + this._client.delete(`/accounts/${account_id}/r2/buckets/${bucketName}/sippy`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: SippyDeleteResponse }> )._thenUnwrap((obj) => obj.result); } @@ -43,11 +54,17 @@ export class SippyResource extends APIResource { * Gets configuration for Sippy for an existing R2 bucket. */ get(bucketName: string, params: SippyGetParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; + const { account_id, jurisdiction } = params; return ( - this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/sippy`, options) as Core.APIPromise<{ - result: Sippy; - }> + this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/sippy`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: Sippy }> )._thenUnwrap((obj) => obj.result); } } @@ -117,7 +134,7 @@ export interface SippyDeleteResponse { export type SippyUpdateParams = SippyUpdateParams.R2EnableSippyAws | SippyUpdateParams.R2EnableSippyGcs; -export namespace SippyUpdateParams { +export declare namespace SippyUpdateParams { export interface R2EnableSippyAws { /** * Path param: Account ID @@ -133,6 +150,11 @@ export namespace SippyUpdateParams { * Body param: AWS S3 bucket to copy objects from */ source?: SippyUpdateParams.R2EnableSippyAws.Source; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; } export namespace R2EnableSippyAws { @@ -206,6 +228,11 @@ export namespace SippyUpdateParams { * Body param: GCS bucket to copy objects from */ source?: SippyUpdateParams.R2EnableSippyGcs.Source; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; } export namespace R2EnableSippyGcs { @@ -262,23 +289,35 @@ export namespace SippyUpdateParams { export interface SippyDeleteParams { /** - * Account ID + * Path param: Account ID */ account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; } export interface SippyGetParams { /** - * Account ID + * Path param: Account ID */ account_id: string; + + /** + * Header param: The bucket jurisdiction + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; } -export namespace SippyResource { - export import Provider = SippyAPI.Provider; - export import Sippy = SippyAPI.Sippy; - export import SippyDeleteResponse = SippyAPI.SippyDeleteResponse; - export import SippyUpdateParams = SippyAPI.SippyUpdateParams; - export import SippyDeleteParams = SippyAPI.SippyDeleteParams; - export import SippyGetParams = SippyAPI.SippyGetParams; +export declare namespace SippyResource { + export { + type Provider as Provider, + type Sippy as Sippy, + type SippyDeleteResponse as SippyDeleteResponse, + type SippyUpdateParams as SippyUpdateParams, + type SippyDeleteParams as SippyDeleteParams, + type SippyGetParams as SippyGetParams, + }; } diff --git a/src/resources/r2/index.ts b/src/resources/r2/index.ts index 724fbdfd2e..788ae8bc61 100644 --- a/src/resources/r2/index.ts +++ b/src/resources/r2/index.ts @@ -1,28 +1,19 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Bucket, - BucketDeleteResponse, - BucketCreateParams, - BucketListParams, - BucketDeleteParams, - BucketGetParams, - BucketsCursorPagination, Buckets, -} from './buckets'; -export { - Provider, - Sippy, - SippyDeleteResponse, - SippyUpdateParams, - SippyDeleteParams, - SippyGetParams, - SippyResource, -} from './sippy'; + type Bucket, + type BucketListResponse, + type BucketDeleteResponse, + type BucketCreateParams, + type BucketListParams, + type BucketDeleteParams, + type BucketGetParams, +} from './buckets/index'; export { R2 } from './r2'; export { - TemporaryCredential, - TemporaryCredentialCreateResponse, - TemporaryCredentialCreateParams, TemporaryCredentials, + type TemporaryCredential, + type TemporaryCredentialCreateResponse, + type TemporaryCredentialCreateParams, } from './temporary-credentials'; diff --git a/src/resources/r2/r2.ts b/src/resources/r2/r2.ts index 1765a725d6..01c40db57c 100644 --- a/src/resources/r2/r2.ts +++ b/src/resources/r2/r2.ts @@ -1,35 +1,50 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as BucketsAPI from './buckets'; -import * as SippyAPI from './sippy'; import * as TemporaryCredentialsAPI from './temporary-credentials'; +import { + TemporaryCredential, + TemporaryCredentialCreateParams, + TemporaryCredentialCreateResponse, + TemporaryCredentials, +} from './temporary-credentials'; +import * as BucketsAPI from './buckets/buckets'; +import { + Bucket, + BucketCreateParams, + BucketDeleteParams, + BucketDeleteResponse, + BucketGetParams, + BucketListParams, + BucketListResponse, + Buckets, +} from './buckets/buckets'; export class R2 extends APIResource { buckets: BucketsAPI.Buckets = new BucketsAPI.Buckets(this._client); - sippy: SippyAPI.SippyResource = new SippyAPI.SippyResource(this._client); temporaryCredentials: TemporaryCredentialsAPI.TemporaryCredentials = new TemporaryCredentialsAPI.TemporaryCredentials(this._client); } -export namespace R2 { - export import Buckets = BucketsAPI.Buckets; - export import Bucket = BucketsAPI.Bucket; - export import BucketDeleteResponse = BucketsAPI.BucketDeleteResponse; - export import BucketsCursorPagination = BucketsAPI.BucketsCursorPagination; - export import BucketCreateParams = BucketsAPI.BucketCreateParams; - export import BucketListParams = BucketsAPI.BucketListParams; - export import BucketDeleteParams = BucketsAPI.BucketDeleteParams; - export import BucketGetParams = BucketsAPI.BucketGetParams; - export import SippyResource = SippyAPI.SippyResource; - export import Provider = SippyAPI.Provider; - export import Sippy = SippyAPI.Sippy; - export import SippyDeleteResponse = SippyAPI.SippyDeleteResponse; - export import SippyUpdateParams = SippyAPI.SippyUpdateParams; - export import SippyDeleteParams = SippyAPI.SippyDeleteParams; - export import SippyGetParams = SippyAPI.SippyGetParams; - export import TemporaryCredentials = TemporaryCredentialsAPI.TemporaryCredentials; - export import TemporaryCredential = TemporaryCredentialsAPI.TemporaryCredential; - export import TemporaryCredentialCreateResponse = TemporaryCredentialsAPI.TemporaryCredentialCreateResponse; - export import TemporaryCredentialCreateParams = TemporaryCredentialsAPI.TemporaryCredentialCreateParams; +R2.Buckets = Buckets; +R2.TemporaryCredentials = TemporaryCredentials; + +export declare namespace R2 { + export { + Buckets as Buckets, + type Bucket as Bucket, + type BucketListResponse as BucketListResponse, + type BucketDeleteResponse as BucketDeleteResponse, + type BucketCreateParams as BucketCreateParams, + type BucketListParams as BucketListParams, + type BucketDeleteParams as BucketDeleteParams, + type BucketGetParams as BucketGetParams, + }; + + export { + TemporaryCredentials as TemporaryCredentials, + type TemporaryCredential as TemporaryCredential, + type TemporaryCredentialCreateResponse as TemporaryCredentialCreateResponse, + type TemporaryCredentialCreateParams as TemporaryCredentialCreateParams, + }; } diff --git a/src/resources/r2/temporary-credentials.ts b/src/resources/r2/temporary-credentials.ts index 1e5788f4ca..930fe9af04 100644 --- a/src/resources/r2/temporary-credentials.ts +++ b/src/resources/r2/temporary-credentials.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TemporaryCredentialsAPI from './temporary-credentials'; export class TemporaryCredentials extends APIResource { /** @@ -109,8 +108,10 @@ export interface TemporaryCredentialCreateParams { prefixes?: Array; } -export namespace TemporaryCredentials { - export import TemporaryCredential = TemporaryCredentialsAPI.TemporaryCredential; - export import TemporaryCredentialCreateResponse = TemporaryCredentialsAPI.TemporaryCredentialCreateResponse; - export import TemporaryCredentialCreateParams = TemporaryCredentialsAPI.TemporaryCredentialCreateParams; +export declare namespace TemporaryCredentials { + export { + type TemporaryCredential as TemporaryCredential, + type TemporaryCredentialCreateResponse as TemporaryCredentialCreateResponse, + type TemporaryCredentialCreateParams as TemporaryCredentialCreateParams, + }; } diff --git a/src/resources/radar/ai/ai.ts b/src/resources/radar/ai/ai.ts new file mode 100755 index 0000000000..6d753eb5f7 --- /dev/null +++ b/src/resources/radar/ai/ai.ts @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as TimeseriesGroupsAPI from './timeseries-groups'; +import { + TimeseriesGroupUserAgentParams, + TimeseriesGroupUserAgentResponse, + TimeseriesGroups, +} from './timeseries-groups'; +import * as BotsAPI from './bots/bots'; +import { Bots } from './bots/bots'; + +export class AI extends APIResource { + bots: BotsAPI.Bots = new BotsAPI.Bots(this._client); + timeseriesGroups: TimeseriesGroupsAPI.TimeseriesGroups = new TimeseriesGroupsAPI.TimeseriesGroups( + this._client, + ); +} + +AI.Bots = Bots; +AI.TimeseriesGroups = TimeseriesGroups; + +export declare namespace AI { + export { Bots as Bots }; + + export { + TimeseriesGroups as TimeseriesGroups, + type TimeseriesGroupUserAgentResponse as TimeseriesGroupUserAgentResponse, + type TimeseriesGroupUserAgentParams as TimeseriesGroupUserAgentParams, + }; +} diff --git a/src/resources/radar/ai/bots/bots.ts b/src/resources/radar/ai/bots/bots.ts new file mode 100644 index 0000000000..865665cba6 --- /dev/null +++ b/src/resources/radar/ai/bots/bots.ts @@ -0,0 +1,19 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as SummaryAPI from './summary'; +import { Summary, SummaryUserAgentParams, SummaryUserAgentResponse } from './summary'; + +export class Bots extends APIResource { + summary: SummaryAPI.Summary = new SummaryAPI.Summary(this._client); +} + +Bots.Summary = Summary; + +export declare namespace Bots { + export { + Summary as Summary, + type SummaryUserAgentResponse as SummaryUserAgentResponse, + type SummaryUserAgentParams as SummaryUserAgentParams, + }; +} diff --git a/src/resources/radar/ai/bots/index.ts b/src/resources/radar/ai/bots/index.ts new file mode 100644 index 0000000000..c94177cbcd --- /dev/null +++ b/src/resources/radar/ai/bots/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Bots } from './bots'; +export { Summary, type SummaryUserAgentResponse, type SummaryUserAgentParams } from './summary'; diff --git a/src/resources/radar/ai/bots/summary.ts b/src/resources/radar/ai/bots/summary.ts new file mode 100644 index 0000000000..faedaabb00 --- /dev/null +++ b/src/resources/radar/ai/bots/summary.ts @@ -0,0 +1,149 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import { isRequestOptions } from '../../../../core'; +import * as Core from '../../../../core'; + +export class Summary extends APIResource { + /** + * Percentage of Internet traffic generated by AI user agents, over a given time + * period. + */ + userAgent( + query?: SummaryUserAgentParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + userAgent(options?: Core.RequestOptions): Core.APIPromise; + userAgent( + query: SummaryUserAgentParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.userAgent({}, query); + } + return ( + this._client.get('/radar/ai/bots/summary/user_agent', { query, ...options }) as Core.APIPromise<{ + result: SummaryUserAgentResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface SummaryUserAgentResponse { + meta: SummaryUserAgentResponse.Meta; + + summary_0: Record; +} + +export namespace SummaryUserAgentResponse { + export interface Meta { + dateRange: Array; + + lastUpdated: string; + + normalization: string; + + confidenceInfo?: Meta.ConfidenceInfo; + } + + export namespace Meta { + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface ConfidenceInfo { + annotations?: Array; + + level?: number; + } + + export namespace ConfidenceInfo { + export interface Annotation { + dataSource: string; + + description: string; + + eventType: string; + + isInstantaneous: boolean; + + endTime?: string; + + linkedUrl?: string; + + startTime?: string; + } + } + } +} + +export interface SummaryUserAgentParams { + /** + * Array of comma separated list of ASNs, start with `-` to exclude from results. + * For example, `-174, 3356` excludes results from AS174, but includes results from + * AS3356. + */ + asn?: Array; + + /** + * Array of comma separated list of continents (alpha-2 continent codes). Start + * with `-` to exclude from results. For example, `-EU,NA` excludes results from + * Europe, but includes results from North America. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * For example, use `7d` and `7dControl` to compare this week with the previous + * week. Use this parameter or set specific start and end dates (`dateStart` and + * `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Array of datetimes to filter the start of a series. + */ + dateStart?: Array; + + /** + * Format results are returned in. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + + /** + * Array of comma separated list of locations (alpha-2 country codes). Start with + * `-` to exclude from results. For example, `-US,PT` excludes results from the US, + * but includes results from PT. + */ + location?: Array; + + /** + * Array of names that will be used to name the series in responses. + */ + name?: Array; +} + +export declare namespace Summary { + export { + type SummaryUserAgentResponse as SummaryUserAgentResponse, + type SummaryUserAgentParams as SummaryUserAgentParams, + }; +} diff --git a/src/resources/radar/ai/index.ts b/src/resources/radar/ai/index.ts new file mode 100755 index 0000000000..e13383ec41 --- /dev/null +++ b/src/resources/radar/ai/index.ts @@ -0,0 +1,9 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { AI } from './ai'; +export { Bots } from './bots/index'; +export { + TimeseriesGroups, + type TimeseriesGroupUserAgentResponse, + type TimeseriesGroupUserAgentParams, +} from './timeseries-groups'; diff --git a/src/resources/radar/ai/timeseries-groups.ts b/src/resources/radar/ai/timeseries-groups.ts new file mode 100644 index 0000000000..fc950832b7 --- /dev/null +++ b/src/resources/radar/ai/timeseries-groups.ts @@ -0,0 +1,113 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import * as Core from '../../../core'; + +export class TimeseriesGroups extends APIResource { + /** + * Percentage distribution of traffic per AI user agent over time. + */ + userAgent( + query?: TimeseriesGroupUserAgentParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + userAgent(options?: Core.RequestOptions): Core.APIPromise; + userAgent( + query: TimeseriesGroupUserAgentParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.userAgent({}, query); + } + return ( + this._client.get('/radar/ai/bots/timeseries_groups/user_agent', { + query, + ...options, + }) as Core.APIPromise<{ result: TimeseriesGroupUserAgentResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface TimeseriesGroupUserAgentResponse { + meta: unknown; + + serie_0: TimeseriesGroupUserAgentResponse.Serie0; +} + +export namespace TimeseriesGroupUserAgentResponse { + export interface Serie0 { + timestamps: Array; + [k: string]: Array | undefined; + } +} + +export interface TimeseriesGroupUserAgentParams { + /** + * Aggregation interval results should be returned in (for example, in 15 minutes + * or 1 hour intervals). Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Array of comma separated list of ASNs, start with `-` to exclude from results. + * For example, `-174, 3356` excludes results from AS174, but includes results from + * AS3356. + */ + asn?: Array; + + /** + * Array of comma separated list of continents (alpha-2 continent codes). Start + * with `-` to exclude from results. For example, `-EU,NA` excludes results from + * Europe, but includes results from North America. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * For example, use `7d` and `7dControl` to compare this week with the previous + * week. Use this parameter or set specific start and end dates (`dateStart` and + * `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Array of datetimes to filter the start of a series. + */ + dateStart?: Array; + + /** + * Format results are returned in. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + + /** + * Array of comma separated list of locations (alpha-2 country codes). Start with + * `-` to exclude from results. For example, `-US,PT` excludes results from the US, + * but includes results from PT. + */ + location?: Array; + + /** + * Array of names that will be used to name the series in responses. + */ + name?: Array; +} + +export declare namespace TimeseriesGroups { + export { + type TimeseriesGroupUserAgentResponse as TimeseriesGroupUserAgentResponse, + type TimeseriesGroupUserAgentParams as TimeseriesGroupUserAgentParams, + }; +} diff --git a/src/resources/radar/annotations/annotations.ts b/src/resources/radar/annotations/annotations.ts index ea0d8ea2bc..1a28d6692a 100644 --- a/src/resources/radar/annotations/annotations.ts +++ b/src/resources/radar/annotations/annotations.ts @@ -1,16 +1,160 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; +import { isRequestOptions } from '../../../core'; +import * as Core from '../../../core'; import * as OutagesAPI from './outages'; +import { + OutageGetParams, + OutageGetResponse, + OutageLocationsParams, + OutageLocationsResponse, + Outages, +} from './outages'; export class Annotations extends APIResource { outages: OutagesAPI.Outages = new OutagesAPI.Outages(this._client); + + /** + * Get the latest annotations. + */ + list(query?: AnnotationListParams, options?: Core.RequestOptions): Core.APIPromise; + list(options?: Core.RequestOptions): Core.APIPromise; + list( + query: AnnotationListParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.list({}, query); + } + return ( + this._client.get('/radar/annotations', { query, ...options }) as Core.APIPromise<{ + result: AnnotationListResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface AnnotationListResponse { + annotations: Array; } -export namespace Annotations { - export import Outages = OutagesAPI.Outages; - export import OutageGetResponse = OutagesAPI.OutageGetResponse; - export import OutageLocationsResponse = OutagesAPI.OutageLocationsResponse; - export import OutageGetParams = OutagesAPI.OutageGetParams; - export import OutageLocationsParams = OutagesAPI.OutageLocationsParams; +export namespace AnnotationListResponse { + export interface Annotation { + id: string; + + asns: Array; + + asnsDetails: Array; + + dataSource: string; + + eventType: string; + + locations: Array; + + locationsDetails: Array; + + outage: Annotation.Outage; + + startDate: string; + + description?: string; + + endDate?: string; + + linkedUrl?: string; + + scope?: string; + } + + export namespace Annotation { + export interface ASNsDetail { + asn: string; + + name: string; + + locations?: ASNsDetail.Locations; + } + + export namespace ASNsDetail { + export interface Locations { + code: string; + + name: string; + } + } + + export interface LocationsDetail { + code: string; + + name: string; + } + + export interface Outage { + outageCause: string; + + outageType: string; + } + } +} + +export interface AnnotationListParams { + /** + * Single ASN as integer. + */ + asn?: number; + + /** + * End of the date range (inclusive). + */ + dateEnd?: string; + + /** + * Shorthand date ranges for the last X days - use when you don't need specific + * start and end dates. + */ + dateRange?: string; + + /** + * Start of the date range (inclusive). + */ + dateStart?: string; + + /** + * Format results are returned in. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limit the number of objects in the response. + */ + limit?: number; + + /** + * Location Alpha2 code. + */ + location?: string; + + /** + * Number of objects to skip before grabbing results. + */ + offset?: number; +} + +Annotations.Outages = Outages; + +export declare namespace Annotations { + export { + type AnnotationListResponse as AnnotationListResponse, + type AnnotationListParams as AnnotationListParams, + }; + + export { + Outages as Outages, + type OutageGetResponse as OutageGetResponse, + type OutageLocationsResponse as OutageLocationsResponse, + type OutageGetParams as OutageGetParams, + type OutageLocationsParams as OutageLocationsParams, + }; } diff --git a/src/resources/radar/annotations/index.ts b/src/resources/radar/annotations/index.ts index c51c25efc5..08229e49b6 100644 --- a/src/resources/radar/annotations/index.ts +++ b/src/resources/radar/annotations/index.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Annotations } from './annotations'; +export { Annotations, type AnnotationListResponse, type AnnotationListParams } from './annotations'; export { - OutageGetResponse, - OutageLocationsResponse, - OutageGetParams, - OutageLocationsParams, Outages, + type OutageGetResponse, + type OutageLocationsResponse, + type OutageGetParams, + type OutageLocationsParams, } from './outages'; diff --git a/src/resources/radar/annotations/outages.ts b/src/resources/radar/annotations/outages.ts index 5d486e6f79..62a5da540b 100644 --- a/src/resources/radar/annotations/outages.ts +++ b/src/resources/radar/annotations/outages.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as OutagesAPI from './outages'; export class Outages extends APIResource { /** @@ -26,7 +25,7 @@ export class Outages extends APIResource { } /** - * Get the number of outages for locations. + * Get the number of outages by location. */ locations( query?: OutageLocationsParams, @@ -197,9 +196,11 @@ export interface OutageLocationsParams { limit?: number; } -export namespace Outages { - export import OutageGetResponse = OutagesAPI.OutageGetResponse; - export import OutageLocationsResponse = OutagesAPI.OutageLocationsResponse; - export import OutageGetParams = OutagesAPI.OutageGetParams; - export import OutageLocationsParams = OutagesAPI.OutageLocationsParams; +export declare namespace Outages { + export { + type OutageGetResponse as OutageGetResponse, + type OutageLocationsResponse as OutageLocationsResponse, + type OutageGetParams as OutageGetParams, + type OutageLocationsParams as OutageLocationsParams, + }; } diff --git a/src/resources/radar/as112/as112.ts b/src/resources/radar/as112/as112.ts index 206b612239..676d248f7a 100644 --- a/src/resources/radar/as112/as112.ts +++ b/src/resources/radar/as112/as112.ts @@ -3,10 +3,50 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as AS112API from './as112'; import * as SummaryAPI from './summary'; +import { + Summary, + SummaryDNSSECParams, + SummaryDNSSECResponse, + SummaryEdnsParams, + SummaryEdnsResponse, + SummaryIPVersionParams, + SummaryIPVersionResponse, + SummaryProtocolParams, + SummaryProtocolResponse, + SummaryQueryTypeParams, + SummaryQueryTypeResponse, + SummaryResponseCodesParams, + SummaryResponseCodesResponse, +} from './summary'; import * as TimeseriesGroupsAPI from './timeseries-groups'; +import { + TimeseriesGroupDNSSECParams, + TimeseriesGroupDNSSECResponse, + TimeseriesGroupEdnsParams, + TimeseriesGroupEdnsResponse, + TimeseriesGroupIPVersionParams, + TimeseriesGroupIPVersionResponse, + TimeseriesGroupProtocolParams, + TimeseriesGroupProtocolResponse, + TimeseriesGroupQueryTypeParams, + TimeseriesGroupQueryTypeResponse, + TimeseriesGroupResponseCodesParams, + TimeseriesGroupResponseCodesResponse, + TimeseriesGroups, +} from './timeseries-groups'; import * as TopAPI from './top'; +import { + Top, + TopDNSSECParams, + TopDNSSECResponse, + TopEdnsParams, + TopEdnsResponse, + TopIPVersionParams, + TopIPVersionResponse, + TopLocationsParams, + TopLocationsResponse, +} from './top'; export class AS112 extends APIResource { summary: SummaryAPI.Summary = new SummaryAPI.Summary(this._client); @@ -157,42 +197,57 @@ export interface AS112TimeseriesParams { name?: Array; } -export namespace AS112 { - export import AS112TimeseriesResponse = AS112API.AS112TimeseriesResponse; - export import AS112TimeseriesParams = AS112API.AS112TimeseriesParams; - export import Summary = SummaryAPI.Summary; - export import SummaryDNSSECResponse = SummaryAPI.SummaryDNSSECResponse; - export import SummaryEdnsResponse = SummaryAPI.SummaryEdnsResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummaryProtocolResponse = SummaryAPI.SummaryProtocolResponse; - export import SummaryQueryTypeResponse = SummaryAPI.SummaryQueryTypeResponse; - export import SummaryResponseCodesResponse = SummaryAPI.SummaryResponseCodesResponse; - export import SummaryDNSSECParams = SummaryAPI.SummaryDNSSECParams; - export import SummaryEdnsParams = SummaryAPI.SummaryEdnsParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummaryProtocolParams = SummaryAPI.SummaryProtocolParams; - export import SummaryQueryTypeParams = SummaryAPI.SummaryQueryTypeParams; - export import SummaryResponseCodesParams = SummaryAPI.SummaryResponseCodesParams; - export import TimeseriesGroups = TimeseriesGroupsAPI.TimeseriesGroups; - export import TimeseriesGroupDNSSECResponse = TimeseriesGroupsAPI.TimeseriesGroupDNSSECResponse; - export import TimeseriesGroupEdnsResponse = TimeseriesGroupsAPI.TimeseriesGroupEdnsResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupProtocolResponse = TimeseriesGroupsAPI.TimeseriesGroupProtocolResponse; - export import TimeseriesGroupQueryTypeResponse = TimeseriesGroupsAPI.TimeseriesGroupQueryTypeResponse; - export import TimeseriesGroupResponseCodesResponse = TimeseriesGroupsAPI.TimeseriesGroupResponseCodesResponse; - export import TimeseriesGroupDNSSECParams = TimeseriesGroupsAPI.TimeseriesGroupDNSSECParams; - export import TimeseriesGroupEdnsParams = TimeseriesGroupsAPI.TimeseriesGroupEdnsParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupProtocolParams = TimeseriesGroupsAPI.TimeseriesGroupProtocolParams; - export import TimeseriesGroupQueryTypeParams = TimeseriesGroupsAPI.TimeseriesGroupQueryTypeParams; - export import TimeseriesGroupResponseCodesParams = TimeseriesGroupsAPI.TimeseriesGroupResponseCodesParams; - export import Top = TopAPI.Top; - export import TopDNSSECResponse = TopAPI.TopDNSSECResponse; - export import TopEdnsResponse = TopAPI.TopEdnsResponse; - export import TopIPVersionResponse = TopAPI.TopIPVersionResponse; - export import TopLocationsResponse = TopAPI.TopLocationsResponse; - export import TopDNSSECParams = TopAPI.TopDNSSECParams; - export import TopEdnsParams = TopAPI.TopEdnsParams; - export import TopIPVersionParams = TopAPI.TopIPVersionParams; - export import TopLocationsParams = TopAPI.TopLocationsParams; +AS112.Summary = Summary; +AS112.TimeseriesGroups = TimeseriesGroups; +AS112.Top = Top; + +export declare namespace AS112 { + export { + type AS112TimeseriesResponse as AS112TimeseriesResponse, + type AS112TimeseriesParams as AS112TimeseriesParams, + }; + + export { + Summary as Summary, + type SummaryDNSSECResponse as SummaryDNSSECResponse, + type SummaryEdnsResponse as SummaryEdnsResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummaryProtocolResponse as SummaryProtocolResponse, + type SummaryQueryTypeResponse as SummaryQueryTypeResponse, + type SummaryResponseCodesResponse as SummaryResponseCodesResponse, + type SummaryDNSSECParams as SummaryDNSSECParams, + type SummaryEdnsParams as SummaryEdnsParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummaryProtocolParams as SummaryProtocolParams, + type SummaryQueryTypeParams as SummaryQueryTypeParams, + type SummaryResponseCodesParams as SummaryResponseCodesParams, + }; + + export { + TimeseriesGroups as TimeseriesGroups, + type TimeseriesGroupDNSSECResponse as TimeseriesGroupDNSSECResponse, + type TimeseriesGroupEdnsResponse as TimeseriesGroupEdnsResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupProtocolResponse as TimeseriesGroupProtocolResponse, + type TimeseriesGroupQueryTypeResponse as TimeseriesGroupQueryTypeResponse, + type TimeseriesGroupResponseCodesResponse as TimeseriesGroupResponseCodesResponse, + type TimeseriesGroupDNSSECParams as TimeseriesGroupDNSSECParams, + type TimeseriesGroupEdnsParams as TimeseriesGroupEdnsParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupProtocolParams as TimeseriesGroupProtocolParams, + type TimeseriesGroupQueryTypeParams as TimeseriesGroupQueryTypeParams, + type TimeseriesGroupResponseCodesParams as TimeseriesGroupResponseCodesParams, + }; + + export { + Top as Top, + type TopDNSSECResponse as TopDNSSECResponse, + type TopEdnsResponse as TopEdnsResponse, + type TopIPVersionResponse as TopIPVersionResponse, + type TopLocationsResponse as TopLocationsResponse, + type TopDNSSECParams as TopDNSSECParams, + type TopEdnsParams as TopEdnsParams, + type TopIPVersionParams as TopIPVersionParams, + type TopLocationsParams as TopLocationsParams, + }; } diff --git a/src/resources/radar/as112/index.ts b/src/resources/radar/as112/index.ts index 2285c358a4..7b5e4752cb 100644 --- a/src/resources/radar/as112/index.ts +++ b/src/resources/radar/as112/index.ts @@ -1,44 +1,44 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AS112TimeseriesResponse, AS112TimeseriesParams, AS112 } from './as112'; +export { AS112, type AS112TimeseriesResponse, type AS112TimeseriesParams } from './as112'; export { - SummaryDNSSECResponse, - SummaryEdnsResponse, - SummaryIPVersionResponse, - SummaryProtocolResponse, - SummaryQueryTypeResponse, - SummaryResponseCodesResponse, - SummaryDNSSECParams, - SummaryEdnsParams, - SummaryIPVersionParams, - SummaryProtocolParams, - SummaryQueryTypeParams, - SummaryResponseCodesParams, Summary, + type SummaryDNSSECResponse, + type SummaryEdnsResponse, + type SummaryIPVersionResponse, + type SummaryProtocolResponse, + type SummaryQueryTypeResponse, + type SummaryResponseCodesResponse, + type SummaryDNSSECParams, + type SummaryEdnsParams, + type SummaryIPVersionParams, + type SummaryProtocolParams, + type SummaryQueryTypeParams, + type SummaryResponseCodesParams, } from './summary'; export { - TimeseriesGroupDNSSECResponse, - TimeseriesGroupEdnsResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupProtocolResponse, - TimeseriesGroupQueryTypeResponse, - TimeseriesGroupResponseCodesResponse, - TimeseriesGroupDNSSECParams, - TimeseriesGroupEdnsParams, - TimeseriesGroupIPVersionParams, - TimeseriesGroupProtocolParams, - TimeseriesGroupQueryTypeParams, - TimeseriesGroupResponseCodesParams, TimeseriesGroups, + type TimeseriesGroupDNSSECResponse, + type TimeseriesGroupEdnsResponse, + type TimeseriesGroupIPVersionResponse, + type TimeseriesGroupProtocolResponse, + type TimeseriesGroupQueryTypeResponse, + type TimeseriesGroupResponseCodesResponse, + type TimeseriesGroupDNSSECParams, + type TimeseriesGroupEdnsParams, + type TimeseriesGroupIPVersionParams, + type TimeseriesGroupProtocolParams, + type TimeseriesGroupQueryTypeParams, + type TimeseriesGroupResponseCodesParams, } from './timeseries-groups'; export { - TopDNSSECResponse, - TopEdnsResponse, - TopIPVersionResponse, - TopLocationsResponse, - TopDNSSECParams, - TopEdnsParams, - TopIPVersionParams, - TopLocationsParams, Top, + type TopDNSSECResponse, + type TopEdnsResponse, + type TopIPVersionResponse, + type TopLocationsResponse, + type TopDNSSECParams, + type TopEdnsParams, + type TopIPVersionParams, + type TopLocationsParams, } from './top'; diff --git a/src/resources/radar/as112/summary.ts b/src/resources/radar/as112/summary.ts index 2b7b567086..5c56fb5e58 100644 --- a/src/resources/radar/as112/summary.ts +++ b/src/resources/radar/as112/summary.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as SummaryAPI from './summary'; export class Summary extends APIResource { /** @@ -26,7 +25,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of DNS queries, to AS112, by EDNS support. + * Percentage distribution of DNS queries to AS112 by EDNS support. */ edns(query?: SummaryEdnsParams, options?: Core.RequestOptions): Core.APIPromise; edns(options?: Core.RequestOptions): Core.APIPromise; @@ -89,7 +88,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of DNS queries to AS112 by Query Type. + * Percentage distribution of DNS queries to AS112 by query type. */ queryType( query?: SummaryQueryTypeParams, @@ -111,7 +110,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of AS112 dns requests classified per Response Codes. + * Percentage distribution of AS112 DNS requests classified by response code. */ responseCodes( query?: SummaryResponseCodesParams, @@ -384,7 +383,7 @@ export namespace SummaryProtocolResponse { export interface SummaryQueryTypeResponse { meta: SummaryQueryTypeResponse.Meta; - summary_0: SummaryQueryTypeResponse.Summary0; + summary_0: Record; } export namespace SummaryQueryTypeResponse { @@ -435,24 +434,12 @@ export namespace SummaryQueryTypeResponse { } } } - - export interface Summary0 { - A: string; - - AAAA: string; - - PTR: string; - - SOA: string; - - SRV: string; - } } export interface SummaryResponseCodesResponse { meta: SummaryResponseCodesResponse.Meta; - summary_0: SummaryResponseCodesResponse.Summary0; + summary_0: Record; } export namespace SummaryResponseCodesResponse { @@ -503,12 +490,6 @@ export namespace SummaryResponseCodesResponse { } } } - - export interface Summary0 { - NOERROR: string; - - NXDOMAIN: string; - } } export interface SummaryDNSSECParams { @@ -748,6 +729,12 @@ export interface SummaryQueryTypeParams { */ format?: 'JSON' | 'CSV'; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -798,6 +785,12 @@ export interface SummaryResponseCodesParams { */ format?: 'JSON' | 'CSV'; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -811,17 +804,19 @@ export interface SummaryResponseCodesParams { name?: Array; } -export namespace Summary { - export import SummaryDNSSECResponse = SummaryAPI.SummaryDNSSECResponse; - export import SummaryEdnsResponse = SummaryAPI.SummaryEdnsResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummaryProtocolResponse = SummaryAPI.SummaryProtocolResponse; - export import SummaryQueryTypeResponse = SummaryAPI.SummaryQueryTypeResponse; - export import SummaryResponseCodesResponse = SummaryAPI.SummaryResponseCodesResponse; - export import SummaryDNSSECParams = SummaryAPI.SummaryDNSSECParams; - export import SummaryEdnsParams = SummaryAPI.SummaryEdnsParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummaryProtocolParams = SummaryAPI.SummaryProtocolParams; - export import SummaryQueryTypeParams = SummaryAPI.SummaryQueryTypeParams; - export import SummaryResponseCodesParams = SummaryAPI.SummaryResponseCodesParams; +export declare namespace Summary { + export { + type SummaryDNSSECResponse as SummaryDNSSECResponse, + type SummaryEdnsResponse as SummaryEdnsResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummaryProtocolResponse as SummaryProtocolResponse, + type SummaryQueryTypeResponse as SummaryQueryTypeResponse, + type SummaryResponseCodesResponse as SummaryResponseCodesResponse, + type SummaryDNSSECParams as SummaryDNSSECParams, + type SummaryEdnsParams as SummaryEdnsParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummaryProtocolParams as SummaryProtocolParams, + type SummaryQueryTypeParams as SummaryQueryTypeParams, + type SummaryResponseCodesParams as SummaryResponseCodesParams, + }; } diff --git a/src/resources/radar/as112/timeseries-groups.ts b/src/resources/radar/as112/timeseries-groups.ts index 852a124579..4663a288ae 100644 --- a/src/resources/radar/as112/timeseries-groups.ts +++ b/src/resources/radar/as112/timeseries-groups.ts @@ -3,11 +3,10 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as TimeseriesGroupsAPI from './timeseries-groups'; export class TimeseriesGroups extends APIResource { /** - * Percentage distribution of DNS AS112 queries by DNSSEC support over time. + * Percentage distribution of AS112 DNS queries by DNSSEC support over time. */ dnssec( query?: TimeseriesGroupDNSSECParams, @@ -51,7 +50,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of AS112 DNS queries by IP Version over time. + * Percentage distribution of AS112 DNS queries by IP version over time. */ ipVersion( query?: TimeseriesGroupIPVersionParams, @@ -74,7 +73,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of AS112 dns requests classified per Protocol over time. + * Percentage distribution of AS112 DNS requests classified by protocol over time. */ protocol( query?: TimeseriesGroupProtocolParams, @@ -96,7 +95,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of AS112 DNS queries by Query Type over time. + * Percentage distribution of AS112 DNS queries by query type over time. */ queryType( query?: TimeseriesGroupQueryTypeParams, @@ -119,7 +118,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of AS112 dns requests classified per Response Codes over + * Percentage distribution of AS112 DNS requests classified by response code over * time. */ responseCodes( @@ -505,6 +504,12 @@ export interface TimeseriesGroupQueryTypeParams { */ format?: 'JSON' | 'CSV'; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -562,6 +567,12 @@ export interface TimeseriesGroupResponseCodesParams { */ format?: 'JSON' | 'CSV'; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -575,17 +586,19 @@ export interface TimeseriesGroupResponseCodesParams { name?: Array; } -export namespace TimeseriesGroups { - export import TimeseriesGroupDNSSECResponse = TimeseriesGroupsAPI.TimeseriesGroupDNSSECResponse; - export import TimeseriesGroupEdnsResponse = TimeseriesGroupsAPI.TimeseriesGroupEdnsResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupProtocolResponse = TimeseriesGroupsAPI.TimeseriesGroupProtocolResponse; - export import TimeseriesGroupQueryTypeResponse = TimeseriesGroupsAPI.TimeseriesGroupQueryTypeResponse; - export import TimeseriesGroupResponseCodesResponse = TimeseriesGroupsAPI.TimeseriesGroupResponseCodesResponse; - export import TimeseriesGroupDNSSECParams = TimeseriesGroupsAPI.TimeseriesGroupDNSSECParams; - export import TimeseriesGroupEdnsParams = TimeseriesGroupsAPI.TimeseriesGroupEdnsParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupProtocolParams = TimeseriesGroupsAPI.TimeseriesGroupProtocolParams; - export import TimeseriesGroupQueryTypeParams = TimeseriesGroupsAPI.TimeseriesGroupQueryTypeParams; - export import TimeseriesGroupResponseCodesParams = TimeseriesGroupsAPI.TimeseriesGroupResponseCodesParams; +export declare namespace TimeseriesGroups { + export { + type TimeseriesGroupDNSSECResponse as TimeseriesGroupDNSSECResponse, + type TimeseriesGroupEdnsResponse as TimeseriesGroupEdnsResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupProtocolResponse as TimeseriesGroupProtocolResponse, + type TimeseriesGroupQueryTypeResponse as TimeseriesGroupQueryTypeResponse, + type TimeseriesGroupResponseCodesResponse as TimeseriesGroupResponseCodesResponse, + type TimeseriesGroupDNSSECParams as TimeseriesGroupDNSSECParams, + type TimeseriesGroupEdnsParams as TimeseriesGroupEdnsParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupProtocolParams as TimeseriesGroupProtocolParams, + type TimeseriesGroupQueryTypeParams as TimeseriesGroupQueryTypeParams, + type TimeseriesGroupResponseCodesParams as TimeseriesGroupResponseCodesParams, + }; } diff --git a/src/resources/radar/as112/top.ts b/src/resources/radar/as112/top.ts index 66fc5d4d65..5fd3b38ee9 100644 --- a/src/resources/radar/as112/top.ts +++ b/src/resources/radar/as112/top.ts @@ -3,11 +3,10 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as TopAPI from './top'; export class Top extends APIResource { /** - * Get the top locations by DNS queries DNSSEC support to AS112. + * Get the top locations of DNS queries to AS112 with DNSSEC. */ dnssec( dnssec: 'SUPPORTED' | 'NOT_SUPPORTED', @@ -35,7 +34,7 @@ export class Top extends APIResource { } /** - * Get the top locations, by DNS queries EDNS support to AS112. + * Get the top locations of DNS queries to AS112 with EDNS support. */ edns( edns: 'SUPPORTED' | 'NOT_SUPPORTED', @@ -59,7 +58,7 @@ export class Top extends APIResource { } /** - * Get the top locations by DNS queries IP version to AS112. + * Get the top locations of DNS queries to AS112 by IP version. */ ipVersion( ipVersion: 'IPv4' | 'IPv6', @@ -572,13 +571,15 @@ export interface TopLocationsParams { name?: Array; } -export namespace Top { - export import TopDNSSECResponse = TopAPI.TopDNSSECResponse; - export import TopEdnsResponse = TopAPI.TopEdnsResponse; - export import TopIPVersionResponse = TopAPI.TopIPVersionResponse; - export import TopLocationsResponse = TopAPI.TopLocationsResponse; - export import TopDNSSECParams = TopAPI.TopDNSSECParams; - export import TopEdnsParams = TopAPI.TopEdnsParams; - export import TopIPVersionParams = TopAPI.TopIPVersionParams; - export import TopLocationsParams = TopAPI.TopLocationsParams; +export declare namespace Top { + export { + type TopDNSSECResponse as TopDNSSECResponse, + type TopEdnsResponse as TopEdnsResponse, + type TopIPVersionResponse as TopIPVersionResponse, + type TopLocationsResponse as TopLocationsResponse, + type TopDNSSECParams as TopDNSSECParams, + type TopEdnsParams as TopEdnsParams, + type TopIPVersionParams as TopIPVersionParams, + type TopLocationsParams as TopLocationsParams, + }; } diff --git a/src/resources/radar/attacks/attacks.ts b/src/resources/radar/attacks/attacks.ts index 3f54faf8cf..9d3c9c4aef 100644 --- a/src/resources/radar/attacks/attacks.ts +++ b/src/resources/radar/attacks/attacks.ts @@ -2,18 +2,28 @@ import { APIResource } from '../../../resource'; import * as Layer3API from './layer3/layer3'; +import { Layer3, Layer3TimeseriesParams, Layer3TimeseriesResponse } from './layer3/layer3'; import * as Layer7API from './layer7/layer7'; +import { Layer7, Layer7TimeseriesParams, Layer7TimeseriesResponse } from './layer7/layer7'; export class Attacks extends APIResource { layer3: Layer3API.Layer3 = new Layer3API.Layer3(this._client); layer7: Layer7API.Layer7 = new Layer7API.Layer7(this._client); } -export namespace Attacks { - export import Layer3 = Layer3API.Layer3; - export import Layer3TimeseriesResponse = Layer3API.Layer3TimeseriesResponse; - export import Layer3TimeseriesParams = Layer3API.Layer3TimeseriesParams; - export import Layer7 = Layer7API.Layer7; - export import Layer7TimeseriesResponse = Layer7API.Layer7TimeseriesResponse; - export import Layer7TimeseriesParams = Layer7API.Layer7TimeseriesParams; +Attacks.Layer3 = Layer3; +Attacks.Layer7 = Layer7; + +export declare namespace Attacks { + export { + Layer3 as Layer3, + type Layer3TimeseriesResponse as Layer3TimeseriesResponse, + type Layer3TimeseriesParams as Layer3TimeseriesParams, + }; + + export { + Layer7 as Layer7, + type Layer7TimeseriesResponse as Layer7TimeseriesResponse, + type Layer7TimeseriesParams as Layer7TimeseriesParams, + }; } diff --git a/src/resources/radar/attacks/index.ts b/src/resources/radar/attacks/index.ts index 674f60a25e..28216f9bd4 100644 --- a/src/resources/radar/attacks/index.ts +++ b/src/resources/radar/attacks/index.ts @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Attacks } from './attacks'; -export { Layer3TimeseriesResponse, Layer3TimeseriesParams, Layer3 } from './layer3/index'; -export { Layer7TimeseriesResponse, Layer7TimeseriesParams, Layer7 } from './layer7/index'; +export { Layer3, type Layer3TimeseriesResponse, type Layer3TimeseriesParams } from './layer3/index'; +export { Layer7, type Layer7TimeseriesResponse, type Layer7TimeseriesParams } from './layer7/index'; diff --git a/src/resources/radar/attacks/layer3/index.ts b/src/resources/radar/attacks/layer3/index.ts index a0ea3207fc..11bf63c011 100644 --- a/src/resources/radar/attacks/layer3/index.ts +++ b/src/resources/radar/attacks/layer3/index.ts @@ -1,46 +1,46 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Layer3TimeseriesResponse, Layer3TimeseriesParams, Layer3 } from './layer3'; +export { Layer3, type Layer3TimeseriesResponse, type Layer3TimeseriesParams } from './layer3'; export { - SummaryBitrateResponse, - SummaryDurationResponse, - SummaryGetResponse, - SummaryIPVersionResponse, - SummaryProtocolResponse, - SummaryVectorResponse, - SummaryBitrateParams, - SummaryDurationParams, - SummaryGetParams, - SummaryIPVersionParams, - SummaryProtocolParams, - SummaryVectorParams, Summary, + type SummaryBitrateResponse, + type SummaryDurationResponse, + type SummaryGetResponse, + type SummaryIPVersionResponse, + type SummaryProtocolResponse, + type SummaryVectorResponse, + type SummaryBitrateParams, + type SummaryDurationParams, + type SummaryGetParams, + type SummaryIPVersionParams, + type SummaryProtocolParams, + type SummaryVectorParams, } from './summary'; export { - TimeseriesGroupBitrateResponse, - TimeseriesGroupDurationResponse, - TimeseriesGroupGetResponse, - TimeseriesGroupIndustryResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupProtocolResponse, - TimeseriesGroupVectorResponse, - TimeseriesGroupVerticalResponse, - TimeseriesGroupBitrateParams, - TimeseriesGroupDurationParams, - TimeseriesGroupGetParams, - TimeseriesGroupIndustryParams, - TimeseriesGroupIPVersionParams, - TimeseriesGroupProtocolParams, - TimeseriesGroupVectorParams, - TimeseriesGroupVerticalParams, TimeseriesGroups, + type TimeseriesGroupBitrateResponse, + type TimeseriesGroupDurationResponse, + type TimeseriesGroupGetResponse, + type TimeseriesGroupIndustryResponse, + type TimeseriesGroupIPVersionResponse, + type TimeseriesGroupProtocolResponse, + type TimeseriesGroupVectorResponse, + type TimeseriesGroupVerticalResponse, + type TimeseriesGroupBitrateParams, + type TimeseriesGroupDurationParams, + type TimeseriesGroupGetParams, + type TimeseriesGroupIndustryParams, + type TimeseriesGroupIPVersionParams, + type TimeseriesGroupProtocolParams, + type TimeseriesGroupVectorParams, + type TimeseriesGroupVerticalParams, } from './timeseries-groups'; export { - TopAttacksResponse, - TopIndustryResponse, - TopVerticalResponse, - TopAttacksParams, - TopIndustryParams, - TopVerticalParams, Top, + type TopAttacksResponse, + type TopIndustryResponse, + type TopVerticalResponse, + type TopAttacksParams, + type TopIndustryParams, + type TopVerticalParams, } from './top/index'; diff --git a/src/resources/radar/attacks/layer3/layer3.ts b/src/resources/radar/attacks/layer3/layer3.ts index 4ef00064b7..86350a6fc5 100644 --- a/src/resources/radar/attacks/layer3/layer3.ts +++ b/src/resources/radar/attacks/layer3/layer3.ts @@ -3,10 +3,52 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as Layer3API from './layer3'; import * as SummaryAPI from './summary'; +import { + Summary, + SummaryBitrateParams, + SummaryBitrateResponse, + SummaryDurationParams, + SummaryDurationResponse, + SummaryGetParams, + SummaryGetResponse, + SummaryIPVersionParams, + SummaryIPVersionResponse, + SummaryProtocolParams, + SummaryProtocolResponse, + SummaryVectorParams, + SummaryVectorResponse, +} from './summary'; import * as TimeseriesGroupsAPI from './timeseries-groups'; +import { + TimeseriesGroupBitrateParams, + TimeseriesGroupBitrateResponse, + TimeseriesGroupDurationParams, + TimeseriesGroupDurationResponse, + TimeseriesGroupGetParams, + TimeseriesGroupGetResponse, + TimeseriesGroupIPVersionParams, + TimeseriesGroupIPVersionResponse, + TimeseriesGroupIndustryParams, + TimeseriesGroupIndustryResponse, + TimeseriesGroupProtocolParams, + TimeseriesGroupProtocolResponse, + TimeseriesGroupVectorParams, + TimeseriesGroupVectorResponse, + TimeseriesGroupVerticalParams, + TimeseriesGroupVerticalResponse, + TimeseriesGroups, +} from './timeseries-groups'; import * as TopAPI from './top/top'; +import { + Top, + TopAttacksParams, + TopAttacksResponse, + TopIndustryParams, + TopIndustryResponse, + TopVerticalParams, + TopVerticalResponse, +} from './top/top'; export class Layer3 extends APIResource { summary: SummaryAPI.Summary = new SummaryAPI.Summary(this._client); @@ -136,44 +178,59 @@ export interface Layer3TimeseriesParams { protocol?: Array<'UDP' | 'TCP' | 'ICMP' | 'GRE'>; } -export namespace Layer3 { - export import Layer3TimeseriesResponse = Layer3API.Layer3TimeseriesResponse; - export import Layer3TimeseriesParams = Layer3API.Layer3TimeseriesParams; - export import Summary = SummaryAPI.Summary; - export import SummaryBitrateResponse = SummaryAPI.SummaryBitrateResponse; - export import SummaryDurationResponse = SummaryAPI.SummaryDurationResponse; - export import SummaryGetResponse = SummaryAPI.SummaryGetResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummaryProtocolResponse = SummaryAPI.SummaryProtocolResponse; - export import SummaryVectorResponse = SummaryAPI.SummaryVectorResponse; - export import SummaryBitrateParams = SummaryAPI.SummaryBitrateParams; - export import SummaryDurationParams = SummaryAPI.SummaryDurationParams; - export import SummaryGetParams = SummaryAPI.SummaryGetParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummaryProtocolParams = SummaryAPI.SummaryProtocolParams; - export import SummaryVectorParams = SummaryAPI.SummaryVectorParams; - export import TimeseriesGroups = TimeseriesGroupsAPI.TimeseriesGroups; - export import TimeseriesGroupBitrateResponse = TimeseriesGroupsAPI.TimeseriesGroupBitrateResponse; - export import TimeseriesGroupDurationResponse = TimeseriesGroupsAPI.TimeseriesGroupDurationResponse; - export import TimeseriesGroupGetResponse = TimeseriesGroupsAPI.TimeseriesGroupGetResponse; - export import TimeseriesGroupIndustryResponse = TimeseriesGroupsAPI.TimeseriesGroupIndustryResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupProtocolResponse = TimeseriesGroupsAPI.TimeseriesGroupProtocolResponse; - export import TimeseriesGroupVectorResponse = TimeseriesGroupsAPI.TimeseriesGroupVectorResponse; - export import TimeseriesGroupVerticalResponse = TimeseriesGroupsAPI.TimeseriesGroupVerticalResponse; - export import TimeseriesGroupBitrateParams = TimeseriesGroupsAPI.TimeseriesGroupBitrateParams; - export import TimeseriesGroupDurationParams = TimeseriesGroupsAPI.TimeseriesGroupDurationParams; - export import TimeseriesGroupGetParams = TimeseriesGroupsAPI.TimeseriesGroupGetParams; - export import TimeseriesGroupIndustryParams = TimeseriesGroupsAPI.TimeseriesGroupIndustryParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupProtocolParams = TimeseriesGroupsAPI.TimeseriesGroupProtocolParams; - export import TimeseriesGroupVectorParams = TimeseriesGroupsAPI.TimeseriesGroupVectorParams; - export import TimeseriesGroupVerticalParams = TimeseriesGroupsAPI.TimeseriesGroupVerticalParams; - export import Top = TopAPI.Top; - export import TopAttacksResponse = TopAPI.TopAttacksResponse; - export import TopIndustryResponse = TopAPI.TopIndustryResponse; - export import TopVerticalResponse = TopAPI.TopVerticalResponse; - export import TopAttacksParams = TopAPI.TopAttacksParams; - export import TopIndustryParams = TopAPI.TopIndustryParams; - export import TopVerticalParams = TopAPI.TopVerticalParams; +Layer3.Summary = Summary; +Layer3.TimeseriesGroups = TimeseriesGroups; +Layer3.Top = Top; + +export declare namespace Layer3 { + export { + type Layer3TimeseriesResponse as Layer3TimeseriesResponse, + type Layer3TimeseriesParams as Layer3TimeseriesParams, + }; + + export { + Summary as Summary, + type SummaryBitrateResponse as SummaryBitrateResponse, + type SummaryDurationResponse as SummaryDurationResponse, + type SummaryGetResponse as SummaryGetResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummaryProtocolResponse as SummaryProtocolResponse, + type SummaryVectorResponse as SummaryVectorResponse, + type SummaryBitrateParams as SummaryBitrateParams, + type SummaryDurationParams as SummaryDurationParams, + type SummaryGetParams as SummaryGetParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummaryProtocolParams as SummaryProtocolParams, + type SummaryVectorParams as SummaryVectorParams, + }; + + export { + TimeseriesGroups as TimeseriesGroups, + type TimeseriesGroupBitrateResponse as TimeseriesGroupBitrateResponse, + type TimeseriesGroupDurationResponse as TimeseriesGroupDurationResponse, + type TimeseriesGroupGetResponse as TimeseriesGroupGetResponse, + type TimeseriesGroupIndustryResponse as TimeseriesGroupIndustryResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupProtocolResponse as TimeseriesGroupProtocolResponse, + type TimeseriesGroupVectorResponse as TimeseriesGroupVectorResponse, + type TimeseriesGroupVerticalResponse as TimeseriesGroupVerticalResponse, + type TimeseriesGroupBitrateParams as TimeseriesGroupBitrateParams, + type TimeseriesGroupDurationParams as TimeseriesGroupDurationParams, + type TimeseriesGroupGetParams as TimeseriesGroupGetParams, + type TimeseriesGroupIndustryParams as TimeseriesGroupIndustryParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupProtocolParams as TimeseriesGroupProtocolParams, + type TimeseriesGroupVectorParams as TimeseriesGroupVectorParams, + type TimeseriesGroupVerticalParams as TimeseriesGroupVerticalParams, + }; + + export { + Top as Top, + type TopAttacksResponse as TopAttacksResponse, + type TopIndustryResponse as TopIndustryResponse, + type TopVerticalResponse as TopVerticalResponse, + type TopAttacksParams as TopAttacksParams, + type TopIndustryParams as TopIndustryParams, + type TopVerticalParams as TopVerticalParams, + }; } diff --git a/src/resources/radar/attacks/layer3/summary.ts b/src/resources/radar/attacks/layer3/summary.ts index d3d2863023..faa203e519 100644 --- a/src/resources/radar/attacks/layer3/summary.ts +++ b/src/resources/radar/attacks/layer3/summary.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as SummaryAPI from './summary'; export class Summary extends APIResource { /** @@ -51,7 +50,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of network protocols in layer 3/4 attacks over a given + * Percentage distribution of network protocols in Layer 3/4 attacks over a given * time period. */ get(query?: SummaryGetParams, options?: Core.RequestOptions): Core.APIPromise; @@ -465,7 +464,7 @@ export namespace SummaryProtocolResponse { export interface SummaryVectorResponse { meta: SummaryVectorResponse.Meta; - summary_0: Record>; + summary_0: Record; } export namespace SummaryVectorResponse { @@ -835,6 +834,12 @@ export interface SummaryVectorParams { */ ipVersion?: Array<'IPv4' | 'IPv6'>; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -853,17 +858,19 @@ export interface SummaryVectorParams { protocol?: Array<'UDP' | 'TCP' | 'ICMP' | 'GRE'>; } -export namespace Summary { - export import SummaryBitrateResponse = SummaryAPI.SummaryBitrateResponse; - export import SummaryDurationResponse = SummaryAPI.SummaryDurationResponse; - export import SummaryGetResponse = SummaryAPI.SummaryGetResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummaryProtocolResponse = SummaryAPI.SummaryProtocolResponse; - export import SummaryVectorResponse = SummaryAPI.SummaryVectorResponse; - export import SummaryBitrateParams = SummaryAPI.SummaryBitrateParams; - export import SummaryDurationParams = SummaryAPI.SummaryDurationParams; - export import SummaryGetParams = SummaryAPI.SummaryGetParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummaryProtocolParams = SummaryAPI.SummaryProtocolParams; - export import SummaryVectorParams = SummaryAPI.SummaryVectorParams; +export declare namespace Summary { + export { + type SummaryBitrateResponse as SummaryBitrateResponse, + type SummaryDurationResponse as SummaryDurationResponse, + type SummaryGetResponse as SummaryGetResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummaryProtocolResponse as SummaryProtocolResponse, + type SummaryVectorResponse as SummaryVectorResponse, + type SummaryBitrateParams as SummaryBitrateParams, + type SummaryDurationParams as SummaryDurationParams, + type SummaryGetParams as SummaryGetParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummaryProtocolParams as SummaryProtocolParams, + type SummaryVectorParams as SummaryVectorParams, + }; } diff --git a/src/resources/radar/attacks/layer3/timeseries-groups.ts b/src/resources/radar/attacks/layer3/timeseries-groups.ts index 71a89d3b4a..a424d9143d 100644 --- a/src/resources/radar/attacks/layer3/timeseries-groups.ts +++ b/src/resources/radar/attacks/layer3/timeseries-groups.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as TimeseriesGroupsAPI from './timeseries-groups'; export class TimeseriesGroups extends APIResource { /** @@ -53,7 +52,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Get a timeseries of the percentage distribution of network protocols in Layer + * Get a time series of the percentage distribution of network protocols in Layer * 3/4 attacks. */ get( @@ -76,7 +75,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of attacks by industry used over time. + * Percentage distribution of attacks by industry targeted over time. */ industry( query?: TimeseriesGroupIndustryParams, @@ -168,7 +167,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of attacks by vertical used over time. + * Percentage distribution of attacks by vertical targeted over time. */ vertical( query?: TimeseriesGroupVerticalParams, @@ -949,21 +948,23 @@ export interface TimeseriesGroupVerticalParams { protocol?: Array<'UDP' | 'TCP' | 'ICMP' | 'GRE'>; } -export namespace TimeseriesGroups { - export import TimeseriesGroupBitrateResponse = TimeseriesGroupsAPI.TimeseriesGroupBitrateResponse; - export import TimeseriesGroupDurationResponse = TimeseriesGroupsAPI.TimeseriesGroupDurationResponse; - export import TimeseriesGroupGetResponse = TimeseriesGroupsAPI.TimeseriesGroupGetResponse; - export import TimeseriesGroupIndustryResponse = TimeseriesGroupsAPI.TimeseriesGroupIndustryResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupProtocolResponse = TimeseriesGroupsAPI.TimeseriesGroupProtocolResponse; - export import TimeseriesGroupVectorResponse = TimeseriesGroupsAPI.TimeseriesGroupVectorResponse; - export import TimeseriesGroupVerticalResponse = TimeseriesGroupsAPI.TimeseriesGroupVerticalResponse; - export import TimeseriesGroupBitrateParams = TimeseriesGroupsAPI.TimeseriesGroupBitrateParams; - export import TimeseriesGroupDurationParams = TimeseriesGroupsAPI.TimeseriesGroupDurationParams; - export import TimeseriesGroupGetParams = TimeseriesGroupsAPI.TimeseriesGroupGetParams; - export import TimeseriesGroupIndustryParams = TimeseriesGroupsAPI.TimeseriesGroupIndustryParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupProtocolParams = TimeseriesGroupsAPI.TimeseriesGroupProtocolParams; - export import TimeseriesGroupVectorParams = TimeseriesGroupsAPI.TimeseriesGroupVectorParams; - export import TimeseriesGroupVerticalParams = TimeseriesGroupsAPI.TimeseriesGroupVerticalParams; +export declare namespace TimeseriesGroups { + export { + type TimeseriesGroupBitrateResponse as TimeseriesGroupBitrateResponse, + type TimeseriesGroupDurationResponse as TimeseriesGroupDurationResponse, + type TimeseriesGroupGetResponse as TimeseriesGroupGetResponse, + type TimeseriesGroupIndustryResponse as TimeseriesGroupIndustryResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupProtocolResponse as TimeseriesGroupProtocolResponse, + type TimeseriesGroupVectorResponse as TimeseriesGroupVectorResponse, + type TimeseriesGroupVerticalResponse as TimeseriesGroupVerticalResponse, + type TimeseriesGroupBitrateParams as TimeseriesGroupBitrateParams, + type TimeseriesGroupDurationParams as TimeseriesGroupDurationParams, + type TimeseriesGroupGetParams as TimeseriesGroupGetParams, + type TimeseriesGroupIndustryParams as TimeseriesGroupIndustryParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupProtocolParams as TimeseriesGroupProtocolParams, + type TimeseriesGroupVectorParams as TimeseriesGroupVectorParams, + type TimeseriesGroupVerticalParams as TimeseriesGroupVerticalParams, + }; } diff --git a/src/resources/radar/attacks/layer3/top/index.ts b/src/resources/radar/attacks/layer3/top/index.ts index e3eb8eadd2..60846d1072 100644 --- a/src/resources/radar/attacks/layer3/top/index.ts +++ b/src/resources/radar/attacks/layer3/top/index.ts @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - LocationOriginResponse, - LocationTargetResponse, - LocationOriginParams, - LocationTargetParams, Locations, + type LocationOriginResponse, + type LocationTargetResponse, + type LocationOriginParams, + type LocationTargetParams, } from './locations'; export { - TopAttacksResponse, - TopIndustryResponse, - TopVerticalResponse, - TopAttacksParams, - TopIndustryParams, - TopVerticalParams, Top, + type TopAttacksResponse, + type TopIndustryResponse, + type TopVerticalResponse, + type TopAttacksParams, + type TopIndustryParams, + type TopVerticalParams, } from './top'; diff --git a/src/resources/radar/attacks/layer3/top/locations.ts b/src/resources/radar/attacks/layer3/top/locations.ts index e956ddf0ec..6f1b72a1f6 100644 --- a/src/resources/radar/attacks/layer3/top/locations.ts +++ b/src/resources/radar/attacks/layer3/top/locations.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../../resource'; import { isRequestOptions } from '../../../../../core'; import * as Core from '../../../../../core'; -import * as LocationsAPI from './locations'; export class Locations extends APIResource { /** @@ -297,9 +296,11 @@ export interface LocationTargetParams { protocol?: Array<'UDP' | 'TCP' | 'ICMP' | 'GRE'>; } -export namespace Locations { - export import LocationOriginResponse = LocationsAPI.LocationOriginResponse; - export import LocationTargetResponse = LocationsAPI.LocationTargetResponse; - export import LocationOriginParams = LocationsAPI.LocationOriginParams; - export import LocationTargetParams = LocationsAPI.LocationTargetParams; +export declare namespace Locations { + export { + type LocationOriginResponse as LocationOriginResponse, + type LocationTargetResponse as LocationTargetResponse, + type LocationOriginParams as LocationOriginParams, + type LocationTargetParams as LocationTargetParams, + }; } diff --git a/src/resources/radar/attacks/layer3/top/top.ts b/src/resources/radar/attacks/layer3/top/top.ts index f7a4e88d2a..ca1611304c 100644 --- a/src/resources/radar/attacks/layer3/top/top.ts +++ b/src/resources/radar/attacks/layer3/top/top.ts @@ -3,9 +3,14 @@ import { APIResource } from '../../../../../resource'; import { isRequestOptions } from '../../../../../core'; import * as Core from '../../../../../core'; -import * as TopTopAPI from './top'; -import * as TopAPI from '../../../http/top'; import * as LocationsAPI from './locations'; +import { + LocationOriginParams, + LocationOriginResponse, + LocationTargetParams, + LocationTargetResponse, + Locations, +} from './locations'; export class Top extends APIResource { locations: LocationsAPI.Locations = new LocationsAPI.Locations(this._client); @@ -33,7 +38,7 @@ export class Top extends APIResource { } /** - * Get the Industry of attacks. + * Get the industries targeted by attacks. */ industry(query?: TopIndustryParams, options?: Core.RequestOptions): Core.APIPromise; industry(options?: Core.RequestOptions): Core.APIPromise; @@ -52,7 +57,7 @@ export class Top extends APIResource { } /** - * Get the Verticals of attacks. + * Get the verticals targeted by attacks. */ vertical(query?: TopVerticalParams, options?: Core.RequestOptions): Core.APIPromise; vertical(options?: Core.RequestOptions): Core.APIPromise; @@ -136,7 +141,7 @@ export namespace TopAttacksResponse { export interface TopIndustryResponse { meta: TopIndustryResponse.Meta; - top_0: Array; + top_0: Array; } export namespace TopIndustryResponse { @@ -185,12 +190,18 @@ export namespace TopIndustryResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } export interface TopVerticalResponse { meta: TopVerticalResponse.Meta; - top_0: Array; + top_0: Array; } export namespace TopVerticalResponse { @@ -239,6 +250,12 @@ export namespace TopVerticalResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } export interface TopAttacksParams { @@ -434,16 +451,23 @@ export interface TopVerticalParams { protocol?: Array<'UDP' | 'TCP' | 'ICMP' | 'GRE'>; } -export namespace Top { - export import TopAttacksResponse = TopTopAPI.TopAttacksResponse; - export import TopIndustryResponse = TopTopAPI.TopIndustryResponse; - export import TopVerticalResponse = TopTopAPI.TopVerticalResponse; - export import TopAttacksParams = TopTopAPI.TopAttacksParams; - export import TopIndustryParams = TopTopAPI.TopIndustryParams; - export import TopVerticalParams = TopTopAPI.TopVerticalParams; - export import Locations = LocationsAPI.Locations; - export import LocationOriginResponse = LocationsAPI.LocationOriginResponse; - export import LocationTargetResponse = LocationsAPI.LocationTargetResponse; - export import LocationOriginParams = LocationsAPI.LocationOriginParams; - export import LocationTargetParams = LocationsAPI.LocationTargetParams; +Top.Locations = Locations; + +export declare namespace Top { + export { + type TopAttacksResponse as TopAttacksResponse, + type TopIndustryResponse as TopIndustryResponse, + type TopVerticalResponse as TopVerticalResponse, + type TopAttacksParams as TopAttacksParams, + type TopIndustryParams as TopIndustryParams, + type TopVerticalParams as TopVerticalParams, + }; + + export { + Locations as Locations, + type LocationOriginResponse as LocationOriginResponse, + type LocationTargetResponse as LocationTargetResponse, + type LocationOriginParams as LocationOriginParams, + type LocationTargetParams as LocationTargetParams, + }; } diff --git a/src/resources/radar/attacks/layer7/index.ts b/src/resources/radar/attacks/layer7/index.ts index c296bee251..2328d6f344 100644 --- a/src/resources/radar/attacks/layer7/index.ts +++ b/src/resources/radar/attacks/layer7/index.ts @@ -1,46 +1,46 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Layer7TimeseriesResponse, Layer7TimeseriesParams, Layer7 } from './layer7'; +export { Layer7, type Layer7TimeseriesResponse, type Layer7TimeseriesParams } from './layer7'; export { - SummaryGetResponse, - SummaryHTTPMethodResponse, - SummaryHTTPVersionResponse, - SummaryIPVersionResponse, - SummaryManagedRulesResponse, - SummaryMitigationProductResponse, - SummaryGetParams, - SummaryHTTPMethodParams, - SummaryHTTPVersionParams, - SummaryIPVersionParams, - SummaryManagedRulesParams, - SummaryMitigationProductParams, Summary, + type SummaryGetResponse, + type SummaryHTTPMethodResponse, + type SummaryHTTPVersionResponse, + type SummaryIPVersionResponse, + type SummaryManagedRulesResponse, + type SummaryMitigationProductResponse, + type SummaryGetParams, + type SummaryHTTPMethodParams, + type SummaryHTTPVersionParams, + type SummaryIPVersionParams, + type SummaryManagedRulesParams, + type SummaryMitigationProductParams, } from './summary'; export { - TimeseriesGroupGetResponse, - TimeseriesGroupHTTPMethodResponse, - TimeseriesGroupHTTPVersionResponse, - TimeseriesGroupIndustryResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupManagedRulesResponse, - TimeseriesGroupMitigationProductResponse, - TimeseriesGroupVerticalResponse, - TimeseriesGroupGetParams, - TimeseriesGroupHTTPMethodParams, - TimeseriesGroupHTTPVersionParams, - TimeseriesGroupIndustryParams, - TimeseriesGroupIPVersionParams, - TimeseriesGroupManagedRulesParams, - TimeseriesGroupMitigationProductParams, - TimeseriesGroupVerticalParams, TimeseriesGroups, + type TimeseriesGroupGetResponse, + type TimeseriesGroupHTTPMethodResponse, + type TimeseriesGroupHTTPVersionResponse, + type TimeseriesGroupIndustryResponse, + type TimeseriesGroupIPVersionResponse, + type TimeseriesGroupManagedRulesResponse, + type TimeseriesGroupMitigationProductResponse, + type TimeseriesGroupVerticalResponse, + type TimeseriesGroupGetParams, + type TimeseriesGroupHTTPMethodParams, + type TimeseriesGroupHTTPVersionParams, + type TimeseriesGroupIndustryParams, + type TimeseriesGroupIPVersionParams, + type TimeseriesGroupManagedRulesParams, + type TimeseriesGroupMitigationProductParams, + type TimeseriesGroupVerticalParams, } from './timeseries-groups'; export { - TopAttacksResponse, - TopIndustryResponse, - TopVerticalResponse, - TopAttacksParams, - TopIndustryParams, - TopVerticalParams, Top, + type TopAttacksResponse, + type TopIndustryResponse, + type TopVerticalResponse, + type TopAttacksParams, + type TopIndustryParams, + type TopVerticalParams, } from './top/index'; diff --git a/src/resources/radar/attacks/layer7/layer7.ts b/src/resources/radar/attacks/layer7/layer7.ts index 607ad786f2..122b6bb732 100644 --- a/src/resources/radar/attacks/layer7/layer7.ts +++ b/src/resources/radar/attacks/layer7/layer7.ts @@ -3,10 +3,52 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as Layer7API from './layer7'; import * as SummaryAPI from './summary'; +import { + Summary, + SummaryGetParams, + SummaryGetResponse, + SummaryHTTPMethodParams, + SummaryHTTPMethodResponse, + SummaryHTTPVersionParams, + SummaryHTTPVersionResponse, + SummaryIPVersionParams, + SummaryIPVersionResponse, + SummaryManagedRulesParams, + SummaryManagedRulesResponse, + SummaryMitigationProductParams, + SummaryMitigationProductResponse, +} from './summary'; import * as TimeseriesGroupsAPI from './timeseries-groups'; +import { + TimeseriesGroupGetParams, + TimeseriesGroupGetResponse, + TimeseriesGroupHTTPMethodParams, + TimeseriesGroupHTTPMethodResponse, + TimeseriesGroupHTTPVersionParams, + TimeseriesGroupHTTPVersionResponse, + TimeseriesGroupIPVersionParams, + TimeseriesGroupIPVersionResponse, + TimeseriesGroupIndustryParams, + TimeseriesGroupIndustryResponse, + TimeseriesGroupManagedRulesParams, + TimeseriesGroupManagedRulesResponse, + TimeseriesGroupMitigationProductParams, + TimeseriesGroupMitigationProductResponse, + TimeseriesGroupVerticalParams, + TimeseriesGroupVerticalResponse, + TimeseriesGroups, +} from './timeseries-groups'; import * as TopAPI from './top/top'; +import { + Top, + TopAttacksParams, + TopAttacksResponse, + TopIndustryParams, + TopIndustryResponse, + TopVerticalParams, + TopVerticalResponse, +} from './top/top'; export class Layer7 extends APIResource { summary: SummaryAPI.Summary = new SummaryAPI.Summary(this._client); @@ -252,44 +294,59 @@ export interface Layer7TimeseriesParams { normalization?: 'PERCENTAGE_CHANGE' | 'MIN0_MAX'; } -export namespace Layer7 { - export import Layer7TimeseriesResponse = Layer7API.Layer7TimeseriesResponse; - export import Layer7TimeseriesParams = Layer7API.Layer7TimeseriesParams; - export import Summary = SummaryAPI.Summary; - export import SummaryGetResponse = SummaryAPI.SummaryGetResponse; - export import SummaryHTTPMethodResponse = SummaryAPI.SummaryHTTPMethodResponse; - export import SummaryHTTPVersionResponse = SummaryAPI.SummaryHTTPVersionResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummaryManagedRulesResponse = SummaryAPI.SummaryManagedRulesResponse; - export import SummaryMitigationProductResponse = SummaryAPI.SummaryMitigationProductResponse; - export import SummaryGetParams = SummaryAPI.SummaryGetParams; - export import SummaryHTTPMethodParams = SummaryAPI.SummaryHTTPMethodParams; - export import SummaryHTTPVersionParams = SummaryAPI.SummaryHTTPVersionParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummaryManagedRulesParams = SummaryAPI.SummaryManagedRulesParams; - export import SummaryMitigationProductParams = SummaryAPI.SummaryMitigationProductParams; - export import TimeseriesGroups = TimeseriesGroupsAPI.TimeseriesGroups; - export import TimeseriesGroupGetResponse = TimeseriesGroupsAPI.TimeseriesGroupGetResponse; - export import TimeseriesGroupHTTPMethodResponse = TimeseriesGroupsAPI.TimeseriesGroupHTTPMethodResponse; - export import TimeseriesGroupHTTPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupHTTPVersionResponse; - export import TimeseriesGroupIndustryResponse = TimeseriesGroupsAPI.TimeseriesGroupIndustryResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupManagedRulesResponse = TimeseriesGroupsAPI.TimeseriesGroupManagedRulesResponse; - export import TimeseriesGroupMitigationProductResponse = TimeseriesGroupsAPI.TimeseriesGroupMitigationProductResponse; - export import TimeseriesGroupVerticalResponse = TimeseriesGroupsAPI.TimeseriesGroupVerticalResponse; - export import TimeseriesGroupGetParams = TimeseriesGroupsAPI.TimeseriesGroupGetParams; - export import TimeseriesGroupHTTPMethodParams = TimeseriesGroupsAPI.TimeseriesGroupHTTPMethodParams; - export import TimeseriesGroupHTTPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupHTTPVersionParams; - export import TimeseriesGroupIndustryParams = TimeseriesGroupsAPI.TimeseriesGroupIndustryParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupManagedRulesParams = TimeseriesGroupsAPI.TimeseriesGroupManagedRulesParams; - export import TimeseriesGroupMitigationProductParams = TimeseriesGroupsAPI.TimeseriesGroupMitigationProductParams; - export import TimeseriesGroupVerticalParams = TimeseriesGroupsAPI.TimeseriesGroupVerticalParams; - export import Top = TopAPI.Top; - export import TopAttacksResponse = TopAPI.TopAttacksResponse; - export import TopIndustryResponse = TopAPI.TopIndustryResponse; - export import TopVerticalResponse = TopAPI.TopVerticalResponse; - export import TopAttacksParams = TopAPI.TopAttacksParams; - export import TopIndustryParams = TopAPI.TopIndustryParams; - export import TopVerticalParams = TopAPI.TopVerticalParams; +Layer7.Summary = Summary; +Layer7.TimeseriesGroups = TimeseriesGroups; +Layer7.Top = Top; + +export declare namespace Layer7 { + export { + type Layer7TimeseriesResponse as Layer7TimeseriesResponse, + type Layer7TimeseriesParams as Layer7TimeseriesParams, + }; + + export { + Summary as Summary, + type SummaryGetResponse as SummaryGetResponse, + type SummaryHTTPMethodResponse as SummaryHTTPMethodResponse, + type SummaryHTTPVersionResponse as SummaryHTTPVersionResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummaryManagedRulesResponse as SummaryManagedRulesResponse, + type SummaryMitigationProductResponse as SummaryMitigationProductResponse, + type SummaryGetParams as SummaryGetParams, + type SummaryHTTPMethodParams as SummaryHTTPMethodParams, + type SummaryHTTPVersionParams as SummaryHTTPVersionParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummaryManagedRulesParams as SummaryManagedRulesParams, + type SummaryMitigationProductParams as SummaryMitigationProductParams, + }; + + export { + TimeseriesGroups as TimeseriesGroups, + type TimeseriesGroupGetResponse as TimeseriesGroupGetResponse, + type TimeseriesGroupHTTPMethodResponse as TimeseriesGroupHTTPMethodResponse, + type TimeseriesGroupHTTPVersionResponse as TimeseriesGroupHTTPVersionResponse, + type TimeseriesGroupIndustryResponse as TimeseriesGroupIndustryResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupManagedRulesResponse as TimeseriesGroupManagedRulesResponse, + type TimeseriesGroupMitigationProductResponse as TimeseriesGroupMitigationProductResponse, + type TimeseriesGroupVerticalResponse as TimeseriesGroupVerticalResponse, + type TimeseriesGroupGetParams as TimeseriesGroupGetParams, + type TimeseriesGroupHTTPMethodParams as TimeseriesGroupHTTPMethodParams, + type TimeseriesGroupHTTPVersionParams as TimeseriesGroupHTTPVersionParams, + type TimeseriesGroupIndustryParams as TimeseriesGroupIndustryParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupManagedRulesParams as TimeseriesGroupManagedRulesParams, + type TimeseriesGroupMitigationProductParams as TimeseriesGroupMitigationProductParams, + type TimeseriesGroupVerticalParams as TimeseriesGroupVerticalParams, + }; + + export { + Top as Top, + type TopAttacksResponse as TopAttacksResponse, + type TopIndustryResponse as TopIndustryResponse, + type TopVerticalResponse as TopVerticalResponse, + type TopAttacksParams as TopAttacksParams, + type TopIndustryParams as TopIndustryParams, + type TopVerticalParams as TopVerticalParams, + }; } diff --git a/src/resources/radar/attacks/layer7/summary.ts b/src/resources/radar/attacks/layer7/summary.ts index fdbae9395f..8749084adf 100644 --- a/src/resources/radar/attacks/layer7/summary.ts +++ b/src/resources/radar/attacks/layer7/summary.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as SummaryAPI from './summary'; export class Summary extends APIResource { /** @@ -211,7 +210,7 @@ export namespace SummaryGetResponse { export interface SummaryHTTPMethodResponse { meta: SummaryHTTPMethodResponse.Meta; - summary_0: SummaryHTTPMethodResponse.Summary0; + summary_0: Record; } export namespace SummaryHTTPMethodResponse { @@ -262,12 +261,6 @@ export namespace SummaryHTTPMethodResponse { } } } - - export interface Summary0 { - GET: string; - - POST: string; - } } export interface SummaryHTTPVersionResponse { @@ -399,7 +392,7 @@ export namespace SummaryIPVersionResponse { export interface SummaryManagedRulesResponse { meta: SummaryManagedRulesResponse.Meta; - summary_0: SummaryManagedRulesResponse.Summary0; + summary_0: Record; } export namespace SummaryManagedRulesResponse { @@ -450,18 +443,12 @@ export namespace SummaryManagedRulesResponse { } } } - - export interface Summary0 { - Bot: string; - - 'HTTP Anomaly': string; - } } export interface SummaryMitigationProductResponse { meta: SummaryMitigationProductResponse.Meta; - summary_0: SummaryMitigationProductResponse.Summary0; + summary_0: Record; } export namespace SummaryMitigationProductResponse { @@ -512,12 +499,6 @@ export namespace SummaryMitigationProductResponse { } } } - - export interface Summary0 { - DDOS: string; - - WAF: string; - } } export interface SummaryGetParams { @@ -617,6 +598,12 @@ export interface SummaryHTTPMethodParams { */ ipVersion?: Array<'IPv4' | 'IPv6'>; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -982,6 +969,12 @@ export interface SummaryManagedRulesParams { */ ipVersion?: Array<'IPv4' | 'IPv6'>; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -1107,6 +1100,12 @@ export interface SummaryMitigationProductParams { */ ipVersion?: Array<'IPv4' | 'IPv6'>; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -1120,17 +1119,19 @@ export interface SummaryMitigationProductParams { name?: Array; } -export namespace Summary { - export import SummaryGetResponse = SummaryAPI.SummaryGetResponse; - export import SummaryHTTPMethodResponse = SummaryAPI.SummaryHTTPMethodResponse; - export import SummaryHTTPVersionResponse = SummaryAPI.SummaryHTTPVersionResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummaryManagedRulesResponse = SummaryAPI.SummaryManagedRulesResponse; - export import SummaryMitigationProductResponse = SummaryAPI.SummaryMitigationProductResponse; - export import SummaryGetParams = SummaryAPI.SummaryGetParams; - export import SummaryHTTPMethodParams = SummaryAPI.SummaryHTTPMethodParams; - export import SummaryHTTPVersionParams = SummaryAPI.SummaryHTTPVersionParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummaryManagedRulesParams = SummaryAPI.SummaryManagedRulesParams; - export import SummaryMitigationProductParams = SummaryAPI.SummaryMitigationProductParams; +export declare namespace Summary { + export { + type SummaryGetResponse as SummaryGetResponse, + type SummaryHTTPMethodResponse as SummaryHTTPMethodResponse, + type SummaryHTTPVersionResponse as SummaryHTTPVersionResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummaryManagedRulesResponse as SummaryManagedRulesResponse, + type SummaryMitigationProductResponse as SummaryMitigationProductResponse, + type SummaryGetParams as SummaryGetParams, + type SummaryHTTPMethodParams as SummaryHTTPMethodParams, + type SummaryHTTPVersionParams as SummaryHTTPVersionParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummaryManagedRulesParams as SummaryManagedRulesParams, + type SummaryMitigationProductParams as SummaryMitigationProductParams, + }; } diff --git a/src/resources/radar/attacks/layer7/timeseries-groups.ts b/src/resources/radar/attacks/layer7/timeseries-groups.ts index 7386034497..1dc0811522 100644 --- a/src/resources/radar/attacks/layer7/timeseries-groups.ts +++ b/src/resources/radar/attacks/layer7/timeseries-groups.ts @@ -3,12 +3,10 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as TimeseriesGroupsAPI from './timeseries-groups'; export class TimeseriesGroups extends APIResource { /** - * Get a time series of the percentual distribution of mitigation techniques, over - * time. + * Get a time series of the distribution of mitigation techniques over time. */ get( query?: TimeseriesGroupGetParams, @@ -76,7 +74,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of attacks by industry used over time. + * Percentage distribution of attacks by targeted industry over time. */ industry( query?: TimeseriesGroupIndustryParams, @@ -168,7 +166,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of attacks by vertical used over time. + * Percentage distribution of attacks by targeted vertical over time. */ vertical( query?: TimeseriesGroupVerticalParams, @@ -273,9 +271,8 @@ export interface TimeseriesGroupHTTPMethodResponse { export namespace TimeseriesGroupHTTPMethodResponse { export interface Serie0 { - GET: Array; - timestamps: Array; + [k: string]: Array | undefined; } } @@ -289,6 +286,10 @@ export namespace TimeseriesGroupHTTPVersionResponse { export interface Serie0 { 'HTTP/1.x': Array; + 'HTTP/2': Array; + + 'HTTP/3': Array; + timestamps: Array; } } @@ -330,9 +331,8 @@ export interface TimeseriesGroupManagedRulesResponse { export namespace TimeseriesGroupManagedRulesResponse { export interface Serie0 { - Bot: Array; - timestamps: Array; + [k: string]: Array | undefined; } } @@ -344,9 +344,8 @@ export interface TimeseriesGroupMitigationProductResponse { export namespace TimeseriesGroupMitigationProductResponse { export interface Serie0 { - DDOS: Array; - timestamps: Array; + [k: string]: Array | undefined; } } @@ -474,6 +473,12 @@ export interface TimeseriesGroupHTTPMethodParams { */ ipVersion?: Array<'IPv4' | 'IPv6'>; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -1022,6 +1027,12 @@ export interface TimeseriesGroupManagedRulesParams { */ ipVersion?: Array<'IPv4' | 'IPv6'>; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -1160,6 +1171,12 @@ export interface TimeseriesGroupMitigationProductParams { */ ipVersion?: Array<'IPv4' | 'IPv6'>; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -1323,21 +1340,23 @@ export interface TimeseriesGroupVerticalParams { normalization?: 'PERCENTAGE' | 'MIN0_MAX'; } -export namespace TimeseriesGroups { - export import TimeseriesGroupGetResponse = TimeseriesGroupsAPI.TimeseriesGroupGetResponse; - export import TimeseriesGroupHTTPMethodResponse = TimeseriesGroupsAPI.TimeseriesGroupHTTPMethodResponse; - export import TimeseriesGroupHTTPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupHTTPVersionResponse; - export import TimeseriesGroupIndustryResponse = TimeseriesGroupsAPI.TimeseriesGroupIndustryResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupManagedRulesResponse = TimeseriesGroupsAPI.TimeseriesGroupManagedRulesResponse; - export import TimeseriesGroupMitigationProductResponse = TimeseriesGroupsAPI.TimeseriesGroupMitigationProductResponse; - export import TimeseriesGroupVerticalResponse = TimeseriesGroupsAPI.TimeseriesGroupVerticalResponse; - export import TimeseriesGroupGetParams = TimeseriesGroupsAPI.TimeseriesGroupGetParams; - export import TimeseriesGroupHTTPMethodParams = TimeseriesGroupsAPI.TimeseriesGroupHTTPMethodParams; - export import TimeseriesGroupHTTPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupHTTPVersionParams; - export import TimeseriesGroupIndustryParams = TimeseriesGroupsAPI.TimeseriesGroupIndustryParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupManagedRulesParams = TimeseriesGroupsAPI.TimeseriesGroupManagedRulesParams; - export import TimeseriesGroupMitigationProductParams = TimeseriesGroupsAPI.TimeseriesGroupMitigationProductParams; - export import TimeseriesGroupVerticalParams = TimeseriesGroupsAPI.TimeseriesGroupVerticalParams; +export declare namespace TimeseriesGroups { + export { + type TimeseriesGroupGetResponse as TimeseriesGroupGetResponse, + type TimeseriesGroupHTTPMethodResponse as TimeseriesGroupHTTPMethodResponse, + type TimeseriesGroupHTTPVersionResponse as TimeseriesGroupHTTPVersionResponse, + type TimeseriesGroupIndustryResponse as TimeseriesGroupIndustryResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupManagedRulesResponse as TimeseriesGroupManagedRulesResponse, + type TimeseriesGroupMitigationProductResponse as TimeseriesGroupMitigationProductResponse, + type TimeseriesGroupVerticalResponse as TimeseriesGroupVerticalResponse, + type TimeseriesGroupGetParams as TimeseriesGroupGetParams, + type TimeseriesGroupHTTPMethodParams as TimeseriesGroupHTTPMethodParams, + type TimeseriesGroupHTTPVersionParams as TimeseriesGroupHTTPVersionParams, + type TimeseriesGroupIndustryParams as TimeseriesGroupIndustryParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupManagedRulesParams as TimeseriesGroupManagedRulesParams, + type TimeseriesGroupMitigationProductParams as TimeseriesGroupMitigationProductParams, + type TimeseriesGroupVerticalParams as TimeseriesGroupVerticalParams, + }; } diff --git a/src/resources/radar/attacks/layer7/top/ases.ts b/src/resources/radar/attacks/layer7/top/ases.ts index 97b63cde5d..b490056d58 100644 --- a/src/resources/radar/attacks/layer7/top/ases.ts +++ b/src/resources/radar/attacks/layer7/top/ases.ts @@ -3,13 +3,12 @@ import { APIResource } from '../../../../../resource'; import { isRequestOptions } from '../../../../../core'; import * as Core from '../../../../../core'; -import * as AsesAPI from './ases'; export class Ases extends APIResource { /** - * Get the top origin Autonomous Systems of and by layer 7 attacks. Values are a - * percentage out of the total layer 7 attacks. The origin Autonomous Systems is - * determined by the client IP. + * Get the top origin Autonomous Systems of and by Layer 7 attacks. Values are a + * percentage out of the total Layer 7 attacks. The origin Autonomous Systems is + * determined by the client IP address. */ origin(query?: AseOriginParams, options?: Core.RequestOptions): Core.APIPromise; origin(options?: Core.RequestOptions): Core.APIPromise; @@ -215,7 +214,6 @@ export interface AseOriginParams { name?: Array; } -export namespace Ases { - export import AseOriginResponse = AsesAPI.AseOriginResponse; - export import AseOriginParams = AsesAPI.AseOriginParams; +export declare namespace Ases { + export { type AseOriginResponse as AseOriginResponse, type AseOriginParams as AseOriginParams }; } diff --git a/src/resources/radar/attacks/layer7/top/index.ts b/src/resources/radar/attacks/layer7/top/index.ts index cae9bb4a54..9ec7ec505e 100644 --- a/src/resources/radar/attacks/layer7/top/index.ts +++ b/src/resources/radar/attacks/layer7/top/index.ts @@ -1,19 +1,19 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AseOriginResponse, AseOriginParams, Ases } from './ases'; +export { Ases, type AseOriginResponse, type AseOriginParams } from './ases'; export { - LocationOriginResponse, - LocationTargetResponse, - LocationOriginParams, - LocationTargetParams, Locations, + type LocationOriginResponse, + type LocationTargetResponse, + type LocationOriginParams, + type LocationTargetParams, } from './locations'; export { - TopAttacksResponse, - TopIndustryResponse, - TopVerticalResponse, - TopAttacksParams, - TopIndustryParams, - TopVerticalParams, Top, + type TopAttacksResponse, + type TopIndustryResponse, + type TopVerticalResponse, + type TopAttacksParams, + type TopIndustryParams, + type TopVerticalParams, } from './top'; diff --git a/src/resources/radar/attacks/layer7/top/locations.ts b/src/resources/radar/attacks/layer7/top/locations.ts index 5e34e10919..21c6e7d757 100644 --- a/src/resources/radar/attacks/layer7/top/locations.ts +++ b/src/resources/radar/attacks/layer7/top/locations.ts @@ -3,13 +3,12 @@ import { APIResource } from '../../../../../resource'; import { isRequestOptions } from '../../../../../core'; import * as Core from '../../../../../core'; -import * as LocationsAPI from './locations'; export class Locations extends APIResource { /** - * Get the top origin locations of and by layer 7 attacks. Values are a percentage - * out of the total layer 7 attacks. The origin location is determined by the - * client IP. + * Get the top origin locations of and by Layer 7 attacks. Values are a percentage + * out of the total Layer 7 attacks. The origin location is determined by the + * client IP address. */ origin( query?: LocationOriginParams, @@ -424,9 +423,11 @@ export interface LocationTargetParams { name?: Array; } -export namespace Locations { - export import LocationOriginResponse = LocationsAPI.LocationOriginResponse; - export import LocationTargetResponse = LocationsAPI.LocationTargetResponse; - export import LocationOriginParams = LocationsAPI.LocationOriginParams; - export import LocationTargetParams = LocationsAPI.LocationTargetParams; +export declare namespace Locations { + export { + type LocationOriginResponse as LocationOriginResponse, + type LocationTargetResponse as LocationTargetResponse, + type LocationOriginParams as LocationOriginParams, + type LocationTargetParams as LocationTargetParams, + }; } diff --git a/src/resources/radar/attacks/layer7/top/top.ts b/src/resources/radar/attacks/layer7/top/top.ts index caa53eaebc..ac8c0f2f1e 100644 --- a/src/resources/radar/attacks/layer7/top/top.ts +++ b/src/resources/radar/attacks/layer7/top/top.ts @@ -3,10 +3,16 @@ import { APIResource } from '../../../../../resource'; import { isRequestOptions } from '../../../../../core'; import * as Core from '../../../../../core'; -import * as TopTopAPI from './top'; -import * as TopAPI from '../../../http/top'; import * as AsesAPI from './ases'; +import { AseOriginParams, AseOriginResponse, Ases } from './ases'; import * as LocationsAPI from './locations'; +import { + LocationOriginParams, + LocationOriginResponse, + LocationTargetParams, + LocationTargetResponse, + Locations, +} from './locations'; export class Top extends APIResource { locations: LocationsAPI.Locations = new LocationsAPI.Locations(this._client); @@ -14,10 +20,10 @@ export class Top extends APIResource { /** * Get the top attacks from origin to target location. Values are a percentage out - * of the total layer 7 attacks (with billing country). The attack magnitude can be + * of the total Layer 7 attacks (with billing country). The attack magnitude can be * defined by the number of mitigated requests or by the number of zones affected. - * You can optionally limit the number of attacks per origin/target location - * (useful if all the top attacks are from or to the same location). + * You can optionally limit the number of attacks by origin/target location (useful + * if all the top attacks are from or to the same location). */ attacks(query?: TopAttacksParams, options?: Core.RequestOptions): Core.APIPromise; attacks(options?: Core.RequestOptions): Core.APIPromise; @@ -36,7 +42,7 @@ export class Top extends APIResource { } /** - * Get the Industry of attacks. + * Get the industries targeted by attacks. */ industry(query?: TopIndustryParams, options?: Core.RequestOptions): Core.APIPromise; industry(options?: Core.RequestOptions): Core.APIPromise; @@ -55,7 +61,7 @@ export class Top extends APIResource { } /** - * Get the Verticals of attacks. + * Get the verticals targeted by attacks. */ vertical(query?: TopVerticalParams, options?: Core.RequestOptions): Core.APIPromise; vertical(options?: Core.RequestOptions): Core.APIPromise; @@ -143,7 +149,7 @@ export namespace TopAttacksResponse { export interface TopIndustryResponse { meta: TopIndustryResponse.Meta; - top_0: Array; + top_0: Array; } export namespace TopIndustryResponse { @@ -192,12 +198,18 @@ export namespace TopIndustryResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } export interface TopVerticalResponse { meta: TopVerticalResponse.Meta; - top_0: Array; + top_0: Array; } export namespace TopVerticalResponse { @@ -246,6 +258,12 @@ export namespace TopVerticalResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } export interface TopAttacksParams { @@ -663,19 +681,30 @@ export interface TopVerticalParams { name?: Array; } -export namespace Top { - export import TopAttacksResponse = TopTopAPI.TopAttacksResponse; - export import TopIndustryResponse = TopTopAPI.TopIndustryResponse; - export import TopVerticalResponse = TopTopAPI.TopVerticalResponse; - export import TopAttacksParams = TopTopAPI.TopAttacksParams; - export import TopIndustryParams = TopTopAPI.TopIndustryParams; - export import TopVerticalParams = TopTopAPI.TopVerticalParams; - export import Locations = LocationsAPI.Locations; - export import LocationOriginResponse = LocationsAPI.LocationOriginResponse; - export import LocationTargetResponse = LocationsAPI.LocationTargetResponse; - export import LocationOriginParams = LocationsAPI.LocationOriginParams; - export import LocationTargetParams = LocationsAPI.LocationTargetParams; - export import Ases = AsesAPI.Ases; - export import AseOriginResponse = AsesAPI.AseOriginResponse; - export import AseOriginParams = AsesAPI.AseOriginParams; +Top.Locations = Locations; +Top.Ases = Ases; + +export declare namespace Top { + export { + type TopAttacksResponse as TopAttacksResponse, + type TopIndustryResponse as TopIndustryResponse, + type TopVerticalResponse as TopVerticalResponse, + type TopAttacksParams as TopAttacksParams, + type TopIndustryParams as TopIndustryParams, + type TopVerticalParams as TopVerticalParams, + }; + + export { + Locations as Locations, + type LocationOriginResponse as LocationOriginResponse, + type LocationTargetResponse as LocationTargetResponse, + type LocationOriginParams as LocationOriginParams, + type LocationTargetParams as LocationTargetParams, + }; + + export { + Ases as Ases, + type AseOriginResponse as AseOriginResponse, + type AseOriginParams as AseOriginParams, + }; } diff --git a/src/resources/radar/bgp/bgp.ts b/src/resources/radar/bgp/bgp.ts index 3288308e33..fabc096689 100644 --- a/src/resources/radar/bgp/bgp.ts +++ b/src/resources/radar/bgp/bgp.ts @@ -3,12 +3,26 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as BGPAPI from './bgp'; import * as IPsAPI from './ips'; +import { IPTimeseriesParams, IPTimeseriesResponse, IPs } from './ips'; import * as RoutesAPI from './routes'; +import { + RouteAsesParams, + RouteAsesResponse, + RouteMoasParams, + RouteMoasResponse, + RoutePfx2asParams, + RoutePfx2asResponse, + RouteStatsParams, + RouteStatsResponse, + Routes, +} from './routes'; import * as HijacksAPI from './hijacks/hijacks'; +import { Hijacks } from './hijacks/hijacks'; import * as LeaksAPI from './leaks/leaks'; +import { Leaks } from './leaks/leaks'; import * as TopAPI from './top/top'; +import { Top, TopPrefixesParams, TopPrefixesResponse } from './top/top'; export class BGP extends APIResource { leaks: LeaksAPI.Leaks = new LeaksAPI.Leaks(this._client); @@ -18,8 +32,8 @@ export class BGP extends APIResource { ips: IPsAPI.IPs = new IPsAPI.IPs(this._client); /** - * Gets BGP updates change over time. Raw values are returned. When requesting - * updates of an autonomous system (AS), only BGP updates of type announcement are + * Get BGP updates change over time. Raw values are returned. When requesting + * updates for an autonomous system (AS), only BGP updates of type announcement are * returned. */ timeseries( @@ -149,7 +163,7 @@ export interface BGPTimeseriesParams { /** * Array of BGP network prefixes. */ - prefix?: Array; + prefix?: Array; /** * Array of BGP update types. @@ -157,39 +171,43 @@ export interface BGPTimeseriesParams { updateType?: Array<'ANNOUNCEMENT' | 'WITHDRAWAL'>; } -export namespace BGPTimeseriesParams { - export interface Prefix { - in: string; - - name: string; - - test: number; - - /** - * Network prefix, IPv4 or IPv6. - */ - type?: string; - } -} - -export namespace BGP { - export import BGPTimeseriesResponse = BGPAPI.BGPTimeseriesResponse; - export import BGPTimeseriesParams = BGPAPI.BGPTimeseriesParams; - export import Leaks = LeaksAPI.Leaks; - export import Top = TopAPI.Top; - export import TopPrefixesResponse = TopAPI.TopPrefixesResponse; - export import TopPrefixesParams = TopAPI.TopPrefixesParams; - export import Hijacks = HijacksAPI.Hijacks; - export import Routes = RoutesAPI.Routes; - export import RouteAsesResponse = RoutesAPI.RouteAsesResponse; - export import RouteMoasResponse = RoutesAPI.RouteMoasResponse; - export import RoutePfx2asResponse = RoutesAPI.RoutePfx2asResponse; - export import RouteStatsResponse = RoutesAPI.RouteStatsResponse; - export import RouteAsesParams = RoutesAPI.RouteAsesParams; - export import RouteMoasParams = RoutesAPI.RouteMoasParams; - export import RoutePfx2asParams = RoutesAPI.RoutePfx2asParams; - export import RouteStatsParams = RoutesAPI.RouteStatsParams; - export import IPs = IPsAPI.IPs; - export import IPTimeseriesResponse = IPsAPI.IPTimeseriesResponse; - export import IPTimeseriesParams = IPsAPI.IPTimeseriesParams; +BGP.Leaks = Leaks; +BGP.Top = Top; +BGP.Hijacks = Hijacks; +BGP.Routes = Routes; +BGP.IPs = IPs; + +export declare namespace BGP { + export { + type BGPTimeseriesResponse as BGPTimeseriesResponse, + type BGPTimeseriesParams as BGPTimeseriesParams, + }; + + export { Leaks as Leaks }; + + export { + Top as Top, + type TopPrefixesResponse as TopPrefixesResponse, + type TopPrefixesParams as TopPrefixesParams, + }; + + export { Hijacks as Hijacks }; + + export { + Routes as Routes, + type RouteAsesResponse as RouteAsesResponse, + type RouteMoasResponse as RouteMoasResponse, + type RoutePfx2asResponse as RoutePfx2asResponse, + type RouteStatsResponse as RouteStatsResponse, + type RouteAsesParams as RouteAsesParams, + type RouteMoasParams as RouteMoasParams, + type RoutePfx2asParams as RoutePfx2asParams, + type RouteStatsParams as RouteStatsParams, + }; + + export { + IPs as IPs, + type IPTimeseriesResponse as IPTimeseriesResponse, + type IPTimeseriesParams as IPTimeseriesParams, + }; } diff --git a/src/resources/radar/bgp/hijacks/events.ts b/src/resources/radar/bgp/hijacks/events.ts index 06e3b95c89..dcb39e8b5c 100644 --- a/src/resources/radar/bgp/hijacks/events.ts +++ b/src/resources/radar/bgp/hijacks/events.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as EventsAPI from './events'; import { V4PagePagination, type V4PagePaginationParams } from '../../../../pagination'; export class Events extends APIResource { @@ -34,86 +33,66 @@ export class Events extends APIResource { export class EventListResponsesV4PagePagination extends V4PagePagination {} export interface EventListResponse { - result: EventListResponse.Result; + asn_info: Array; - result_info: EventListResponse.ResultInfo; + events: Array; - success: boolean; + total_monitors: number; } export namespace EventListResponse { - export interface Result { - asn_info: Array; + export interface ASNInfo { + asn: number; - events: Array; + country_code: string; - total_monitors: number; + org_name: string; } - export namespace Result { - export interface ASNInfo { - asn: number; + export interface Event { + id: number; - country_code: string; + confidence_score: number; - org_name: string; - } - - export interface Event { - id: number; - - confidence_score: number; - - duration: number; - - event_type: number; - - hijack_msgs_count: number; + duration: number; - hijacker_asn: number; + event_type: number; - hijacker_country: string; + hijack_msgs_count: number; - is_stale: boolean; + hijacker_asn: number; - max_hijack_ts: string; + hijacker_country: string; - max_msg_ts: string; + is_stale: boolean; - min_hijack_ts: string; + max_hijack_ts: string; - on_going_count: number; + max_msg_ts: string; - peer_asns: Array; + min_hijack_ts: string; - peer_ip_count: number; + on_going_count: number; - prefixes: Array; + peer_asns: Array; - tags: Array; + peer_ip_count: number; - victim_asns: Array; + prefixes: Array; - victim_countries: Array; - } + tags: Array; - export namespace Event { - export interface Tag { - name: string; + victim_asns: Array; - score: number; - } - } + victim_countries: Array; } - export interface ResultInfo { - count: number; - - page: number; + export namespace Event { + export interface Tag { + name: string; - per_page: number; - - total_count: number; + score: number; + } } } @@ -190,8 +169,12 @@ export interface EventListParams extends V4PagePaginationParams { victimAsn?: number; } -export namespace Events { - export import EventListResponse = EventsAPI.EventListResponse; - export import EventListResponsesV4PagePagination = EventsAPI.EventListResponsesV4PagePagination; - export import EventListParams = EventsAPI.EventListParams; +Events.EventListResponsesV4PagePagination = EventListResponsesV4PagePagination; + +export declare namespace Events { + export { + type EventListResponse as EventListResponse, + EventListResponsesV4PagePagination as EventListResponsesV4PagePagination, + type EventListParams as EventListParams, + }; } diff --git a/src/resources/radar/bgp/hijacks/hijacks.ts b/src/resources/radar/bgp/hijacks/hijacks.ts index 17f01e0a56..d935975781 100644 --- a/src/resources/radar/bgp/hijacks/hijacks.ts +++ b/src/resources/radar/bgp/hijacks/hijacks.ts @@ -2,14 +2,20 @@ import { APIResource } from '../../../../resource'; import * as EventsAPI from './events'; +import { EventListParams, EventListResponse, EventListResponsesV4PagePagination, Events } from './events'; export class Hijacks extends APIResource { events: EventsAPI.Events = new EventsAPI.Events(this._client); } -export namespace Hijacks { - export import Events = EventsAPI.Events; - export import EventListResponse = EventsAPI.EventListResponse; - export import EventListResponsesV4PagePagination = EventsAPI.EventListResponsesV4PagePagination; - export import EventListParams = EventsAPI.EventListParams; +Hijacks.Events = Events; +Hijacks.EventListResponsesV4PagePagination = EventListResponsesV4PagePagination; + +export declare namespace Hijacks { + export { + Events as Events, + type EventListResponse as EventListResponse, + EventListResponsesV4PagePagination as EventListResponsesV4PagePagination, + type EventListParams as EventListParams, + }; } diff --git a/src/resources/radar/bgp/hijacks/index.ts b/src/resources/radar/bgp/hijacks/index.ts index 779802cd8a..fbf7468fda 100644 --- a/src/resources/radar/bgp/hijacks/index.ts +++ b/src/resources/radar/bgp/hijacks/index.ts @@ -1,4 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { EventListResponse, EventListParams, EventListResponsesV4PagePagination, Events } from './events'; +export { + EventListResponsesV4PagePagination, + Events, + type EventListResponse, + type EventListParams, +} from './events'; export { Hijacks } from './hijacks'; diff --git a/src/resources/radar/bgp/index.ts b/src/resources/radar/bgp/index.ts index f977cdd137..812c29b78a 100644 --- a/src/resources/radar/bgp/index.ts +++ b/src/resources/radar/bgp/index.ts @@ -1,18 +1,18 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { BGPTimeseriesResponse, BGPTimeseriesParams, BGP } from './bgp'; +export { BGP, type BGPTimeseriesResponse, type BGPTimeseriesParams } from './bgp'; export { Hijacks } from './hijacks/index'; -export { IPTimeseriesResponse, IPTimeseriesParams, IPs } from './ips'; +export { IPs, type IPTimeseriesResponse, type IPTimeseriesParams } from './ips'; export { Leaks } from './leaks/index'; export { - RouteAsesResponse, - RouteMoasResponse, - RoutePfx2asResponse, - RouteStatsResponse, - RouteAsesParams, - RouteMoasParams, - RoutePfx2asParams, - RouteStatsParams, Routes, + type RouteAsesResponse, + type RouteMoasResponse, + type RoutePfx2asResponse, + type RouteStatsResponse, + type RouteAsesParams, + type RouteMoasParams, + type RoutePfx2asParams, + type RouteStatsParams, } from './routes'; -export { TopPrefixesResponse, TopPrefixesParams, Top } from './top/index'; +export { Top, type TopPrefixesResponse, type TopPrefixesParams } from './top/index'; diff --git a/src/resources/radar/bgp/ips.ts b/src/resources/radar/bgp/ips.ts index 250e63b09f..5901f529de 100644 --- a/src/resources/radar/bgp/ips.ts +++ b/src/resources/radar/bgp/ips.ts @@ -3,12 +3,11 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as IPsAPI from './ips'; export class IPs extends APIResource { /** - * Gets time-series data for the announced IP space count, represented as the - * number of IPv4 /24s and IPv6 /48s, for a given ASN. + * Get time series data for the announced IP space count, represented as the number + * of IPv4 /24s and IPv6 /48s, for a given ASN. */ timeseries( query?: IPTimeseriesParams, @@ -34,38 +33,30 @@ export interface IPTimeseriesResponse { meta: IPTimeseriesResponse.Meta; serie_174: IPTimeseriesResponse.Serie174; - - serie_cn: IPTimeseriesResponse.SerieCn; } export namespace IPTimeseriesResponse { export interface Meta { - dateRange: Array; + queries: Array; } export namespace Meta { - export interface DateRange { - /** - * Adjusted end of date range. - */ - endTime: string; - - /** - * Adjusted start of date range. - */ - startTime: string; - } - } + export interface Query { + dateRange: Query.DateRange; - export interface Serie174 { - ipv4: Array; + entity: string; + } - ipv6: Array; + export namespace Query { + export interface DateRange { + endTime: string; - timestamps: Array; + startTime: string; + } + } } - export interface SerieCn { + export interface Serie174 { ipv4: Array; ipv6: Array; @@ -76,25 +67,28 @@ export namespace IPTimeseriesResponse { export interface IPTimeseriesParams { /** - * Comma separated list of ASNs. + * Array of comma separated list of ASNs, start with `-` to exclude from results. + * For example, `-174, 3356` excludes results from AS174, but includes results from + * AS3356. */ - asn?: string; + asn?: Array; /** * End of the date range (inclusive). */ - dateEnd?: string; + dateEnd?: Array; /** - * Shorthand date ranges for the last X days - use when you don't need specific - * start and end dates. + * For example, use `7d` and `7dControl` to compare this week with the previous + * week. Use this parameter or set specific start and end dates (`dateStart` and + * `dateEnd` parameters). */ - dateRange?: string; + dateRange?: Array; /** - * Start of the date range (inclusive). + * Array of datetimes to filter the start of a series. */ - dateStart?: string; + dateStart?: Array; /** * Format results are returned in. @@ -107,9 +101,14 @@ export interface IPTimeseriesParams { includeDelay?: boolean; /** - * Comma separated list of locations. + * Filter for ip version. + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Array of locations (alpha-2 country codes). */ - location?: string; + location?: Array; /** * Array of names that will be used to name the series in responses. @@ -117,7 +116,6 @@ export interface IPTimeseriesParams { name?: Array; } -export namespace IPs { - export import IPTimeseriesResponse = IPsAPI.IPTimeseriesResponse; - export import IPTimeseriesParams = IPsAPI.IPTimeseriesParams; +export declare namespace IPs { + export { type IPTimeseriesResponse as IPTimeseriesResponse, type IPTimeseriesParams as IPTimeseriesParams }; } diff --git a/src/resources/radar/bgp/leaks/events.ts b/src/resources/radar/bgp/leaks/events.ts index 1dfb59df09..d8d7f29740 100644 --- a/src/resources/radar/bgp/leaks/events.ts +++ b/src/resources/radar/bgp/leaks/events.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as EventsAPI from './events'; import { V4PagePagination, type V4PagePaginationParams } from '../../../../pagination'; export class Events extends APIResource { @@ -34,66 +33,46 @@ export class Events extends APIResource { export class EventListResponsesV4PagePagination extends V4PagePagination {} export interface EventListResponse { - result: EventListResponse.Result; + asn_info: Array; - result_info: EventListResponse.ResultInfo; - - success: boolean; + events: Array; } export namespace EventListResponse { - export interface Result { - asn_info: Array; - - events: Array; - } - - export namespace Result { - export interface ASNInfo { - asn: number; - - country_code: string; - - org_name: string; - } + export interface ASNInfo { + asn: number; - export interface Event { - id: number; + country_code: string; - countries: Array; - - detected_ts: string; - - finished: boolean; + org_name: string; + } - leak_asn: number; + export interface Event { + id: number; - leak_count: number; + countries: Array; - leak_seg: Array; + detected_ts: string; - leak_type: number; + finished: boolean; - max_ts: string; + leak_asn: number; - min_ts: string; + leak_count: number; - origin_count: number; + leak_seg: Array; - peer_count: number; + leak_type: number; - prefix_count: number; - } - } + max_ts: string; - export interface ResultInfo { - count: number; + min_ts: string; - page: number; + origin_count: number; - per_page: number; + peer_count: number; - total_count: number; + prefix_count: number; } } @@ -150,8 +129,12 @@ export interface EventListParams extends V4PagePaginationParams { sortOrder?: 'ASC' | 'DESC'; } -export namespace Events { - export import EventListResponse = EventsAPI.EventListResponse; - export import EventListResponsesV4PagePagination = EventsAPI.EventListResponsesV4PagePagination; - export import EventListParams = EventsAPI.EventListParams; +Events.EventListResponsesV4PagePagination = EventListResponsesV4PagePagination; + +export declare namespace Events { + export { + type EventListResponse as EventListResponse, + EventListResponsesV4PagePagination as EventListResponsesV4PagePagination, + type EventListParams as EventListParams, + }; } diff --git a/src/resources/radar/bgp/leaks/index.ts b/src/resources/radar/bgp/leaks/index.ts index e860583180..61267b9408 100644 --- a/src/resources/radar/bgp/leaks/index.ts +++ b/src/resources/radar/bgp/leaks/index.ts @@ -1,4 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { EventListResponse, EventListParams, EventListResponsesV4PagePagination, Events } from './events'; +export { + EventListResponsesV4PagePagination, + Events, + type EventListResponse, + type EventListParams, +} from './events'; export { Leaks } from './leaks'; diff --git a/src/resources/radar/bgp/leaks/leaks.ts b/src/resources/radar/bgp/leaks/leaks.ts index 7f58990b1f..aba88dc1af 100644 --- a/src/resources/radar/bgp/leaks/leaks.ts +++ b/src/resources/radar/bgp/leaks/leaks.ts @@ -2,14 +2,20 @@ import { APIResource } from '../../../../resource'; import * as EventsAPI from './events'; +import { EventListParams, EventListResponse, EventListResponsesV4PagePagination, Events } from './events'; export class Leaks extends APIResource { events: EventsAPI.Events = new EventsAPI.Events(this._client); } -export namespace Leaks { - export import Events = EventsAPI.Events; - export import EventListResponse = EventsAPI.EventListResponse; - export import EventListResponsesV4PagePagination = EventsAPI.EventListResponsesV4PagePagination; - export import EventListParams = EventsAPI.EventListParams; +Leaks.Events = Events; +Leaks.EventListResponsesV4PagePagination = EventListResponsesV4PagePagination; + +export declare namespace Leaks { + export { + Events as Events, + type EventListResponse as EventListResponse, + EventListResponsesV4PagePagination as EventListResponsesV4PagePagination, + type EventListParams as EventListParams, + }; } diff --git a/src/resources/radar/bgp/routes.ts b/src/resources/radar/bgp/routes.ts index c86f53d312..140b741062 100644 --- a/src/resources/radar/bgp/routes.ts +++ b/src/resources/radar/bgp/routes.ts @@ -3,11 +3,10 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as RoutesAPI from './routes'; export class Routes extends APIResource { /** - * List all ASes on current global routing tables with routing statistics + * List all ASes in current global routing tables with routing statistics */ ases(query?: RouteAsesParams, options?: Core.RequestOptions): Core.APIPromise; ases(options?: Core.RequestOptions): Core.APIPromise; @@ -26,7 +25,7 @@ export class Routes extends APIResource { } /** - * List all Multi-origin AS (MOAS) prefixes on the global routing tables. + * List all Multi-Origin AS (MOAS) prefixes on the global routing tables. */ moas(query?: RouteMoasParams, options?: Core.RequestOptions): Core.APIPromise; moas(options?: Core.RequestOptions): Core.APIPromise; @@ -363,13 +362,15 @@ export interface RouteStatsParams { location?: string; } -export namespace Routes { - export import RouteAsesResponse = RoutesAPI.RouteAsesResponse; - export import RouteMoasResponse = RoutesAPI.RouteMoasResponse; - export import RoutePfx2asResponse = RoutesAPI.RoutePfx2asResponse; - export import RouteStatsResponse = RoutesAPI.RouteStatsResponse; - export import RouteAsesParams = RoutesAPI.RouteAsesParams; - export import RouteMoasParams = RoutesAPI.RouteMoasParams; - export import RoutePfx2asParams = RoutesAPI.RoutePfx2asParams; - export import RouteStatsParams = RoutesAPI.RouteStatsParams; +export declare namespace Routes { + export { + type RouteAsesResponse as RouteAsesResponse, + type RouteMoasResponse as RouteMoasResponse, + type RoutePfx2asResponse as RoutePfx2asResponse, + type RouteStatsResponse as RouteStatsResponse, + type RouteAsesParams as RouteAsesParams, + type RouteMoasParams as RouteMoasParams, + type RoutePfx2asParams as RoutePfx2asParams, + type RouteStatsParams as RouteStatsParams, + }; } diff --git a/src/resources/radar/bgp/top/ases.ts b/src/resources/radar/bgp/top/ases.ts index d8c734785e..42fa8d3b7f 100644 --- a/src/resources/radar/bgp/top/ases.ts +++ b/src/resources/radar/bgp/top/ases.ts @@ -3,12 +3,11 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as AsesAPI from './ases'; export class Ases extends APIResource { /** - * Get the top autonomous systems (AS) by BGP updates (announcements only). Values - * are a percentage out of the total updates. + * Get the top autonomous systems (ASes) by BGP updates (announcements only). + * Values are a percentage out of the total updates. */ get(query?: AseGetParams, options?: Core.RequestOptions): Core.APIPromise; get(options?: Core.RequestOptions): Core.APIPromise; @@ -155,7 +154,7 @@ export interface AseGetParams { /** * Array of BGP network prefixes. */ - prefix?: Array; + prefix?: Array; /** * Array of BGP update types. @@ -163,21 +162,6 @@ export interface AseGetParams { updateType?: Array<'ANNOUNCEMENT' | 'WITHDRAWAL'>; } -export namespace AseGetParams { - export interface Prefix { - in: string; - - name: string; - - test: number; - - /** - * Network prefix, IPv4 or IPv6. - */ - type?: string; - } -} - export interface AsePrefixesParams { /** * Alpha-2 country code. @@ -195,9 +179,11 @@ export interface AsePrefixesParams { limit?: number; } -export namespace Ases { - export import AseGetResponse = AsesAPI.AseGetResponse; - export import AsePrefixesResponse = AsesAPI.AsePrefixesResponse; - export import AseGetParams = AsesAPI.AseGetParams; - export import AsePrefixesParams = AsesAPI.AsePrefixesParams; +export declare namespace Ases { + export { + type AseGetResponse as AseGetResponse, + type AsePrefixesResponse as AsePrefixesResponse, + type AseGetParams as AseGetParams, + type AsePrefixesParams as AsePrefixesParams, + }; } diff --git a/src/resources/radar/bgp/top/index.ts b/src/resources/radar/bgp/top/index.ts index 2e4d816971..7969bb325e 100644 --- a/src/resources/radar/bgp/top/index.ts +++ b/src/resources/radar/bgp/top/index.ts @@ -1,4 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AseGetResponse, AsePrefixesResponse, AseGetParams, AsePrefixesParams, Ases } from './ases'; -export { TopPrefixesResponse, TopPrefixesParams, Top } from './top'; +export { + Ases, + type AseGetResponse, + type AsePrefixesResponse, + type AseGetParams, + type AsePrefixesParams, +} from './ases'; +export { Top, type TopPrefixesResponse, type TopPrefixesParams } from './top'; diff --git a/src/resources/radar/bgp/top/top.ts b/src/resources/radar/bgp/top/top.ts index d238fdd052..6a65717460 100644 --- a/src/resources/radar/bgp/top/top.ts +++ b/src/resources/radar/bgp/top/top.ts @@ -3,8 +3,8 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as TopAPI from './top'; import * as AsesAPI from './ases'; +import { AseGetParams, AseGetResponse, AsePrefixesParams, AsePrefixesResponse, Ases } from './ases'; export class Top extends APIResource { ases: AsesAPI.Ases = new AsesAPI.Ases(this._client); @@ -108,12 +108,16 @@ export interface TopPrefixesParams { updateType?: Array<'ANNOUNCEMENT' | 'WITHDRAWAL'>; } -export namespace Top { - export import TopPrefixesResponse = TopAPI.TopPrefixesResponse; - export import TopPrefixesParams = TopAPI.TopPrefixesParams; - export import Ases = AsesAPI.Ases; - export import AseGetResponse = AsesAPI.AseGetResponse; - export import AsePrefixesResponse = AsesAPI.AsePrefixesResponse; - export import AseGetParams = AsesAPI.AseGetParams; - export import AsePrefixesParams = AsesAPI.AsePrefixesParams; +Top.Ases = Ases; + +export declare namespace Top { + export { type TopPrefixesResponse as TopPrefixesResponse, type TopPrefixesParams as TopPrefixesParams }; + + export { + Ases as Ases, + type AseGetResponse as AseGetResponse, + type AsePrefixesResponse as AsePrefixesResponse, + type AseGetParams as AseGetParams, + type AsePrefixesParams as AsePrefixesParams, + }; } diff --git a/src/resources/radar/datasets.ts b/src/resources/radar/datasets.ts index c88034e95d..ffd616edc2 100644 --- a/src/resources/radar/datasets.ts +++ b/src/resources/radar/datasets.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as DatasetsAPI from './datasets'; export class Datasets extends APIResource { /** @@ -43,7 +42,7 @@ export class Datasets extends APIResource { } /** - * Get the csv content of a given dataset by alias or id. When getting the content + * Get the CSV content of a given dataset by alias or ID. When getting the content * by alias the latest dataset is returned, optionally filtered by the latest * available at a given date. */ @@ -121,10 +120,12 @@ export interface DatasetDownloadParams { format?: 'JSON' | 'CSV'; } -export namespace Datasets { - export import DatasetListResponse = DatasetsAPI.DatasetListResponse; - export import DatasetDownloadResponse = DatasetsAPI.DatasetDownloadResponse; - export import DatasetGetResponse = DatasetsAPI.DatasetGetResponse; - export import DatasetListParams = DatasetsAPI.DatasetListParams; - export import DatasetDownloadParams = DatasetsAPI.DatasetDownloadParams; +export declare namespace Datasets { + export { + type DatasetListResponse as DatasetListResponse, + type DatasetDownloadResponse as DatasetDownloadResponse, + type DatasetGetResponse as DatasetGetResponse, + type DatasetListParams as DatasetListParams, + type DatasetDownloadParams as DatasetDownloadParams, + }; } diff --git a/src/resources/radar/dns/dns.ts b/src/resources/radar/dns/dns.ts index f9a56b8302..d12569d779 100644 --- a/src/resources/radar/dns/dns.ts +++ b/src/resources/radar/dns/dns.ts @@ -2,15 +2,20 @@ import { APIResource } from '../../../resource'; import * as TopAPI from './top'; +import { Top, TopAsesParams, TopAsesResponse, TopLocationsParams, TopLocationsResponse } from './top'; export class DNS extends APIResource { top: TopAPI.Top = new TopAPI.Top(this._client); } -export namespace DNS { - export import Top = TopAPI.Top; - export import TopAsesResponse = TopAPI.TopAsesResponse; - export import TopLocationsResponse = TopAPI.TopLocationsResponse; - export import TopAsesParams = TopAPI.TopAsesParams; - export import TopLocationsParams = TopAPI.TopLocationsParams; +DNS.Top = Top; + +export declare namespace DNS { + export { + Top as Top, + type TopAsesResponse as TopAsesResponse, + type TopLocationsResponse as TopLocationsResponse, + type TopAsesParams as TopAsesParams, + type TopLocationsParams as TopLocationsParams, + }; } diff --git a/src/resources/radar/dns/index.ts b/src/resources/radar/dns/index.ts index 7e3ef59511..2178145608 100644 --- a/src/resources/radar/dns/index.ts +++ b/src/resources/radar/dns/index.ts @@ -1,4 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { DNS } from './dns'; -export { TopAsesResponse, TopLocationsResponse, TopAsesParams, TopLocationsParams, Top } from './top'; +export { + Top, + type TopAsesResponse, + type TopLocationsResponse, + type TopAsesParams, + type TopLocationsParams, +} from './top'; diff --git a/src/resources/radar/dns/top.ts b/src/resources/radar/dns/top.ts index e9c45b11d6..d6f13b87f7 100644 --- a/src/resources/radar/dns/top.ts +++ b/src/resources/radar/dns/top.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as TopAPI from './top'; export class Top extends APIResource { /** @@ -269,9 +268,11 @@ export interface TopLocationsParams { name?: Array; } -export namespace Top { - export import TopAsesResponse = TopAPI.TopAsesResponse; - export import TopLocationsResponse = TopAPI.TopLocationsResponse; - export import TopAsesParams = TopAPI.TopAsesParams; - export import TopLocationsParams = TopAPI.TopLocationsParams; +export declare namespace Top { + export { + type TopAsesResponse as TopAsesResponse, + type TopLocationsResponse as TopLocationsResponse, + type TopAsesParams as TopAsesParams, + type TopLocationsParams as TopLocationsParams, + }; } diff --git a/src/resources/radar/email/email.ts b/src/resources/radar/email/email.ts index 57ef0faae4..d6f3265d42 100644 --- a/src/resources/radar/email/email.ts +++ b/src/resources/radar/email/email.ts @@ -1,9 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import * as EmailAPI from './email'; import * as RoutingAPI from './routing/routing'; +import { Routing } from './routing/routing'; import * as SecurityAPI from './security/security'; +import { Security } from './security/security'; export class Email extends APIResource { routing: RoutingAPI.Routing = new RoutingAPI.Routing(this._client); @@ -26,9 +27,13 @@ export interface RadarEmailSummary { PASS: string; } -export namespace Email { - export import RadarEmailSeries = EmailAPI.RadarEmailSeries; - export import RadarEmailSummary = EmailAPI.RadarEmailSummary; - export import Routing = RoutingAPI.Routing; - export import Security = SecurityAPI.Security; +Email.Routing = Routing; +Email.Security = Security; + +export declare namespace Email { + export { type RadarEmailSeries as RadarEmailSeries, type RadarEmailSummary as RadarEmailSummary }; + + export { Routing as Routing }; + + export { Security as Security }; } diff --git a/src/resources/radar/email/index.ts b/src/resources/radar/email/index.ts index 678d7437b3..0e113c2250 100644 --- a/src/resources/radar/email/index.ts +++ b/src/resources/radar/email/index.ts @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { RadarEmailSeries, RadarEmailSummary, Email } from './email'; +export { Email, type RadarEmailSeries, type RadarEmailSummary } from './email'; export { Routing } from './routing/index'; export { Security } from './security/index'; diff --git a/src/resources/radar/email/routing/index.ts b/src/resources/radar/email/routing/index.ts index cca91bb818..a7447f6d0f 100644 --- a/src/resources/radar/email/routing/index.ts +++ b/src/resources/radar/email/routing/index.ts @@ -2,32 +2,32 @@ export { Routing } from './routing'; export { - SummaryARCResponse, - SummaryDKIMResponse, - SummaryDMARCResponse, - SummaryEncryptedResponse, - SummaryIPVersionResponse, - SummarySPFResponse, - SummaryARCParams, - SummaryDKIMParams, - SummaryDMARCParams, - SummaryEncryptedParams, - SummaryIPVersionParams, - SummarySPFParams, Summary, + type SummaryARCResponse, + type SummaryDKIMResponse, + type SummaryDMARCResponse, + type SummaryEncryptedResponse, + type SummaryIPVersionResponse, + type SummarySPFResponse, + type SummaryARCParams, + type SummaryDKIMParams, + type SummaryDMARCParams, + type SummaryEncryptedParams, + type SummaryIPVersionParams, + type SummarySPFParams, } from './summary'; export { - TimeseriesGroupARCResponse, - TimeseriesGroupDKIMResponse, - TimeseriesGroupDMARCResponse, - TimeseriesGroupEncryptedResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupSPFResponse, - TimeseriesGroupARCParams, - TimeseriesGroupDKIMParams, - TimeseriesGroupDMARCParams, - TimeseriesGroupEncryptedParams, - TimeseriesGroupIPVersionParams, - TimeseriesGroupSPFParams, TimeseriesGroups, + type TimeseriesGroupARCResponse, + type TimeseriesGroupDKIMResponse, + type TimeseriesGroupDMARCResponse, + type TimeseriesGroupEncryptedResponse, + type TimeseriesGroupIPVersionResponse, + type TimeseriesGroupSPFResponse, + type TimeseriesGroupARCParams, + type TimeseriesGroupDKIMParams, + type TimeseriesGroupDMARCParams, + type TimeseriesGroupEncryptedParams, + type TimeseriesGroupIPVersionParams, + type TimeseriesGroupSPFParams, } from './timeseries-groups'; diff --git a/src/resources/radar/email/routing/routing.ts b/src/resources/radar/email/routing/routing.ts index 7ed68db170..f4c5d68359 100644 --- a/src/resources/radar/email/routing/routing.ts +++ b/src/resources/radar/email/routing/routing.ts @@ -2,7 +2,37 @@ import { APIResource } from '../../../../resource'; import * as SummaryAPI from './summary'; +import { + Summary, + SummaryARCParams, + SummaryARCResponse, + SummaryDKIMParams, + SummaryDKIMResponse, + SummaryDMARCParams, + SummaryDMARCResponse, + SummaryEncryptedParams, + SummaryEncryptedResponse, + SummaryIPVersionParams, + SummaryIPVersionResponse, + SummarySPFParams, + SummarySPFResponse, +} from './summary'; import * as TimeseriesGroupsAPI from './timeseries-groups'; +import { + TimeseriesGroupARCParams, + TimeseriesGroupARCResponse, + TimeseriesGroupDKIMParams, + TimeseriesGroupDKIMResponse, + TimeseriesGroupDMARCParams, + TimeseriesGroupDMARCResponse, + TimeseriesGroupEncryptedParams, + TimeseriesGroupEncryptedResponse, + TimeseriesGroupIPVersionParams, + TimeseriesGroupIPVersionResponse, + TimeseriesGroupSPFParams, + TimeseriesGroupSPFResponse, + TimeseriesGroups, +} from './timeseries-groups'; export class Routing extends APIResource { summary: SummaryAPI.Summary = new SummaryAPI.Summary(this._client); @@ -11,31 +41,39 @@ export class Routing extends APIResource { ); } -export namespace Routing { - export import Summary = SummaryAPI.Summary; - export import SummaryARCResponse = SummaryAPI.SummaryARCResponse; - export import SummaryDKIMResponse = SummaryAPI.SummaryDKIMResponse; - export import SummaryDMARCResponse = SummaryAPI.SummaryDMARCResponse; - export import SummaryEncryptedResponse = SummaryAPI.SummaryEncryptedResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummarySPFResponse = SummaryAPI.SummarySPFResponse; - export import SummaryARCParams = SummaryAPI.SummaryARCParams; - export import SummaryDKIMParams = SummaryAPI.SummaryDKIMParams; - export import SummaryDMARCParams = SummaryAPI.SummaryDMARCParams; - export import SummaryEncryptedParams = SummaryAPI.SummaryEncryptedParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummarySPFParams = SummaryAPI.SummarySPFParams; - export import TimeseriesGroups = TimeseriesGroupsAPI.TimeseriesGroups; - export import TimeseriesGroupARCResponse = TimeseriesGroupsAPI.TimeseriesGroupARCResponse; - export import TimeseriesGroupDKIMResponse = TimeseriesGroupsAPI.TimeseriesGroupDKIMResponse; - export import TimeseriesGroupDMARCResponse = TimeseriesGroupsAPI.TimeseriesGroupDMARCResponse; - export import TimeseriesGroupEncryptedResponse = TimeseriesGroupsAPI.TimeseriesGroupEncryptedResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupSPFResponse = TimeseriesGroupsAPI.TimeseriesGroupSPFResponse; - export import TimeseriesGroupARCParams = TimeseriesGroupsAPI.TimeseriesGroupARCParams; - export import TimeseriesGroupDKIMParams = TimeseriesGroupsAPI.TimeseriesGroupDKIMParams; - export import TimeseriesGroupDMARCParams = TimeseriesGroupsAPI.TimeseriesGroupDMARCParams; - export import TimeseriesGroupEncryptedParams = TimeseriesGroupsAPI.TimeseriesGroupEncryptedParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupSPFParams = TimeseriesGroupsAPI.TimeseriesGroupSPFParams; +Routing.Summary = Summary; +Routing.TimeseriesGroups = TimeseriesGroups; + +export declare namespace Routing { + export { + Summary as Summary, + type SummaryARCResponse as SummaryARCResponse, + type SummaryDKIMResponse as SummaryDKIMResponse, + type SummaryDMARCResponse as SummaryDMARCResponse, + type SummaryEncryptedResponse as SummaryEncryptedResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummarySPFResponse as SummarySPFResponse, + type SummaryARCParams as SummaryARCParams, + type SummaryDKIMParams as SummaryDKIMParams, + type SummaryDMARCParams as SummaryDMARCParams, + type SummaryEncryptedParams as SummaryEncryptedParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummarySPFParams as SummarySPFParams, + }; + + export { + TimeseriesGroups as TimeseriesGroups, + type TimeseriesGroupARCResponse as TimeseriesGroupARCResponse, + type TimeseriesGroupDKIMResponse as TimeseriesGroupDKIMResponse, + type TimeseriesGroupDMARCResponse as TimeseriesGroupDMARCResponse, + type TimeseriesGroupEncryptedResponse as TimeseriesGroupEncryptedResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupSPFResponse as TimeseriesGroupSPFResponse, + type TimeseriesGroupARCParams as TimeseriesGroupARCParams, + type TimeseriesGroupDKIMParams as TimeseriesGroupDKIMParams, + type TimeseriesGroupDMARCParams as TimeseriesGroupDMARCParams, + type TimeseriesGroupEncryptedParams as TimeseriesGroupEncryptedParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupSPFParams as TimeseriesGroupSPFParams, + }; } diff --git a/src/resources/radar/email/routing/summary.ts b/src/resources/radar/email/routing/summary.ts index da866977b2..4de0f24ad1 100644 --- a/src/resources/radar/email/routing/summary.ts +++ b/src/resources/radar/email/routing/summary.ts @@ -3,12 +3,11 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as SummaryAPI from './summary'; import * as EmailAPI from '../email'; export class Summary extends APIResource { /** - * Percentage distribution of emails classified per ARC validation. + * Percentage distribution of emails classified by ARC validation. */ arc(query?: SummaryARCParams, options?: Core.RequestOptions): Core.APIPromise; arc(options?: Core.RequestOptions): Core.APIPromise; @@ -27,7 +26,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of emails classified per DKIM validation. + * Percentage distribution of emails classified by DKIM validation. */ dkim(query?: SummaryDKIMParams, options?: Core.RequestOptions): Core.APIPromise; dkim(options?: Core.RequestOptions): Core.APIPromise; @@ -46,7 +45,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of emails classified per DMARC validation. + * Percentage distribution of emails classified by DMARC validation. */ dmarc(query?: SummaryDMARCParams, options?: Core.RequestOptions): Core.APIPromise; dmarc(options?: Core.RequestOptions): Core.APIPromise; @@ -65,7 +64,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of emails by Encrypted + * Percentage distribution of emails by encryption status. */ encrypted( query?: SummaryEncryptedParams, @@ -87,7 +86,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of emails by Ip Version. + * Percentage distribution of emails by IP version. */ ipVersion( query?: SummaryIPVersionParams, @@ -109,7 +108,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of emails classified per SPF validation. + * Percentage distribution of emails classified by SPF validation. */ spf(query?: SummarySPFParams, options?: Core.RequestOptions): Core.APIPromise; spf(options?: Core.RequestOptions): Core.APIPromise; @@ -800,17 +799,19 @@ export interface SummarySPFParams { name?: Array; } -export namespace Summary { - export import SummaryARCResponse = SummaryAPI.SummaryARCResponse; - export import SummaryDKIMResponse = SummaryAPI.SummaryDKIMResponse; - export import SummaryDMARCResponse = SummaryAPI.SummaryDMARCResponse; - export import SummaryEncryptedResponse = SummaryAPI.SummaryEncryptedResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummarySPFResponse = SummaryAPI.SummarySPFResponse; - export import SummaryARCParams = SummaryAPI.SummaryARCParams; - export import SummaryDKIMParams = SummaryAPI.SummaryDKIMParams; - export import SummaryDMARCParams = SummaryAPI.SummaryDMARCParams; - export import SummaryEncryptedParams = SummaryAPI.SummaryEncryptedParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummarySPFParams = SummaryAPI.SummarySPFParams; +export declare namespace Summary { + export { + type SummaryARCResponse as SummaryARCResponse, + type SummaryDKIMResponse as SummaryDKIMResponse, + type SummaryDMARCResponse as SummaryDMARCResponse, + type SummaryEncryptedResponse as SummaryEncryptedResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummarySPFResponse as SummarySPFResponse, + type SummaryARCParams as SummaryARCParams, + type SummaryDKIMParams as SummaryDKIMParams, + type SummaryDMARCParams as SummaryDMARCParams, + type SummaryEncryptedParams as SummaryEncryptedParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummarySPFParams as SummarySPFParams, + }; } diff --git a/src/resources/radar/email/routing/timeseries-groups.ts b/src/resources/radar/email/routing/timeseries-groups.ts index 4f50e19810..da3d75efdf 100644 --- a/src/resources/radar/email/routing/timeseries-groups.ts +++ b/src/resources/radar/email/routing/timeseries-groups.ts @@ -3,12 +3,11 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as TimeseriesGroupsAPI from './timeseries-groups'; import * as EmailAPI from '../email'; export class TimeseriesGroups extends APIResource { /** - * Percentage distribution of emails classified per Arc validation over time. + * Percentage distribution of emails classified by ARC validation over time. */ arc( query?: TimeseriesGroupARCParams, @@ -31,7 +30,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails classified per DKIM validation over time. + * Percentage distribution of emails classified by DKIM validation over time. */ dkim( query?: TimeseriesGroupDKIMParams, @@ -54,7 +53,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails classified per DMARC validation over time. + * Percentage distribution of emails classified by DMARC validation over time. */ dmarc( query?: TimeseriesGroupDMARCParams, @@ -77,7 +76,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails by Encrypted over time. + * Percentage distribution of emails by encryption status over time. */ encrypted( query?: TimeseriesGroupEncryptedParams, @@ -100,7 +99,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails by Ip Version over time. + * Percentage distribution of emails by IP version over time. */ ipVersion( query?: TimeseriesGroupIPVersionParams, @@ -123,7 +122,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails classified per SPF validation over time. + * Percentage distribution of emails classified by SPF validation over time. */ spf( query?: TimeseriesGroupSPFParams, @@ -564,17 +563,19 @@ export interface TimeseriesGroupSPFParams { name?: Array; } -export namespace TimeseriesGroups { - export import TimeseriesGroupARCResponse = TimeseriesGroupsAPI.TimeseriesGroupARCResponse; - export import TimeseriesGroupDKIMResponse = TimeseriesGroupsAPI.TimeseriesGroupDKIMResponse; - export import TimeseriesGroupDMARCResponse = TimeseriesGroupsAPI.TimeseriesGroupDMARCResponse; - export import TimeseriesGroupEncryptedResponse = TimeseriesGroupsAPI.TimeseriesGroupEncryptedResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupSPFResponse = TimeseriesGroupsAPI.TimeseriesGroupSPFResponse; - export import TimeseriesGroupARCParams = TimeseriesGroupsAPI.TimeseriesGroupARCParams; - export import TimeseriesGroupDKIMParams = TimeseriesGroupsAPI.TimeseriesGroupDKIMParams; - export import TimeseriesGroupDMARCParams = TimeseriesGroupsAPI.TimeseriesGroupDMARCParams; - export import TimeseriesGroupEncryptedParams = TimeseriesGroupsAPI.TimeseriesGroupEncryptedParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupSPFParams = TimeseriesGroupsAPI.TimeseriesGroupSPFParams; +export declare namespace TimeseriesGroups { + export { + type TimeseriesGroupARCResponse as TimeseriesGroupARCResponse, + type TimeseriesGroupDKIMResponse as TimeseriesGroupDKIMResponse, + type TimeseriesGroupDMARCResponse as TimeseriesGroupDMARCResponse, + type TimeseriesGroupEncryptedResponse as TimeseriesGroupEncryptedResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupSPFResponse as TimeseriesGroupSPFResponse, + type TimeseriesGroupARCParams as TimeseriesGroupARCParams, + type TimeseriesGroupDKIMParams as TimeseriesGroupDKIMParams, + type TimeseriesGroupDMARCParams as TimeseriesGroupDMARCParams, + type TimeseriesGroupEncryptedParams as TimeseriesGroupEncryptedParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupSPFParams as TimeseriesGroupSPFParams, + }; } diff --git a/src/resources/radar/email/security/index.ts b/src/resources/radar/email/security/index.ts index d7ff8eb85e..b48f43fb39 100644 --- a/src/resources/radar/email/security/index.ts +++ b/src/resources/radar/email/security/index.ts @@ -2,45 +2,45 @@ export { Security } from './security'; export { - SummaryARCResponse, - SummaryDKIMResponse, - SummaryDMARCResponse, - SummaryMaliciousResponse, - SummarySpamResponse, - SummarySPFResponse, - SummarySpoofResponse, - SummaryThreatCategoryResponse, - SummaryTLSVersionResponse, - SummaryARCParams, - SummaryDKIMParams, - SummaryDMARCParams, - SummaryMaliciousParams, - SummarySpamParams, - SummarySPFParams, - SummarySpoofParams, - SummaryThreatCategoryParams, - SummaryTLSVersionParams, Summary, + type SummaryARCResponse, + type SummaryDKIMResponse, + type SummaryDMARCResponse, + type SummaryMaliciousResponse, + type SummarySpamResponse, + type SummarySPFResponse, + type SummarySpoofResponse, + type SummaryThreatCategoryResponse, + type SummaryTLSVersionResponse, + type SummaryARCParams, + type SummaryDKIMParams, + type SummaryDMARCParams, + type SummaryMaliciousParams, + type SummarySpamParams, + type SummarySPFParams, + type SummarySpoofParams, + type SummaryThreatCategoryParams, + type SummaryTLSVersionParams, } from './summary'; export { - TimeseriesGroupARCResponse, - TimeseriesGroupDKIMResponse, - TimeseriesGroupDMARCResponse, - TimeseriesGroupMaliciousResponse, - TimeseriesGroupSpamResponse, - TimeseriesGroupSPFResponse, - TimeseriesGroupSpoofResponse, - TimeseriesGroupThreatCategoryResponse, - TimeseriesGroupTLSVersionResponse, - TimeseriesGroupARCParams, - TimeseriesGroupDKIMParams, - TimeseriesGroupDMARCParams, - TimeseriesGroupMaliciousParams, - TimeseriesGroupSpamParams, - TimeseriesGroupSPFParams, - TimeseriesGroupSpoofParams, - TimeseriesGroupThreatCategoryParams, - TimeseriesGroupTLSVersionParams, TimeseriesGroups, + type TimeseriesGroupARCResponse, + type TimeseriesGroupDKIMResponse, + type TimeseriesGroupDMARCResponse, + type TimeseriesGroupMaliciousResponse, + type TimeseriesGroupSpamResponse, + type TimeseriesGroupSPFResponse, + type TimeseriesGroupSpoofResponse, + type TimeseriesGroupThreatCategoryResponse, + type TimeseriesGroupTLSVersionResponse, + type TimeseriesGroupARCParams, + type TimeseriesGroupDKIMParams, + type TimeseriesGroupDMARCParams, + type TimeseriesGroupMaliciousParams, + type TimeseriesGroupSpamParams, + type TimeseriesGroupSPFParams, + type TimeseriesGroupSpoofParams, + type TimeseriesGroupThreatCategoryParams, + type TimeseriesGroupTLSVersionParams, } from './timeseries-groups'; export { Top } from './top/index'; diff --git a/src/resources/radar/email/security/security.ts b/src/resources/radar/email/security/security.ts index bb2ff1ce6f..c1c1c5f337 100644 --- a/src/resources/radar/email/security/security.ts +++ b/src/resources/radar/email/security/security.ts @@ -2,8 +2,51 @@ import { APIResource } from '../../../../resource'; import * as SummaryAPI from './summary'; +import { + Summary, + SummaryARCParams, + SummaryARCResponse, + SummaryDKIMParams, + SummaryDKIMResponse, + SummaryDMARCParams, + SummaryDMARCResponse, + SummaryMaliciousParams, + SummaryMaliciousResponse, + SummarySPFParams, + SummarySPFResponse, + SummarySpamParams, + SummarySpamResponse, + SummarySpoofParams, + SummarySpoofResponse, + SummaryTLSVersionParams, + SummaryTLSVersionResponse, + SummaryThreatCategoryParams, + SummaryThreatCategoryResponse, +} from './summary'; import * as TimeseriesGroupsAPI from './timeseries-groups'; +import { + TimeseriesGroupARCParams, + TimeseriesGroupARCResponse, + TimeseriesGroupDKIMParams, + TimeseriesGroupDKIMResponse, + TimeseriesGroupDMARCParams, + TimeseriesGroupDMARCResponse, + TimeseriesGroupMaliciousParams, + TimeseriesGroupMaliciousResponse, + TimeseriesGroupSPFParams, + TimeseriesGroupSPFResponse, + TimeseriesGroupSpamParams, + TimeseriesGroupSpamResponse, + TimeseriesGroupSpoofParams, + TimeseriesGroupSpoofResponse, + TimeseriesGroupTLSVersionParams, + TimeseriesGroupTLSVersionResponse, + TimeseriesGroupThreatCategoryParams, + TimeseriesGroupThreatCategoryResponse, + TimeseriesGroups, +} from './timeseries-groups'; import * as TopAPI from './top/top'; +import { Top } from './top/top'; export class Security extends APIResource { top: TopAPI.Top = new TopAPI.Top(this._client); @@ -13,44 +56,54 @@ export class Security extends APIResource { ); } -export namespace Security { - export import Top = TopAPI.Top; - export import Summary = SummaryAPI.Summary; - export import SummaryARCResponse = SummaryAPI.SummaryARCResponse; - export import SummaryDKIMResponse = SummaryAPI.SummaryDKIMResponse; - export import SummaryDMARCResponse = SummaryAPI.SummaryDMARCResponse; - export import SummaryMaliciousResponse = SummaryAPI.SummaryMaliciousResponse; - export import SummarySpamResponse = SummaryAPI.SummarySpamResponse; - export import SummarySPFResponse = SummaryAPI.SummarySPFResponse; - export import SummarySpoofResponse = SummaryAPI.SummarySpoofResponse; - export import SummaryThreatCategoryResponse = SummaryAPI.SummaryThreatCategoryResponse; - export import SummaryTLSVersionResponse = SummaryAPI.SummaryTLSVersionResponse; - export import SummaryARCParams = SummaryAPI.SummaryARCParams; - export import SummaryDKIMParams = SummaryAPI.SummaryDKIMParams; - export import SummaryDMARCParams = SummaryAPI.SummaryDMARCParams; - export import SummaryMaliciousParams = SummaryAPI.SummaryMaliciousParams; - export import SummarySpamParams = SummaryAPI.SummarySpamParams; - export import SummarySPFParams = SummaryAPI.SummarySPFParams; - export import SummarySpoofParams = SummaryAPI.SummarySpoofParams; - export import SummaryThreatCategoryParams = SummaryAPI.SummaryThreatCategoryParams; - export import SummaryTLSVersionParams = SummaryAPI.SummaryTLSVersionParams; - export import TimeseriesGroups = TimeseriesGroupsAPI.TimeseriesGroups; - export import TimeseriesGroupARCResponse = TimeseriesGroupsAPI.TimeseriesGroupARCResponse; - export import TimeseriesGroupDKIMResponse = TimeseriesGroupsAPI.TimeseriesGroupDKIMResponse; - export import TimeseriesGroupDMARCResponse = TimeseriesGroupsAPI.TimeseriesGroupDMARCResponse; - export import TimeseriesGroupMaliciousResponse = TimeseriesGroupsAPI.TimeseriesGroupMaliciousResponse; - export import TimeseriesGroupSpamResponse = TimeseriesGroupsAPI.TimeseriesGroupSpamResponse; - export import TimeseriesGroupSPFResponse = TimeseriesGroupsAPI.TimeseriesGroupSPFResponse; - export import TimeseriesGroupSpoofResponse = TimeseriesGroupsAPI.TimeseriesGroupSpoofResponse; - export import TimeseriesGroupThreatCategoryResponse = TimeseriesGroupsAPI.TimeseriesGroupThreatCategoryResponse; - export import TimeseriesGroupTLSVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupTLSVersionResponse; - export import TimeseriesGroupARCParams = TimeseriesGroupsAPI.TimeseriesGroupARCParams; - export import TimeseriesGroupDKIMParams = TimeseriesGroupsAPI.TimeseriesGroupDKIMParams; - export import TimeseriesGroupDMARCParams = TimeseriesGroupsAPI.TimeseriesGroupDMARCParams; - export import TimeseriesGroupMaliciousParams = TimeseriesGroupsAPI.TimeseriesGroupMaliciousParams; - export import TimeseriesGroupSpamParams = TimeseriesGroupsAPI.TimeseriesGroupSpamParams; - export import TimeseriesGroupSPFParams = TimeseriesGroupsAPI.TimeseriesGroupSPFParams; - export import TimeseriesGroupSpoofParams = TimeseriesGroupsAPI.TimeseriesGroupSpoofParams; - export import TimeseriesGroupThreatCategoryParams = TimeseriesGroupsAPI.TimeseriesGroupThreatCategoryParams; - export import TimeseriesGroupTLSVersionParams = TimeseriesGroupsAPI.TimeseriesGroupTLSVersionParams; +Security.Top = Top; +Security.Summary = Summary; +Security.TimeseriesGroups = TimeseriesGroups; + +export declare namespace Security { + export { Top as Top }; + + export { + Summary as Summary, + type SummaryARCResponse as SummaryARCResponse, + type SummaryDKIMResponse as SummaryDKIMResponse, + type SummaryDMARCResponse as SummaryDMARCResponse, + type SummaryMaliciousResponse as SummaryMaliciousResponse, + type SummarySpamResponse as SummarySpamResponse, + type SummarySPFResponse as SummarySPFResponse, + type SummarySpoofResponse as SummarySpoofResponse, + type SummaryThreatCategoryResponse as SummaryThreatCategoryResponse, + type SummaryTLSVersionResponse as SummaryTLSVersionResponse, + type SummaryARCParams as SummaryARCParams, + type SummaryDKIMParams as SummaryDKIMParams, + type SummaryDMARCParams as SummaryDMARCParams, + type SummaryMaliciousParams as SummaryMaliciousParams, + type SummarySpamParams as SummarySpamParams, + type SummarySPFParams as SummarySPFParams, + type SummarySpoofParams as SummarySpoofParams, + type SummaryThreatCategoryParams as SummaryThreatCategoryParams, + type SummaryTLSVersionParams as SummaryTLSVersionParams, + }; + + export { + TimeseriesGroups as TimeseriesGroups, + type TimeseriesGroupARCResponse as TimeseriesGroupARCResponse, + type TimeseriesGroupDKIMResponse as TimeseriesGroupDKIMResponse, + type TimeseriesGroupDMARCResponse as TimeseriesGroupDMARCResponse, + type TimeseriesGroupMaliciousResponse as TimeseriesGroupMaliciousResponse, + type TimeseriesGroupSpamResponse as TimeseriesGroupSpamResponse, + type TimeseriesGroupSPFResponse as TimeseriesGroupSPFResponse, + type TimeseriesGroupSpoofResponse as TimeseriesGroupSpoofResponse, + type TimeseriesGroupThreatCategoryResponse as TimeseriesGroupThreatCategoryResponse, + type TimeseriesGroupTLSVersionResponse as TimeseriesGroupTLSVersionResponse, + type TimeseriesGroupARCParams as TimeseriesGroupARCParams, + type TimeseriesGroupDKIMParams as TimeseriesGroupDKIMParams, + type TimeseriesGroupDMARCParams as TimeseriesGroupDMARCParams, + type TimeseriesGroupMaliciousParams as TimeseriesGroupMaliciousParams, + type TimeseriesGroupSpamParams as TimeseriesGroupSpamParams, + type TimeseriesGroupSPFParams as TimeseriesGroupSPFParams, + type TimeseriesGroupSpoofParams as TimeseriesGroupSpoofParams, + type TimeseriesGroupThreatCategoryParams as TimeseriesGroupThreatCategoryParams, + type TimeseriesGroupTLSVersionParams as TimeseriesGroupTLSVersionParams, + }; } diff --git a/src/resources/radar/email/security/summary.ts b/src/resources/radar/email/security/summary.ts index bc1dbb1f18..c00c830bdc 100644 --- a/src/resources/radar/email/security/summary.ts +++ b/src/resources/radar/email/security/summary.ts @@ -3,12 +3,11 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as SummaryAPI from './summary'; import * as EmailAPI from '../email'; export class Summary extends APIResource { /** - * Percentage distribution of emails classified per ARC validation. + * Percentage distribution of emails classified by ARC validation. */ arc(query?: SummaryARCParams, options?: Core.RequestOptions): Core.APIPromise; arc(options?: Core.RequestOptions): Core.APIPromise; @@ -27,7 +26,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of emails classified per DKIM validation. + * Percentage distribution of emails classified by DKIM validation. */ dkim(query?: SummaryDKIMParams, options?: Core.RequestOptions): Core.APIPromise; dkim(options?: Core.RequestOptions): Core.APIPromise; @@ -46,7 +45,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of emails classified per DMARC validation. + * Percentage distribution of emails classified by DMARC validation. */ dmarc(query?: SummaryDMARCParams, options?: Core.RequestOptions): Core.APIPromise; dmarc(options?: Core.RequestOptions): Core.APIPromise; @@ -106,7 +105,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of emails classified per SPF validation. + * Percentage distribution of emails classified by SPF validation. */ spf(query?: SummarySPFParams, options?: Core.RequestOptions): Core.APIPromise; spf(options?: Core.RequestOptions): Core.APIPromise; @@ -167,7 +166,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of emails classified per TLS Version. + * Percentage distribution of emails classified by TLS version. */ tlsVersion( query?: SummaryTLSVersionParams, @@ -1193,23 +1192,25 @@ export interface SummaryTLSVersionParams { spf?: Array<'PASS' | 'NONE' | 'FAIL'>; } -export namespace Summary { - export import SummaryARCResponse = SummaryAPI.SummaryARCResponse; - export import SummaryDKIMResponse = SummaryAPI.SummaryDKIMResponse; - export import SummaryDMARCResponse = SummaryAPI.SummaryDMARCResponse; - export import SummaryMaliciousResponse = SummaryAPI.SummaryMaliciousResponse; - export import SummarySpamResponse = SummaryAPI.SummarySpamResponse; - export import SummarySPFResponse = SummaryAPI.SummarySPFResponse; - export import SummarySpoofResponse = SummaryAPI.SummarySpoofResponse; - export import SummaryThreatCategoryResponse = SummaryAPI.SummaryThreatCategoryResponse; - export import SummaryTLSVersionResponse = SummaryAPI.SummaryTLSVersionResponse; - export import SummaryARCParams = SummaryAPI.SummaryARCParams; - export import SummaryDKIMParams = SummaryAPI.SummaryDKIMParams; - export import SummaryDMARCParams = SummaryAPI.SummaryDMARCParams; - export import SummaryMaliciousParams = SummaryAPI.SummaryMaliciousParams; - export import SummarySpamParams = SummaryAPI.SummarySpamParams; - export import SummarySPFParams = SummaryAPI.SummarySPFParams; - export import SummarySpoofParams = SummaryAPI.SummarySpoofParams; - export import SummaryThreatCategoryParams = SummaryAPI.SummaryThreatCategoryParams; - export import SummaryTLSVersionParams = SummaryAPI.SummaryTLSVersionParams; +export declare namespace Summary { + export { + type SummaryARCResponse as SummaryARCResponse, + type SummaryDKIMResponse as SummaryDKIMResponse, + type SummaryDMARCResponse as SummaryDMARCResponse, + type SummaryMaliciousResponse as SummaryMaliciousResponse, + type SummarySpamResponse as SummarySpamResponse, + type SummarySPFResponse as SummarySPFResponse, + type SummarySpoofResponse as SummarySpoofResponse, + type SummaryThreatCategoryResponse as SummaryThreatCategoryResponse, + type SummaryTLSVersionResponse as SummaryTLSVersionResponse, + type SummaryARCParams as SummaryARCParams, + type SummaryDKIMParams as SummaryDKIMParams, + type SummaryDMARCParams as SummaryDMARCParams, + type SummaryMaliciousParams as SummaryMaliciousParams, + type SummarySpamParams as SummarySpamParams, + type SummarySPFParams as SummarySPFParams, + type SummarySpoofParams as SummarySpoofParams, + type SummaryThreatCategoryParams as SummaryThreatCategoryParams, + type SummaryTLSVersionParams as SummaryTLSVersionParams, + }; } diff --git a/src/resources/radar/email/security/timeseries-groups.ts b/src/resources/radar/email/security/timeseries-groups.ts index 194b1cac64..ba4865b003 100644 --- a/src/resources/radar/email/security/timeseries-groups.ts +++ b/src/resources/radar/email/security/timeseries-groups.ts @@ -3,12 +3,11 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as TimeseriesGroupsAPI from './timeseries-groups'; import * as EmailAPI from '../email'; export class TimeseriesGroups extends APIResource { /** - * Percentage distribution of emails classified per Arc validation over time. + * Percentage distribution of emails classified by ARC validation over time. */ arc( query?: TimeseriesGroupARCParams, @@ -31,7 +30,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails classified per DKIM validation over time. + * Percentage distribution of emails classified by DKIM validation over time. */ dkim( query?: TimeseriesGroupDKIMParams, @@ -54,7 +53,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails classified per DMARC validation over time. + * Percentage distribution of emails classified by DMARC validation over time. */ dmarc( query?: TimeseriesGroupDMARCParams, @@ -123,7 +122,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails classified per SPF validation over time. + * Percentage distribution of emails classified by SPF validation over time. */ spf( query?: TimeseriesGroupSPFParams, @@ -169,7 +168,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails classified in Threat Categories over time. + * Percentage distribution of emails classified by threat category over time. */ threatCategory( query?: TimeseriesGroupThreatCategoryParams, @@ -192,7 +191,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Percentage distribution of emails classified per TLS Version over time. + * Percentage distribution of emails classified by TLS version over time. */ tlsVersion( query?: TimeseriesGroupTLSVersionParams, @@ -841,23 +840,25 @@ export interface TimeseriesGroupTLSVersionParams { spf?: Array<'PASS' | 'NONE' | 'FAIL'>; } -export namespace TimeseriesGroups { - export import TimeseriesGroupARCResponse = TimeseriesGroupsAPI.TimeseriesGroupARCResponse; - export import TimeseriesGroupDKIMResponse = TimeseriesGroupsAPI.TimeseriesGroupDKIMResponse; - export import TimeseriesGroupDMARCResponse = TimeseriesGroupsAPI.TimeseriesGroupDMARCResponse; - export import TimeseriesGroupMaliciousResponse = TimeseriesGroupsAPI.TimeseriesGroupMaliciousResponse; - export import TimeseriesGroupSpamResponse = TimeseriesGroupsAPI.TimeseriesGroupSpamResponse; - export import TimeseriesGroupSPFResponse = TimeseriesGroupsAPI.TimeseriesGroupSPFResponse; - export import TimeseriesGroupSpoofResponse = TimeseriesGroupsAPI.TimeseriesGroupSpoofResponse; - export import TimeseriesGroupThreatCategoryResponse = TimeseriesGroupsAPI.TimeseriesGroupThreatCategoryResponse; - export import TimeseriesGroupTLSVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupTLSVersionResponse; - export import TimeseriesGroupARCParams = TimeseriesGroupsAPI.TimeseriesGroupARCParams; - export import TimeseriesGroupDKIMParams = TimeseriesGroupsAPI.TimeseriesGroupDKIMParams; - export import TimeseriesGroupDMARCParams = TimeseriesGroupsAPI.TimeseriesGroupDMARCParams; - export import TimeseriesGroupMaliciousParams = TimeseriesGroupsAPI.TimeseriesGroupMaliciousParams; - export import TimeseriesGroupSpamParams = TimeseriesGroupsAPI.TimeseriesGroupSpamParams; - export import TimeseriesGroupSPFParams = TimeseriesGroupsAPI.TimeseriesGroupSPFParams; - export import TimeseriesGroupSpoofParams = TimeseriesGroupsAPI.TimeseriesGroupSpoofParams; - export import TimeseriesGroupThreatCategoryParams = TimeseriesGroupsAPI.TimeseriesGroupThreatCategoryParams; - export import TimeseriesGroupTLSVersionParams = TimeseriesGroupsAPI.TimeseriesGroupTLSVersionParams; +export declare namespace TimeseriesGroups { + export { + type TimeseriesGroupARCResponse as TimeseriesGroupARCResponse, + type TimeseriesGroupDKIMResponse as TimeseriesGroupDKIMResponse, + type TimeseriesGroupDMARCResponse as TimeseriesGroupDMARCResponse, + type TimeseriesGroupMaliciousResponse as TimeseriesGroupMaliciousResponse, + type TimeseriesGroupSpamResponse as TimeseriesGroupSpamResponse, + type TimeseriesGroupSPFResponse as TimeseriesGroupSPFResponse, + type TimeseriesGroupSpoofResponse as TimeseriesGroupSpoofResponse, + type TimeseriesGroupThreatCategoryResponse as TimeseriesGroupThreatCategoryResponse, + type TimeseriesGroupTLSVersionResponse as TimeseriesGroupTLSVersionResponse, + type TimeseriesGroupARCParams as TimeseriesGroupARCParams, + type TimeseriesGroupDKIMParams as TimeseriesGroupDKIMParams, + type TimeseriesGroupDMARCParams as TimeseriesGroupDMARCParams, + type TimeseriesGroupMaliciousParams as TimeseriesGroupMaliciousParams, + type TimeseriesGroupSpamParams as TimeseriesGroupSpamParams, + type TimeseriesGroupSPFParams as TimeseriesGroupSPFParams, + type TimeseriesGroupSpoofParams as TimeseriesGroupSpoofParams, + type TimeseriesGroupThreatCategoryParams as TimeseriesGroupThreatCategoryParams, + type TimeseriesGroupTLSVersionParams as TimeseriesGroupTLSVersionParams, + }; } diff --git a/src/resources/radar/email/security/top/index.ts b/src/resources/radar/email/security/top/index.ts index 39006854a9..b3c3ac212f 100644 --- a/src/resources/radar/email/security/top/index.ts +++ b/src/resources/radar/email/security/top/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { TldGetResponse, TldGetParams, Tlds } from './tlds/index'; +export { Tlds, type TldGetResponse, type TldGetParams } from './tlds/index'; export { Top } from './top'; diff --git a/src/resources/radar/email/security/top/tlds/index.ts b/src/resources/radar/email/security/top/tlds/index.ts index ca5e990ca0..3db5c6c624 100644 --- a/src/resources/radar/email/security/top/tlds/index.ts +++ b/src/resources/radar/email/security/top/tlds/index.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { MaliciousGetResponse, MaliciousGetParams, Malicious } from './malicious'; -export { SpamGetResponse, SpamGetParams, Spam } from './spam'; -export { SpoofGetResponse, SpoofGetParams, Spoof } from './spoof'; -export { TldGetResponse, TldGetParams, Tlds } from './tlds'; +export { Malicious, type MaliciousGetResponse, type MaliciousGetParams } from './malicious'; +export { Spam, type SpamGetResponse, type SpamGetParams } from './spam'; +export { Spoof, type SpoofGetResponse, type SpoofGetParams } from './spoof'; +export { Tlds, type TldGetResponse, type TldGetParams } from './tlds'; diff --git a/src/resources/radar/email/security/top/tlds/malicious.ts b/src/resources/radar/email/security/top/tlds/malicious.ts index 0b71dddc1b..9b88d6fbbd 100644 --- a/src/resources/radar/email/security/top/tlds/malicious.ts +++ b/src/resources/radar/email/security/top/tlds/malicious.ts @@ -3,8 +3,6 @@ import { APIResource } from '../../../../../../resource'; import { isRequestOptions } from '../../../../../../core'; import * as Core from '../../../../../../core'; -import * as MaliciousAPI from './malicious'; -import * as TopAPI from '../../../../http/top'; export class Malicious extends APIResource { /** @@ -39,7 +37,7 @@ export class Malicious extends APIResource { export interface MaliciousGetResponse { meta: MaliciousGetResponse.Meta; - top_0: Array; + top_0: Array; } export namespace MaliciousGetResponse { @@ -88,6 +86,12 @@ export namespace MaliciousGetResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } export interface MaliciousGetParams { @@ -154,7 +158,6 @@ export interface MaliciousGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3'>; } -export namespace Malicious { - export import MaliciousGetResponse = MaliciousAPI.MaliciousGetResponse; - export import MaliciousGetParams = MaliciousAPI.MaliciousGetParams; +export declare namespace Malicious { + export { type MaliciousGetResponse as MaliciousGetResponse, type MaliciousGetParams as MaliciousGetParams }; } diff --git a/src/resources/radar/email/security/top/tlds/spam.ts b/src/resources/radar/email/security/top/tlds/spam.ts index 0f4b92bb75..06035fa47d 100644 --- a/src/resources/radar/email/security/top/tlds/spam.ts +++ b/src/resources/radar/email/security/top/tlds/spam.ts @@ -3,12 +3,10 @@ import { APIResource } from '../../../../../../resource'; import { isRequestOptions } from '../../../../../../core'; import * as Core from '../../../../../../core'; -import * as SpamAPI from './spam'; -import * as TopAPI from '../../../../http/top'; export class Spam extends APIResource { /** - * Get the top TLDs by emails classified as Spam or not. + * Get the top TLDs by emails classified as spam or not. */ get( spam: 'SPAM' | 'NOT_SPAM', @@ -36,7 +34,7 @@ export class Spam extends APIResource { export interface SpamGetResponse { meta: SpamGetResponse.Meta; - top_0: Array; + top_0: Array; } export namespace SpamGetResponse { @@ -85,6 +83,12 @@ export namespace SpamGetResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } export interface SpamGetParams { @@ -151,7 +155,6 @@ export interface SpamGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3'>; } -export namespace Spam { - export import SpamGetResponse = SpamAPI.SpamGetResponse; - export import SpamGetParams = SpamAPI.SpamGetParams; +export declare namespace Spam { + export { type SpamGetResponse as SpamGetResponse, type SpamGetParams as SpamGetParams }; } diff --git a/src/resources/radar/email/security/top/tlds/spoof.ts b/src/resources/radar/email/security/top/tlds/spoof.ts index d20b8ddb28..5451d5c102 100644 --- a/src/resources/radar/email/security/top/tlds/spoof.ts +++ b/src/resources/radar/email/security/top/tlds/spoof.ts @@ -3,8 +3,6 @@ import { APIResource } from '../../../../../../resource'; import { isRequestOptions } from '../../../../../../core'; import * as Core from '../../../../../../core'; -import * as SpoofAPI from './spoof'; -import * as TopAPI from '../../../../http/top'; export class Spoof extends APIResource { /** @@ -36,7 +34,7 @@ export class Spoof extends APIResource { export interface SpoofGetResponse { meta: SpoofGetResponse.Meta; - top_0: Array; + top_0: Array; } export namespace SpoofGetResponse { @@ -85,6 +83,12 @@ export namespace SpoofGetResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } export interface SpoofGetParams { @@ -151,7 +155,6 @@ export interface SpoofGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3'>; } -export namespace Spoof { - export import SpoofGetResponse = SpoofAPI.SpoofGetResponse; - export import SpoofGetParams = SpoofAPI.SpoofGetParams; +export declare namespace Spoof { + export { type SpoofGetResponse as SpoofGetResponse, type SpoofGetParams as SpoofGetParams }; } diff --git a/src/resources/radar/email/security/top/tlds/tlds.ts b/src/resources/radar/email/security/top/tlds/tlds.ts index f14636b382..3968a4f3cb 100644 --- a/src/resources/radar/email/security/top/tlds/tlds.ts +++ b/src/resources/radar/email/security/top/tlds/tlds.ts @@ -3,11 +3,12 @@ import { APIResource } from '../../../../../../resource'; import { isRequestOptions } from '../../../../../../core'; import * as Core from '../../../../../../core'; -import * as TldsAPI from './tlds'; -import * as TopAPI from '../../../../http/top'; import * as MaliciousAPI from './malicious'; +import { Malicious, MaliciousGetParams, MaliciousGetResponse } from './malicious'; import * as SpamAPI from './spam'; +import { Spam, SpamGetParams, SpamGetResponse } from './spam'; import * as SpoofAPI from './spoof'; +import { Spoof, SpoofGetParams, SpoofGetResponse } from './spoof'; export class Tlds extends APIResource { malicious: MaliciousAPI.Malicious = new MaliciousAPI.Malicious(this._client); @@ -15,8 +16,8 @@ export class Tlds extends APIResource { spoof: SpoofAPI.Spoof = new SpoofAPI.Spoof(this._client); /** - * Get the top TLDs by email messages. Values are a percentage out of the total - * emails. + * Get the top TLDs by email messages. Values are a percentage out of total email + * volume. */ get(query?: TldGetParams, options?: Core.RequestOptions): Core.APIPromise; get(options?: Core.RequestOptions): Core.APIPromise; @@ -38,7 +39,7 @@ export class Tlds extends APIResource { export interface TldGetResponse { meta: TldGetResponse.Meta; - top_0: Array; + top_0: Array; } export namespace TldGetResponse { @@ -87,6 +88,12 @@ export namespace TldGetResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } export interface TldGetParams { @@ -153,16 +160,20 @@ export interface TldGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3'>; } -export namespace Tlds { - export import TldGetResponse = TldsAPI.TldGetResponse; - export import TldGetParams = TldsAPI.TldGetParams; - export import Malicious = MaliciousAPI.Malicious; - export import MaliciousGetResponse = MaliciousAPI.MaliciousGetResponse; - export import MaliciousGetParams = MaliciousAPI.MaliciousGetParams; - export import Spam = SpamAPI.Spam; - export import SpamGetResponse = SpamAPI.SpamGetResponse; - export import SpamGetParams = SpamAPI.SpamGetParams; - export import Spoof = SpoofAPI.Spoof; - export import SpoofGetResponse = SpoofAPI.SpoofGetResponse; - export import SpoofGetParams = SpoofAPI.SpoofGetParams; +Tlds.Malicious = Malicious; +Tlds.Spam = Spam; +Tlds.Spoof = Spoof; + +export declare namespace Tlds { + export { type TldGetResponse as TldGetResponse, type TldGetParams as TldGetParams }; + + export { + Malicious as Malicious, + type MaliciousGetResponse as MaliciousGetResponse, + type MaliciousGetParams as MaliciousGetParams, + }; + + export { Spam as Spam, type SpamGetResponse as SpamGetResponse, type SpamGetParams as SpamGetParams }; + + export { Spoof as Spoof, type SpoofGetResponse as SpoofGetResponse, type SpoofGetParams as SpoofGetParams }; } diff --git a/src/resources/radar/email/security/top/top.ts b/src/resources/radar/email/security/top/top.ts index 1ef8c26ab4..3d3814a796 100644 --- a/src/resources/radar/email/security/top/top.ts +++ b/src/resources/radar/email/security/top/top.ts @@ -2,13 +2,14 @@ import { APIResource } from '../../../../../resource'; import * as TldsAPI from './tlds/tlds'; +import { TldGetParams, TldGetResponse, Tlds } from './tlds/tlds'; export class Top extends APIResource { tlds: TldsAPI.Tlds = new TldsAPI.Tlds(this._client); } -export namespace Top { - export import Tlds = TldsAPI.Tlds; - export import TldGetResponse = TldsAPI.TldGetResponse; - export import TldGetParams = TldsAPI.TldGetParams; +Top.Tlds = Tlds; + +export declare namespace Top { + export { Tlds as Tlds, type TldGetResponse as TldGetResponse, type TldGetParams as TldGetParams }; } diff --git a/src/resources/radar/entities/asns.ts b/src/resources/radar/entities/asns.ts index 312e73da02..5585bae01b 100644 --- a/src/resources/radar/entities/asns.ts +++ b/src/resources/radar/entities/asns.ts @@ -3,11 +3,10 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as ASNsAPI from './asns'; export class ASNs extends APIResource { /** - * Gets a list of autonomous systems (AS). + * Get a list of autonomous systems (ASes). */ list(query?: ASNListParams, options?: Core.RequestOptions): Core.APIPromise; list(options?: Core.RequestOptions): Core.APIPromise; @@ -26,7 +25,7 @@ export class ASNs extends APIResource { } /** - * Get the requested autonomous system information. A confidence level below `5` + * Get the requested autonomous system information. (A confidence level below `5` * indicates a low level of confidence in the traffic data - normally this happens * because Cloudflare has a small amount of traffic from/to this AS). Population * estimates come from APNIC (refer to https://labs.apnic.net/?p=526). @@ -351,13 +350,15 @@ export interface ASNRelParams { format?: 'JSON' | 'CSV'; } -export namespace ASNs { - export import ASNListResponse = ASNsAPI.ASNListResponse; - export import ASNGetResponse = ASNsAPI.ASNGetResponse; - export import ASNIPResponse = ASNsAPI.ASNIPResponse; - export import ASNRelResponse = ASNsAPI.ASNRelResponse; - export import ASNListParams = ASNsAPI.ASNListParams; - export import ASNGetParams = ASNsAPI.ASNGetParams; - export import ASNIPParams = ASNsAPI.ASNIPParams; - export import ASNRelParams = ASNsAPI.ASNRelParams; +export declare namespace ASNs { + export { + type ASNListResponse as ASNListResponse, + type ASNGetResponse as ASNGetResponse, + type ASNIPResponse as ASNIPResponse, + type ASNRelResponse as ASNRelResponse, + type ASNListParams as ASNListParams, + type ASNGetParams as ASNGetParams, + type ASNIPParams as ASNIPParams, + type ASNRelParams as ASNRelParams, + }; } diff --git a/src/resources/radar/entities/entities.ts b/src/resources/radar/entities/entities.ts index 10f0c0cf40..474754c159 100644 --- a/src/resources/radar/entities/entities.ts +++ b/src/resources/radar/entities/entities.ts @@ -2,9 +2,26 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as EntitiesAPI from './entities'; import * as ASNsAPI from './asns'; +import { + ASNGetParams, + ASNGetResponse, + ASNIPParams, + ASNIPResponse, + ASNListParams, + ASNListResponse, + ASNRelParams, + ASNRelResponse, + ASNs, +} from './asns'; import * as LocationsAPI from './locations'; +import { + LocationGetParams, + LocationGetResponse, + LocationListParams, + LocationListResponse, + Locations, +} from './locations'; export class Entities extends APIResource { asns: ASNsAPI.ASNs = new ASNsAPI.ASNs(this._client); @@ -58,21 +75,29 @@ export interface EntityGetParams { format?: 'JSON' | 'CSV'; } -export namespace Entities { - export import EntityGetResponse = EntitiesAPI.EntityGetResponse; - export import EntityGetParams = EntitiesAPI.EntityGetParams; - export import ASNs = ASNsAPI.ASNs; - export import ASNListResponse = ASNsAPI.ASNListResponse; - export import ASNGetResponse = ASNsAPI.ASNGetResponse; - export import ASNIPResponse = ASNsAPI.ASNIPResponse; - export import ASNRelResponse = ASNsAPI.ASNRelResponse; - export import ASNListParams = ASNsAPI.ASNListParams; - export import ASNGetParams = ASNsAPI.ASNGetParams; - export import ASNIPParams = ASNsAPI.ASNIPParams; - export import ASNRelParams = ASNsAPI.ASNRelParams; - export import Locations = LocationsAPI.Locations; - export import LocationListResponse = LocationsAPI.LocationListResponse; - export import LocationGetResponse = LocationsAPI.LocationGetResponse; - export import LocationListParams = LocationsAPI.LocationListParams; - export import LocationGetParams = LocationsAPI.LocationGetParams; +Entities.ASNs = ASNs; +Entities.Locations = Locations; + +export declare namespace Entities { + export { type EntityGetResponse as EntityGetResponse, type EntityGetParams as EntityGetParams }; + + export { + ASNs as ASNs, + type ASNListResponse as ASNListResponse, + type ASNGetResponse as ASNGetResponse, + type ASNIPResponse as ASNIPResponse, + type ASNRelResponse as ASNRelResponse, + type ASNListParams as ASNListParams, + type ASNGetParams as ASNGetParams, + type ASNIPParams as ASNIPParams, + type ASNRelParams as ASNRelParams, + }; + + export { + Locations as Locations, + type LocationListResponse as LocationListResponse, + type LocationGetResponse as LocationGetResponse, + type LocationListParams as LocationListParams, + type LocationGetParams as LocationGetParams, + }; } diff --git a/src/resources/radar/entities/index.ts b/src/resources/radar/entities/index.ts index 2f29351748..2039fc458d 100644 --- a/src/resources/radar/entities/index.ts +++ b/src/resources/radar/entities/index.ts @@ -1,21 +1,21 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - ASNListResponse, - ASNGetResponse, - ASNIPResponse, - ASNRelResponse, - ASNListParams, - ASNGetParams, - ASNIPParams, - ASNRelParams, ASNs, + type ASNListResponse, + type ASNGetResponse, + type ASNIPResponse, + type ASNRelResponse, + type ASNListParams, + type ASNGetParams, + type ASNIPParams, + type ASNRelParams, } from './asns'; -export { EntityGetResponse, EntityGetParams, Entities } from './entities'; +export { Entities, type EntityGetResponse, type EntityGetParams } from './entities'; export { - LocationListResponse, - LocationGetResponse, - LocationListParams, - LocationGetParams, Locations, + type LocationListResponse, + type LocationGetResponse, + type LocationListParams, + type LocationGetParams, } from './locations'; diff --git a/src/resources/radar/entities/locations.ts b/src/resources/radar/entities/locations.ts index bec8eb9910..4077aa11ee 100644 --- a/src/resources/radar/entities/locations.ts +++ b/src/resources/radar/entities/locations.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as LocationsAPI from './locations'; export class Locations extends APIResource { /** @@ -26,8 +25,8 @@ export class Locations extends APIResource { } /** - * Get the requested location information. A confidence level below `5` indicates a - * low level of confidence in the traffic data - normally this happens because + * Get the requested location information. (A confidence level below `5` indicates + * a low level of confidence in the traffic data - normally this happens because * Cloudflare has a small amount of traffic from/to this location). */ get( @@ -119,9 +118,11 @@ export interface LocationGetParams { format?: 'JSON' | 'CSV'; } -export namespace Locations { - export import LocationListResponse = LocationsAPI.LocationListResponse; - export import LocationGetResponse = LocationsAPI.LocationGetResponse; - export import LocationListParams = LocationsAPI.LocationListParams; - export import LocationGetParams = LocationsAPI.LocationGetParams; +export declare namespace Locations { + export { + type LocationListResponse as LocationListResponse, + type LocationGetResponse as LocationGetResponse, + type LocationListParams as LocationListParams, + type LocationGetParams as LocationGetParams, + }; } diff --git a/src/resources/radar/http/ases/ases.ts b/src/resources/radar/http/ases/ases.ts index 30a61e3c04..acfad7ee67 100644 --- a/src/resources/radar/http/ases/ases.ts +++ b/src/resources/radar/http/ases/ases.ts @@ -3,15 +3,22 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as AsesAPI from './ases'; import * as BotClassAPI from './bot-class'; +import { BotClass, BotClassGetParams, BotClassGetResponse } from './bot-class'; import * as BrowserFamilyAPI from './browser-family'; +import { BrowserFamily, BrowserFamilyGetParams, BrowserFamilyGetResponse } from './browser-family'; import * as DeviceTypeAPI from './device-type'; +import { DeviceType, DeviceTypeGetParams, DeviceTypeGetResponse } from './device-type'; import * as HTTPMethodAPI from './http-method'; +import { HTTPMethod, HTTPMethodGetParams, HTTPMethodGetResponse } from './http-method'; import * as HTTPProtocolAPI from './http-protocol'; +import { HTTPProtocol, HTTPProtocolGetParams, HTTPProtocolGetResponse } from './http-protocol'; import * as IPVersionAPI from './ip-version'; +import { IPVersion, IPVersionGetParams, IPVersionGetResponse } from './ip-version'; import * as OSAPI from './os'; +import { OS, OSGetParams, OSGetResponse } from './os'; import * as TLSVersionAPI from './tls-version'; +import { TLSVersion, TLSVersionGetParams, TLSVersionGetResponse } from './tls-version'; export class Ases extends APIResource { botClass: BotClassAPI.BotClass = new BotClassAPI.BotClass(this._client); @@ -202,31 +209,59 @@ export interface AseGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace Ases { - export import AseGetResponse = AsesAPI.AseGetResponse; - export import AseGetParams = AsesAPI.AseGetParams; - export import BotClass = BotClassAPI.BotClass; - export import BotClassGetResponse = BotClassAPI.BotClassGetResponse; - export import BotClassGetParams = BotClassAPI.BotClassGetParams; - export import DeviceType = DeviceTypeAPI.DeviceType; - export import DeviceTypeGetResponse = DeviceTypeAPI.DeviceTypeGetResponse; - export import DeviceTypeGetParams = DeviceTypeAPI.DeviceTypeGetParams; - export import HTTPProtocol = HTTPProtocolAPI.HTTPProtocol; - export import HTTPProtocolGetResponse = HTTPProtocolAPI.HTTPProtocolGetResponse; - export import HTTPProtocolGetParams = HTTPProtocolAPI.HTTPProtocolGetParams; - export import HTTPMethod = HTTPMethodAPI.HTTPMethod; - export import HTTPMethodGetResponse = HTTPMethodAPI.HTTPMethodGetResponse; - export import HTTPMethodGetParams = HTTPMethodAPI.HTTPMethodGetParams; - export import IPVersion = IPVersionAPI.IPVersion; - export import IPVersionGetResponse = IPVersionAPI.IPVersionGetResponse; - export import IPVersionGetParams = IPVersionAPI.IPVersionGetParams; - export import OS = OSAPI.OS; - export import OSGetResponse = OSAPI.OSGetResponse; - export import OSGetParams = OSAPI.OSGetParams; - export import TLSVersion = TLSVersionAPI.TLSVersion; - export import TLSVersionGetResponse = TLSVersionAPI.TLSVersionGetResponse; - export import TLSVersionGetParams = TLSVersionAPI.TLSVersionGetParams; - export import BrowserFamily = BrowserFamilyAPI.BrowserFamily; - export import BrowserFamilyGetResponse = BrowserFamilyAPI.BrowserFamilyGetResponse; - export import BrowserFamilyGetParams = BrowserFamilyAPI.BrowserFamilyGetParams; +Ases.BotClass = BotClass; +Ases.DeviceType = DeviceType; +Ases.HTTPProtocol = HTTPProtocol; +Ases.HTTPMethod = HTTPMethod; +Ases.IPVersion = IPVersion; +Ases.OS = OS; +Ases.TLSVersion = TLSVersion; +Ases.BrowserFamily = BrowserFamily; + +export declare namespace Ases { + export { type AseGetResponse as AseGetResponse, type AseGetParams as AseGetParams }; + + export { + BotClass as BotClass, + type BotClassGetResponse as BotClassGetResponse, + type BotClassGetParams as BotClassGetParams, + }; + + export { + DeviceType as DeviceType, + type DeviceTypeGetResponse as DeviceTypeGetResponse, + type DeviceTypeGetParams as DeviceTypeGetParams, + }; + + export { + HTTPProtocol as HTTPProtocol, + type HTTPProtocolGetResponse as HTTPProtocolGetResponse, + type HTTPProtocolGetParams as HTTPProtocolGetParams, + }; + + export { + HTTPMethod as HTTPMethod, + type HTTPMethodGetResponse as HTTPMethodGetResponse, + type HTTPMethodGetParams as HTTPMethodGetParams, + }; + + export { + IPVersion as IPVersion, + type IPVersionGetResponse as IPVersionGetResponse, + type IPVersionGetParams as IPVersionGetParams, + }; + + export { OS as OS, type OSGetResponse as OSGetResponse, type OSGetParams as OSGetParams }; + + export { + TLSVersion as TLSVersion, + type TLSVersionGetResponse as TLSVersionGetResponse, + type TLSVersionGetParams as TLSVersionGetParams, + }; + + export { + BrowserFamily as BrowserFamily, + type BrowserFamilyGetResponse as BrowserFamilyGetResponse, + type BrowserFamilyGetParams as BrowserFamilyGetParams, + }; } diff --git a/src/resources/radar/http/ases/bot-class.ts b/src/resources/radar/http/ases/bot-class.ts index 6f0b6d84b7..acf4060d1d 100644 --- a/src/resources/radar/http/ases/bot-class.ts +++ b/src/resources/radar/http/ases/bot-class.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as BotClassAPI from './bot-class'; export class BotClass extends APIResource { /** @@ -190,7 +189,6 @@ export interface BotClassGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace BotClass { - export import BotClassGetResponse = BotClassAPI.BotClassGetResponse; - export import BotClassGetParams = BotClassAPI.BotClassGetParams; +export declare namespace BotClass { + export { type BotClassGetResponse as BotClassGetResponse, type BotClassGetParams as BotClassGetParams }; } diff --git a/src/resources/radar/http/ases/browser-family.ts b/src/resources/radar/http/ases/browser-family.ts index 61f6177eaa..0db19926e3 100644 --- a/src/resources/radar/http/ases/browser-family.ts +++ b/src/resources/radar/http/ases/browser-family.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as BrowserFamilyAPI from './browser-family'; export class BrowserFamily extends APIResource { /** @@ -189,7 +188,9 @@ export interface BrowserFamilyGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace BrowserFamily { - export import BrowserFamilyGetResponse = BrowserFamilyAPI.BrowserFamilyGetResponse; - export import BrowserFamilyGetParams = BrowserFamilyAPI.BrowserFamilyGetParams; +export declare namespace BrowserFamily { + export { + type BrowserFamilyGetResponse as BrowserFamilyGetResponse, + type BrowserFamilyGetParams as BrowserFamilyGetParams, + }; } diff --git a/src/resources/radar/http/ases/device-type.ts b/src/resources/radar/http/ases/device-type.ts index 07395dd5ee..e8a0b9864c 100644 --- a/src/resources/radar/http/ases/device-type.ts +++ b/src/resources/radar/http/ases/device-type.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as DeviceTypeAPI from './device-type'; export class DeviceType extends APIResource { /** @@ -189,7 +188,9 @@ export interface DeviceTypeGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace DeviceType { - export import DeviceTypeGetResponse = DeviceTypeAPI.DeviceTypeGetResponse; - export import DeviceTypeGetParams = DeviceTypeAPI.DeviceTypeGetParams; +export declare namespace DeviceType { + export { + type DeviceTypeGetResponse as DeviceTypeGetResponse, + type DeviceTypeGetParams as DeviceTypeGetParams, + }; } diff --git a/src/resources/radar/http/ases/http-method.ts b/src/resources/radar/http/ases/http-method.ts index b6e6efb3d0..9d59cc389f 100644 --- a/src/resources/radar/http/ases/http-method.ts +++ b/src/resources/radar/http/ases/http-method.ts @@ -3,12 +3,11 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as HTTPMethodAPI from './http-method'; export class HTTPMethod extends APIResource { /** * Get the top autonomous systems (AS), by HTTP traffic, of the requested HTTP - * protocol version. Values are a percentage out of the total traffic. + * version. Values are a percentage out of the total traffic. */ get( httpVersion: 'HTTPv1' | 'HTTPv2' | 'HTTPv3', @@ -189,7 +188,9 @@ export interface HTTPMethodGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace HTTPMethod { - export import HTTPMethodGetResponse = HTTPMethodAPI.HTTPMethodGetResponse; - export import HTTPMethodGetParams = HTTPMethodAPI.HTTPMethodGetParams; +export declare namespace HTTPMethod { + export { + type HTTPMethodGetResponse as HTTPMethodGetResponse, + type HTTPMethodGetParams as HTTPMethodGetParams, + }; } diff --git a/src/resources/radar/http/ases/http-protocol.ts b/src/resources/radar/http/ases/http-protocol.ts index fb2c9cb92b..1cae581232 100644 --- a/src/resources/radar/http/ases/http-protocol.ts +++ b/src/resources/radar/http/ases/http-protocol.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as HTTPProtocolAPI from './http-protocol'; export class HTTPProtocol extends APIResource { /** @@ -184,7 +183,9 @@ export interface HTTPProtocolGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace HTTPProtocol { - export import HTTPProtocolGetResponse = HTTPProtocolAPI.HTTPProtocolGetResponse; - export import HTTPProtocolGetParams = HTTPProtocolAPI.HTTPProtocolGetParams; +export declare namespace HTTPProtocol { + export { + type HTTPProtocolGetResponse as HTTPProtocolGetResponse, + type HTTPProtocolGetParams as HTTPProtocolGetParams, + }; } diff --git a/src/resources/radar/http/ases/index.ts b/src/resources/radar/http/ases/index.ts index badc76c9e0..ebcde47505 100644 --- a/src/resources/radar/http/ases/index.ts +++ b/src/resources/radar/http/ases/index.ts @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AseGetResponse, AseGetParams, Ases } from './ases'; -export { BotClassGetResponse, BotClassGetParams, BotClass } from './bot-class'; -export { BrowserFamilyGetResponse, BrowserFamilyGetParams, BrowserFamily } from './browser-family'; -export { DeviceTypeGetResponse, DeviceTypeGetParams, DeviceType } from './device-type'; -export { HTTPMethodGetResponse, HTTPMethodGetParams, HTTPMethod } from './http-method'; -export { HTTPProtocolGetResponse, HTTPProtocolGetParams, HTTPProtocol } from './http-protocol'; -export { IPVersionGetResponse, IPVersionGetParams, IPVersion } from './ip-version'; -export { OSGetResponse, OSGetParams, OS } from './os'; -export { TLSVersionGetResponse, TLSVersionGetParams, TLSVersion } from './tls-version'; +export { Ases, type AseGetResponse, type AseGetParams } from './ases'; +export { BotClass, type BotClassGetResponse, type BotClassGetParams } from './bot-class'; +export { BrowserFamily, type BrowserFamilyGetResponse, type BrowserFamilyGetParams } from './browser-family'; +export { DeviceType, type DeviceTypeGetResponse, type DeviceTypeGetParams } from './device-type'; +export { HTTPMethod, type HTTPMethodGetResponse, type HTTPMethodGetParams } from './http-method'; +export { HTTPProtocol, type HTTPProtocolGetResponse, type HTTPProtocolGetParams } from './http-protocol'; +export { IPVersion, type IPVersionGetResponse, type IPVersionGetParams } from './ip-version'; +export { OS, type OSGetResponse, type OSGetParams } from './os'; +export { TLSVersion, type TLSVersionGetResponse, type TLSVersionGetParams } from './tls-version'; diff --git a/src/resources/radar/http/ases/ip-version.ts b/src/resources/radar/http/ases/ip-version.ts index 6a897f7bb0..d956a1eef6 100644 --- a/src/resources/radar/http/ases/ip-version.ts +++ b/src/resources/radar/http/ases/ip-version.ts @@ -3,12 +3,11 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as IPVersionAPI from './ip-version'; export class IPVersion extends APIResource { /** - * Get the top autonomous systems, by HTTP traffic, of the requested IP protocol - * version. Values are a percentage out of the total traffic. + * Get the top autonomous systems, by HTTP traffic, of the requested IP version. + * Values are a percentage out of the total traffic. */ get( ipVersion: 'IPv4' | 'IPv6', @@ -186,7 +185,6 @@ export interface IPVersionGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace IPVersion { - export import IPVersionGetResponse = IPVersionAPI.IPVersionGetResponse; - export import IPVersionGetParams = IPVersionAPI.IPVersionGetParams; +export declare namespace IPVersion { + export { type IPVersionGetResponse as IPVersionGetResponse, type IPVersionGetParams as IPVersionGetParams }; } diff --git a/src/resources/radar/http/ases/os.ts b/src/resources/radar/http/ases/os.ts index 8000c8924a..68154baf46 100644 --- a/src/resources/radar/http/ases/os.ts +++ b/src/resources/radar/http/ases/os.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as OSAPI from './os'; export class OS extends APIResource { /** @@ -188,7 +187,6 @@ export interface OSGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace OS { - export import OSGetResponse = OSAPI.OSGetResponse; - export import OSGetParams = OSAPI.OSGetParams; +export declare namespace OS { + export { type OSGetResponse as OSGetResponse, type OSGetParams as OSGetParams }; } diff --git a/src/resources/radar/http/ases/tls-version.ts b/src/resources/radar/http/ases/tls-version.ts index ba737df4b7..a7e2ea72db 100644 --- a/src/resources/radar/http/ases/tls-version.ts +++ b/src/resources/radar/http/ases/tls-version.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as TLSVersionAPI from './tls-version'; export class TLSVersion extends APIResource { /** @@ -189,7 +188,9 @@ export interface TLSVersionGetParams { os?: Array<'WINDOWS' | 'MACOSX' | 'IOS' | 'ANDROID' | 'CHROMEOS' | 'LINUX' | 'SMART_TV'>; } -export namespace TLSVersion { - export import TLSVersionGetResponse = TLSVersionAPI.TLSVersionGetResponse; - export import TLSVersionGetParams = TLSVersionAPI.TLSVersionGetParams; +export declare namespace TLSVersion { + export { + type TLSVersionGetResponse as TLSVersionGetResponse, + type TLSVersionGetParams as TLSVersionGetParams, + }; } diff --git a/src/resources/radar/http/http.ts b/src/resources/radar/http/http.ts index e5d5e7cfd1..8a69086c20 100644 --- a/src/resources/radar/http/http.ts +++ b/src/resources/radar/http/http.ts @@ -3,21 +3,71 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as HTTPAPI from './http'; import * as SummaryAPI from './summary'; +import { + Summary, + SummaryBotClassParams, + SummaryBotClassResponse, + SummaryDeviceTypeParams, + SummaryDeviceTypeResponse, + SummaryHTTPProtocolParams, + SummaryHTTPProtocolResponse, + SummaryHTTPVersionParams, + SummaryHTTPVersionResponse, + SummaryIPVersionParams, + SummaryIPVersionResponse, + SummaryOSParams, + SummaryOSResponse, + SummaryPostQuantumParams, + SummaryPostQuantumResponse, + SummaryTLSVersionParams, + SummaryTLSVersionResponse, +} from './summary'; import * as TimeseriesGroupsAPI from './timeseries-groups'; +import { + TimeseriesGroupBotClassParams, + TimeseriesGroupBotClassResponse, + TimeseriesGroupBrowserFamilyParams, + TimeseriesGroupBrowserFamilyResponse, + TimeseriesGroupBrowserParams, + TimeseriesGroupBrowserResponse, + TimeseriesGroupDeviceTypeParams, + TimeseriesGroupDeviceTypeResponse, + TimeseriesGroupHTTPProtocolParams, + TimeseriesGroupHTTPProtocolResponse, + TimeseriesGroupHTTPVersionParams, + TimeseriesGroupHTTPVersionResponse, + TimeseriesGroupIPVersionParams, + TimeseriesGroupIPVersionResponse, + TimeseriesGroupOSParams, + TimeseriesGroupOSResponse, + TimeseriesGroupPostQuantumParams, + TimeseriesGroupPostQuantumResponse, + TimeseriesGroupTLSVersionParams, + TimeseriesGroupTLSVersionResponse, + TimeseriesGroups, +} from './timeseries-groups'; import * as TopAPI from './top'; +import { + Top, + TopBrowserFamilyParams, + TopBrowserFamilyResponse, + TopBrowserParams, + TopBrowserResponse, +} from './top'; import * as AsesAPI from './ases/ases'; +import { AseGetParams, AseGetResponse, Ases } from './ases/ases'; import * as LocationsAPI from './locations/locations'; +import { LocationGetParams, LocationGetResponse, Locations } from './locations/locations'; export class HTTP extends APIResource { - top: TopAPI.Top = new TopAPI.Top(this._client); locations: LocationsAPI.Locations = new LocationsAPI.Locations(this._client); ases: AsesAPI.Ases = new AsesAPI.Ases(this._client); summary: SummaryAPI.Summary = new SummaryAPI.Summary(this._client); timeseriesGroups: TimeseriesGroupsAPI.TimeseriesGroups = new TimeseriesGroupsAPI.TimeseriesGroups( this._client, ); + top: TopAPI.Top = new TopAPI.Top(this._client); /** * Get HTTP requests over time. @@ -119,6 +169,12 @@ export interface HTTPTimeseriesParams { */ asn?: Array; + /** + * Filter for bot class. Refer to + * [Bot classes](https://developers.cloudflare.com/radar/concepts/bot-classes/). + */ + botClass?: Array<'LIKELY_AUTOMATED' | 'LIKELY_HUMAN'>; + /** * Array of comma separated list of continents (alpha-2 continent codes). Start * with `-` to exclude from results. For example, `-EU,NA` excludes results from @@ -143,11 +199,31 @@ export interface HTTPTimeseriesParams { */ dateStart?: Array; + /** + * Filter for device type. + */ + deviceType?: Array<'DESKTOP' | 'MOBILE' | 'OTHER'>; + /** * Format results are returned in. */ format?: 'JSON' | 'CSV'; + /** + * Filter for http protocol. + */ + httpProtocol?: Array<'HTTP' | 'HTTPS'>; + + /** + * Filter for http version. + */ + httpVersion?: Array<'HTTPv1' | 'HTTPv2' | 'HTTPv3'>; + + /** + * Filter for ip version. + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -159,59 +235,93 @@ export interface HTTPTimeseriesParams { * Array of names that will be used to name the series in responses. */ name?: Array; + + /** + * Normalization method applied. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization?: 'PERCENTAGE_CHANGE' | 'MIN0_MAX'; + + /** + * Filter for os name. + */ + os?: Array<'WINDOWS' | 'MACOSX' | 'IOS' | 'ANDROID' | 'CHROMEOS' | 'LINUX' | 'SMART_TV'>; + + /** + * Filter for tls version. + */ + tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace HTTP { - export import HTTPTimeseriesResponse = HTTPAPI.HTTPTimeseriesResponse; - export import HTTPTimeseriesParams = HTTPAPI.HTTPTimeseriesParams; - export import Top = TopAPI.Top; - export import Browser = TopAPI.Browser; - export import TopBrowserFamiliesResponse = TopAPI.TopBrowserFamiliesResponse; - export import TopBrowsersResponse = TopAPI.TopBrowsersResponse; - export import TopBrowserFamiliesParams = TopAPI.TopBrowserFamiliesParams; - export import TopBrowsersParams = TopAPI.TopBrowsersParams; - export import Locations = LocationsAPI.Locations; - export import LocationGetResponse = LocationsAPI.LocationGetResponse; - export import LocationGetParams = LocationsAPI.LocationGetParams; - export import Ases = AsesAPI.Ases; - export import AseGetResponse = AsesAPI.AseGetResponse; - export import AseGetParams = AsesAPI.AseGetParams; - export import Summary = SummaryAPI.Summary; - export import SummaryBotClassResponse = SummaryAPI.SummaryBotClassResponse; - export import SummaryDeviceTypeResponse = SummaryAPI.SummaryDeviceTypeResponse; - export import SummaryHTTPProtocolResponse = SummaryAPI.SummaryHTTPProtocolResponse; - export import SummaryHTTPVersionResponse = SummaryAPI.SummaryHTTPVersionResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummaryOSResponse = SummaryAPI.SummaryOSResponse; - export import SummaryPostQuantumResponse = SummaryAPI.SummaryPostQuantumResponse; - export import SummaryTLSVersionResponse = SummaryAPI.SummaryTLSVersionResponse; - export import SummaryBotClassParams = SummaryAPI.SummaryBotClassParams; - export import SummaryDeviceTypeParams = SummaryAPI.SummaryDeviceTypeParams; - export import SummaryHTTPProtocolParams = SummaryAPI.SummaryHTTPProtocolParams; - export import SummaryHTTPVersionParams = SummaryAPI.SummaryHTTPVersionParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummaryOSParams = SummaryAPI.SummaryOSParams; - export import SummaryPostQuantumParams = SummaryAPI.SummaryPostQuantumParams; - export import SummaryTLSVersionParams = SummaryAPI.SummaryTLSVersionParams; - export import TimeseriesGroups = TimeseriesGroupsAPI.TimeseriesGroups; - export import TimeseriesGroupBotClassResponse = TimeseriesGroupsAPI.TimeseriesGroupBotClassResponse; - export import TimeseriesGroupBrowserResponse = TimeseriesGroupsAPI.TimeseriesGroupBrowserResponse; - export import TimeseriesGroupBrowserFamilyResponse = TimeseriesGroupsAPI.TimeseriesGroupBrowserFamilyResponse; - export import TimeseriesGroupDeviceTypeResponse = TimeseriesGroupsAPI.TimeseriesGroupDeviceTypeResponse; - export import TimeseriesGroupHTTPProtocolResponse = TimeseriesGroupsAPI.TimeseriesGroupHTTPProtocolResponse; - export import TimeseriesGroupHTTPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupHTTPVersionResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupOSResponse = TimeseriesGroupsAPI.TimeseriesGroupOSResponse; - export import TimeseriesGroupPostQuantumResponse = TimeseriesGroupsAPI.TimeseriesGroupPostQuantumResponse; - export import TimeseriesGroupTLSVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupTLSVersionResponse; - export import TimeseriesGroupBotClassParams = TimeseriesGroupsAPI.TimeseriesGroupBotClassParams; - export import TimeseriesGroupBrowserParams = TimeseriesGroupsAPI.TimeseriesGroupBrowserParams; - export import TimeseriesGroupBrowserFamilyParams = TimeseriesGroupsAPI.TimeseriesGroupBrowserFamilyParams; - export import TimeseriesGroupDeviceTypeParams = TimeseriesGroupsAPI.TimeseriesGroupDeviceTypeParams; - export import TimeseriesGroupHTTPProtocolParams = TimeseriesGroupsAPI.TimeseriesGroupHTTPProtocolParams; - export import TimeseriesGroupHTTPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupHTTPVersionParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupOSParams = TimeseriesGroupsAPI.TimeseriesGroupOSParams; - export import TimeseriesGroupPostQuantumParams = TimeseriesGroupsAPI.TimeseriesGroupPostQuantumParams; - export import TimeseriesGroupTLSVersionParams = TimeseriesGroupsAPI.TimeseriesGroupTLSVersionParams; +HTTP.Locations = Locations; +HTTP.Ases = Ases; +HTTP.Summary = Summary; +HTTP.TimeseriesGroups = TimeseriesGroups; +HTTP.Top = Top; + +export declare namespace HTTP { + export { + type HTTPTimeseriesResponse as HTTPTimeseriesResponse, + type HTTPTimeseriesParams as HTTPTimeseriesParams, + }; + + export { + Locations as Locations, + type LocationGetResponse as LocationGetResponse, + type LocationGetParams as LocationGetParams, + }; + + export { Ases as Ases, type AseGetResponse as AseGetResponse, type AseGetParams as AseGetParams }; + + export { + Summary as Summary, + type SummaryBotClassResponse as SummaryBotClassResponse, + type SummaryDeviceTypeResponse as SummaryDeviceTypeResponse, + type SummaryHTTPProtocolResponse as SummaryHTTPProtocolResponse, + type SummaryHTTPVersionResponse as SummaryHTTPVersionResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummaryOSResponse as SummaryOSResponse, + type SummaryPostQuantumResponse as SummaryPostQuantumResponse, + type SummaryTLSVersionResponse as SummaryTLSVersionResponse, + type SummaryBotClassParams as SummaryBotClassParams, + type SummaryDeviceTypeParams as SummaryDeviceTypeParams, + type SummaryHTTPProtocolParams as SummaryHTTPProtocolParams, + type SummaryHTTPVersionParams as SummaryHTTPVersionParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummaryOSParams as SummaryOSParams, + type SummaryPostQuantumParams as SummaryPostQuantumParams, + type SummaryTLSVersionParams as SummaryTLSVersionParams, + }; + + export { + TimeseriesGroups as TimeseriesGroups, + type TimeseriesGroupBotClassResponse as TimeseriesGroupBotClassResponse, + type TimeseriesGroupBrowserResponse as TimeseriesGroupBrowserResponse, + type TimeseriesGroupBrowserFamilyResponse as TimeseriesGroupBrowserFamilyResponse, + type TimeseriesGroupDeviceTypeResponse as TimeseriesGroupDeviceTypeResponse, + type TimeseriesGroupHTTPProtocolResponse as TimeseriesGroupHTTPProtocolResponse, + type TimeseriesGroupHTTPVersionResponse as TimeseriesGroupHTTPVersionResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupOSResponse as TimeseriesGroupOSResponse, + type TimeseriesGroupPostQuantumResponse as TimeseriesGroupPostQuantumResponse, + type TimeseriesGroupTLSVersionResponse as TimeseriesGroupTLSVersionResponse, + type TimeseriesGroupBotClassParams as TimeseriesGroupBotClassParams, + type TimeseriesGroupBrowserParams as TimeseriesGroupBrowserParams, + type TimeseriesGroupBrowserFamilyParams as TimeseriesGroupBrowserFamilyParams, + type TimeseriesGroupDeviceTypeParams as TimeseriesGroupDeviceTypeParams, + type TimeseriesGroupHTTPProtocolParams as TimeseriesGroupHTTPProtocolParams, + type TimeseriesGroupHTTPVersionParams as TimeseriesGroupHTTPVersionParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupOSParams as TimeseriesGroupOSParams, + type TimeseriesGroupPostQuantumParams as TimeseriesGroupPostQuantumParams, + type TimeseriesGroupTLSVersionParams as TimeseriesGroupTLSVersionParams, + }; + + export { + Top as Top, + type TopBrowserResponse as TopBrowserResponse, + type TopBrowserFamilyResponse as TopBrowserFamilyResponse, + type TopBrowserParams as TopBrowserParams, + type TopBrowserFamilyParams as TopBrowserFamilyParams, + }; } diff --git a/src/resources/radar/http/index.ts b/src/resources/radar/http/index.ts index 5771a8ead1..cd20232224 100644 --- a/src/resources/radar/http/index.ts +++ b/src/resources/radar/http/index.ts @@ -1,55 +1,54 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AseGetResponse, AseGetParams, Ases } from './ases/index'; +export { Ases, type AseGetResponse, type AseGetParams } from './ases/index'; +export { HTTP, type HTTPTimeseriesResponse, type HTTPTimeseriesParams } from './http'; +export { Locations, type LocationGetResponse, type LocationGetParams } from './locations/index'; export { - Browser, - TopBrowserFamiliesResponse, - TopBrowsersResponse, - TopBrowserFamiliesParams, - TopBrowsersParams, - Top, -} from './top'; -export { HTTPTimeseriesResponse, HTTPTimeseriesParams, HTTP } from './http'; -export { LocationGetResponse, LocationGetParams, Locations } from './locations/index'; -export { - SummaryBotClassResponse, - SummaryDeviceTypeResponse, - SummaryHTTPProtocolResponse, - SummaryHTTPVersionResponse, - SummaryIPVersionResponse, - SummaryOSResponse, - SummaryPostQuantumResponse, - SummaryTLSVersionResponse, - SummaryBotClassParams, - SummaryDeviceTypeParams, - SummaryHTTPProtocolParams, - SummaryHTTPVersionParams, - SummaryIPVersionParams, - SummaryOSParams, - SummaryPostQuantumParams, - SummaryTLSVersionParams, Summary, + type SummaryBotClassResponse, + type SummaryDeviceTypeResponse, + type SummaryHTTPProtocolResponse, + type SummaryHTTPVersionResponse, + type SummaryIPVersionResponse, + type SummaryOSResponse, + type SummaryPostQuantumResponse, + type SummaryTLSVersionResponse, + type SummaryBotClassParams, + type SummaryDeviceTypeParams, + type SummaryHTTPProtocolParams, + type SummaryHTTPVersionParams, + type SummaryIPVersionParams, + type SummaryOSParams, + type SummaryPostQuantumParams, + type SummaryTLSVersionParams, } from './summary'; export { - TimeseriesGroupBotClassResponse, - TimeseriesGroupBrowserResponse, - TimeseriesGroupBrowserFamilyResponse, - TimeseriesGroupDeviceTypeResponse, - TimeseriesGroupHTTPProtocolResponse, - TimeseriesGroupHTTPVersionResponse, - TimeseriesGroupIPVersionResponse, - TimeseriesGroupOSResponse, - TimeseriesGroupPostQuantumResponse, - TimeseriesGroupTLSVersionResponse, - TimeseriesGroupBotClassParams, - TimeseriesGroupBrowserParams, - TimeseriesGroupBrowserFamilyParams, - TimeseriesGroupDeviceTypeParams, - TimeseriesGroupHTTPProtocolParams, - TimeseriesGroupHTTPVersionParams, - TimeseriesGroupIPVersionParams, - TimeseriesGroupOSParams, - TimeseriesGroupPostQuantumParams, - TimeseriesGroupTLSVersionParams, TimeseriesGroups, + type TimeseriesGroupBotClassResponse, + type TimeseriesGroupBrowserResponse, + type TimeseriesGroupBrowserFamilyResponse, + type TimeseriesGroupDeviceTypeResponse, + type TimeseriesGroupHTTPProtocolResponse, + type TimeseriesGroupHTTPVersionResponse, + type TimeseriesGroupIPVersionResponse, + type TimeseriesGroupOSResponse, + type TimeseriesGroupPostQuantumResponse, + type TimeseriesGroupTLSVersionResponse, + type TimeseriesGroupBotClassParams, + type TimeseriesGroupBrowserParams, + type TimeseriesGroupBrowserFamilyParams, + type TimeseriesGroupDeviceTypeParams, + type TimeseriesGroupHTTPProtocolParams, + type TimeseriesGroupHTTPVersionParams, + type TimeseriesGroupIPVersionParams, + type TimeseriesGroupOSParams, + type TimeseriesGroupPostQuantumParams, + type TimeseriesGroupTLSVersionParams, } from './timeseries-groups'; +export { + Top, + type TopBrowserResponse, + type TopBrowserFamilyResponse, + type TopBrowserParams, + type TopBrowserFamilyParams, +} from './top'; diff --git a/src/resources/radar/http/locations/bot-class.ts b/src/resources/radar/http/locations/bot-class.ts index 4c31289d5a..862368003c 100644 --- a/src/resources/radar/http/locations/bot-class.ts +++ b/src/resources/radar/http/locations/bot-class.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as BotClassAPI from './bot-class'; export class BotClass extends APIResource { /** @@ -190,7 +189,6 @@ export interface BotClassGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace BotClass { - export import BotClassGetResponse = BotClassAPI.BotClassGetResponse; - export import BotClassGetParams = BotClassAPI.BotClassGetParams; +export declare namespace BotClass { + export { type BotClassGetResponse as BotClassGetResponse, type BotClassGetParams as BotClassGetParams }; } diff --git a/src/resources/radar/http/locations/browser-family.ts b/src/resources/radar/http/locations/browser-family.ts index 37d36ef603..4f852e9f1e 100644 --- a/src/resources/radar/http/locations/browser-family.ts +++ b/src/resources/radar/http/locations/browser-family.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as BrowserFamilyAPI from './browser-family'; export class BrowserFamily extends APIResource { /** @@ -189,7 +188,9 @@ export interface BrowserFamilyGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace BrowserFamily { - export import BrowserFamilyGetResponse = BrowserFamilyAPI.BrowserFamilyGetResponse; - export import BrowserFamilyGetParams = BrowserFamilyAPI.BrowserFamilyGetParams; +export declare namespace BrowserFamily { + export { + type BrowserFamilyGetResponse as BrowserFamilyGetResponse, + type BrowserFamilyGetParams as BrowserFamilyGetParams, + }; } diff --git a/src/resources/radar/http/locations/device-type.ts b/src/resources/radar/http/locations/device-type.ts index 509bee7038..f772e35ec0 100644 --- a/src/resources/radar/http/locations/device-type.ts +++ b/src/resources/radar/http/locations/device-type.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as DeviceTypeAPI from './device-type'; export class DeviceType extends APIResource { /** @@ -189,7 +188,9 @@ export interface DeviceTypeGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace DeviceType { - export import DeviceTypeGetResponse = DeviceTypeAPI.DeviceTypeGetResponse; - export import DeviceTypeGetParams = DeviceTypeAPI.DeviceTypeGetParams; +export declare namespace DeviceType { + export { + type DeviceTypeGetResponse as DeviceTypeGetResponse, + type DeviceTypeGetParams as DeviceTypeGetParams, + }; } diff --git a/src/resources/radar/http/locations/http-method.ts b/src/resources/radar/http/locations/http-method.ts index 27add60ece..480fa7b076 100644 --- a/src/resources/radar/http/locations/http-method.ts +++ b/src/resources/radar/http/locations/http-method.ts @@ -3,11 +3,10 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as HTTPMethodAPI from './http-method'; export class HTTPMethod extends APIResource { /** - * Get the top locations, by HTTP traffic, of the requested HTTP protocol. Values + * Get the top locations, by HTTP traffic, of the requested HTTP version. Values * are a percentage out of the total traffic. */ get( @@ -189,7 +188,9 @@ export interface HTTPMethodGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace HTTPMethod { - export import HTTPMethodGetResponse = HTTPMethodAPI.HTTPMethodGetResponse; - export import HTTPMethodGetParams = HTTPMethodAPI.HTTPMethodGetParams; +export declare namespace HTTPMethod { + export { + type HTTPMethodGetResponse as HTTPMethodGetResponse, + type HTTPMethodGetParams as HTTPMethodGetParams, + }; } diff --git a/src/resources/radar/http/locations/http-protocol.ts b/src/resources/radar/http/locations/http-protocol.ts index 10ae2ee392..92af13c25a 100644 --- a/src/resources/radar/http/locations/http-protocol.ts +++ b/src/resources/radar/http/locations/http-protocol.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as HTTPProtocolAPI from './http-protocol'; export class HTTPProtocol extends APIResource { /** @@ -184,7 +183,9 @@ export interface HTTPProtocolGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace HTTPProtocol { - export import HTTPProtocolGetResponse = HTTPProtocolAPI.HTTPProtocolGetResponse; - export import HTTPProtocolGetParams = HTTPProtocolAPI.HTTPProtocolGetParams; +export declare namespace HTTPProtocol { + export { + type HTTPProtocolGetResponse as HTTPProtocolGetResponse, + type HTTPProtocolGetParams as HTTPProtocolGetParams, + }; } diff --git a/src/resources/radar/http/locations/index.ts b/src/resources/radar/http/locations/index.ts index c1bf9e23b8..4af7184433 100644 --- a/src/resources/radar/http/locations/index.ts +++ b/src/resources/radar/http/locations/index.ts @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { BotClassGetResponse, BotClassGetParams, BotClass } from './bot-class'; -export { BrowserFamilyGetResponse, BrowserFamilyGetParams, BrowserFamily } from './browser-family'; -export { DeviceTypeGetResponse, DeviceTypeGetParams, DeviceType } from './device-type'; -export { HTTPMethodGetResponse, HTTPMethodGetParams, HTTPMethod } from './http-method'; -export { HTTPProtocolGetResponse, HTTPProtocolGetParams, HTTPProtocol } from './http-protocol'; -export { IPVersionGetResponse, IPVersionGetParams, IPVersion } from './ip-version'; -export { LocationGetResponse, LocationGetParams, Locations } from './locations'; -export { OSGetResponse, OSGetParams, OS } from './os'; -export { TLSVersionGetResponse, TLSVersionGetParams, TLSVersion } from './tls-version'; +export { BotClass, type BotClassGetResponse, type BotClassGetParams } from './bot-class'; +export { BrowserFamily, type BrowserFamilyGetResponse, type BrowserFamilyGetParams } from './browser-family'; +export { DeviceType, type DeviceTypeGetResponse, type DeviceTypeGetParams } from './device-type'; +export { HTTPMethod, type HTTPMethodGetResponse, type HTTPMethodGetParams } from './http-method'; +export { HTTPProtocol, type HTTPProtocolGetResponse, type HTTPProtocolGetParams } from './http-protocol'; +export { IPVersion, type IPVersionGetResponse, type IPVersionGetParams } from './ip-version'; +export { Locations, type LocationGetResponse, type LocationGetParams } from './locations'; +export { OS, type OSGetResponse, type OSGetParams } from './os'; +export { TLSVersion, type TLSVersionGetResponse, type TLSVersionGetParams } from './tls-version'; diff --git a/src/resources/radar/http/locations/ip-version.ts b/src/resources/radar/http/locations/ip-version.ts index bedb0719e9..bd3cbcd97b 100644 --- a/src/resources/radar/http/locations/ip-version.ts +++ b/src/resources/radar/http/locations/ip-version.ts @@ -3,12 +3,11 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as IPVersionAPI from './ip-version'; export class IPVersion extends APIResource { /** - * Get the top locations, by HTTP traffic, of the requested IP protocol version. - * Values are a percentage out of the total traffic. + * Get the top locations, by HTTP traffic, of the requested IP version. Values are + * a percentage out of the total traffic. */ get( ipVersion: 'IPv4' | 'IPv6', @@ -186,7 +185,6 @@ export interface IPVersionGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace IPVersion { - export import IPVersionGetResponse = IPVersionAPI.IPVersionGetResponse; - export import IPVersionGetParams = IPVersionAPI.IPVersionGetParams; +export declare namespace IPVersion { + export { type IPVersionGetResponse as IPVersionGetResponse, type IPVersionGetParams as IPVersionGetParams }; } diff --git a/src/resources/radar/http/locations/locations.ts b/src/resources/radar/http/locations/locations.ts index adb4f5788f..aa69ce07e3 100644 --- a/src/resources/radar/http/locations/locations.ts +++ b/src/resources/radar/http/locations/locations.ts @@ -3,15 +3,22 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as LocationsAPI from './locations'; import * as BotClassAPI from './bot-class'; +import { BotClass, BotClassGetParams, BotClassGetResponse } from './bot-class'; import * as BrowserFamilyAPI from './browser-family'; +import { BrowserFamily, BrowserFamilyGetParams, BrowserFamilyGetResponse } from './browser-family'; import * as DeviceTypeAPI from './device-type'; +import { DeviceType, DeviceTypeGetParams, DeviceTypeGetResponse } from './device-type'; import * as HTTPMethodAPI from './http-method'; +import { HTTPMethod, HTTPMethodGetParams, HTTPMethodGetResponse } from './http-method'; import * as HTTPProtocolAPI from './http-protocol'; +import { HTTPProtocol, HTTPProtocolGetParams, HTTPProtocolGetResponse } from './http-protocol'; import * as IPVersionAPI from './ip-version'; +import { IPVersion, IPVersionGetParams, IPVersionGetResponse } from './ip-version'; import * as OSAPI from './os'; +import { OS, OSGetParams, OSGetResponse } from './os'; import * as TLSVersionAPI from './tls-version'; +import { TLSVersion, TLSVersionGetParams, TLSVersionGetResponse } from './tls-version'; export class Locations extends APIResource { botClass: BotClassAPI.BotClass = new BotClassAPI.BotClass(this._client); @@ -202,31 +209,59 @@ export interface LocationGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace Locations { - export import LocationGetResponse = LocationsAPI.LocationGetResponse; - export import LocationGetParams = LocationsAPI.LocationGetParams; - export import BotClass = BotClassAPI.BotClass; - export import BotClassGetResponse = BotClassAPI.BotClassGetResponse; - export import BotClassGetParams = BotClassAPI.BotClassGetParams; - export import DeviceType = DeviceTypeAPI.DeviceType; - export import DeviceTypeGetResponse = DeviceTypeAPI.DeviceTypeGetResponse; - export import DeviceTypeGetParams = DeviceTypeAPI.DeviceTypeGetParams; - export import HTTPProtocol = HTTPProtocolAPI.HTTPProtocol; - export import HTTPProtocolGetResponse = HTTPProtocolAPI.HTTPProtocolGetResponse; - export import HTTPProtocolGetParams = HTTPProtocolAPI.HTTPProtocolGetParams; - export import HTTPMethod = HTTPMethodAPI.HTTPMethod; - export import HTTPMethodGetResponse = HTTPMethodAPI.HTTPMethodGetResponse; - export import HTTPMethodGetParams = HTTPMethodAPI.HTTPMethodGetParams; - export import IPVersion = IPVersionAPI.IPVersion; - export import IPVersionGetResponse = IPVersionAPI.IPVersionGetResponse; - export import IPVersionGetParams = IPVersionAPI.IPVersionGetParams; - export import OS = OSAPI.OS; - export import OSGetResponse = OSAPI.OSGetResponse; - export import OSGetParams = OSAPI.OSGetParams; - export import TLSVersion = TLSVersionAPI.TLSVersion; - export import TLSVersionGetResponse = TLSVersionAPI.TLSVersionGetResponse; - export import TLSVersionGetParams = TLSVersionAPI.TLSVersionGetParams; - export import BrowserFamily = BrowserFamilyAPI.BrowserFamily; - export import BrowserFamilyGetResponse = BrowserFamilyAPI.BrowserFamilyGetResponse; - export import BrowserFamilyGetParams = BrowserFamilyAPI.BrowserFamilyGetParams; +Locations.BotClass = BotClass; +Locations.DeviceType = DeviceType; +Locations.HTTPProtocol = HTTPProtocol; +Locations.HTTPMethod = HTTPMethod; +Locations.IPVersion = IPVersion; +Locations.OS = OS; +Locations.TLSVersion = TLSVersion; +Locations.BrowserFamily = BrowserFamily; + +export declare namespace Locations { + export { type LocationGetResponse as LocationGetResponse, type LocationGetParams as LocationGetParams }; + + export { + BotClass as BotClass, + type BotClassGetResponse as BotClassGetResponse, + type BotClassGetParams as BotClassGetParams, + }; + + export { + DeviceType as DeviceType, + type DeviceTypeGetResponse as DeviceTypeGetResponse, + type DeviceTypeGetParams as DeviceTypeGetParams, + }; + + export { + HTTPProtocol as HTTPProtocol, + type HTTPProtocolGetResponse as HTTPProtocolGetResponse, + type HTTPProtocolGetParams as HTTPProtocolGetParams, + }; + + export { + HTTPMethod as HTTPMethod, + type HTTPMethodGetResponse as HTTPMethodGetResponse, + type HTTPMethodGetParams as HTTPMethodGetParams, + }; + + export { + IPVersion as IPVersion, + type IPVersionGetResponse as IPVersionGetResponse, + type IPVersionGetParams as IPVersionGetParams, + }; + + export { OS as OS, type OSGetResponse as OSGetResponse, type OSGetParams as OSGetParams }; + + export { + TLSVersion as TLSVersion, + type TLSVersionGetResponse as TLSVersionGetResponse, + type TLSVersionGetParams as TLSVersionGetParams, + }; + + export { + BrowserFamily as BrowserFamily, + type BrowserFamilyGetResponse as BrowserFamilyGetResponse, + type BrowserFamilyGetParams as BrowserFamilyGetParams, + }; } diff --git a/src/resources/radar/http/locations/os.ts b/src/resources/radar/http/locations/os.ts index fc42106a10..b73f727137 100644 --- a/src/resources/radar/http/locations/os.ts +++ b/src/resources/radar/http/locations/os.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as OSAPI from './os'; export class OS extends APIResource { /** @@ -188,7 +187,6 @@ export interface OSGetParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace OS { - export import OSGetResponse = OSAPI.OSGetResponse; - export import OSGetParams = OSAPI.OSGetParams; +export declare namespace OS { + export { type OSGetResponse as OSGetResponse, type OSGetParams as OSGetParams }; } diff --git a/src/resources/radar/http/locations/tls-version.ts b/src/resources/radar/http/locations/tls-version.ts index 84e38f4ae3..0642feb239 100644 --- a/src/resources/radar/http/locations/tls-version.ts +++ b/src/resources/radar/http/locations/tls-version.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as TLSVersionAPI from './tls-version'; export class TLSVersion extends APIResource { /** @@ -189,7 +188,9 @@ export interface TLSVersionGetParams { os?: Array<'WINDOWS' | 'MACOSX' | 'IOS' | 'ANDROID' | 'CHROMEOS' | 'LINUX' | 'SMART_TV'>; } -export namespace TLSVersion { - export import TLSVersionGetResponse = TLSVersionAPI.TLSVersionGetResponse; - export import TLSVersionGetParams = TLSVersionAPI.TLSVersionGetParams; +export declare namespace TLSVersion { + export { + type TLSVersionGetResponse as TLSVersionGetResponse, + type TLSVersionGetParams as TLSVersionGetParams, + }; } diff --git a/src/resources/radar/http/summary.ts b/src/resources/radar/http/summary.ts index 246143509c..23d48b2c45 100644 --- a/src/resources/radar/http/summary.ts +++ b/src/resources/radar/http/summary.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as SummaryAPI from './summary'; export class Summary extends APIResource { /** @@ -33,7 +32,7 @@ export class Summary extends APIResource { /** * Percentage of Internet traffic generated by mobile, desktop, and other types of - * devices, over a given time period. + * devices over a given time period. */ deviceType( query?: SummaryDeviceTypeParams, @@ -55,7 +54,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of traffic per HTTP protocol over a given time period. + * Percentage distribution of traffic by HTTP protocol over a given time period. */ httpProtocol( query?: SummaryHTTPProtocolParams, @@ -77,8 +76,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of traffic per HTTP protocol version over a given time - * period. + * Percentage distribution of traffic by HTTP version over a given time period. */ httpVersion( query?: SummaryHTTPVersionParams, @@ -100,8 +98,8 @@ export class Summary extends APIResource { } /** - * Percentage distribution of Internet traffic based on IP protocol versions, such - * as IPv4 and IPv6, over a given time period. + * Percentage distribution of Internet traffic based on IP versions (IPv4 and IPv6) + * over a given time period. */ ipVersion( query?: SummaryIPVersionParams, @@ -143,7 +141,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of traffic per Post Quantum support over a given time + * Percentage distribution of traffic by post-quantum support over a given time * period. */ postQuantum( @@ -166,7 +164,7 @@ export class Summary extends APIResource { } /** - * Percentage distribution of traffic per TLS protocol version, over a given time + * Percentage distribution of traffic by TLS protocol version, over a given time * period. */ tlsVersion( @@ -1347,21 +1345,23 @@ export interface SummaryTLSVersionParams { os?: Array<'WINDOWS' | 'MACOSX' | 'IOS' | 'ANDROID' | 'CHROMEOS' | 'LINUX' | 'SMART_TV'>; } -export namespace Summary { - export import SummaryBotClassResponse = SummaryAPI.SummaryBotClassResponse; - export import SummaryDeviceTypeResponse = SummaryAPI.SummaryDeviceTypeResponse; - export import SummaryHTTPProtocolResponse = SummaryAPI.SummaryHTTPProtocolResponse; - export import SummaryHTTPVersionResponse = SummaryAPI.SummaryHTTPVersionResponse; - export import SummaryIPVersionResponse = SummaryAPI.SummaryIPVersionResponse; - export import SummaryOSResponse = SummaryAPI.SummaryOSResponse; - export import SummaryPostQuantumResponse = SummaryAPI.SummaryPostQuantumResponse; - export import SummaryTLSVersionResponse = SummaryAPI.SummaryTLSVersionResponse; - export import SummaryBotClassParams = SummaryAPI.SummaryBotClassParams; - export import SummaryDeviceTypeParams = SummaryAPI.SummaryDeviceTypeParams; - export import SummaryHTTPProtocolParams = SummaryAPI.SummaryHTTPProtocolParams; - export import SummaryHTTPVersionParams = SummaryAPI.SummaryHTTPVersionParams; - export import SummaryIPVersionParams = SummaryAPI.SummaryIPVersionParams; - export import SummaryOSParams = SummaryAPI.SummaryOSParams; - export import SummaryPostQuantumParams = SummaryAPI.SummaryPostQuantumParams; - export import SummaryTLSVersionParams = SummaryAPI.SummaryTLSVersionParams; +export declare namespace Summary { + export { + type SummaryBotClassResponse as SummaryBotClassResponse, + type SummaryDeviceTypeResponse as SummaryDeviceTypeResponse, + type SummaryHTTPProtocolResponse as SummaryHTTPProtocolResponse, + type SummaryHTTPVersionResponse as SummaryHTTPVersionResponse, + type SummaryIPVersionResponse as SummaryIPVersionResponse, + type SummaryOSResponse as SummaryOSResponse, + type SummaryPostQuantumResponse as SummaryPostQuantumResponse, + type SummaryTLSVersionResponse as SummaryTLSVersionResponse, + type SummaryBotClassParams as SummaryBotClassParams, + type SummaryDeviceTypeParams as SummaryDeviceTypeParams, + type SummaryHTTPProtocolParams as SummaryHTTPProtocolParams, + type SummaryHTTPVersionParams as SummaryHTTPVersionParams, + type SummaryIPVersionParams as SummaryIPVersionParams, + type SummaryOSParams as SummaryOSParams, + type SummaryPostQuantumParams as SummaryPostQuantumParams, + type SummaryTLSVersionParams as SummaryTLSVersionParams, + }; } diff --git a/src/resources/radar/http/timeseries-groups.ts b/src/resources/radar/http/timeseries-groups.ts index fe8a78cd19..8477127b16 100644 --- a/src/resources/radar/http/timeseries-groups.ts +++ b/src/resources/radar/http/timeseries-groups.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as TimeseriesGroupsAPI from './timeseries-groups'; export class TimeseriesGroups extends APIResource { /** @@ -79,7 +78,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Get a time series of the percentage distribution of traffic per device type. + * Get a time series of the percentage distribution of traffic by device type. */ deviceType( query?: TimeseriesGroupDeviceTypeParams, @@ -102,7 +101,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Get a time series of the percentage distribution of traffic per HTTP protocol. + * Get a time series of the percentage distribution of traffic by HTTP protocol. */ httpProtocol( query?: TimeseriesGroupHTTPProtocolParams, @@ -125,8 +124,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Get a time series of the percentage distribution of traffic per HTTP protocol - * version. + * Get a time series of the percentage distribution of traffic by HTTP version. */ httpVersion( query?: TimeseriesGroupHTTPVersionParams, @@ -149,8 +147,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Get a time series of the percentage distribution of traffic per IP protocol - * version. + * Get a time series of the percentage distribution of traffic by IP version. */ ipVersion( query?: TimeseriesGroupIPVersionParams, @@ -195,7 +192,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Get a time series of the percentage distribution of traffic per Post Quantum + * Get a time series of the percentage distribution of traffic by post-quantum * suport. */ postQuantum( @@ -219,7 +216,7 @@ export class TimeseriesGroups extends APIResource { } /** - * Get a time series of the percentage distribution of traffic per TLS protocol + * Get a time series of the percentage distribution of traffic by TLS protocol * version. */ tlsVersion( @@ -660,6 +657,12 @@ export interface TimeseriesGroupBrowserFamilyParams { */ ipVersion?: Array<'IPv4' | 'IPv6'>; + /** + * Limit the number of objects (eg browsers, verticals, etc) to the top items over + * the time range. + */ + limitPerGroup?: number; + /** * Array of comma separated list of locations (alpha-2 country codes). Start with * `-` to exclude from results. For example, `-US,PT` excludes results from the US, @@ -1304,25 +1307,27 @@ export interface TimeseriesGroupTLSVersionParams { os?: Array<'WINDOWS' | 'MACOSX' | 'IOS' | 'ANDROID' | 'CHROMEOS' | 'LINUX' | 'SMART_TV'>; } -export namespace TimeseriesGroups { - export import TimeseriesGroupBotClassResponse = TimeseriesGroupsAPI.TimeseriesGroupBotClassResponse; - export import TimeseriesGroupBrowserResponse = TimeseriesGroupsAPI.TimeseriesGroupBrowserResponse; - export import TimeseriesGroupBrowserFamilyResponse = TimeseriesGroupsAPI.TimeseriesGroupBrowserFamilyResponse; - export import TimeseriesGroupDeviceTypeResponse = TimeseriesGroupsAPI.TimeseriesGroupDeviceTypeResponse; - export import TimeseriesGroupHTTPProtocolResponse = TimeseriesGroupsAPI.TimeseriesGroupHTTPProtocolResponse; - export import TimeseriesGroupHTTPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupHTTPVersionResponse; - export import TimeseriesGroupIPVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupIPVersionResponse; - export import TimeseriesGroupOSResponse = TimeseriesGroupsAPI.TimeseriesGroupOSResponse; - export import TimeseriesGroupPostQuantumResponse = TimeseriesGroupsAPI.TimeseriesGroupPostQuantumResponse; - export import TimeseriesGroupTLSVersionResponse = TimeseriesGroupsAPI.TimeseriesGroupTLSVersionResponse; - export import TimeseriesGroupBotClassParams = TimeseriesGroupsAPI.TimeseriesGroupBotClassParams; - export import TimeseriesGroupBrowserParams = TimeseriesGroupsAPI.TimeseriesGroupBrowserParams; - export import TimeseriesGroupBrowserFamilyParams = TimeseriesGroupsAPI.TimeseriesGroupBrowserFamilyParams; - export import TimeseriesGroupDeviceTypeParams = TimeseriesGroupsAPI.TimeseriesGroupDeviceTypeParams; - export import TimeseriesGroupHTTPProtocolParams = TimeseriesGroupsAPI.TimeseriesGroupHTTPProtocolParams; - export import TimeseriesGroupHTTPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupHTTPVersionParams; - export import TimeseriesGroupIPVersionParams = TimeseriesGroupsAPI.TimeseriesGroupIPVersionParams; - export import TimeseriesGroupOSParams = TimeseriesGroupsAPI.TimeseriesGroupOSParams; - export import TimeseriesGroupPostQuantumParams = TimeseriesGroupsAPI.TimeseriesGroupPostQuantumParams; - export import TimeseriesGroupTLSVersionParams = TimeseriesGroupsAPI.TimeseriesGroupTLSVersionParams; +export declare namespace TimeseriesGroups { + export { + type TimeseriesGroupBotClassResponse as TimeseriesGroupBotClassResponse, + type TimeseriesGroupBrowserResponse as TimeseriesGroupBrowserResponse, + type TimeseriesGroupBrowserFamilyResponse as TimeseriesGroupBrowserFamilyResponse, + type TimeseriesGroupDeviceTypeResponse as TimeseriesGroupDeviceTypeResponse, + type TimeseriesGroupHTTPProtocolResponse as TimeseriesGroupHTTPProtocolResponse, + type TimeseriesGroupHTTPVersionResponse as TimeseriesGroupHTTPVersionResponse, + type TimeseriesGroupIPVersionResponse as TimeseriesGroupIPVersionResponse, + type TimeseriesGroupOSResponse as TimeseriesGroupOSResponse, + type TimeseriesGroupPostQuantumResponse as TimeseriesGroupPostQuantumResponse, + type TimeseriesGroupTLSVersionResponse as TimeseriesGroupTLSVersionResponse, + type TimeseriesGroupBotClassParams as TimeseriesGroupBotClassParams, + type TimeseriesGroupBrowserParams as TimeseriesGroupBrowserParams, + type TimeseriesGroupBrowserFamilyParams as TimeseriesGroupBrowserFamilyParams, + type TimeseriesGroupDeviceTypeParams as TimeseriesGroupDeviceTypeParams, + type TimeseriesGroupHTTPProtocolParams as TimeseriesGroupHTTPProtocolParams, + type TimeseriesGroupHTTPVersionParams as TimeseriesGroupHTTPVersionParams, + type TimeseriesGroupIPVersionParams as TimeseriesGroupIPVersionParams, + type TimeseriesGroupOSParams as TimeseriesGroupOSParams, + type TimeseriesGroupPostQuantumParams as TimeseriesGroupPostQuantumParams, + type TimeseriesGroupTLSVersionParams as TimeseriesGroupTLSVersionParams, + }; } diff --git a/src/resources/radar/http/top.ts b/src/resources/radar/http/top.ts index 160d6abd27..b1c8f5506b 100644 --- a/src/resources/radar/http/top.ts +++ b/src/resources/radar/http/top.ts @@ -3,66 +3,59 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as TopAPI from './top'; export class Top extends APIResource { /** - * Get the top user agents aggregated in families by HTTP traffic. Values are a - * percentage out of the total traffic. + * Get the top user agents by HTTP traffic. Values are a percentage out of the + * total traffic. */ - browserFamilies( - query?: TopBrowserFamiliesParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - browserFamilies(options?: Core.RequestOptions): Core.APIPromise; - browserFamilies( - query: TopBrowserFamiliesParams | Core.RequestOptions = {}, + browser(query?: TopBrowserParams, options?: Core.RequestOptions): Core.APIPromise; + browser(options?: Core.RequestOptions): Core.APIPromise; + browser( + query: TopBrowserParams | Core.RequestOptions = {}, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { if (isRequestOptions(query)) { - return this.browserFamilies({}, query); + return this.browser({}, query); } return ( - this._client.get('/radar/http/top/browser_families', { query, ...options }) as Core.APIPromise<{ - result: TopBrowserFamiliesResponse; + this._client.get('/radar/http/top/browser', { query, ...options }) as Core.APIPromise<{ + result: TopBrowserResponse; }> )._thenUnwrap((obj) => obj.result); } /** - * Get the top user agents by HTTP traffic. Values are a percentage out of the - * total traffic. + * Get the top user agents aggregated in families by HTTP traffic. Values are a + * percentage out of the total traffic. */ - browsers(query?: TopBrowsersParams, options?: Core.RequestOptions): Core.APIPromise; - browsers(options?: Core.RequestOptions): Core.APIPromise; - browsers( - query: TopBrowsersParams | Core.RequestOptions = {}, + browserFamily( + query?: TopBrowserFamilyParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + browserFamily(options?: Core.RequestOptions): Core.APIPromise; + browserFamily( + query: TopBrowserFamilyParams | Core.RequestOptions = {}, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { if (isRequestOptions(query)) { - return this.browsers({}, query); + return this.browserFamily({}, query); } return ( - this._client.get('/radar/http/top/browsers', { query, ...options }) as Core.APIPromise<{ - result: TopBrowsersResponse; + this._client.get('/radar/http/top/browser_family', { query, ...options }) as Core.APIPromise<{ + result: TopBrowserFamilyResponse; }> )._thenUnwrap((obj) => obj.result); } } -export interface Browser { - name: string; +export interface TopBrowserResponse { + meta: TopBrowserResponse.Meta; - value: string; + top_0: Array; } -export interface TopBrowserFamiliesResponse { - meta: TopBrowserFamiliesResponse.Meta; - - top_0: Array; -} - -export namespace TopBrowserFamiliesResponse { +export namespace TopBrowserResponse { export interface Meta { dateRange: Array; @@ -108,15 +101,21 @@ export namespace TopBrowserFamiliesResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } -export interface TopBrowsersResponse { - meta: TopBrowsersResponse.Meta; +export interface TopBrowserFamilyResponse { + meta: TopBrowserFamilyResponse.Meta; - top_0: Array; + top_0: Array; } -export namespace TopBrowsersResponse { +export namespace TopBrowserFamilyResponse { export interface Meta { dateRange: Array; @@ -162,9 +161,15 @@ export namespace TopBrowsersResponse { } } } + + export interface Top0 { + name: string; + + value: string; + } } -export interface TopBrowserFamiliesParams { +export interface TopBrowserParams { /** * Array of comma separated list of ASNs, start with `-` to exclude from results. * For example, `-174, 3356` excludes results from AS174, but includes results from @@ -260,7 +265,7 @@ export interface TopBrowserFamiliesParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export interface TopBrowsersParams { +export interface TopBrowserFamilyParams { /** * Array of comma separated list of ASNs, start with `-` to exclude from results. * For example, `-174, 3356` excludes results from AS174, but includes results from @@ -356,10 +361,11 @@ export interface TopBrowsersParams { tlsVersion?: Array<'TLSv1_0' | 'TLSv1_1' | 'TLSv1_2' | 'TLSv1_3' | 'TLSvQUIC'>; } -export namespace Top { - export import Browser = TopAPI.Browser; - export import TopBrowserFamiliesResponse = TopAPI.TopBrowserFamiliesResponse; - export import TopBrowsersResponse = TopAPI.TopBrowsersResponse; - export import TopBrowserFamiliesParams = TopAPI.TopBrowserFamiliesParams; - export import TopBrowsersParams = TopAPI.TopBrowsersParams; +export declare namespace Top { + export { + type TopBrowserResponse as TopBrowserResponse, + type TopBrowserFamilyResponse as TopBrowserFamilyResponse, + type TopBrowserParams as TopBrowserParams, + type TopBrowserFamilyParams as TopBrowserFamilyParams, + }; } diff --git a/src/resources/radar/index.ts b/src/resources/radar/index.ts index c76b32f68d..d121093d06 100644 --- a/src/resources/radar/index.ts +++ b/src/resources/radar/index.ts @@ -1,42 +1,49 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AS112TimeseriesResponse, AS112TimeseriesParams, AS112 } from './as112/index'; -export { Annotations } from './annotations/index'; +export { AI } from './ai/index'; +export { AS112, type AS112TimeseriesResponse, type AS112TimeseriesParams } from './as112/index'; +export { Annotations, type AnnotationListResponse, type AnnotationListParams } from './annotations/index'; export { Attacks } from './attacks/index'; -export { BGPTimeseriesResponse, BGPTimeseriesParams, BGP } from './bgp/index'; +export { BGP, type BGPTimeseriesResponse, type BGPTimeseriesParams } from './bgp/index'; export { DNS } from './dns/index'; export { - DatasetListResponse, - DatasetDownloadResponse, - DatasetGetResponse, - DatasetListParams, - DatasetDownloadParams, Datasets, + type DatasetListResponse, + type DatasetDownloadResponse, + type DatasetGetResponse, + type DatasetListParams, + type DatasetDownloadParams, } from './datasets'; -export { EntityGetResponse, EntityGetParams, Entities } from './entities/index'; -export { HTTPTimeseriesResponse, HTTPTimeseriesParams, HTTP } from './http/index'; -export { NetflowTimeseriesResponse, NetflowTimeseriesParams, Netflows } from './netflows/index'; +export { Email, type RadarEmailSeries, type RadarEmailSummary } from './email/index'; +export { Entities, type EntityGetResponse, type EntityGetParams } from './entities/index'; +export { HTTP, type HTTPTimeseriesResponse, type HTTPTimeseriesParams } from './http/index'; +export { + Netflows, + type NetflowSummaryResponse, + type NetflowTimeseriesResponse, + type NetflowSummaryParams, + type NetflowTimeseriesParams, +} from './netflows/index'; export { Quality } from './quality/index'; export { Radar } from './radar'; -export { RadarEmailSeries, RadarEmailSummary, Email } from './email/index'; export { - RankingTimeseriesGroupsResponse, - RankingTopResponse, - RankingTimeseriesGroupsParams, - RankingTopParams, Ranking, + type RankingTimeseriesGroupsResponse, + type RankingTopResponse, + type RankingTimeseriesGroupsParams, + type RankingTopParams, } from './ranking/index'; -export { SearchGlobalResponse, SearchGlobalParams, Search } from './search'; +export { Search, type SearchGlobalResponse, type SearchGlobalParams } from './search'; export { - TCPResetsTimeoutSummaryResponse, - TCPResetsTimeoutTimeseriesGroupsResponse, - TCPResetsTimeoutSummaryParams, - TCPResetsTimeoutTimeseriesGroupsParams, TCPResetsTimeouts, + type TCPResetsTimeoutSummaryResponse, + type TCPResetsTimeoutTimeseriesGroupsResponse, + type TCPResetsTimeoutSummaryParams, + type TCPResetsTimeoutTimeseriesGroupsParams, } from './tcp-resets-timeouts'; export { - TrafficAnomalyGetResponse, - TrafficAnomalyGetParams, TrafficAnomalies, + type TrafficAnomalyGetResponse, + type TrafficAnomalyGetParams, } from './traffic-anomalies/index'; export { VerifiedBots } from './verified-bots/index'; diff --git a/src/resources/radar/netflows/index.ts b/src/resources/radar/netflows/index.ts index 4bd2c40b2d..cceee75f9d 100644 --- a/src/resources/radar/netflows/index.ts +++ b/src/resources/radar/netflows/index.ts @@ -1,4 +1,16 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { NetflowTimeseriesResponse, NetflowTimeseriesParams, Netflows } from './netflows'; -export { TopAsesResponse, TopLocationsResponse, TopAsesParams, TopLocationsParams, Top } from './top'; +export { + Netflows, + type NetflowSummaryResponse, + type NetflowTimeseriesResponse, + type NetflowSummaryParams, + type NetflowTimeseriesParams, +} from './netflows'; +export { + Top, + type TopAsesResponse, + type TopLocationsResponse, + type TopAsesParams, + type TopLocationsParams, +} from './top'; diff --git a/src/resources/radar/netflows/netflows.ts b/src/resources/radar/netflows/netflows.ts index 95ea7403b7..a73c6ad75b 100644 --- a/src/resources/radar/netflows/netflows.ts +++ b/src/resources/radar/netflows/netflows.ts @@ -3,12 +3,35 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as NetflowsAPI from './netflows'; import * as TopAPI from './top'; +import { Top, TopAsesParams, TopAsesResponse, TopLocationsParams, TopLocationsResponse } from './top'; export class Netflows extends APIResource { top: TopAPI.Top = new TopAPI.Top(this._client); + /** + * Percentage distribution of HTTP vs other protocols traffic over a given time + * period. + */ + summary( + query?: NetflowSummaryParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + summary(options?: Core.RequestOptions): Core.APIPromise; + summary( + query: NetflowSummaryParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summary({}, query); + } + return ( + this._client.get('/radar/netflows/summary', { query, ...options }) as Core.APIPromise<{ + result: NetflowSummaryResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + /** * Get network traffic change over time. Visit * https://en.wikipedia.org/wiki/NetFlow for more information on NetFlows. @@ -33,6 +56,64 @@ export class Netflows extends APIResource { } } +export interface NetflowSummaryResponse { + meta: NetflowSummaryResponse.Meta; + + summary_0: NetflowSummaryResponse.Summary0; +} + +export namespace NetflowSummaryResponse { + export interface Meta { + dateRange: Array; + + confidenceInfo?: Meta.ConfidenceInfo; + } + + export namespace Meta { + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface ConfidenceInfo { + annotations?: Array; + + level?: number; + } + + export namespace ConfidenceInfo { + export interface Annotation { + dataSource: string; + + description: string; + + eventType: string; + + isInstantaneous: boolean; + + endTime?: string; + + linkedUrl?: string; + + startTime?: string; + } + } + } + + export interface Summary0 { + HTTP: string; + + OTHER: string; + } +} + export interface NetflowTimeseriesResponse { meta: NetflowTimeseriesResponse.Meta; @@ -95,6 +176,56 @@ export namespace NetflowTimeseriesResponse { } } +export interface NetflowSummaryParams { + /** + * Array of comma separated list of ASNs, start with `-` to exclude from results. + * For example, `-174, 3356` excludes results from AS174, but includes results from + * AS3356. + */ + asn?: Array; + + /** + * Array of comma separated list of continents (alpha-2 continent codes). Start + * with `-` to exclude from results. For example, `-EU,NA` excludes results from + * Europe, but includes results from North America. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * For example, use `7d` and `7dControl` to compare this week with the previous + * week. Use this parameter or set specific start and end dates (`dateStart` and + * `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Array of datetimes to filter the start of a series. + */ + dateStart?: Array; + + /** + * Format results are returned in. + */ + format?: 'JSON' | 'CSV'; + + /** + * Array of comma separated list of locations (alpha-2 country codes). Start with + * `-` to exclude from results. For example, `-US,PT` excludes results from the US, + * but includes results from PT. + */ + location?: Array; + + /** + * Array of names that will be used to name the series in responses. + */ + name?: Array; +} + export interface NetflowTimeseriesParams { /** * Aggregation interval results should be returned in (for example, in 15 minutes @@ -163,12 +294,21 @@ export interface NetflowTimeseriesParams { product?: Array<'HTTP' | 'ALL'>; } -export namespace Netflows { - export import NetflowTimeseriesResponse = NetflowsAPI.NetflowTimeseriesResponse; - export import NetflowTimeseriesParams = NetflowsAPI.NetflowTimeseriesParams; - export import Top = TopAPI.Top; - export import TopAsesResponse = TopAPI.TopAsesResponse; - export import TopLocationsResponse = TopAPI.TopLocationsResponse; - export import TopAsesParams = TopAPI.TopAsesParams; - export import TopLocationsParams = TopAPI.TopLocationsParams; +Netflows.Top = Top; + +export declare namespace Netflows { + export { + type NetflowSummaryResponse as NetflowSummaryResponse, + type NetflowTimeseriesResponse as NetflowTimeseriesResponse, + type NetflowSummaryParams as NetflowSummaryParams, + type NetflowTimeseriesParams as NetflowTimeseriesParams, + }; + + export { + Top as Top, + type TopAsesResponse as TopAsesResponse, + type TopLocationsResponse as TopLocationsResponse, + type TopAsesParams as TopAsesParams, + type TopLocationsParams as TopLocationsParams, + }; } diff --git a/src/resources/radar/netflows/top.ts b/src/resources/radar/netflows/top.ts index fa6cdd037f..ada69f9272 100644 --- a/src/resources/radar/netflows/top.ts +++ b/src/resources/radar/netflows/top.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as TopAPI from './top'; export class Top extends APIResource { /** @@ -185,9 +184,11 @@ export interface TopLocationsParams { name?: Array; } -export namespace Top { - export import TopAsesResponse = TopAPI.TopAsesResponse; - export import TopLocationsResponse = TopAPI.TopLocationsResponse; - export import TopAsesParams = TopAPI.TopAsesParams; - export import TopLocationsParams = TopAPI.TopLocationsParams; +export declare namespace Top { + export { + type TopAsesResponse as TopAsesResponse, + type TopLocationsResponse as TopLocationsResponse, + type TopAsesParams as TopAsesParams, + type TopLocationsParams as TopLocationsParams, + }; } diff --git a/src/resources/radar/quality/index.ts b/src/resources/radar/quality/index.ts index 91a4c8f82a..9a5330e30a 100644 --- a/src/resources/radar/quality/index.ts +++ b/src/resources/radar/quality/index.ts @@ -1,17 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - IQISummaryResponse, - IQITimeseriesGroupsResponse, - IQISummaryParams, - IQITimeseriesGroupsParams, IQI, + type IQISummaryResponse, + type IQITimeseriesGroupsResponse, + type IQISummaryParams, + type IQITimeseriesGroupsParams, } from './iqi'; export { Quality } from './quality'; export { - SpeedHistogramResponse, - SpeedSummaryResponse, - SpeedHistogramParams, - SpeedSummaryParams, Speed, + type SpeedHistogramResponse, + type SpeedSummaryResponse, + type SpeedHistogramParams, + type SpeedSummaryParams, } from './speed/index'; diff --git a/src/resources/radar/quality/iqi.ts b/src/resources/radar/quality/iqi.ts index b12f6c1298..06fad05efc 100644 --- a/src/resources/radar/quality/iqi.ts +++ b/src/resources/radar/quality/iqi.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as IQIAPI from './iqi'; export class IQI extends APIResource { /** @@ -237,9 +236,11 @@ export interface IQITimeseriesGroupsParams { name?: Array; } -export namespace IQI { - export import IQISummaryResponse = IQIAPI.IQISummaryResponse; - export import IQITimeseriesGroupsResponse = IQIAPI.IQITimeseriesGroupsResponse; - export import IQISummaryParams = IQIAPI.IQISummaryParams; - export import IQITimeseriesGroupsParams = IQIAPI.IQITimeseriesGroupsParams; +export declare namespace IQI { + export { + type IQISummaryResponse as IQISummaryResponse, + type IQITimeseriesGroupsResponse as IQITimeseriesGroupsResponse, + type IQISummaryParams as IQISummaryParams, + type IQITimeseriesGroupsParams as IQITimeseriesGroupsParams, + }; } diff --git a/src/resources/radar/quality/quality.ts b/src/resources/radar/quality/quality.ts index d1836e4e82..ecab431d24 100644 --- a/src/resources/radar/quality/quality.ts +++ b/src/resources/radar/quality/quality.ts @@ -2,22 +2,44 @@ import { APIResource } from '../../../resource'; import * as IQIAPI from './iqi'; +import { + IQI, + IQISummaryParams, + IQISummaryResponse, + IQITimeseriesGroupsParams, + IQITimeseriesGroupsResponse, +} from './iqi'; import * as SpeedAPI from './speed/speed'; +import { + Speed, + SpeedHistogramParams, + SpeedHistogramResponse, + SpeedSummaryParams, + SpeedSummaryResponse, +} from './speed/speed'; export class Quality extends APIResource { iqi: IQIAPI.IQI = new IQIAPI.IQI(this._client); speed: SpeedAPI.Speed = new SpeedAPI.Speed(this._client); } -export namespace Quality { - export import IQI = IQIAPI.IQI; - export import IQISummaryResponse = IQIAPI.IQISummaryResponse; - export import IQITimeseriesGroupsResponse = IQIAPI.IQITimeseriesGroupsResponse; - export import IQISummaryParams = IQIAPI.IQISummaryParams; - export import IQITimeseriesGroupsParams = IQIAPI.IQITimeseriesGroupsParams; - export import Speed = SpeedAPI.Speed; - export import SpeedHistogramResponse = SpeedAPI.SpeedHistogramResponse; - export import SpeedSummaryResponse = SpeedAPI.SpeedSummaryResponse; - export import SpeedHistogramParams = SpeedAPI.SpeedHistogramParams; - export import SpeedSummaryParams = SpeedAPI.SpeedSummaryParams; +Quality.IQI = IQI; +Quality.Speed = Speed; + +export declare namespace Quality { + export { + IQI as IQI, + type IQISummaryResponse as IQISummaryResponse, + type IQITimeseriesGroupsResponse as IQITimeseriesGroupsResponse, + type IQISummaryParams as IQISummaryParams, + type IQITimeseriesGroupsParams as IQITimeseriesGroupsParams, + }; + + export { + Speed as Speed, + type SpeedHistogramResponse as SpeedHistogramResponse, + type SpeedSummaryResponse as SpeedSummaryResponse, + type SpeedHistogramParams as SpeedHistogramParams, + type SpeedSummaryParams as SpeedSummaryParams, + }; } diff --git a/src/resources/radar/quality/speed/index.ts b/src/resources/radar/quality/speed/index.ts index 23181ef5d4..9a8a0c8e81 100644 --- a/src/resources/radar/quality/speed/index.ts +++ b/src/resources/radar/quality/speed/index.ts @@ -1,10 +1,16 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - SpeedHistogramResponse, - SpeedSummaryResponse, - SpeedHistogramParams, - SpeedSummaryParams, Speed, + type SpeedHistogramResponse, + type SpeedSummaryResponse, + type SpeedHistogramParams, + type SpeedSummaryParams, } from './speed'; -export { TopAsesResponse, TopLocationsResponse, TopAsesParams, TopLocationsParams, Top } from './top'; +export { + Top, + type TopAsesResponse, + type TopLocationsResponse, + type TopAsesParams, + type TopLocationsParams, +} from './top'; diff --git a/src/resources/radar/quality/speed/speed.ts b/src/resources/radar/quality/speed/speed.ts index 97721d9399..7fc18b213d 100644 --- a/src/resources/radar/quality/speed/speed.ts +++ b/src/resources/radar/quality/speed/speed.ts @@ -3,8 +3,8 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as SpeedAPI from './speed'; import * as TopAPI from './top'; +import { Top, TopAsesParams, TopAsesResponse, TopLocationsParams, TopLocationsResponse } from './top'; export class Speed extends APIResource { top: TopAPI.Top = new TopAPI.Top(this._client); @@ -227,14 +227,21 @@ export interface SpeedSummaryParams { name?: Array; } -export namespace Speed { - export import SpeedHistogramResponse = SpeedAPI.SpeedHistogramResponse; - export import SpeedSummaryResponse = SpeedAPI.SpeedSummaryResponse; - export import SpeedHistogramParams = SpeedAPI.SpeedHistogramParams; - export import SpeedSummaryParams = SpeedAPI.SpeedSummaryParams; - export import Top = TopAPI.Top; - export import TopAsesResponse = TopAPI.TopAsesResponse; - export import TopLocationsResponse = TopAPI.TopLocationsResponse; - export import TopAsesParams = TopAPI.TopAsesParams; - export import TopLocationsParams = TopAPI.TopLocationsParams; +Speed.Top = Top; + +export declare namespace Speed { + export { + type SpeedHistogramResponse as SpeedHistogramResponse, + type SpeedSummaryResponse as SpeedSummaryResponse, + type SpeedHistogramParams as SpeedHistogramParams, + type SpeedSummaryParams as SpeedSummaryParams, + }; + + export { + Top as Top, + type TopAsesResponse as TopAsesResponse, + type TopLocationsResponse as TopLocationsResponse, + type TopAsesParams as TopAsesParams, + type TopLocationsParams as TopLocationsParams, + }; } diff --git a/src/resources/radar/quality/speed/top.ts b/src/resources/radar/quality/speed/top.ts index c28c7dc659..bbfe641ccc 100644 --- a/src/resources/radar/quality/speed/top.ts +++ b/src/resources/radar/quality/speed/top.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../../resource'; import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as TopAPI from './top'; export class Top extends APIResource { /** @@ -317,9 +316,11 @@ export interface TopLocationsParams { reverse?: boolean; } -export namespace Top { - export import TopAsesResponse = TopAPI.TopAsesResponse; - export import TopLocationsResponse = TopAPI.TopLocationsResponse; - export import TopAsesParams = TopAPI.TopAsesParams; - export import TopLocationsParams = TopAPI.TopLocationsParams; +export declare namespace Top { + export { + type TopAsesResponse as TopAsesResponse, + type TopLocationsResponse as TopLocationsResponse, + type TopAsesParams as TopAsesParams, + type TopLocationsParams as TopLocationsParams, + }; } diff --git a/src/resources/radar/radar.ts b/src/resources/radar/radar.ts index 038030f0fd..d7634e0786 100644 --- a/src/resources/radar/radar.ts +++ b/src/resources/radar/radar.ts @@ -2,23 +2,71 @@ import { APIResource } from '../../resource'; import * as DatasetsAPI from './datasets'; +import { + DatasetDownloadParams, + DatasetDownloadResponse, + DatasetGetResponse, + DatasetListParams, + DatasetListResponse, + Datasets, +} from './datasets'; import * as SearchAPI from './search'; +import { Search, SearchGlobalParams, SearchGlobalResponse } from './search'; import * as TCPResetsTimeoutsAPI from './tcp-resets-timeouts'; +import { + TCPResetsTimeoutSummaryParams, + TCPResetsTimeoutSummaryResponse, + TCPResetsTimeoutTimeseriesGroupsParams, + TCPResetsTimeoutTimeseriesGroupsResponse, + TCPResetsTimeouts, +} from './tcp-resets-timeouts'; +import * as AIAPI from './ai/ai'; +import { AI } from './ai/ai'; import * as AnnotationsAPI from './annotations/annotations'; +import { AnnotationListParams, AnnotationListResponse, Annotations } from './annotations/annotations'; import * as AS112API from './as112/as112'; +import { AS112, AS112TimeseriesParams, AS112TimeseriesResponse } from './as112/as112'; import * as AttacksAPI from './attacks/attacks'; +import { Attacks } from './attacks/attacks'; import * as BGPAPI from './bgp/bgp'; +import { BGP, BGPTimeseriesParams, BGPTimeseriesResponse } from './bgp/bgp'; import * as DNSAPI from './dns/dns'; +import { DNS } from './dns/dns'; import * as EmailAPI from './email/email'; +import { Email, RadarEmailSeries, RadarEmailSummary } from './email/email'; import * as EntitiesAPI from './entities/entities'; +import { Entities, EntityGetParams, EntityGetResponse } from './entities/entities'; import * as HTTPAPI from './http/http'; +import { HTTP, HTTPTimeseriesParams, HTTPTimeseriesResponse } from './http/http'; import * as NetflowsAPI from './netflows/netflows'; +import { + NetflowSummaryParams, + NetflowSummaryResponse, + NetflowTimeseriesParams, + NetflowTimeseriesResponse, + Netflows, +} from './netflows/netflows'; import * as QualityAPI from './quality/quality'; +import { Quality } from './quality/quality'; import * as RankingAPI from './ranking/ranking'; +import { + Ranking, + RankingTimeseriesGroupsParams, + RankingTimeseriesGroupsResponse, + RankingTopParams, + RankingTopResponse, +} from './ranking/ranking'; import * as TrafficAnomaliesAPI from './traffic-anomalies/traffic-anomalies'; +import { + TrafficAnomalies, + TrafficAnomalyGetParams, + TrafficAnomalyGetResponse, +} from './traffic-anomalies/traffic-anomalies'; import * as VerifiedBotsAPI from './verified-bots/verified-bots'; +import { VerifiedBots } from './verified-bots/verified-bots'; export class Radar extends APIResource { + ai: AIAPI.AI = new AIAPI.AI(this._client); annotations: AnnotationsAPI.Annotations = new AnnotationsAPI.Annotations(this._client); bgp: BGPAPI.BGP = new BGPAPI.BGP(this._client); datasets: DatasetsAPI.Datasets = new DatasetsAPI.Datasets(this._client); @@ -41,50 +89,113 @@ export class Radar extends APIResource { ); } -export namespace Radar { - export import Annotations = AnnotationsAPI.Annotations; - export import BGP = BGPAPI.BGP; - export import BGPTimeseriesResponse = BGPAPI.BGPTimeseriesResponse; - export import BGPTimeseriesParams = BGPAPI.BGPTimeseriesParams; - export import Datasets = DatasetsAPI.Datasets; - export import DatasetListResponse = DatasetsAPI.DatasetListResponse; - export import DatasetDownloadResponse = DatasetsAPI.DatasetDownloadResponse; - export import DatasetGetResponse = DatasetsAPI.DatasetGetResponse; - export import DatasetListParams = DatasetsAPI.DatasetListParams; - export import DatasetDownloadParams = DatasetsAPI.DatasetDownloadParams; - export import DNS = DNSAPI.DNS; - export import Netflows = NetflowsAPI.Netflows; - export import NetflowTimeseriesResponse = NetflowsAPI.NetflowTimeseriesResponse; - export import NetflowTimeseriesParams = NetflowsAPI.NetflowTimeseriesParams; - export import Search = SearchAPI.Search; - export import SearchGlobalResponse = SearchAPI.SearchGlobalResponse; - export import SearchGlobalParams = SearchAPI.SearchGlobalParams; - export import VerifiedBots = VerifiedBotsAPI.VerifiedBots; - export import AS112 = AS112API.AS112; - export import AS112TimeseriesResponse = AS112API.AS112TimeseriesResponse; - export import AS112TimeseriesParams = AS112API.AS112TimeseriesParams; - export import Email = EmailAPI.Email; - export import RadarEmailSeries = EmailAPI.RadarEmailSeries; - export import RadarEmailSummary = EmailAPI.RadarEmailSummary; - export import Attacks = AttacksAPI.Attacks; - export import Entities = EntitiesAPI.Entities; - export import EntityGetResponse = EntitiesAPI.EntityGetResponse; - export import EntityGetParams = EntitiesAPI.EntityGetParams; - export import HTTP = HTTPAPI.HTTP; - export import HTTPTimeseriesResponse = HTTPAPI.HTTPTimeseriesResponse; - export import HTTPTimeseriesParams = HTTPAPI.HTTPTimeseriesParams; - export import Quality = QualityAPI.Quality; - export import Ranking = RankingAPI.Ranking; - export import RankingTimeseriesGroupsResponse = RankingAPI.RankingTimeseriesGroupsResponse; - export import RankingTopResponse = RankingAPI.RankingTopResponse; - export import RankingTimeseriesGroupsParams = RankingAPI.RankingTimeseriesGroupsParams; - export import RankingTopParams = RankingAPI.RankingTopParams; - export import TrafficAnomalies = TrafficAnomaliesAPI.TrafficAnomalies; - export import TrafficAnomalyGetResponse = TrafficAnomaliesAPI.TrafficAnomalyGetResponse; - export import TrafficAnomalyGetParams = TrafficAnomaliesAPI.TrafficAnomalyGetParams; - export import TCPResetsTimeouts = TCPResetsTimeoutsAPI.TCPResetsTimeouts; - export import TCPResetsTimeoutSummaryResponse = TCPResetsTimeoutsAPI.TCPResetsTimeoutSummaryResponse; - export import TCPResetsTimeoutTimeseriesGroupsResponse = TCPResetsTimeoutsAPI.TCPResetsTimeoutTimeseriesGroupsResponse; - export import TCPResetsTimeoutSummaryParams = TCPResetsTimeoutsAPI.TCPResetsTimeoutSummaryParams; - export import TCPResetsTimeoutTimeseriesGroupsParams = TCPResetsTimeoutsAPI.TCPResetsTimeoutTimeseriesGroupsParams; +Radar.AI = AI; +Radar.Annotations = Annotations; +Radar.BGP = BGP; +Radar.Datasets = Datasets; +Radar.DNS = DNS; +Radar.Netflows = Netflows; +Radar.Search = Search; +Radar.VerifiedBots = VerifiedBots; +Radar.AS112 = AS112; +Radar.Email = Email; +Radar.Attacks = Attacks; +Radar.Entities = Entities; +Radar.HTTP = HTTP; +Radar.Quality = Quality; +Radar.Ranking = Ranking; +Radar.TrafficAnomalies = TrafficAnomalies; +Radar.TCPResetsTimeouts = TCPResetsTimeouts; + +export declare namespace Radar { + export { AI as AI }; + + export { + Annotations as Annotations, + type AnnotationListResponse as AnnotationListResponse, + type AnnotationListParams as AnnotationListParams, + }; + + export { + BGP as BGP, + type BGPTimeseriesResponse as BGPTimeseriesResponse, + type BGPTimeseriesParams as BGPTimeseriesParams, + }; + + export { + Datasets as Datasets, + type DatasetListResponse as DatasetListResponse, + type DatasetDownloadResponse as DatasetDownloadResponse, + type DatasetGetResponse as DatasetGetResponse, + type DatasetListParams as DatasetListParams, + type DatasetDownloadParams as DatasetDownloadParams, + }; + + export { DNS as DNS }; + + export { + Netflows as Netflows, + type NetflowSummaryResponse as NetflowSummaryResponse, + type NetflowTimeseriesResponse as NetflowTimeseriesResponse, + type NetflowSummaryParams as NetflowSummaryParams, + type NetflowTimeseriesParams as NetflowTimeseriesParams, + }; + + export { + Search as Search, + type SearchGlobalResponse as SearchGlobalResponse, + type SearchGlobalParams as SearchGlobalParams, + }; + + export { VerifiedBots as VerifiedBots }; + + export { + AS112 as AS112, + type AS112TimeseriesResponse as AS112TimeseriesResponse, + type AS112TimeseriesParams as AS112TimeseriesParams, + }; + + export { + Email as Email, + type RadarEmailSeries as RadarEmailSeries, + type RadarEmailSummary as RadarEmailSummary, + }; + + export { Attacks as Attacks }; + + export { + Entities as Entities, + type EntityGetResponse as EntityGetResponse, + type EntityGetParams as EntityGetParams, + }; + + export { + HTTP as HTTP, + type HTTPTimeseriesResponse as HTTPTimeseriesResponse, + type HTTPTimeseriesParams as HTTPTimeseriesParams, + }; + + export { Quality as Quality }; + + export { + Ranking as Ranking, + type RankingTimeseriesGroupsResponse as RankingTimeseriesGroupsResponse, + type RankingTopResponse as RankingTopResponse, + type RankingTimeseriesGroupsParams as RankingTimeseriesGroupsParams, + type RankingTopParams as RankingTopParams, + }; + + export { + TrafficAnomalies as TrafficAnomalies, + type TrafficAnomalyGetResponse as TrafficAnomalyGetResponse, + type TrafficAnomalyGetParams as TrafficAnomalyGetParams, + }; + + export { + TCPResetsTimeouts as TCPResetsTimeouts, + type TCPResetsTimeoutSummaryResponse as TCPResetsTimeoutSummaryResponse, + type TCPResetsTimeoutTimeseriesGroupsResponse as TCPResetsTimeoutTimeseriesGroupsResponse, + type TCPResetsTimeoutSummaryParams as TCPResetsTimeoutSummaryParams, + type TCPResetsTimeoutTimeseriesGroupsParams as TCPResetsTimeoutTimeseriesGroupsParams, + }; } diff --git a/src/resources/radar/ranking/domain.ts b/src/resources/radar/ranking/domain.ts index 63c3d14ccb..c9414f5038 100644 --- a/src/resources/radar/ranking/domain.ts +++ b/src/resources/radar/ranking/domain.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as DomainAPI from './domain'; export class Domain extends APIResource { /** @@ -82,6 +81,11 @@ export interface DomainGetParams { */ format?: 'JSON' | 'CSV'; + /** + * Include top locations in the response. + */ + includeTopLocations?: boolean; + /** * Limit the number of objects in the response. */ @@ -98,7 +102,6 @@ export interface DomainGetParams { rankingType?: 'POPULAR' | 'TRENDING_RISE' | 'TRENDING_STEADY'; } -export namespace Domain { - export import DomainGetResponse = DomainAPI.DomainGetResponse; - export import DomainGetParams = DomainAPI.DomainGetParams; +export declare namespace Domain { + export { type DomainGetResponse as DomainGetResponse, type DomainGetParams as DomainGetParams }; } diff --git a/src/resources/radar/ranking/index.ts b/src/resources/radar/ranking/index.ts index 8712f0452c..baf7f19d56 100644 --- a/src/resources/radar/ranking/index.ts +++ b/src/resources/radar/ranking/index.ts @@ -1,10 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { DomainGetResponse, DomainGetParams, Domain } from './domain'; +export { Domain, type DomainGetResponse, type DomainGetParams } from './domain'; export { - RankingTimeseriesGroupsResponse, - RankingTopResponse, - RankingTimeseriesGroupsParams, - RankingTopParams, Ranking, + type RankingTimeseriesGroupsResponse, + type RankingTopResponse, + type RankingTimeseriesGroupsParams, + type RankingTopParams, } from './ranking'; diff --git a/src/resources/radar/ranking/ranking.ts b/src/resources/radar/ranking/ranking.ts index e1480a1fdb..56b6b4fcb7 100644 --- a/src/resources/radar/ranking/ranking.ts +++ b/src/resources/radar/ranking/ranking.ts @@ -3,8 +3,8 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as RankingAPI from './ranking'; import * as DomainAPI from './domain'; +import { Domain, DomainGetParams, DomainGetResponse } from './domain'; export class Ranking extends APIResource { domain: DomainAPI.Domain = new DomainAPI.Domain(this._client); @@ -207,12 +207,19 @@ export interface RankingTopParams { rankingType?: 'POPULAR' | 'TRENDING_RISE' | 'TRENDING_STEADY'; } -export namespace Ranking { - export import RankingTimeseriesGroupsResponse = RankingAPI.RankingTimeseriesGroupsResponse; - export import RankingTopResponse = RankingAPI.RankingTopResponse; - export import RankingTimeseriesGroupsParams = RankingAPI.RankingTimeseriesGroupsParams; - export import RankingTopParams = RankingAPI.RankingTopParams; - export import Domain = DomainAPI.Domain; - export import DomainGetResponse = DomainAPI.DomainGetResponse; - export import DomainGetParams = DomainAPI.DomainGetParams; +Ranking.Domain = Domain; + +export declare namespace Ranking { + export { + type RankingTimeseriesGroupsResponse as RankingTimeseriesGroupsResponse, + type RankingTopResponse as RankingTopResponse, + type RankingTimeseriesGroupsParams as RankingTimeseriesGroupsParams, + type RankingTopParams as RankingTopParams, + }; + + export { + Domain as Domain, + type DomainGetResponse as DomainGetResponse, + type DomainGetParams as DomainGetParams, + }; } diff --git a/src/resources/radar/search.ts b/src/resources/radar/search.ts index cc0bd31f45..e8dcaa5a6a 100644 --- a/src/resources/radar/search.ts +++ b/src/resources/radar/search.ts @@ -2,11 +2,10 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SearchAPI from './search'; export class Search extends APIResource { /** - * Lets you search for locations, autonomous systems (AS) and reports. + * Lets you search for locations, autonomous systems (ASes), and reports. */ global(query: SearchGlobalParams, options?: Core.RequestOptions): Core.APIPromise { return ( @@ -63,7 +62,6 @@ export interface SearchGlobalParams { limitPerGroup?: number; } -export namespace Search { - export import SearchGlobalResponse = SearchAPI.SearchGlobalResponse; - export import SearchGlobalParams = SearchAPI.SearchGlobalParams; +export declare namespace Search { + export { type SearchGlobalResponse as SearchGlobalResponse, type SearchGlobalParams as SearchGlobalParams }; } diff --git a/src/resources/radar/tcp-resets-timeouts.ts b/src/resources/radar/tcp-resets-timeouts.ts index 05b12d1e2d..c101e0732e 100644 --- a/src/resources/radar/tcp-resets-timeouts.ts +++ b/src/resources/radar/tcp-resets-timeouts.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as TCPResetsTimeoutsAPI from './tcp-resets-timeouts'; export class TCPResetsTimeouts extends APIResource { /** @@ -193,33 +192,14 @@ export namespace TCPResetsTimeoutTimeseriesGroupsResponse { } export interface Serie0 { - /** - * Connection resets within the first 10 packets from the client, but after the - * server has received multiple data packets. - */ later_in_flow: Array; - /** - * All other connections. - */ no_match: Array; - /** - * Connection resets or timeouts after the server received both a SYN packet and an - * ACK packet, meaning the connection was successfully established. - */ post_ack: Array; - /** - * Connection resets or timeouts after the server received a packet with PSH flag - * set, following connection establishment. - */ post_psh: Array; - /** - * Connection resets or timeouts after the server received only a single SYN - * packet. - */ post_syn: Array; timestamps: Array; @@ -333,9 +313,11 @@ export interface TCPResetsTimeoutTimeseriesGroupsParams { name?: Array; } -export namespace TCPResetsTimeouts { - export import TCPResetsTimeoutSummaryResponse = TCPResetsTimeoutsAPI.TCPResetsTimeoutSummaryResponse; - export import TCPResetsTimeoutTimeseriesGroupsResponse = TCPResetsTimeoutsAPI.TCPResetsTimeoutTimeseriesGroupsResponse; - export import TCPResetsTimeoutSummaryParams = TCPResetsTimeoutsAPI.TCPResetsTimeoutSummaryParams; - export import TCPResetsTimeoutTimeseriesGroupsParams = TCPResetsTimeoutsAPI.TCPResetsTimeoutTimeseriesGroupsParams; +export declare namespace TCPResetsTimeouts { + export { + type TCPResetsTimeoutSummaryResponse as TCPResetsTimeoutSummaryResponse, + type TCPResetsTimeoutTimeseriesGroupsResponse as TCPResetsTimeoutTimeseriesGroupsResponse, + type TCPResetsTimeoutSummaryParams as TCPResetsTimeoutSummaryParams, + type TCPResetsTimeoutTimeseriesGroupsParams as TCPResetsTimeoutTimeseriesGroupsParams, + }; } diff --git a/src/resources/radar/traffic-anomalies/index.ts b/src/resources/radar/traffic-anomalies/index.ts index e858e79a73..77a5579b0d 100644 --- a/src/resources/radar/traffic-anomalies/index.ts +++ b/src/resources/radar/traffic-anomalies/index.ts @@ -1,4 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { LocationGetResponse, LocationGetParams, Locations } from './locations'; -export { TrafficAnomalyGetResponse, TrafficAnomalyGetParams, TrafficAnomalies } from './traffic-anomalies'; +export { Locations, type LocationGetResponse, type LocationGetParams } from './locations'; +export { + TrafficAnomalies, + type TrafficAnomalyGetResponse, + type TrafficAnomalyGetParams, +} from './traffic-anomalies'; diff --git a/src/resources/radar/traffic-anomalies/locations.ts b/src/resources/radar/traffic-anomalies/locations.ts index d9a47f375f..96d4ff5428 100644 --- a/src/resources/radar/traffic-anomalies/locations.ts +++ b/src/resources/radar/traffic-anomalies/locations.ts @@ -3,11 +3,10 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as LocationsAPI from './locations'; export class Locations extends APIResource { /** - * Internet traffic anomalies are signals that might point to an outage, These + * Internet traffic anomalies are signals that might point to an outage. These * alerts are automatically detected by Radar and then manually verified by our * team. This endpoint returns the sum of alerts grouped by location. */ @@ -72,7 +71,6 @@ export interface LocationGetParams { status?: 'VERIFIED' | 'UNVERIFIED'; } -export namespace Locations { - export import LocationGetResponse = LocationsAPI.LocationGetResponse; - export import LocationGetParams = LocationsAPI.LocationGetParams; +export declare namespace Locations { + export { type LocationGetResponse as LocationGetResponse, type LocationGetParams as LocationGetParams }; } diff --git a/src/resources/radar/traffic-anomalies/traffic-anomalies.ts b/src/resources/radar/traffic-anomalies/traffic-anomalies.ts index 202f42bc72..6fb2b431ee 100644 --- a/src/resources/radar/traffic-anomalies/traffic-anomalies.ts +++ b/src/resources/radar/traffic-anomalies/traffic-anomalies.ts @@ -3,14 +3,14 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as TrafficAnomaliesAPI from './traffic-anomalies'; import * as LocationsAPI from './locations'; +import { LocationGetParams, LocationGetResponse, Locations as LocationsAPILocations } from './locations'; export class TrafficAnomalies extends APIResource { locations: LocationsAPI.Locations = new LocationsAPI.Locations(this._client); /** - * Internet traffic anomalies are signals that might point to an outage, These + * Internet traffic anomalies are signals that might point to an outage. These * alerts are automatically detected by Radar and then manually verified by our * team. This endpoint returns the latest alerts. */ @@ -127,10 +127,17 @@ export interface TrafficAnomalyGetParams { status?: 'VERIFIED' | 'UNVERIFIED'; } -export namespace TrafficAnomalies { - export import TrafficAnomalyGetResponse = TrafficAnomaliesAPI.TrafficAnomalyGetResponse; - export import TrafficAnomalyGetParams = TrafficAnomaliesAPI.TrafficAnomalyGetParams; - export import Locations = LocationsAPI.Locations; - export import LocationGetResponse = LocationsAPI.LocationGetResponse; - export import LocationGetParams = LocationsAPI.LocationGetParams; +TrafficAnomalies.Locations = LocationsAPILocations; + +export declare namespace TrafficAnomalies { + export { + type TrafficAnomalyGetResponse as TrafficAnomalyGetResponse, + type TrafficAnomalyGetParams as TrafficAnomalyGetParams, + }; + + export { + LocationsAPILocations as Locations, + type LocationGetResponse as LocationGetResponse, + type LocationGetParams as LocationGetParams, + }; } diff --git a/src/resources/radar/verified-bots/index.ts b/src/resources/radar/verified-bots/index.ts index 5c1332dfe1..49f218000e 100644 --- a/src/resources/radar/verified-bots/index.ts +++ b/src/resources/radar/verified-bots/index.ts @@ -1,4 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { TopBotsResponse, TopCategoriesResponse, TopBotsParams, TopCategoriesParams, Top } from './top'; +export { + Top, + type TopBotsResponse, + type TopCategoriesResponse, + type TopBotsParams, + type TopCategoriesParams, +} from './top'; export { VerifiedBots } from './verified-bots'; diff --git a/src/resources/radar/verified-bots/top.ts b/src/resources/radar/verified-bots/top.ts index 5b39674fa8..7e8fae769f 100644 --- a/src/resources/radar/verified-bots/top.ts +++ b/src/resources/radar/verified-bots/top.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as TopAPI from './top'; export class Top extends APIResource { /** @@ -279,9 +278,11 @@ export interface TopCategoriesParams { name?: Array; } -export namespace Top { - export import TopBotsResponse = TopAPI.TopBotsResponse; - export import TopCategoriesResponse = TopAPI.TopCategoriesResponse; - export import TopBotsParams = TopAPI.TopBotsParams; - export import TopCategoriesParams = TopAPI.TopCategoriesParams; +export declare namespace Top { + export { + type TopBotsResponse as TopBotsResponse, + type TopCategoriesResponse as TopCategoriesResponse, + type TopBotsParams as TopBotsParams, + type TopCategoriesParams as TopCategoriesParams, + }; } diff --git a/src/resources/radar/verified-bots/verified-bots.ts b/src/resources/radar/verified-bots/verified-bots.ts index 9983346183..18b72ca619 100644 --- a/src/resources/radar/verified-bots/verified-bots.ts +++ b/src/resources/radar/verified-bots/verified-bots.ts @@ -2,15 +2,20 @@ import { APIResource } from '../../../resource'; import * as TopAPI from './top'; +import { Top, TopBotsParams, TopBotsResponse, TopCategoriesParams, TopCategoriesResponse } from './top'; export class VerifiedBots extends APIResource { top: TopAPI.Top = new TopAPI.Top(this._client); } -export namespace VerifiedBots { - export import Top = TopAPI.Top; - export import TopBotsResponse = TopAPI.TopBotsResponse; - export import TopCategoriesResponse = TopAPI.TopCategoriesResponse; - export import TopBotsParams = TopAPI.TopBotsParams; - export import TopCategoriesParams = TopAPI.TopCategoriesParams; +VerifiedBots.Top = Top; + +export declare namespace VerifiedBots { + export { + Top as Top, + type TopBotsResponse as TopBotsResponse, + type TopCategoriesResponse as TopCategoriesResponse, + type TopBotsParams as TopBotsParams, + type TopCategoriesParams as TopCategoriesParams, + }; } diff --git a/src/resources/rate-limits.ts b/src/resources/rate-limits.ts index dbc788d85e..bb572da598 100644 --- a/src/resources/rate-limits.ts +++ b/src/resources/rate-limits.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../resource'; -import { isRequestOptions } from '../core'; import * as Core from '../core'; import * as RateLimitsAPI from './rate-limits'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../pagination'; @@ -13,14 +12,11 @@ export class RateLimits extends APIResource { * * @deprecated Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details. */ - create( - zoneIdentifier: string, - body: RateLimitCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + create(params: RateLimitCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zoneIdentifier}/rate_limits`, { body, ...options }) as Core.APIPromise<{ - result: RateLimitCreateResponse; + this._client.post(`/zones/${zone_id}/rate_limits`, { body, ...options }) as Core.APIPromise<{ + result: RateLimit; }> )._thenUnwrap((obj) => obj.result); } @@ -31,23 +27,11 @@ export class RateLimits extends APIResource { * @deprecated Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details. */ list( - zoneIdentifier: string, - query?: RateLimitListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zoneIdentifier: string, - query: RateLimitListParams | Core.RequestOptions = {}, + params: RateLimitListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(zoneIdentifier, {}, query); - } - return this._client.getAPIList(`/zones/${zoneIdentifier}/rate_limits`, RateLimitsV4PagePaginationArray, { + const { zone_id, ...query } = params; + return this._client.getAPIList(`/zones/${zone_id}/rate_limits`, RateLimitsV4PagePaginationArray, { query, ...options, }); @@ -59,12 +43,13 @@ export class RateLimits extends APIResource { * @deprecated Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details. */ delete( - zoneIdentifier: string, - id: string, + rateLimitId: string, + params: RateLimitDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.delete(`/zones/${zoneIdentifier}/rate_limits/${id}`, options) as Core.APIPromise<{ + this._client.delete(`/zones/${zone_id}/rate_limits/${rateLimitId}`, options) as Core.APIPromise<{ result: RateLimitDeleteResponse; }> )._thenUnwrap((obj) => obj.result); @@ -76,16 +61,16 @@ export class RateLimits extends APIResource { * @deprecated Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details. */ edit( - zoneIdentifier: string, - id: string, - body: RateLimitEditParams, + rateLimitId: string, + params: RateLimitEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.put(`/zones/${zoneIdentifier}/rate_limits/${id}`, { + this._client.put(`/zones/${zone_id}/rate_limits/${rateLimitId}`, { body, ...options, - }) as Core.APIPromise<{ result: RateLimitEditResponse }> + }) as Core.APIPromise<{ result: RateLimit }> )._thenUnwrap((obj) => obj.result); } @@ -95,13 +80,14 @@ export class RateLimits extends APIResource { * @deprecated Rate limiting API is deprecated in favour of using the Ruleset Engine. See https://developers.cloudflare.com/fundamentals/api/reference/deprecations/#rate-limiting-api-previous-version for full details. */ get( - zoneIdentifier: string, - id: string, + rateLimitId: string, + params: RateLimitGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.get(`/zones/${zoneIdentifier}/rate_limits/${id}`, options) as Core.APIPromise<{ - result: RateLimitGetResponse; + this._client.get(`/zones/${zone_id}/rate_limits/${rateLimitId}`, options) as Core.APIPromise<{ + result: RateLimit; }> )._thenUnwrap((obj) => obj.result); } @@ -127,6 +113,11 @@ export type Action = */ export type Methods = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | '_ALL_'; +/** + * An HTTP method or `_ALL_` to indicate all methods. + */ +export type MethodsParam = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | '_ALL_'; + export interface RateLimit { /** * The unique identifier of the rate limit. @@ -304,21 +295,506 @@ export namespace RateLimit { } } -export type RateLimitCreateResponse = unknown | string | null; - export interface RateLimitDeleteResponse { /** * The unique identifier of the rate limit. */ id?: string; + + /** + * The action to perform when the threshold of matched traffic within the + * configured period is exceeded. + */ + action?: RateLimitDeleteResponse.Action; + + /** + * Criteria specifying when the current rate limit should be bypassed. You can + * specify that the rate limit should not apply to one or more URLs. + */ + bypass?: Array; + + /** + * An informative summary of the rate limit. This value is sanitized and any tags + * will be removed. + */ + description?: string; + + /** + * When true, indicates that the rate limit is currently disabled. + */ + disabled?: boolean; + + /** + * Determines which traffic the rate limit counts towards the threshold. + */ + match?: RateLimitDeleteResponse.Match; + + /** + * The time in seconds (an integer value) to count matching traffic. If the count + * exceeds the configured threshold within this period, Cloudflare will perform the + * configured action. + */ + period?: number; + + /** + * The threshold that will trigger the configured mitigation action. Configure this + * value along with the `period` property to establish a threshold per period. + */ + threshold?: number; +} + +export namespace RateLimitDeleteResponse { + /** + * The action to perform when the threshold of matched traffic within the + * configured period is exceeded. + */ + export interface Action { + /** + * The action to perform. + */ + mode?: 'simulate' | 'ban' | 'challenge' | 'js_challenge' | 'managed_challenge'; + + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + response?: Action.Response; + + /** + * The time in seconds during which Cloudflare will perform the mitigation action. + * Must be an integer value greater than or equal to the period. Notes: If "mode" + * is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the + * zone's Challenge Passage time and you should not provide this value. + */ + timeout?: number; + } + + export namespace Action { + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + export interface Response { + /** + * The response body to return. The value must conform to the configured content + * type. + */ + body?: string; + + /** + * The content type of the body. Must be one of the following: `text/plain`, + * `text/xml`, or `application/json`. + */ + content_type?: string; + } + } + + export interface Bypass { + name?: 'url'; + + /** + * The URL to bypass. + */ + value?: string; + } + + /** + * Determines which traffic the rate limit counts towards the threshold. + */ + export interface Match { + headers?: Array; + + request?: Match.Request; + + response?: Match.Response; + } + + export namespace Match { + export interface Header { + /** + * The name of the response header to match. + */ + name?: string; + + /** + * The operator used when matching: `eq` means "equal" and `ne` means "not equal". + */ + op?: 'eq' | 'ne'; + + /** + * The value of the response header, which must match exactly. + */ + value?: string; + } + + export interface Request { + /** + * The HTTP methods to match. You can specify a subset (for example, + * `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when + * creating a rate limit. + */ + methods?: Array; + + /** + * The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both + * schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is + * optional. + */ + schemes?: Array; + + /** + * The URL pattern to match, composed of a host and a path such as + * `example.org/path*`. Normalization is applied before the pattern is matched. `*` + * wildcards are expanded to match applicable traffic. Query strings are not + * matched. Set the value to `*` to match all traffic to your zone. + */ + url?: string; + } + + export interface Response { + /** + * When true, only the uncached traffic served from your origin servers will count + * towards rate limiting. In this case, any cached traffic served by Cloudflare + * will not count towards rate limiting. This field is optional. Notes: This field + * is deprecated. Instead, use response headers and set "origin_traffic" to "false" + * to avoid legacy behaviour interacting with the "response_headers" property. + */ + origin_traffic?: boolean; + } + } +} + +export interface RateLimitCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The action to perform when the threshold of matched traffic within + * the configured period is exceeded. + */ + action: RateLimitCreateParams.Action; + + /** + * Body param: Determines which traffic the rate limit counts towards the + * threshold. + */ + match: RateLimitCreateParams.Match; + + /** + * Body param: The time in seconds (an integer value) to count matching traffic. If + * the count exceeds the configured threshold within this period, Cloudflare will + * perform the configured action. + */ + period: number; + + /** + * Body param: The threshold that will trigger the configured mitigation action. + * Configure this value along with the `period` property to establish a threshold + * per period. + */ + threshold: number; +} + +export namespace RateLimitCreateParams { + /** + * The action to perform when the threshold of matched traffic within the + * configured period is exceeded. + */ + export interface Action { + /** + * The action to perform. + */ + mode?: 'simulate' | 'ban' | 'challenge' | 'js_challenge' | 'managed_challenge'; + + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + response?: Action.Response; + + /** + * The time in seconds during which Cloudflare will perform the mitigation action. + * Must be an integer value greater than or equal to the period. Notes: If "mode" + * is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the + * zone's Challenge Passage time and you should not provide this value. + */ + timeout?: number; + } + + export namespace Action { + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + export interface Response { + /** + * The response body to return. The value must conform to the configured content + * type. + */ + body?: string; + + /** + * The content type of the body. Must be one of the following: `text/plain`, + * `text/xml`, or `application/json`. + */ + content_type?: string; + } + } + + /** + * Determines which traffic the rate limit counts towards the threshold. + */ + export interface Match { + headers?: Array; + + request?: Match.Request; + + response?: Match.Response; + } + + export namespace Match { + export interface Header { + /** + * The name of the response header to match. + */ + name?: string; + + /** + * The operator used when matching: `eq` means "equal" and `ne` means "not equal". + */ + op?: 'eq' | 'ne'; + + /** + * The value of the response header, which must match exactly. + */ + value?: string; + } + + export interface Request { + /** + * The HTTP methods to match. You can specify a subset (for example, + * `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when + * creating a rate limit. + */ + methods?: Array; + + /** + * The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both + * schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is + * optional. + */ + schemes?: Array; + + /** + * The URL pattern to match, composed of a host and a path such as + * `example.org/path*`. Normalization is applied before the pattern is matched. `*` + * wildcards are expanded to match applicable traffic. Query strings are not + * matched. Set the value to `*` to match all traffic to your zone. + */ + url?: string; + } + + export interface Response { + /** + * When true, only the uncached traffic served from your origin servers will count + * towards rate limiting. In this case, any cached traffic served by Cloudflare + * will not count towards rate limiting. This field is optional. Notes: This field + * is deprecated. Instead, use response headers and set "origin_traffic" to "false" + * to avoid legacy behaviour interacting with the "response_headers" property. + */ + origin_traffic?: boolean; + } + } } -export type RateLimitEditResponse = unknown | string | null; +export interface RateLimitListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier + */ + zone_id: string; +} + +export interface RateLimitDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface RateLimitEditParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The action to perform when the threshold of matched traffic within + * the configured period is exceeded. + */ + action: RateLimitEditParams.Action; + + /** + * Body param: Determines which traffic the rate limit counts towards the + * threshold. + */ + match: RateLimitEditParams.Match; + + /** + * Body param: The time in seconds (an integer value) to count matching traffic. If + * the count exceeds the configured threshold within this period, Cloudflare will + * perform the configured action. + */ + period: number; + + /** + * Body param: The threshold that will trigger the configured mitigation action. + * Configure this value along with the `period` property to establish a threshold + * per period. + */ + threshold: number; +} + +export namespace RateLimitEditParams { + /** + * The action to perform when the threshold of matched traffic within the + * configured period is exceeded. + */ + export interface Action { + /** + * The action to perform. + */ + mode?: 'simulate' | 'ban' | 'challenge' | 'js_challenge' | 'managed_challenge'; + + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + response?: Action.Response; -export type RateLimitGetResponse = unknown | string | null; + /** + * The time in seconds during which Cloudflare will perform the mitigation action. + * Must be an integer value greater than or equal to the period. Notes: If "mode" + * is "challenge", "managed_challenge", or "js_challenge", Cloudflare will use the + * zone's Challenge Passage time and you should not provide this value. + */ + timeout?: number; + } -export type RateLimitCreateParams = unknown; + export namespace Action { + /** + * A custom content type and reponse to return when the threshold is exceeded. The + * custom response configured in this object will override the custom error for the + * zone. This object is optional. Notes: If you omit this object, Cloudflare will + * use the default HTML error page. If "mode" is "challenge", "managed_challenge", + * or "js_challenge", Cloudflare will use the zone challenge pages and you should + * not provide the "response" object. + */ + export interface Response { + /** + * The response body to return. The value must conform to the configured content + * type. + */ + body?: string; + + /** + * The content type of the body. Must be one of the following: `text/plain`, + * `text/xml`, or `application/json`. + */ + content_type?: string; + } + } + + /** + * Determines which traffic the rate limit counts towards the threshold. + */ + export interface Match { + headers?: Array; -export interface RateLimitListParams extends V4PagePaginationArrayParams {} + request?: Match.Request; -export type RateLimitEditParams = unknown; + response?: Match.Response; + } + + export namespace Match { + export interface Header { + /** + * The name of the response header to match. + */ + name?: string; + + /** + * The operator used when matching: `eq` means "equal" and `ne` means "not equal". + */ + op?: 'eq' | 'ne'; + + /** + * The value of the response header, which must match exactly. + */ + value?: string; + } + + export interface Request { + /** + * The HTTP methods to match. You can specify a subset (for example, + * `['POST','PUT']`) or all methods (`['_ALL_']`). This field is optional when + * creating a rate limit. + */ + methods?: Array; + + /** + * The HTTP schemes to match. You can specify one scheme (`['HTTPS']`), both + * schemes (`['HTTP','HTTPS']`), or all schemes (`['_ALL_']`). This field is + * optional. + */ + schemes?: Array; + + /** + * The URL pattern to match, composed of a host and a path such as + * `example.org/path*`. Normalization is applied before the pattern is matched. `*` + * wildcards are expanded to match applicable traffic. Query strings are not + * matched. Set the value to `*` to match all traffic to your zone. + */ + url?: string; + } + + export interface Response { + /** + * When true, only the uncached traffic served from your origin servers will count + * towards rate limiting. In this case, any cached traffic served by Cloudflare + * will not count towards rate limiting. This field is optional. Notes: This field + * is deprecated. Instead, use response headers and set "origin_traffic" to "false" + * to avoid legacy behaviour interacting with the "response_headers" property. + */ + origin_traffic?: boolean; + } + } +} + +export interface RateLimitGetParams { + /** + * Identifier + */ + zone_id: string; +} diff --git a/src/resources/rate-plans.ts b/src/resources/rate-plans.ts deleted file mode 100644 index 661962ff54..0000000000 --- a/src/resources/rate-plans.ts +++ /dev/null @@ -1,70 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../resource'; -import * as Core from '../core'; - -export class RatePlans extends APIResource { - /** - * Lists all rate plans the zone can subscribe to. - */ - get(zoneIdentifier: string, options?: Core.RequestOptions): Core.APIPromise { - return ( - this._client.get(`/zones/${zoneIdentifier}/available_rate_plans`, options) as Core.APIPromise<{ - result: RatePlanGetResponse | null; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export interface RatePlan { - /** - * Plan identifier tag. - */ - id?: string; - - /** - * Array of available components values for the plan. - */ - components?: Array; - - /** - * The monetary unit in which pricing information is displayed. - */ - currency?: string; - - /** - * The duration of the plan subscription. - */ - duration?: number; - - /** - * The frequency at which you will be billed for this plan. - */ - frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; - - /** - * The plan name. - */ - name?: string; -} - -export namespace RatePlan { - export interface Component { - /** - * The default amount allocated. - */ - default?: number; - - /** - * The unique component. - */ - name?: 'zones' | 'page_rules' | 'dedicated_certificates' | 'dedicated_certificates_custom'; - - /** - * The unit price of the addon. - */ - unit_price?: number; - } -} - -export type RatePlanGetResponse = Array; diff --git a/src/resources/registrar/domains.ts b/src/resources/registrar/domains.ts index e065542937..eccc7effdb 100644 --- a/src/resources/registrar/domains.ts +++ b/src/resources/registrar/domains.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as DomainsAPI from './domains'; import { SinglePage } from '../../pagination'; export class Domains extends APIResource { @@ -195,12 +194,12 @@ export namespace Domain { /** * Form of authorization has been accepted by the registrant. */ - accept_foa?: string; + accept_foa?: 'needed' | 'ok'; /** * Shows transfer status with the registry. */ - approve_transfer?: string; + approve_transfer?: 'needed' | 'ok' | 'pending' | 'trying' | 'rejected' | 'unknown'; /** * Indicates if cancellation is still possible. @@ -210,23 +209,23 @@ export namespace Domain { /** * Privacy guards are disabled at the foreign registrar. */ - disable_privacy?: unknown; + disable_privacy?: 'needed' | 'ok' | 'unknown'; /** * Auth code has been entered and verified. */ - enter_auth_code?: string; + enter_auth_code?: 'needed' | 'ok' | 'pending' | 'trying' | 'rejected'; /** * Domain is unlocked at the foreign registrar. */ - unlock_domain?: unknown; + unlock_domain?: 'needed' | 'ok' | 'pending' | 'trying' | 'unknown'; } } -export type DomainUpdateResponse = unknown | Array | string; +export type DomainUpdateResponse = unknown; -export type DomainGetResponse = unknown | Array | string; +export type DomainGetResponse = unknown; export interface DomainUpdateParams { /** @@ -265,12 +264,16 @@ export interface DomainGetParams { account_id: string; } -export namespace Domains { - export import Domain = DomainsAPI.Domain; - export import DomainUpdateResponse = DomainsAPI.DomainUpdateResponse; - export import DomainGetResponse = DomainsAPI.DomainGetResponse; - export import DomainsSinglePage = DomainsAPI.DomainsSinglePage; - export import DomainUpdateParams = DomainsAPI.DomainUpdateParams; - export import DomainListParams = DomainsAPI.DomainListParams; - export import DomainGetParams = DomainsAPI.DomainGetParams; +Domains.DomainsSinglePage = DomainsSinglePage; + +export declare namespace Domains { + export { + type Domain as Domain, + type DomainUpdateResponse as DomainUpdateResponse, + type DomainGetResponse as DomainGetResponse, + DomainsSinglePage as DomainsSinglePage, + type DomainUpdateParams as DomainUpdateParams, + type DomainListParams as DomainListParams, + type DomainGetParams as DomainGetParams, + }; } diff --git a/src/resources/registrar/index.ts b/src/resources/registrar/index.ts index 20862ab100..577c1befbe 100644 --- a/src/resources/registrar/index.ts +++ b/src/resources/registrar/index.ts @@ -1,13 +1,13 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Domain, - DomainUpdateResponse, - DomainGetResponse, - DomainUpdateParams, - DomainListParams, - DomainGetParams, DomainsSinglePage, Domains, + type Domain, + type DomainUpdateResponse, + type DomainGetResponse, + type DomainUpdateParams, + type DomainListParams, + type DomainGetParams, } from './domains'; export { Registrar } from './registrar'; diff --git a/src/resources/registrar/registrar.ts b/src/resources/registrar/registrar.ts index c7b79a625d..024ae38f57 100644 --- a/src/resources/registrar/registrar.ts +++ b/src/resources/registrar/registrar.ts @@ -2,18 +2,33 @@ import { APIResource } from '../../resource'; import * as DomainsAPI from './domains'; +import { + Domain, + DomainGetParams, + DomainGetResponse, + DomainListParams, + DomainUpdateParams, + DomainUpdateResponse, + Domains, + DomainsSinglePage, +} from './domains'; export class Registrar extends APIResource { domains: DomainsAPI.Domains = new DomainsAPI.Domains(this._client); } -export namespace Registrar { - export import Domains = DomainsAPI.Domains; - export import Domain = DomainsAPI.Domain; - export import DomainUpdateResponse = DomainsAPI.DomainUpdateResponse; - export import DomainGetResponse = DomainsAPI.DomainGetResponse; - export import DomainsSinglePage = DomainsAPI.DomainsSinglePage; - export import DomainUpdateParams = DomainsAPI.DomainUpdateParams; - export import DomainListParams = DomainsAPI.DomainListParams; - export import DomainGetParams = DomainsAPI.DomainGetParams; +Registrar.Domains = Domains; +Registrar.DomainsSinglePage = DomainsSinglePage; + +export declare namespace Registrar { + export { + Domains as Domains, + type Domain as Domain, + type DomainUpdateResponse as DomainUpdateResponse, + type DomainGetResponse as DomainGetResponse, + DomainsSinglePage as DomainsSinglePage, + type DomainUpdateParams as DomainUpdateParams, + type DomainListParams as DomainListParams, + type DomainGetParams as DomainGetParams, + }; } diff --git a/src/resources/request-tracers/index.ts b/src/resources/request-tracers/index.ts index 0a4f6b455a..9e028924a4 100644 --- a/src/resources/request-tracers/index.ts +++ b/src/resources/request-tracers/index.ts @@ -1,4 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { RequestTracers } from './request-tracers'; -export { Trace, TraceItem, TraceCreateResponse, TraceCreateParams, Traces } from './traces'; +export { + Traces, + type Trace, + type TraceItem, + type TraceCreateResponse, + type TraceCreateParams, +} from './traces'; diff --git a/src/resources/request-tracers/request-tracers.ts b/src/resources/request-tracers/request-tracers.ts index 4d7396aa06..1980dfad3c 100644 --- a/src/resources/request-tracers/request-tracers.ts +++ b/src/resources/request-tracers/request-tracers.ts @@ -2,15 +2,20 @@ import { APIResource } from '../../resource'; import * as TracesAPI from './traces'; +import { Trace, TraceCreateParams, TraceCreateResponse, TraceItem, Traces } from './traces'; export class RequestTracers extends APIResource { traces: TracesAPI.Traces = new TracesAPI.Traces(this._client); } -export namespace RequestTracers { - export import Traces = TracesAPI.Traces; - export import Trace = TracesAPI.Trace; - export import TraceItem = TracesAPI.TraceItem; - export import TraceCreateResponse = TracesAPI.TraceCreateResponse; - export import TraceCreateParams = TracesAPI.TraceCreateParams; +RequestTracers.Traces = Traces; + +export declare namespace RequestTracers { + export { + Traces as Traces, + type Trace as Trace, + type TraceItem as TraceItem, + type TraceCreateResponse as TraceCreateResponse, + type TraceCreateParams as TraceCreateParams, + }; } diff --git a/src/resources/request-tracers/traces.ts b/src/resources/request-tracers/traces.ts index a93c4910c1..d86f1f49ac 100644 --- a/src/resources/request-tracers/traces.ts +++ b/src/resources/request-tracers/traces.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as TracesAPI from './traces'; export class Traces extends APIResource { /** @@ -204,9 +203,11 @@ export namespace TraceCreateParams { } } -export namespace Traces { - export import Trace = TracesAPI.Trace; - export import TraceItem = TracesAPI.TraceItem; - export import TraceCreateResponse = TracesAPI.TraceCreateResponse; - export import TraceCreateParams = TracesAPI.TraceCreateParams; +export declare namespace Traces { + export { + type Trace as Trace, + type TraceItem as TraceItem, + type TraceCreateResponse as TraceCreateResponse, + type TraceCreateParams as TraceCreateParams, + }; } diff --git a/src/resources/resource-sharing/index.ts b/src/resources/resource-sharing/index.ts new file mode 100644 index 0000000000..dc65044d98 --- /dev/null +++ b/src/resources/resource-sharing/index.ts @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + RecipientListResponsesV4PagePaginationArray, + Recipients, + type RecipientCreateResponse, + type RecipientListResponse, + type RecipientDeleteResponse, + type RecipientGetResponse, + type RecipientCreateParams, + type RecipientListParams, + type RecipientDeleteParams, + type RecipientGetParams, +} from './recipients'; +export { + ResourceListResponsesV4PagePaginationArray, + Resources, + type ResourceCreateResponse, + type ResourceUpdateResponse, + type ResourceListResponse, + type ResourceDeleteResponse, + type ResourceGetResponse, + type ResourceCreateParams, + type ResourceUpdateParams, + type ResourceListParams, + type ResourceDeleteParams, + type ResourceGetParams, +} from './resources'; +export { ResourceSharing } from './resource-sharing'; diff --git a/src/resources/resource-sharing/recipients.ts b/src/resources/resource-sharing/recipients.ts new file mode 100644 index 0000000000..b1e19b8784 --- /dev/null +++ b/src/resources/resource-sharing/recipients.ts @@ -0,0 +1,261 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Recipients extends APIResource { + /** + * Create a new share recipient + */ + create( + shareId: string, + params: RecipientCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { path_account_id, body_account_id, ...body } = params; + return ( + this._client.post(`/accounts/${path_account_id}/shares/${shareId}/recipients`, { + body: { account_id: body_account_id, ...body }, + ...options, + }) as Core.APIPromise<{ result: RecipientCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List share recipients by share ID. + */ + list( + shareId: string, + params: RecipientListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/shares/${shareId}/recipients`, + RecipientListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Deletion is not immediate, an updated share recipient object with a new status + * will be returned. + */ + delete( + shareId: string, + recipientId: string, + params: RecipientDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/shares/${shareId}/recipients/${recipientId}`, + options, + ) as Core.APIPromise<{ result: RecipientDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get share recipient by ID. + */ + get( + shareId: string, + recipientId: string, + params: RecipientGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/shares/${shareId}/recipients/${recipientId}`, + options, + ) as Core.APIPromise<{ result: RecipientGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class RecipientListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface RecipientCreateResponse { + /** + * Share Recipient identifier tag. + */ + id: string; + + /** + * Account identifier. + */ + account_id: string; + + /** + * Share Recipient association status. + */ + association_status: 'associating' | 'associated' | 'disassociating' | 'disassociated'; + + /** + * When the share was created. + */ + created: string; + + /** + * When the share was modified. + */ + modified: string; + + /** + * Share Recipient status message. + */ + status_message: string; +} + +export interface RecipientListResponse { + /** + * Share Recipient identifier tag. + */ + id: string; + + /** + * Account identifier. + */ + account_id: string; + + /** + * Share Recipient association status. + */ + association_status: 'associating' | 'associated' | 'disassociating' | 'disassociated'; + + /** + * When the share was created. + */ + created: string; + + /** + * When the share was modified. + */ + modified: string; + + /** + * Share Recipient status message. + */ + status_message: string; +} + +export interface RecipientDeleteResponse { + /** + * Share Recipient identifier tag. + */ + id: string; + + /** + * Account identifier. + */ + account_id: string; + + /** + * Share Recipient association status. + */ + association_status: 'associating' | 'associated' | 'disassociating' | 'disassociated'; + + /** + * When the share was created. + */ + created: string; + + /** + * When the share was modified. + */ + modified: string; + + /** + * Share Recipient status message. + */ + status_message: string; +} + +export interface RecipientGetResponse { + /** + * Share Recipient identifier tag. + */ + id: string; + + /** + * Account identifier. + */ + account_id: string; + + /** + * Share Recipient association status. + */ + association_status: 'associating' | 'associated' | 'disassociating' | 'disassociated'; + + /** + * When the share was created. + */ + created: string; + + /** + * When the share was modified. + */ + modified: string; + + /** + * Share Recipient status message. + */ + status_message: string; +} + +export interface RecipientCreateParams { + /** + * Path param: Account identifier. + */ + path_account_id: string; + + /** + * Body param: Account identifier. + */ + body_account_id?: string; + + /** + * Body param: Organization identifier. + */ + organization_id?: string; +} + +export interface RecipientListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account identifier. + */ + account_id: string; +} + +export interface RecipientDeleteParams { + /** + * Account identifier. + */ + account_id: string; +} + +export interface RecipientGetParams { + /** + * Account identifier. + */ + account_id: string; +} + +Recipients.RecipientListResponsesV4PagePaginationArray = RecipientListResponsesV4PagePaginationArray; + +export declare namespace Recipients { + export { + type RecipientCreateResponse as RecipientCreateResponse, + type RecipientListResponse as RecipientListResponse, + type RecipientDeleteResponse as RecipientDeleteResponse, + type RecipientGetResponse as RecipientGetResponse, + RecipientListResponsesV4PagePaginationArray as RecipientListResponsesV4PagePaginationArray, + type RecipientCreateParams as RecipientCreateParams, + type RecipientListParams as RecipientListParams, + type RecipientDeleteParams as RecipientDeleteParams, + type RecipientGetParams as RecipientGetParams, + }; +} diff --git a/src/resources/resource-sharing/resource-sharing.ts b/src/resources/resource-sharing/resource-sharing.ts new file mode 100644 index 0000000000..ddd96b75a6 --- /dev/null +++ b/src/resources/resource-sharing/resource-sharing.ts @@ -0,0 +1,489 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as RecipientsAPI from './recipients'; +import { + RecipientCreateParams, + RecipientCreateResponse, + RecipientDeleteParams, + RecipientDeleteResponse, + RecipientGetParams, + RecipientGetResponse, + RecipientListParams, + RecipientListResponse, + RecipientListResponsesV4PagePaginationArray, + Recipients, +} from './recipients'; +import * as ResourcesAPI from './resources'; +import { + ResourceCreateParams, + ResourceCreateResponse, + ResourceDeleteParams, + ResourceDeleteResponse, + ResourceGetParams, + ResourceGetResponse, + ResourceListParams, + ResourceListResponse, + ResourceListResponsesV4PagePaginationArray, + ResourceUpdateParams, + ResourceUpdateResponse, + Resources, +} from './resources'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class ResourceSharing extends APIResource { + recipients: RecipientsAPI.Recipients = new RecipientsAPI.Recipients(this._client); + resources: ResourcesAPI.Resources = new ResourcesAPI.Resources(this._client); + + /** + * Create a new share + */ + create( + params: ResourceSharingCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/shares`, { body, ...options }) as Core.APIPromise<{ + result: ResourceSharingCreateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Updating is not immediate, an updated share object with a new status will be + * returned. + */ + update( + shareId: string, + params: ResourceSharingUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/shares/${shareId}`, { body, ...options }) as Core.APIPromise<{ + result: ResourceSharingUpdateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Lists all account shares. + */ + list( + params: ResourceSharingListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/shares`, + ResourceSharingListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Deletion is not immediate, an updated share object with a new status will be + * returned. + */ + delete( + shareId: string, + params: ResourceSharingDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}/shares/${shareId}`, options) as Core.APIPromise<{ + result: ResourceSharingDeleteResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetches share by ID. + */ + get( + shareId: string, + params: ResourceSharingGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/shares/${shareId}`, options) as Core.APIPromise<{ + result: ResourceSharingGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class ResourceSharingListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface ResourceSharingCreateResponse { + /** + * Share identifier tag. + */ + id: string; + + /** + * Account identifier. + */ + account_id: string; + + /** + * The display name of an account. + */ + account_name: string; + + /** + * When the share was created. + */ + created: string; + + /** + * When the share was modified. + */ + modified: string; + + /** + * The name of the share. + */ + name: string; + + /** + * Organization identifier. + */ + organization_id: string; + + status: 'active' | 'deleting' | 'deleted'; + + target_type: 'account' | 'organization'; + + kind?: 'sent' | 'received'; +} + +export interface ResourceSharingUpdateResponse { + /** + * Share identifier tag. + */ + id: string; + + /** + * Account identifier. + */ + account_id: string; + + /** + * The display name of an account. + */ + account_name: string; + + /** + * When the share was created. + */ + created: string; + + /** + * When the share was modified. + */ + modified: string; + + /** + * The name of the share. + */ + name: string; + + /** + * Organization identifier. + */ + organization_id: string; + + status: 'active' | 'deleting' | 'deleted'; + + target_type: 'account' | 'organization'; + + kind?: 'sent' | 'received'; +} + +export interface ResourceSharingListResponse { + /** + * Share identifier tag. + */ + id: string; + + /** + * Account identifier. + */ + account_id: string; + + /** + * The display name of an account. + */ + account_name: string; + + /** + * When the share was created. + */ + created: string; + + /** + * When the share was modified. + */ + modified: string; + + /** + * The name of the share. + */ + name: string; + + /** + * Organization identifier. + */ + organization_id: string; + + status: 'active' | 'deleting' | 'deleted'; + + target_type: 'account' | 'organization'; + + kind?: 'sent' | 'received'; +} + +export interface ResourceSharingDeleteResponse { + /** + * Share identifier tag. + */ + id: string; + + /** + * Account identifier. + */ + account_id: string; + + /** + * The display name of an account. + */ + account_name: string; + + /** + * When the share was created. + */ + created: string; + + /** + * When the share was modified. + */ + modified: string; + + /** + * The name of the share. + */ + name: string; + + /** + * Organization identifier. + */ + organization_id: string; + + status: 'active' | 'deleting' | 'deleted'; + + target_type: 'account' | 'organization'; + + kind?: 'sent' | 'received'; +} + +export interface ResourceSharingGetResponse { + /** + * Share identifier tag. + */ + id: string; + + /** + * Account identifier. + */ + account_id: string; + + /** + * The display name of an account. + */ + account_name: string; + + /** + * When the share was created. + */ + created: string; + + /** + * When the share was modified. + */ + modified: string; + + /** + * The name of the share. + */ + name: string; + + /** + * Organization identifier. + */ + organization_id: string; + + status: 'active' | 'deleting' | 'deleted'; + + target_type: 'account' | 'organization'; + + kind?: 'sent' | 'received'; +} + +export interface ResourceSharingCreateParams { + /** + * Path param: Account identifier. + */ + account_id: string; + + /** + * Body param: The name of the share. + */ + name: string; + + /** + * Body param: + */ + recipients: Array; + + /** + * Body param: + */ + resources: Array; +} + +export namespace ResourceSharingCreateParams { + /** + * Account or organization ID must be provided. + */ + export interface Recipient { + /** + * Account identifier. + */ + account_id?: string; + + /** + * Organization identifier. + */ + organization_id?: string; + } + + export interface Resource { + /** + * Resource Metadata. + */ + meta: unknown; + + /** + * Account identifier. + */ + resource_account_id: string; + + /** + * Share Resource identifier. + */ + resource_id: string; + + /** + * Resource Type. + */ + resource_type: 'custom-ruleset' | 'widget'; + } +} + +export interface ResourceSharingUpdateParams { + /** + * Path param: Account identifier. + */ + account_id: string; + + /** + * Body param: The name of the share. + */ + name: string; +} + +export interface ResourceSharingListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account identifier. + */ + account_id: string; + + /** + * Query param: Direction to sort objects. + */ + direction?: 'asc' | 'desc'; + + /** + * Query param: Filter shares by kind. + */ + kind?: 'sent' | 'received'; + + /** + * Query param: Order shares by values in the given field. + */ + order?: 'name' | 'created'; + + /** + * Query param: Filter shares by status. + */ + status?: 'active' | 'deleting' | 'deleted'; + + /** + * Query param: Filter shares by target_type. + */ + target_type?: 'account' | 'organization'; +} + +export interface ResourceSharingDeleteParams { + /** + * Account identifier. + */ + account_id: string; +} + +export interface ResourceSharingGetParams { + /** + * Account identifier. + */ + account_id: string; +} + +ResourceSharing.Recipients = Recipients; +ResourceSharing.RecipientListResponsesV4PagePaginationArray = RecipientListResponsesV4PagePaginationArray; +ResourceSharing.Resources = Resources; +ResourceSharing.ResourceListResponsesV4PagePaginationArray = ResourceListResponsesV4PagePaginationArray; + +export declare namespace ResourceSharing { + export { + Recipients as Recipients, + type RecipientCreateResponse as RecipientCreateResponse, + type RecipientListResponse as RecipientListResponse, + type RecipientDeleteResponse as RecipientDeleteResponse, + type RecipientGetResponse as RecipientGetResponse, + RecipientListResponsesV4PagePaginationArray as RecipientListResponsesV4PagePaginationArray, + type RecipientCreateParams as RecipientCreateParams, + type RecipientListParams as RecipientListParams, + type RecipientDeleteParams as RecipientDeleteParams, + type RecipientGetParams as RecipientGetParams, + }; + + export { + Resources as Resources, + type ResourceCreateResponse as ResourceCreateResponse, + type ResourceUpdateResponse as ResourceUpdateResponse, + type ResourceListResponse as ResourceListResponse, + type ResourceDeleteResponse as ResourceDeleteResponse, + type ResourceGetResponse as ResourceGetResponse, + ResourceListResponsesV4PagePaginationArray as ResourceListResponsesV4PagePaginationArray, + type ResourceCreateParams as ResourceCreateParams, + type ResourceUpdateParams as ResourceUpdateParams, + type ResourceListParams as ResourceListParams, + type ResourceDeleteParams as ResourceDeleteParams, + type ResourceGetParams as ResourceGetParams, + }; +} diff --git a/src/resources/resource-sharing/resources.ts b/src/resources/resource-sharing/resources.ts new file mode 100644 index 0000000000..b5795c87ed --- /dev/null +++ b/src/resources/resource-sharing/resources.ts @@ -0,0 +1,421 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; + +export class Resources extends APIResource { + /** + * Create a new share resource + */ + create( + shareId: string, + params: ResourceCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/shares/${shareId}/resources`, { + body, + ...options, + }) as Core.APIPromise<{ result: ResourceCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update is not immediate, an updated share resource object with a new status will + * be returned. + */ + update( + shareId: string, + resourceId: string, + params: ResourceUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/shares/${shareId}/resources/${resourceId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: ResourceUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List share resources by share ID. + */ + list( + shareId: string, + params: ResourceListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/shares/${shareId}/resources`, + ResourceListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Deletion is not immediate, an updated share resource object with a new status + * will be returned. + */ + delete( + shareId: string, + resourceId: string, + params: ResourceDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/shares/${shareId}/resources/${resourceId}`, + options, + ) as Core.APIPromise<{ result: ResourceDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get share resource by ID. + */ + get( + shareId: string, + resourceId: string, + params: ResourceGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/shares/${shareId}/resources/${resourceId}`, + options, + ) as Core.APIPromise<{ result: ResourceGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class ResourceListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface ResourceCreateResponse { + /** + * Share Resource identifier. + */ + id: string; + + /** + * When the share was created. + */ + created: string; + + /** + * Resource Metadata. + */ + meta: unknown; + + /** + * When the share was modified. + */ + modified: string; + + /** + * Account identifier. + */ + resource_account_id: string; + + /** + * Share Resource identifier. + */ + resource_id: string; + + /** + * Resource Type. + */ + resource_type: 'custom-ruleset' | 'widget'; + + /** + * Resource Version. + */ + resource_version: number; + + /** + * Resource Status. + */ + status: 'active' | 'deleting' | 'deleted'; +} + +export interface ResourceUpdateResponse { + /** + * Share Resource identifier. + */ + id: string; + + /** + * When the share was created. + */ + created: string; + + /** + * Resource Metadata. + */ + meta: unknown; + + /** + * When the share was modified. + */ + modified: string; + + /** + * Account identifier. + */ + resource_account_id: string; + + /** + * Share Resource identifier. + */ + resource_id: string; + + /** + * Resource Type. + */ + resource_type: 'custom-ruleset' | 'widget'; + + /** + * Resource Version. + */ + resource_version: number; + + /** + * Resource Status. + */ + status: 'active' | 'deleting' | 'deleted'; +} + +export interface ResourceListResponse { + /** + * Share Resource identifier. + */ + id: string; + + /** + * When the share was created. + */ + created: string; + + /** + * Resource Metadata. + */ + meta: unknown; + + /** + * When the share was modified. + */ + modified: string; + + /** + * Account identifier. + */ + resource_account_id: string; + + /** + * Share Resource identifier. + */ + resource_id: string; + + /** + * Resource Type. + */ + resource_type: 'custom-ruleset' | 'widget'; + + /** + * Resource Version. + */ + resource_version: number; + + /** + * Resource Status. + */ + status: 'active' | 'deleting' | 'deleted'; +} + +export interface ResourceDeleteResponse { + /** + * Share Resource identifier. + */ + id: string; + + /** + * When the share was created. + */ + created: string; + + /** + * Resource Metadata. + */ + meta: unknown; + + /** + * When the share was modified. + */ + modified: string; + + /** + * Account identifier. + */ + resource_account_id: string; + + /** + * Share Resource identifier. + */ + resource_id: string; + + /** + * Resource Type. + */ + resource_type: 'custom-ruleset' | 'widget'; + + /** + * Resource Version. + */ + resource_version: number; + + /** + * Resource Status. + */ + status: 'active' | 'deleting' | 'deleted'; +} + +export interface ResourceGetResponse { + /** + * Share Resource identifier. + */ + id: string; + + /** + * When the share was created. + */ + created: string; + + /** + * Resource Metadata. + */ + meta: unknown; + + /** + * When the share was modified. + */ + modified: string; + + /** + * Account identifier. + */ + resource_account_id: string; + + /** + * Share Resource identifier. + */ + resource_id: string; + + /** + * Resource Type. + */ + resource_type: 'custom-ruleset' | 'widget'; + + /** + * Resource Version. + */ + resource_version: number; + + /** + * Resource Status. + */ + status: 'active' | 'deleting' | 'deleted'; +} + +export interface ResourceCreateParams { + /** + * Path param: Account identifier. + */ + account_id: string; + + /** + * Body param: Resource Metadata. + */ + meta: unknown; + + /** + * Body param: Account identifier. + */ + resource_account_id: string; + + /** + * Body param: Share Resource identifier. + */ + resource_id: string; + + /** + * Body param: Resource Type. + */ + resource_type: 'custom-ruleset' | 'widget'; +} + +export interface ResourceUpdateParams { + /** + * Path param: Account identifier. + */ + account_id: string; + + /** + * Body param: Resource Metadata. + */ + meta: unknown; +} + +export interface ResourceListParams extends V4PagePaginationArrayParams { + /** + * Path param: Account identifier. + */ + account_id: string; + + /** + * Query param: Filter share resources by resource_type. + */ + resource_type?: 'custom-ruleset' | 'widget'; + + /** + * Query param: Filter share resources by status. + */ + status?: 'active' | 'deleting' | 'deleted'; +} + +export interface ResourceDeleteParams { + /** + * Account identifier. + */ + account_id: string; +} + +export interface ResourceGetParams { + /** + * Account identifier. + */ + account_id: string; +} + +Resources.ResourceListResponsesV4PagePaginationArray = ResourceListResponsesV4PagePaginationArray; + +export declare namespace Resources { + export { + type ResourceCreateResponse as ResourceCreateResponse, + type ResourceUpdateResponse as ResourceUpdateResponse, + type ResourceListResponse as ResourceListResponse, + type ResourceDeleteResponse as ResourceDeleteResponse, + type ResourceGetResponse as ResourceGetResponse, + ResourceListResponsesV4PagePaginationArray as ResourceListResponsesV4PagePaginationArray, + type ResourceCreateParams as ResourceCreateParams, + type ResourceUpdateParams as ResourceUpdateParams, + type ResourceListParams as ResourceListParams, + type ResourceDeleteParams as ResourceDeleteParams, + type ResourceGetParams as ResourceGetParams, + }; +} diff --git a/src/resources/rules/index.ts b/src/resources/rules/index.ts index 6d4f2c3525..5cf6cec221 100644 --- a/src/resources/rules/index.ts +++ b/src/resources/rules/index.ts @@ -1,16 +1,16 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Hostname, - ListsList, - Redirect, - ListDeleteResponse, - ListCreateParams, - ListUpdateParams, - ListListParams, - ListDeleteParams, - ListGetParams, ListsListsSinglePage, Lists, + type Hostname, + type ListsList, + type Redirect, + type ListDeleteResponse, + type ListCreateParams, + type ListUpdateParams, + type ListListParams, + type ListDeleteParams, + type ListGetParams, } from './lists/index'; export { Rules } from './rules'; diff --git a/src/resources/rules/lists/bulk-operations.ts b/src/resources/rules/lists/bulk-operations.ts index 97571df020..f321d4858a 100644 --- a/src/resources/rules/lists/bulk-operations.ts +++ b/src/resources/rules/lists/bulk-operations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as BulkOperationsAPI from './bulk-operations'; export class BulkOperations extends APIResource { /** @@ -16,12 +15,12 @@ export class BulkOperations extends APIResource { accountIdentifier: string, operationId: string, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { return ( this._client.get( `/accounts/${accountIdentifier}/rules/lists/bulk_operations/${operationId}`, options, - ) as Core.APIPromise<{ result: BulkOperationGetResponse | null }> + ) as Core.APIPromise<{ result: BulkOperationGetResponse }> )._thenUnwrap((obj) => obj.result); } } @@ -31,9 +30,31 @@ export class BulkOperations extends APIResource { */ export type OperationStatus = 'pending' | 'running' | 'completed' | 'failed'; -export type BulkOperationGetResponse = Array; +export interface BulkOperationGetResponse { + /** + * The unique operation ID of the asynchronous action. + */ + id: string; + + /** + * The current status of the asynchronous operation. + */ + status: OperationStatus; + + /** + * The RFC 3339 timestamp of when the operation was completed. + */ + completed?: string; + + /** + * A message describing the error when the status is `failed`. + */ + error?: string; +} -export namespace BulkOperations { - export import OperationStatus = BulkOperationsAPI.OperationStatus; - export import BulkOperationGetResponse = BulkOperationsAPI.BulkOperationGetResponse; +export declare namespace BulkOperations { + export { + type OperationStatus as OperationStatus, + type BulkOperationGetResponse as BulkOperationGetResponse, + }; } diff --git a/src/resources/rules/lists/index.ts b/src/resources/rules/lists/index.ts index 02e60d5a15..125176ba37 100644 --- a/src/resources/rules/lists/index.ts +++ b/src/resources/rules/lists/index.ts @@ -1,31 +1,31 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { BulkOperations, type OperationStatus, type BulkOperationGetResponse } from './bulk-operations'; export { - Hostname, - ListsList, - Redirect, - ListDeleteResponse, - ListCreateParams, - ListUpdateParams, - ListListParams, - ListDeleteParams, - ListGetParams, - ListsListsSinglePage, - Lists, -} from './lists'; -export { - ListCursor, - ListItem, - ItemCreateResponse, - ItemUpdateResponse, - ItemListResponse, - ItemDeleteResponse, - ItemGetResponse, - ItemCreateParams, - ItemUpdateParams, - ItemListParams, - ItemDeleteParams, ItemListResponsesCursorPagination, Items, + type ListCursor, + type ListItem, + type ItemCreateResponse, + type ItemUpdateResponse, + type ItemListResponse, + type ItemDeleteResponse, + type ItemGetResponse, + type ItemCreateParams, + type ItemUpdateParams, + type ItemListParams, + type ItemDeleteParams, } from './items'; -export { OperationStatus, BulkOperationGetResponse, BulkOperations } from './bulk-operations'; +export { + ListsListsSinglePage, + Lists, + type Hostname, + type ListsList, + type Redirect, + type ListDeleteResponse, + type ListCreateParams, + type ListUpdateParams, + type ListListParams, + type ListDeleteParams, + type ListGetParams, +} from './lists'; diff --git a/src/resources/rules/lists/items.ts b/src/resources/rules/lists/items.ts index 0ffb89b0bf..90d1442bf7 100644 --- a/src/resources/rules/lists/items.ts +++ b/src/resources/rules/lists/items.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ItemsAPI from './items'; import * as ListsAPI from './lists'; import { CursorPagination, type CursorPaginationParams } from '../../../pagination'; @@ -18,13 +17,13 @@ export class Items extends APIResource { listId: string, params: ItemCreateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, body } = params; return ( this._client.post(`/accounts/${account_id}/rules/lists/${listId}/items`, { body: body, ...options, - }) as Core.APIPromise<{ result: ItemCreateResponse | null }> + }) as Core.APIPromise<{ result: ItemCreateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -40,13 +39,13 @@ export class Items extends APIResource { listId: string, params: ItemUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, body } = params; return ( this._client.put(`/accounts/${account_id}/rules/lists/${listId}/items`, { body: body, ...options, - }) as Core.APIPromise<{ result: ItemUpdateResponse | null }> + }) as Core.APIPromise<{ result: ItemUpdateResponse }> )._thenUnwrap((obj) => obj.result); } @@ -77,11 +76,11 @@ export class Items extends APIResource { listId: string, params: ItemDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.delete(`/accounts/${account_id}/rules/lists/${listId}/items`, options) as Core.APIPromise<{ - result: ItemDeleteResponse | null; + result: ItemDeleteResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -94,12 +93,12 @@ export class Items extends APIResource { listId: string, itemId: string, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { return ( this._client.get( `/accounts/${accountIdentifier}/rules/lists/${listId}/items/${itemId}`, options, - ) as Core.APIPromise<{ result: ItemGetResponse | null }> + ) as Core.APIPromise<{ result: ItemGetResponse }> )._thenUnwrap((obj) => obj.result); } } @@ -133,7 +132,49 @@ export interface ItemUpdateResponse { operation_id?: string; } -export type ItemListResponse = unknown; +export interface ItemListResponse { + /** + * The unique ID of the list. + */ + id?: string; + + /** + * A non-negative 32 bit integer + */ + asn?: number; + + /** + * An informative summary of the list item. + */ + comment?: string; + + /** + * The RFC 3339 timestamp of when the item was created. + */ + created_on?: string; + + /** + * Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + * 0 to 9, wildcards (\*), and the hyphen (-). + */ + hostname?: ListsAPI.Hostname; + + /** + * An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + * maximum of /64. + */ + ip?: string; + + /** + * The RFC 3339 timestamp of when the item was last modified. + */ + modified_on?: string; + + /** + * The definition of the redirect. + */ + redirect?: ListsAPI.Redirect; +} export interface ItemDeleteResponse { /** @@ -142,11 +183,49 @@ export interface ItemDeleteResponse { operation_id?: string; } -/** - * An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a - * maximum of /64. - */ -export type ItemGetResponse = string | ListsAPI.Redirect | ListsAPI.Hostname | number; +export interface ItemGetResponse { + /** + * The unique ID of the list. + */ + id?: string; + + /** + * A non-negative 32 bit integer + */ + asn?: number; + + /** + * An informative summary of the list item. + */ + comment?: string; + + /** + * The RFC 3339 timestamp of when the item was created. + */ + created_on?: string; + + /** + * Valid characters for hostnames are ASCII(7) letters from a to z, the digits from + * 0 to 9, wildcards (\*), and the hyphen (-). + */ + hostname?: ListsAPI.Hostname; + + /** + * An IPv4 address, an IPv4 CIDR, or an IPv6 CIDR. IPv6 CIDRs are limited to a + * maximum of /64. + */ + ip?: string; + + /** + * The RFC 3339 timestamp of when the item was last modified. + */ + modified_on?: string; + + /** + * The definition of the redirect. + */ + redirect?: ListsAPI.Redirect; +} export interface ItemCreateParams { /** @@ -255,17 +334,21 @@ export interface ItemDeleteParams { account_id: string; } -export namespace Items { - export import ListCursor = ItemsAPI.ListCursor; - export import ListItem = ItemsAPI.ListItem; - export import ItemCreateResponse = ItemsAPI.ItemCreateResponse; - export import ItemUpdateResponse = ItemsAPI.ItemUpdateResponse; - export import ItemListResponse = ItemsAPI.ItemListResponse; - export import ItemDeleteResponse = ItemsAPI.ItemDeleteResponse; - export import ItemGetResponse = ItemsAPI.ItemGetResponse; - export import ItemListResponsesCursorPagination = ItemsAPI.ItemListResponsesCursorPagination; - export import ItemCreateParams = ItemsAPI.ItemCreateParams; - export import ItemUpdateParams = ItemsAPI.ItemUpdateParams; - export import ItemListParams = ItemsAPI.ItemListParams; - export import ItemDeleteParams = ItemsAPI.ItemDeleteParams; +Items.ItemListResponsesCursorPagination = ItemListResponsesCursorPagination; + +export declare namespace Items { + export { + type ListCursor as ListCursor, + type ListItem as ListItem, + type ItemCreateResponse as ItemCreateResponse, + type ItemUpdateResponse as ItemUpdateResponse, + type ItemListResponse as ItemListResponse, + type ItemDeleteResponse as ItemDeleteResponse, + type ItemGetResponse as ItemGetResponse, + ItemListResponsesCursorPagination as ItemListResponsesCursorPagination, + type ItemCreateParams as ItemCreateParams, + type ItemUpdateParams as ItemUpdateParams, + type ItemListParams as ItemListParams, + type ItemDeleteParams as ItemDeleteParams, + }; } diff --git a/src/resources/rules/lists/lists.ts b/src/resources/rules/lists/lists.ts index 5db7df38f3..e93cf4c831 100644 --- a/src/resources/rules/lists/lists.ts +++ b/src/resources/rules/lists/lists.ts @@ -2,9 +2,24 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as ListsAPI from './lists'; import * as BulkOperationsAPI from './bulk-operations'; +import { BulkOperationGetResponse, BulkOperations, OperationStatus } from './bulk-operations'; import * as ItemsAPI from './items'; +import { + ItemCreateParams, + ItemCreateResponse, + ItemDeleteParams, + ItemDeleteResponse, + ItemGetResponse, + ItemListParams, + ItemListResponse, + ItemListResponsesCursorPagination, + ItemUpdateParams, + ItemUpdateResponse, + Items, + ListCursor, + ListItem, +} from './items'; import { SinglePage } from '../../../pagination'; export class Lists extends APIResource { @@ -14,11 +29,11 @@ export class Lists extends APIResource { /** * Creates a new list of the specified type. */ - create(params: ListCreateParams, options?: Core.RequestOptions): Core.APIPromise { + create(params: ListCreateParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.post(`/accounts/${account_id}/rules/lists`, { body, ...options }) as Core.APIPromise<{ - result: ListsList | null; + result: ListsList; }> )._thenUnwrap((obj) => obj.result); } @@ -30,13 +45,13 @@ export class Lists extends APIResource { listId: string, params: ListUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id, ...body } = params; return ( this._client.put(`/accounts/${account_id}/rules/lists/${listId}`, { body, ...options, - }) as Core.APIPromise<{ result: ListsList | null }> + }) as Core.APIPromise<{ result: ListsList }> )._thenUnwrap((obj) => obj.result); } @@ -58,11 +73,11 @@ export class Lists extends APIResource { listId: string, params: ListDeleteParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { account_id } = params; return ( this._client.delete(`/accounts/${account_id}/rules/lists/${listId}`, options) as Core.APIPromise<{ - result: ListDeleteResponse | null; + result: ListDeleteResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -70,15 +85,11 @@ export class Lists extends APIResource { /** * Fetches the details of a list. */ - get( - listId: string, - params: ListGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + get(listId: string, params: ListGetParams, options?: Core.RequestOptions): Core.APIPromise { const { account_id } = params; return ( this._client.get(`/accounts/${account_id}/rules/lists/${listId}`, options) as Core.APIPromise<{ - result: ListsList | null; + result: ListsList; }> )._thenUnwrap((obj) => obj.result); } @@ -247,31 +258,44 @@ export interface ListGetParams { account_id: string; } -export namespace Lists { - export import Hostname = ListsAPI.Hostname; - export import ListsList = ListsAPI.ListsList; - export import Redirect = ListsAPI.Redirect; - export import ListDeleteResponse = ListsAPI.ListDeleteResponse; - export import ListsListsSinglePage = ListsAPI.ListsListsSinglePage; - export import ListCreateParams = ListsAPI.ListCreateParams; - export import ListUpdateParams = ListsAPI.ListUpdateParams; - export import ListListParams = ListsAPI.ListListParams; - export import ListDeleteParams = ListsAPI.ListDeleteParams; - export import ListGetParams = ListsAPI.ListGetParams; - export import BulkOperations = BulkOperationsAPI.BulkOperations; - export import OperationStatus = BulkOperationsAPI.OperationStatus; - export import BulkOperationGetResponse = BulkOperationsAPI.BulkOperationGetResponse; - export import Items = ItemsAPI.Items; - export import ListCursor = ItemsAPI.ListCursor; - export import ListItem = ItemsAPI.ListItem; - export import ItemCreateResponse = ItemsAPI.ItemCreateResponse; - export import ItemUpdateResponse = ItemsAPI.ItemUpdateResponse; - export import ItemListResponse = ItemsAPI.ItemListResponse; - export import ItemDeleteResponse = ItemsAPI.ItemDeleteResponse; - export import ItemGetResponse = ItemsAPI.ItemGetResponse; - export import ItemListResponsesCursorPagination = ItemsAPI.ItemListResponsesCursorPagination; - export import ItemCreateParams = ItemsAPI.ItemCreateParams; - export import ItemUpdateParams = ItemsAPI.ItemUpdateParams; - export import ItemListParams = ItemsAPI.ItemListParams; - export import ItemDeleteParams = ItemsAPI.ItemDeleteParams; +Lists.ListsListsSinglePage = ListsListsSinglePage; +Lists.BulkOperations = BulkOperations; +Lists.Items = Items; +Lists.ItemListResponsesCursorPagination = ItemListResponsesCursorPagination; + +export declare namespace Lists { + export { + type Hostname as Hostname, + type ListsList as ListsList, + type Redirect as Redirect, + type ListDeleteResponse as ListDeleteResponse, + ListsListsSinglePage as ListsListsSinglePage, + type ListCreateParams as ListCreateParams, + type ListUpdateParams as ListUpdateParams, + type ListListParams as ListListParams, + type ListDeleteParams as ListDeleteParams, + type ListGetParams as ListGetParams, + }; + + export { + BulkOperations as BulkOperations, + type OperationStatus as OperationStatus, + type BulkOperationGetResponse as BulkOperationGetResponse, + }; + + export { + Items as Items, + type ListCursor as ListCursor, + type ListItem as ListItem, + type ItemCreateResponse as ItemCreateResponse, + type ItemUpdateResponse as ItemUpdateResponse, + type ItemListResponse as ItemListResponse, + type ItemDeleteResponse as ItemDeleteResponse, + type ItemGetResponse as ItemGetResponse, + ItemListResponsesCursorPagination as ItemListResponsesCursorPagination, + type ItemCreateParams as ItemCreateParams, + type ItemUpdateParams as ItemUpdateParams, + type ItemListParams as ItemListParams, + type ItemDeleteParams as ItemDeleteParams, + }; } diff --git a/src/resources/rules/rules.ts b/src/resources/rules/rules.ts index 024dcf605e..d2a2ccbf5e 100644 --- a/src/resources/rules/rules.ts +++ b/src/resources/rules/rules.ts @@ -2,21 +2,39 @@ import { APIResource } from '../../resource'; import * as ListsAPI from './lists/lists'; +import { + Hostname, + ListCreateParams, + ListDeleteParams, + ListDeleteResponse, + ListGetParams, + ListListParams, + ListUpdateParams, + Lists, + ListsList, + ListsListsSinglePage, + Redirect, +} from './lists/lists'; export class Rules extends APIResource { lists: ListsAPI.Lists = new ListsAPI.Lists(this._client); } -export namespace Rules { - export import Lists = ListsAPI.Lists; - export import Hostname = ListsAPI.Hostname; - export import ListsList = ListsAPI.ListsList; - export import Redirect = ListsAPI.Redirect; - export import ListDeleteResponse = ListsAPI.ListDeleteResponse; - export import ListsListsSinglePage = ListsAPI.ListsListsSinglePage; - export import ListCreateParams = ListsAPI.ListCreateParams; - export import ListUpdateParams = ListsAPI.ListUpdateParams; - export import ListListParams = ListsAPI.ListListParams; - export import ListDeleteParams = ListsAPI.ListDeleteParams; - export import ListGetParams = ListsAPI.ListGetParams; +Rules.Lists = Lists; +Rules.ListsListsSinglePage = ListsListsSinglePage; + +export declare namespace Rules { + export { + Lists as Lists, + type Hostname as Hostname, + type ListsList as ListsList, + type Redirect as Redirect, + type ListDeleteResponse as ListDeleteResponse, + ListsListsSinglePage as ListsListsSinglePage, + type ListCreateParams as ListCreateParams, + type ListUpdateParams as ListUpdateParams, + type ListListParams as ListListParams, + type ListDeleteParams as ListDeleteParams, + type ListGetParams as ListGetParams, + }; } diff --git a/src/resources/rulesets/index.ts b/src/resources/rulesets/index.ts index 1422ae1008..f36949cca7 100644 --- a/src/resources/rulesets/index.ts +++ b/src/resources/rulesets/index.ts @@ -1,46 +1,47 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - BlockRule, - ChallengeRule, - CompressResponseRule, - ExecuteRule, - JSChallengeRule, - LogRule, - Logging, - ManagedChallengeRule, - RedirectRule, - RewriteRule, - RewriteURIPart, - RouteRule, - RulesetRule, - ScoreRule, - ServeErrorRule, - SetCacheSettingsRule, - SetConfigRule, - SkipRule, - RuleCreateResponse, - RuleDeleteResponse, - RuleEditResponse, - RuleCreateParams, - RuleDeleteParams, - RuleEditParams, - Rules, -} from './rules'; -export { - PhaseUpdateResponse, - PhaseGetResponse, - PhaseUpdateParams, - PhaseGetParams, Phases, + type PhaseUpdateResponse, + type PhaseGetResponse, + type PhaseUpdateParams, + type PhaseGetParams, } from './phases/index'; +export { + Rules, + type BlockRule, + type CompressResponseRule, + type DDoSDynamicRule, + type ExecuteRule, + type ForceConnectionCloseRule, + type LogCustomFieldRule, + type LogRule, + type Logging, + type ManagedChallengeRule, + type RedirectRule, + type RewriteRule, + type RewriteURIPart, + type RouteRule, + type RulesetRule, + type ScoreRule, + type ServeErrorRule, + type SetCacheSettingsRule, + type SetConfigRule, + type SkipRule, + type RuleCreateResponse, + type RuleDeleteResponse, + type RuleEditResponse, + type RuleCreateParams, + type RuleDeleteParams, + type RuleEditParams, +} from './rules'; export { Rulesets } from './rulesets'; export { - VersionListResponse, - VersionGetResponse, - VersionListParams, - VersionDeleteParams, - VersionGetParams, VersionListResponsesSinglePage, Versions, -} from './versions/index'; + type VersionListResponse, + type VersionGetResponse, + type VersionListParams, + type VersionDeleteParams, + type VersionGetParams, +} from './versions'; diff --git a/src/resources/rulesets/phases/index.ts b/src/resources/rulesets/phases/index.ts index 048dff1de6..ed7b852e8b 100644 --- a/src/resources/rulesets/phases/index.ts +++ b/src/resources/rulesets/phases/index.ts @@ -1,11 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { PhaseUpdateResponse, PhaseGetResponse, PhaseUpdateParams, PhaseGetParams, Phases } from './phases'; export { - VersionListResponse, - VersionGetResponse, - VersionListParams, - VersionGetParams, + Phases, + type PhaseUpdateResponse, + type PhaseGetResponse, + type PhaseUpdateParams, + type PhaseGetParams, +} from './phases'; +export { VersionListResponsesSinglePage, Versions, + type VersionListResponse, + type VersionGetResponse, + type VersionListParams, + type VersionGetParams, } from './versions'; diff --git a/src/resources/rulesets/phases/phases.ts b/src/resources/rulesets/phases/phases.ts index 204c0334ca..c01d50a013 100644 --- a/src/resources/rulesets/phases/phases.ts +++ b/src/resources/rulesets/phases/phases.ts @@ -3,11 +3,18 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import { CloudflareError } from '../../../error'; -import * as PhasesAPI from './phases'; +import { CloudflareError } from 'cloudflare/error'; import * as RulesAPI from '../rules'; import * as RulesetsAPI from '../rulesets'; import * as VersionsAPI from './versions'; +import { + VersionGetParams, + VersionGetResponse, + VersionListParams, + VersionListResponse, + VersionListResponsesSinglePage, + Versions, +} from './versions'; export class Phases extends APIResource { versions: VersionsAPI.Versions = new VersionsAPI.Versions(this._client); @@ -123,10 +130,10 @@ export interface PhaseUpdateResponse { */ rules: Array< | RulesAPI.BlockRule - | RulesAPI.ChallengeRule + | PhaseUpdateResponse.RulesetsChallengeRule | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | RulesAPI.JSChallengeRule + | PhaseUpdateResponse.RulesetsJSChallengeRule | RulesAPI.LogRule | RulesAPI.ManagedChallengeRule | RulesAPI.RedirectRule @@ -137,9 +144,9 @@ export interface PhaseUpdateResponse { | RulesAPI.SetConfigRule | RulesAPI.SkipRule | RulesAPI.SetCacheSettingsRule - | PhaseUpdateResponse.RulesetsLogCustomFieldRule - | PhaseUpdateResponse.RulesetsDDoSDynamicRule - | PhaseUpdateResponse.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRule + | RulesAPI.DDoSDynamicRule + | RulesAPI.ForceConnectionCloseRule >; /** @@ -154,7 +161,7 @@ export interface PhaseUpdateResponse { } export namespace PhaseUpdateResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -173,12 +180,12 @@ export namespace PhaseUpdateResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -195,6 +202,11 @@ export namespace PhaseUpdateResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -205,67 +217,86 @@ export namespace PhaseUpdateResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - export namespace ActionParameters { /** - * The cookie field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; /** - * The request field to log. + * The threshold of requests per period after which the action will be executed for + * the first time. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + requests_per_period?: number; /** - * The response field to log. + * Defines if ratelimit counting is only done when an origin is reached. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -284,7 +315,7 @@ export namespace PhaseUpdateResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -306,6 +337,11 @@ export namespace PhaseUpdateResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -317,66 +353,82 @@ export namespace PhaseUpdateResponse { logging?: RulesAPI.Logging; /** - * The reference of the rule (the rule ID by default). + * An object configuring the rule's ratelimit behavior. */ - ref?: string; - } + ratelimit?: RulesetsJSChallengeRule.Ratelimit; - export interface RulesetsForceConnectionCloseRule { /** - * The timestamp of when the rule was last modified. + * The reference of the rule (the rule ID by default). */ - last_updated: string; + ref?: string; + } + export namespace RulesetsJSChallengeRule { /** - * The version of the rule. + * Configure checks for exposed credentials. */ - version: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The action to perform when the rule matches. + * An object configuring the rule's ratelimit behavior. */ - action?: 'force_connection_close'; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -414,10 +466,10 @@ export interface PhaseGetResponse { */ rules: Array< | RulesAPI.BlockRule - | RulesAPI.ChallengeRule + | PhaseGetResponse.RulesetsChallengeRule | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | RulesAPI.JSChallengeRule + | PhaseGetResponse.RulesetsJSChallengeRule | RulesAPI.LogRule | RulesAPI.ManagedChallengeRule | RulesAPI.RedirectRule @@ -428,9 +480,9 @@ export interface PhaseGetResponse { | RulesAPI.SetConfigRule | RulesAPI.SkipRule | RulesAPI.SetCacheSettingsRule - | PhaseGetResponse.RulesetsLogCustomFieldRule - | PhaseGetResponse.RulesetsDDoSDynamicRule - | PhaseGetResponse.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRule + | RulesAPI.DDoSDynamicRule + | RulesAPI.ForceConnectionCloseRule >; /** @@ -445,7 +497,7 @@ export interface PhaseGetResponse { } export namespace PhaseGetResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -464,12 +516,12 @@ export namespace PhaseGetResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -486,6 +538,11 @@ export namespace PhaseGetResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -496,67 +553,86 @@ export namespace PhaseGetResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; - export namespace ActionParameters { /** - * The cookie field to log. + * Period in seconds over which the counter is being incremented. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + period: 10 | 60 | 600 | 3600; /** - * The request field to log. + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + counting_expression?: string; /** - * The response field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -575,7 +651,7 @@ export namespace PhaseGetResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -597,6 +673,11 @@ export namespace PhaseGetResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -608,66 +689,82 @@ export namespace PhaseGetResponse { logging?: RulesAPI.Logging; /** - * The reference of the rule (the rule ID by default). + * An object configuring the rule's ratelimit behavior. */ - ref?: string; - } + ratelimit?: RulesetsJSChallengeRule.Ratelimit; - export interface RulesetsForceConnectionCloseRule { /** - * The timestamp of when the rule was last modified. + * The reference of the rule (the rule ID by default). */ - last_updated: string; + ref?: string; + } + export namespace RulesetsJSChallengeRule { /** - * The version of the rule. + * Configure checks for exposed credentials. */ - version: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The action to perform when the rule matches. + * An object configuring the rule's ratelimit behavior. */ - action?: 'force_connection_close'; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -677,10 +774,10 @@ export interface PhaseUpdateParams { */ rules: Array< | RulesAPI.BlockRuleParam - | RulesAPI.ChallengeRuleParam + | PhaseUpdateParams.RulesetsChallengeRule | RulesAPI.CompressResponseRuleParam | RulesAPI.ExecuteRuleParam - | RulesAPI.JSChallengeRuleParam + | PhaseUpdateParams.RulesetsJSChallengeRule | RulesAPI.LogRuleParam | RulesAPI.ManagedChallengeRuleParam | RulesAPI.RedirectRuleParam @@ -691,9 +788,9 @@ export interface PhaseUpdateParams { | RulesAPI.SetConfigRuleParam | RulesAPI.SkipRuleParam | RulesAPI.SetCacheSettingsRuleParam - | PhaseUpdateParams.RulesetsLogCustomFieldRule - | PhaseUpdateParams.RulesetsDDoSDynamicRule - | PhaseUpdateParams.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRuleParam + | RulesAPI.DDoSDynamicRuleParam + | RulesAPI.ForceConnectionCloseRuleParam >; /** @@ -720,7 +817,7 @@ export interface PhaseUpdateParams { } export namespace PhaseUpdateParams { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The unique ID of the rule. */ @@ -729,12 +826,12 @@ export namespace PhaseUpdateParams { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * An informative description of the rule. @@ -746,6 +843,11 @@ export namespace PhaseUpdateParams { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -756,67 +858,86 @@ export namespace PhaseUpdateParams { */ logging?: RulesAPI.LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + /** - * The cookie fields to log. + * Expression that selects the user ID used in the credentials check. */ - cookie_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The request fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - request_fields?: Array; + characteristics: Array; /** - * The response fields to log. + * Period in seconds over which the counter is being incremented. */ - response_fields?: Array; - } + period: 10 | 60 | 600 | 3600; - export namespace ActionParameters { /** - * The cookie field to log. + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + counting_expression?: string; /** - * The request field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; /** - * The response field to log. + * The threshold of requests per period after which the action will be executed for + * the first time. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The unique ID of the rule. */ @@ -825,7 +946,7 @@ export namespace PhaseUpdateParams { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -842,6 +963,11 @@ export namespace PhaseUpdateParams { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -852,52 +978,83 @@ export namespace PhaseUpdateParams { */ logging?: RulesAPI.LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsJSChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export interface RulesetsForceConnectionCloseRule { + export namespace RulesetsJSChallengeRule { /** - * The unique ID of the rule. + * Configure checks for exposed credentials. */ - id?: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The action to perform when the rule matches. - */ - action?: 'force_connection_close'; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The parameters configuring the rule's action. + * An object configuring the rule's ratelimit behavior. */ - action_parameters?: unknown; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.LoggingParam; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -913,15 +1070,23 @@ export interface PhaseGetParams { zone_id?: string; } -export namespace Phases { - export import PhaseUpdateResponse = PhasesAPI.PhaseUpdateResponse; - export import PhaseGetResponse = PhasesAPI.PhaseGetResponse; - export import PhaseUpdateParams = PhasesAPI.PhaseUpdateParams; - export import PhaseGetParams = PhasesAPI.PhaseGetParams; - export import Versions = VersionsAPI.Versions; - export import VersionListResponse = VersionsAPI.VersionListResponse; - export import VersionGetResponse = VersionsAPI.VersionGetResponse; - export import VersionListResponsesSinglePage = VersionsAPI.VersionListResponsesSinglePage; - export import VersionListParams = VersionsAPI.VersionListParams; - export import VersionGetParams = VersionsAPI.VersionGetParams; +Phases.Versions = Versions; +Phases.VersionListResponsesSinglePage = VersionListResponsesSinglePage; + +export declare namespace Phases { + export { + type PhaseUpdateResponse as PhaseUpdateResponse, + type PhaseGetResponse as PhaseGetResponse, + type PhaseUpdateParams as PhaseUpdateParams, + type PhaseGetParams as PhaseGetParams, + }; + + export { + Versions as Versions, + type VersionListResponse as VersionListResponse, + type VersionGetResponse as VersionGetResponse, + VersionListResponsesSinglePage as VersionListResponsesSinglePage, + type VersionListParams as VersionListParams, + type VersionGetParams as VersionGetParams, + }; } diff --git a/src/resources/rulesets/phases/versions.ts b/src/resources/rulesets/phases/versions.ts index 6aef23ca2a..9cba4a8c22 100644 --- a/src/resources/rulesets/phases/versions.ts +++ b/src/resources/rulesets/phases/versions.ts @@ -3,8 +3,7 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import { CloudflareError } from '../../../error'; -import * as VersionsAPI from './versions'; +import { CloudflareError } from 'cloudflare/error'; import * as RulesAPI from '../rules'; import * as RulesetsAPI from '../rulesets'; import { SinglePage } from '../../../pagination'; @@ -179,10 +178,10 @@ export interface VersionGetResponse { */ rules: Array< | RulesAPI.BlockRule - | RulesAPI.ChallengeRule + | VersionGetResponse.RulesetsChallengeRule | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | RulesAPI.JSChallengeRule + | VersionGetResponse.RulesetsJSChallengeRule | RulesAPI.LogRule | RulesAPI.ManagedChallengeRule | RulesAPI.RedirectRule @@ -193,9 +192,9 @@ export interface VersionGetResponse { | RulesAPI.SetConfigRule | RulesAPI.SkipRule | RulesAPI.SetCacheSettingsRule - | VersionGetResponse.RulesetsLogCustomFieldRule - | VersionGetResponse.RulesetsDDoSDynamicRule - | VersionGetResponse.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRule + | RulesAPI.DDoSDynamicRule + | RulesAPI.ForceConnectionCloseRule >; /** @@ -210,7 +209,7 @@ export interface VersionGetResponse { } export namespace VersionGetResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -229,12 +228,12 @@ export namespace VersionGetResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -251,6 +250,11 @@ export namespace VersionGetResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -261,67 +265,86 @@ export namespace VersionGetResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - export namespace ActionParameters { /** - * The cookie field to log. + * Defines if ratelimit counting is only done when an origin is reached. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + requests_to_origin?: boolean; /** - * The request field to log. + * The score threshold per period for which the action will be executed the first + * time. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + score_per_period?: number; /** - * The response field to log. + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -340,7 +363,7 @@ export namespace VersionGetResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -362,6 +385,11 @@ export namespace VersionGetResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -373,66 +401,82 @@ export namespace VersionGetResponse { logging?: RulesAPI.Logging; /** - * The reference of the rule (the rule ID by default). + * An object configuring the rule's ratelimit behavior. */ - ref?: string; - } + ratelimit?: RulesetsJSChallengeRule.Ratelimit; - export interface RulesetsForceConnectionCloseRule { /** - * The timestamp of when the rule was last modified. + * The reference of the rule (the rule ID by default). */ - last_updated: string; + ref?: string; + } + export namespace RulesetsJSChallengeRule { /** - * The version of the rule. + * Configure checks for exposed credentials. */ - version: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The action to perform when the rule matches. + * An object configuring the rule's ratelimit behavior. */ - action?: 'force_connection_close'; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -460,10 +504,14 @@ export interface VersionGetParams { zone_id?: string; } -export namespace Versions { - export import VersionListResponse = VersionsAPI.VersionListResponse; - export import VersionGetResponse = VersionsAPI.VersionGetResponse; - export import VersionListResponsesSinglePage = VersionsAPI.VersionListResponsesSinglePage; - export import VersionListParams = VersionsAPI.VersionListParams; - export import VersionGetParams = VersionsAPI.VersionGetParams; +Versions.VersionListResponsesSinglePage = VersionListResponsesSinglePage; + +export declare namespace Versions { + export { + type VersionListResponse as VersionListResponse, + type VersionGetResponse as VersionGetResponse, + VersionListResponsesSinglePage as VersionListResponsesSinglePage, + type VersionListParams as VersionListParams, + type VersionGetParams as VersionGetParams, + }; } diff --git a/src/resources/rulesets/rules.ts b/src/resources/rulesets/rules.ts index 98a27fd7df..3cda9367df 100644 --- a/src/resources/rulesets/rules.ts +++ b/src/resources/rulesets/rules.ts @@ -3,7 +3,7 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import { CloudflareError } from '../../error'; +import { CloudflareError } from 'cloudflare/error'; import * as RulesAPI from './rules'; import * as RulesetsAPI from './rulesets'; @@ -166,6 +166,11 @@ export interface BlockRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: BlockRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -176,6 +181,11 @@ export interface BlockRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: BlockRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -214,6 +224,72 @@ export namespace BlockRule { status_code: number; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface BlockRuleParam { @@ -242,6 +318,11 @@ export interface BlockRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: BlockRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -252,6 +333,11 @@ export interface BlockRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: BlockRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -290,105 +376,72 @@ export namespace BlockRuleParam { status_code: number; } } -} - -export interface ChallengeRule { - /** - * The timestamp of when the rule was last modified. - */ - last_updated: string; - - /** - * The version of the rule. - */ - version: string; - - /** - * The unique ID of the rule. - */ - id?: string; /** - * The action to perform when the rule matches. - */ - action?: 'challenge'; - - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * An informative description of the rule. - */ - description?: string; - - /** - * Whether the rule should be executed. - */ - enabled?: boolean; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. + * Configure checks for exposed credentials. */ - logging?: Logging; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; -} + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } -export interface ChallengeRuleParam { /** - * The unique ID of the rule. + * An object configuring the rule's ratelimit behavior. */ - id?: string; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The action to perform when the rule matches. - */ - action?: 'challenge'; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: LoggingParam; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface CompressResponseRule { @@ -432,6 +485,11 @@ export interface CompressResponseRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: CompressResponseRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -442,6 +500,11 @@ export interface CompressResponseRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: CompressResponseRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -470,6 +533,72 @@ export namespace CompressResponseRule { name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface CompressResponseRuleParam { @@ -498,6 +627,11 @@ export interface CompressResponseRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: CompressResponseRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -508,6 +642,11 @@ export interface CompressResponseRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: CompressResponseRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -536,9 +675,75 @@ export namespace CompressResponseRuleParam { name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } -export interface ExecuteRule { +export interface DDoSDynamicRule { /** * The timestamp of when the rule was last modified. */ @@ -557,12 +762,12 @@ export interface ExecuteRule { /** * The action to perform when the rule matches. */ - action?: 'execute'; + action?: 'ddos_dynamic'; /** * The parameters configuring the rule's action. */ - action_parameters?: ExecuteRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -579,6 +784,11 @@ export interface ExecuteRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: DDoSDynamicRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -589,29 +799,289 @@ export interface ExecuteRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: DDoSDynamicRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } -export namespace ExecuteRule { +export namespace DDoSDynamicRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The ID of the ruleset to execute. + * Expression that selects the password used in the credentials check. */ - id: string; + password_expression: string; /** - * The configuration to use for matched data logging. + * Expression that selects the user ID used in the credentials check. */ - matched_data?: ActionParameters.MatchedData; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * A set of overrides to apply to the target ruleset. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + +export interface DDoSDynamicRuleParam { + /** + * The unique ID of the rule. + */ + id?: string; + + /** + * The action to perform when the rule matches. + */ + action?: 'ddos_dynamic'; + + /** + * The parameters configuring the rule's action. + */ + action_parameters?: unknown; + + /** + * An informative description of the rule. + */ + description?: string; + + /** + * Whether the rule should be executed. + */ + enabled?: boolean; + + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: DDoSDynamicRuleParam.ExposedCredentialCheck; + + /** + * The expression defining which traffic will match the rule. + */ + expression?: string; + + /** + * An object configuring the rule's logging behavior. + */ + logging?: LoggingParam; + + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: DDoSDynamicRuleParam.Ratelimit; + + /** + * The reference of the rule (the rule ID by default). + */ + ref?: string; +} + +export namespace DDoSDynamicRuleParam { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + +export interface ExecuteRule { + /** + * The timestamp of when the rule was last modified. + */ + last_updated: string; + + /** + * The version of the rule. + */ + version: string; + + /** + * The unique ID of the rule. + */ + id?: string; + + /** + * The action to perform when the rule matches. + */ + action?: 'execute'; + + /** + * The parameters configuring the rule's action. + */ + action_parameters?: ExecuteRule.ActionParameters; + + /** + * The categories of the rule. + */ + categories?: Array; + + /** + * An informative description of the rule. + */ + description?: string; + + /** + * Whether the rule should be executed. + */ + enabled?: boolean; + + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ExecuteRule.ExposedCredentialCheck; + + /** + * The expression defining which traffic will match the rule. + */ + expression?: string; + + /** + * An object configuring the rule's logging behavior. + */ + logging?: Logging; + + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ExecuteRule.Ratelimit; + + /** + * The reference of the rule (the rule ID by default). + */ + ref?: string; +} + +export namespace ExecuteRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { + /** + * The ID of the ruleset to execute. + */ + id: string; + + /** + * The configuration to use for matched data logging. + */ + matched_data?: ActionParameters.MatchedData; + + /** + * A set of overrides to apply to the target ruleset. */ overrides?: ActionParameters.Overrides; } @@ -718,6 +1188,72 @@ export namespace ExecuteRule { } } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface ExecuteRuleParam { @@ -746,6 +1282,11 @@ export interface ExecuteRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ExecuteRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -756,6 +1297,11 @@ export interface ExecuteRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ExecuteRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -885,33 +1431,99 @@ export namespace ExecuteRuleParam { } } } -} - -export interface JSChallengeRule { - /** - * The timestamp of when the rule was last modified. - */ - last_updated: string; /** - * The version of the rule. + * Configure checks for exposed credentials. */ - version: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The action to perform when the rule matches. + * An object configuring the rule's ratelimit behavior. */ - action?: 'js_challenge'; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + +export interface ForceConnectionCloseRule { + /** + * The timestamp of when the rule was last modified. + */ + last_updated: string; + + /** + * The version of the rule. + */ + version: string; + + /** + * The unique ID of the rule. + */ + id?: string; + + /** + * The action to perform when the rule matches. + */ + action?: 'force_connection_close'; + + /** + * The parameters configuring the rule's action. + */ + action_parameters?: unknown; /** * The categories of the rule. @@ -928,6 +1540,11 @@ export interface JSChallengeRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ForceConnectionCloseRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -938,13 +1555,86 @@ export interface JSChallengeRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ForceConnectionCloseRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } -export interface JSChallengeRuleParam { +export namespace ForceConnectionCloseRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + +export interface ForceConnectionCloseRuleParam { /** * The unique ID of the rule. */ @@ -953,7 +1643,7 @@ export interface JSChallengeRuleParam { /** * The action to perform when the rule matches. */ - action?: 'js_challenge'; + action?: 'force_connection_close'; /** * The parameters configuring the rule's action. @@ -970,6 +1660,318 @@ export interface JSChallengeRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ForceConnectionCloseRuleParam.ExposedCredentialCheck; + + /** + * The expression defining which traffic will match the rule. + */ + expression?: string; + + /** + * An object configuring the rule's logging behavior. + */ + logging?: LoggingParam; + + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ForceConnectionCloseRuleParam.Ratelimit; + + /** + * The reference of the rule (the rule ID by default). + */ + ref?: string; +} + +export namespace ForceConnectionCloseRuleParam { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + +export interface LogCustomFieldRule { + /** + * The timestamp of when the rule was last modified. + */ + last_updated: string; + + /** + * The version of the rule. + */ + version: string; + + /** + * The unique ID of the rule. + */ + id?: string; + + /** + * The action to perform when the rule matches. + */ + action?: 'log_custom_field'; + + /** + * The parameters configuring the rule's action. + */ + action_parameters?: LogCustomFieldRule.ActionParameters; + + /** + * The categories of the rule. + */ + categories?: Array; + + /** + * An informative description of the rule. + */ + description?: string; + + /** + * Whether the rule should be executed. + */ + enabled?: boolean; + + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: LogCustomFieldRule.ExposedCredentialCheck; + + /** + * The expression defining which traffic will match the rule. + */ + expression?: string; + + /** + * An object configuring the rule's logging behavior. + */ + logging?: Logging; + + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: LogCustomFieldRule.Ratelimit; + + /** + * The reference of the rule (the rule ID by default). + */ + ref?: string; +} + +export namespace LogCustomFieldRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { + /** + * The cookie fields to log. + */ + cookie_fields?: Array; + + /** + * The request fields to log. + */ + request_fields?: Array; + + /** + * The response fields to log. + */ + response_fields?: Array; + } + + export namespace ActionParameters { + /** + * The cookie field to log. + */ + export interface CookieField { + /** + * The name of the field. + */ + name: string; + } + + /** + * The request field to log. + */ + export interface RequestField { + /** + * The name of the field. + */ + name: string; + } + + /** + * The response field to log. + */ + export interface ResponseField { + /** + * The name of the field. + */ + name: string; + } + } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + +export interface LogCustomFieldRuleParam { + /** + * The unique ID of the rule. + */ + id?: string; + + /** + * The action to perform when the rule matches. + */ + action?: 'log_custom_field'; + + /** + * The parameters configuring the rule's action. + */ + action_parameters?: LogCustomFieldRuleParam.ActionParameters; + + /** + * An informative description of the rule. + */ + description?: string; + + /** + * Whether the rule should be executed. + */ + enabled?: boolean; + + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: LogCustomFieldRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -980,12 +1982,137 @@ export interface JSChallengeRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: LogCustomFieldRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } +export namespace LogCustomFieldRuleParam { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { + /** + * The cookie fields to log. + */ + cookie_fields?: Array; + + /** + * The request fields to log. + */ + request_fields?: Array; + + /** + * The response fields to log. + */ + response_fields?: Array; + } + + export namespace ActionParameters { + /** + * The cookie field to log. + */ + export interface CookieField { + /** + * The name of the field. + */ + name: string; + } + + /** + * The request field to log. + */ + export interface RequestField { + /** + * The name of the field. + */ + name: string; + } + + /** + * The response field to log. + */ + export interface ResponseField { + /** + * The name of the field. + */ + name: string; + } + } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + export interface LogRule { /** * The timestamp of when the rule was last modified. @@ -1027,6 +2154,11 @@ export interface LogRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: LogRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1037,12 +2169,85 @@ export interface LogRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: LogRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } +export namespace LogRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + export interface LogRuleParam { /** * The unique ID of the rule. @@ -1067,7 +2272,12 @@ export interface LogRuleParam { /** * Whether the rule should be executed. */ - enabled?: boolean; + enabled?: boolean; + + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: LogRuleParam.ExposedCredentialCheck; /** * The expression defining which traffic will match the rule. @@ -1079,12 +2289,85 @@ export interface LogRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: LogRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } +export namespace LogRuleParam { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + /** * An object configuring the rule's logging behavior. */ @@ -1146,6 +2429,11 @@ export interface ManagedChallengeRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ManagedChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1156,12 +2444,85 @@ export interface ManagedChallengeRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ManagedChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } +export namespace ManagedChallengeRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + export interface ManagedChallengeRuleParam { /** * The unique ID of the rule. @@ -1188,6 +2549,11 @@ export interface ManagedChallengeRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ManagedChallengeRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1198,12 +2564,85 @@ export interface ManagedChallengeRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ManagedChallengeRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } +export namespace ManagedChallengeRuleParam { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + export interface RedirectRule { /** * The timestamp of when the rule was last modified. @@ -1245,6 +2684,11 @@ export interface RedirectRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RedirectRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1255,6 +2699,11 @@ export interface RedirectRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RedirectRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -1329,6 +2778,72 @@ export namespace RedirectRule { } } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface RedirectRuleParam { @@ -1357,6 +2872,11 @@ export interface RedirectRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RedirectRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1367,6 +2887,11 @@ export interface RedirectRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RedirectRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -1441,6 +2966,72 @@ export namespace RedirectRuleParam { } } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface RewriteRule { @@ -1484,6 +3075,11 @@ export interface RewriteRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RewriteRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1494,6 +3090,11 @@ export interface RewriteRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RewriteRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -1566,6 +3167,72 @@ export namespace RewriteRule { query?: RulesAPI.RewriteURIPart; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface RewriteRuleParam { @@ -1594,6 +3261,11 @@ export interface RewriteRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RewriteRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1604,6 +3276,11 @@ export interface RewriteRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RewriteRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -1676,6 +3353,72 @@ export namespace RewriteRuleParam { query?: RulesAPI.RewriteURIPartParam; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export type RewriteURIPart = RewriteURIPart.StaticValue | RewriteURIPart.DynamicValue; @@ -1755,6 +3498,11 @@ export interface RouteRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RouteRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1765,6 +3513,11 @@ export interface RouteRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RouteRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -1818,6 +3571,72 @@ export namespace RouteRule { value: string; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface RouteRuleParam { @@ -1846,6 +3665,11 @@ export interface RouteRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RouteRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1856,6 +3680,11 @@ export interface RouteRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RouteRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -1909,6 +3738,72 @@ export namespace RouteRuleParam { value: string; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface RulesetRule { @@ -1952,6 +3847,11 @@ export interface RulesetRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1962,12 +3862,85 @@ export interface RulesetRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } +export namespace RulesetRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } +} + export interface ScoreRule { /** * The timestamp of when the rule was last modified. @@ -2009,6 +3982,11 @@ export interface ScoreRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ScoreRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -2019,6 +3997,11 @@ export interface ScoreRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ScoreRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -2036,6 +4019,72 @@ export namespace ScoreRule { */ increment?: number; } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface ScoreRuleParam { @@ -2064,6 +4113,11 @@ export interface ScoreRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ScoreRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -2074,6 +4128,11 @@ export interface ScoreRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ScoreRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -2091,6 +4150,72 @@ export namespace ScoreRuleParam { */ increment?: number; } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface ServeErrorRule { @@ -2134,6 +4259,11 @@ export interface ServeErrorRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ServeErrorRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -2144,6 +4274,11 @@ export interface ServeErrorRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ServeErrorRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -2170,6 +4305,72 @@ export namespace ServeErrorRule { */ status_code?: number; } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface ServeErrorRuleParam { @@ -2198,6 +4399,11 @@ export interface ServeErrorRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: ServeErrorRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -2208,6 +4414,11 @@ export interface ServeErrorRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: ServeErrorRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -2234,6 +4445,72 @@ export namespace ServeErrorRuleParam { */ status_code?: number; } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface SetCacheSettingsRule { @@ -2277,6 +4554,11 @@ export interface SetCacheSettingsRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: SetCacheSettingsRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -2287,6 +4569,11 @@ export interface SetCacheSettingsRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: SetCacheSettingsRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -2438,10 +4725,9 @@ export namespace SetCacheSettingsRule { host?: CustomKey.Host; /** - * Use the presence or absence of parameters in the query string to build the cache - * key. + * Use the presence of parameters in the query string to build the cache key. */ - query_string?: CustomKey.QueryString; + query_string?: CustomKey.IncludedQueryStringParameters | CustomKey.ExcludedQueryStringParameters; /** * Characteristics of the request user agent used in building the cache key. @@ -2508,56 +4794,69 @@ export namespace SetCacheSettingsRule { } /** - * Use the presence or absence of parameters in the query string to build the cache - * key. + * Use the presence of parameters in the query string to build the cache key. */ - export interface QueryString { + export interface IncludedQueryStringParameters { /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters + * A list of query string parameters used to build the cache key. */ - exclude?: QueryString.Exclude; + include?: + | IncludedQueryStringParameters.SomeQueryStringParameters + | IncludedQueryStringParameters.AllQueryStringParameters; + } + export namespace IncludedQueryStringParameters { /** - * build the cache key using a list of query string parameters that ARE in the - * request. + * A list of query string parameters used to build the cache key. */ - include?: QueryString.Include; - } + export interface SomeQueryStringParameters { + list?: Array; + } - export namespace QueryString { /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters + * Build the cache key using ALL query string parameters that are in the request. */ - export interface Exclude { + export interface AllQueryStringParameters { /** - * Exclude all query string parameters from use in building the cache key. + * Determines whether to include all query string parameters in the cache key. */ all?: boolean; + } + } - /** - * A list of query string parameters NOT used to build the cache key. All - * parameters present in the request but missing in this list will be used to build - * the cache key. - */ + /** + * Use the absence of parameters in the query string to build the cache key. + */ + export interface ExcludedQueryStringParameters { + /** + * A list of query string parameters NOT used to build the cache key. All + * parameters present in the request but missing in this list will be used to build + * the cache key. + */ + exclude?: + | ExcludedQueryStringParameters.SomeQueryStringParameters + | ExcludedQueryStringParameters.AllQueryStringParameters; + } + + export namespace ExcludedQueryStringParameters { + /** + * A list of query string parameters NOT used to build the cache key. All + * parameters present in the request but missing in this list will be used to build + * the cache key. + */ + export interface SomeQueryStringParameters { list?: Array; } /** - * build the cache key using a list of query string parameters that ARE in the + * Build the cache key excluding ALL query string parameters that are in the * request. */ - export interface Include { + export interface AllQueryStringParameters { /** - * Use all query string parameters in the cache key. + * Determines whether to exclude all query string parameters from the cache key. */ all?: boolean; - - /** - * A list of query string parameters used to build the cache key. - */ - list?: Array; } } @@ -2597,7 +4896,7 @@ export namespace SetCacheSettingsRule { /** * The minimum file size eligible for store in cache reserve. */ - min_file_size: number; + minimum_file_size: number; } /** @@ -2677,6 +4976,72 @@ export namespace SetCacheSettingsRule { disable_stale_while_updating: boolean; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface SetCacheSettingsRuleParam { @@ -2705,6 +5070,11 @@ export interface SetCacheSettingsRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: SetCacheSettingsRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -2715,6 +5085,11 @@ export interface SetCacheSettingsRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: SetCacheSettingsRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -2866,10 +5241,9 @@ export namespace SetCacheSettingsRuleParam { host?: CustomKey.Host; /** - * Use the presence or absence of parameters in the query string to build the cache - * key. + * Use the presence of parameters in the query string to build the cache key. */ - query_string?: CustomKey.QueryString; + query_string?: CustomKey.IncludedQueryStringParameters | CustomKey.ExcludedQueryStringParameters; /** * Characteristics of the request user agent used in building the cache key. @@ -2936,56 +5310,69 @@ export namespace SetCacheSettingsRuleParam { } /** - * Use the presence or absence of parameters in the query string to build the cache - * key. + * Use the presence of parameters in the query string to build the cache key. */ - export interface QueryString { + export interface IncludedQueryStringParameters { /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters + * A list of query string parameters used to build the cache key. */ - exclude?: QueryString.Exclude; + include?: + | IncludedQueryStringParameters.SomeQueryStringParameters + | IncludedQueryStringParameters.AllQueryStringParameters; + } + export namespace IncludedQueryStringParameters { /** - * build the cache key using a list of query string parameters that ARE in the - * request. + * A list of query string parameters used to build the cache key. */ - include?: QueryString.Include; - } + export interface SomeQueryStringParameters { + list?: Array; + } - export namespace QueryString { /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters + * Build the cache key using ALL query string parameters that are in the request. */ - export interface Exclude { + export interface AllQueryStringParameters { /** - * Exclude all query string parameters from use in building the cache key. + * Determines whether to include all query string parameters in the cache key. */ all?: boolean; + } + } - /** - * A list of query string parameters NOT used to build the cache key. All - * parameters present in the request but missing in this list will be used to build - * the cache key. - */ + /** + * Use the absence of parameters in the query string to build the cache key. + */ + export interface ExcludedQueryStringParameters { + /** + * A list of query string parameters NOT used to build the cache key. All + * parameters present in the request but missing in this list will be used to build + * the cache key. + */ + exclude?: + | ExcludedQueryStringParameters.SomeQueryStringParameters + | ExcludedQueryStringParameters.AllQueryStringParameters; + } + + export namespace ExcludedQueryStringParameters { + /** + * A list of query string parameters NOT used to build the cache key. All + * parameters present in the request but missing in this list will be used to build + * the cache key. + */ + export interface SomeQueryStringParameters { list?: Array; } /** - * build the cache key using a list of query string parameters that ARE in the + * Build the cache key excluding ALL query string parameters that are in the * request. */ - export interface Include { + export interface AllQueryStringParameters { /** - * Use all query string parameters in the cache key. + * Determines whether to exclude all query string parameters from the cache key. */ all?: boolean; - - /** - * A list of query string parameters used to build the cache key. - */ - list?: Array; } } @@ -3025,7 +5412,7 @@ export namespace SetCacheSettingsRuleParam { /** * The minimum file size eligible for store in cache reserve. */ - min_file_size: number; + minimum_file_size: number; } /** @@ -3105,6 +5492,72 @@ export namespace SetCacheSettingsRuleParam { disable_stale_while_updating: boolean; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface SetConfigRule { @@ -3148,6 +5601,11 @@ export interface SetConfigRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: SetConfigRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -3158,6 +5616,11 @@ export interface SetConfigRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: SetConfigRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -3270,11 +5733,77 @@ export namespace SetConfigRule { */ html?: boolean; - /** - * Minify JS files. - */ - js?: boolean; - } + /** + * Minify JS files. + */ + js?: boolean; + } + } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } @@ -3304,6 +5833,11 @@ export interface SetConfigRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: SetConfigRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -3314,6 +5848,11 @@ export interface SetConfigRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: SetConfigRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -3432,6 +5971,72 @@ export namespace SetConfigRuleParam { js?: boolean; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface SkipRule { @@ -3475,6 +6080,11 @@ export interface SkipRule { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: SkipRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -3485,6 +6095,11 @@ export interface SkipRule { */ logging?: Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: SkipRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -3525,6 +6140,72 @@ export namespace SkipRule { */ rulesets?: Array; } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface SkipRuleParam { @@ -3553,6 +6234,11 @@ export interface SkipRuleParam { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: SkipRuleParam.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -3563,6 +6249,11 @@ export interface SkipRuleParam { */ logging?: LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: SkipRuleParam.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ @@ -3603,6 +6294,72 @@ export namespace SkipRuleParam { */ rulesets?: Array; } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } /** @@ -3639,10 +6396,10 @@ export interface RuleCreateResponse { */ rules: Array< | BlockRule - | ChallengeRule + | RuleCreateResponse.RulesetsChallengeRule | CompressResponseRule | ExecuteRule - | JSChallengeRule + | RuleCreateResponse.RulesetsJSChallengeRule | LogRule | ManagedChallengeRule | RedirectRule @@ -3653,9 +6410,9 @@ export interface RuleCreateResponse { | SetConfigRule | SkipRule | SetCacheSettingsRule - | RuleCreateResponse.RulesetsLogCustomFieldRule - | RuleCreateResponse.RulesetsDDoSDynamicRule - | RuleCreateResponse.RulesetsForceConnectionCloseRule + | LogCustomFieldRule + | DDoSDynamicRule + | ForceConnectionCloseRule >; /** @@ -3670,7 +6427,7 @@ export interface RuleCreateResponse { } export namespace RuleCreateResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -3689,12 +6446,12 @@ export namespace RuleCreateResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -3711,6 +6468,11 @@ export namespace RuleCreateResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -3721,67 +6483,86 @@ export namespace RuleCreateResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; - export namespace ActionParameters { /** - * The cookie field to log. + * Period in seconds over which the counter is being incremented. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + period: 10 | 60 | 600 | 3600; /** - * The request field to log. + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + counting_expression?: string; /** - * The response field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -3800,7 +6581,7 @@ export namespace RuleCreateResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -3822,6 +6603,11 @@ export namespace RuleCreateResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -3833,66 +6619,82 @@ export namespace RuleCreateResponse { logging?: RulesAPI.Logging; /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsForceConnectionCloseRule { - /** - * The timestamp of when the rule was last modified. + * An object configuring the rule's ratelimit behavior. */ - last_updated: string; + ratelimit?: RulesetsJSChallengeRule.Ratelimit; /** - * The version of the rule. + * The reference of the rule (the rule ID by default). */ - version: string; + ref?: string; + } + export namespace RulesetsJSChallengeRule { /** - * The unique ID of the rule. + * Configure checks for exposed credentials. */ - id?: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The action to perform when the rule matches. - */ - action?: 'force_connection_close'; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The parameters configuring the rule's action. + * An object configuring the rule's ratelimit behavior. */ - action_parameters?: unknown; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -3930,10 +6732,10 @@ export interface RuleDeleteResponse { */ rules: Array< | BlockRule - | ChallengeRule + | RuleDeleteResponse.RulesetsChallengeRule | CompressResponseRule | ExecuteRule - | JSChallengeRule + | RuleDeleteResponse.RulesetsJSChallengeRule | LogRule | ManagedChallengeRule | RedirectRule @@ -3944,9 +6746,9 @@ export interface RuleDeleteResponse { | SetConfigRule | SkipRule | SetCacheSettingsRule - | RuleDeleteResponse.RulesetsLogCustomFieldRule - | RuleDeleteResponse.RulesetsDDoSDynamicRule - | RuleDeleteResponse.RulesetsForceConnectionCloseRule + | LogCustomFieldRule + | DDoSDynamicRule + | ForceConnectionCloseRule >; /** @@ -3961,7 +6763,7 @@ export interface RuleDeleteResponse { } export namespace RuleDeleteResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -3980,12 +6782,12 @@ export namespace RuleDeleteResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -4002,6 +6804,11 @@ export namespace RuleDeleteResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -4012,67 +6819,86 @@ export namespace RuleDeleteResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; - export namespace ActionParameters { /** - * The cookie field to log. + * Period in seconds over which the counter is being incremented. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + period: 10 | 60 | 600 | 3600; /** - * The request field to log. + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + counting_expression?: string; /** - * The response field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -4091,7 +6917,7 @@ export namespace RuleDeleteResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -4113,6 +6939,11 @@ export namespace RuleDeleteResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -4124,66 +6955,82 @@ export namespace RuleDeleteResponse { logging?: RulesAPI.Logging; /** - * The reference of the rule (the rule ID by default). + * An object configuring the rule's ratelimit behavior. */ - ref?: string; - } + ratelimit?: RulesetsJSChallengeRule.Ratelimit; - export interface RulesetsForceConnectionCloseRule { /** - * The timestamp of when the rule was last modified. + * The reference of the rule (the rule ID by default). */ - last_updated: string; + ref?: string; + } + export namespace RulesetsJSChallengeRule { /** - * The version of the rule. + * Configure checks for exposed credentials. */ - version: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The action to perform when the rule matches. + * An object configuring the rule's ratelimit behavior. */ - action?: 'force_connection_close'; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -4221,10 +7068,10 @@ export interface RuleEditResponse { */ rules: Array< | BlockRule - | ChallengeRule + | RuleEditResponse.RulesetsChallengeRule | CompressResponseRule | ExecuteRule - | JSChallengeRule + | RuleEditResponse.RulesetsJSChallengeRule | LogRule | ManagedChallengeRule | RedirectRule @@ -4235,9 +7082,9 @@ export interface RuleEditResponse { | SetConfigRule | SkipRule | SetCacheSettingsRule - | RuleEditResponse.RulesetsLogCustomFieldRule - | RuleEditResponse.RulesetsDDoSDynamicRule - | RuleEditResponse.RulesetsForceConnectionCloseRule + | LogCustomFieldRule + | DDoSDynamicRule + | ForceConnectionCloseRule >; /** @@ -4252,7 +7099,7 @@ export interface RuleEditResponse { } export namespace RuleEditResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -4271,12 +7118,12 @@ export namespace RuleEditResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -4293,6 +7140,11 @@ export namespace RuleEditResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -4303,67 +7155,86 @@ export namespace RuleEditResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; - export namespace ActionParameters { /** - * The cookie field to log. + * Period in seconds over which the counter is being incremented. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + period: 10 | 60 | 600 | 3600; /** - * The request field to log. + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + counting_expression?: string; /** - * The response field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -4382,7 +7253,7 @@ export namespace RuleEditResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -4404,6 +7275,11 @@ export namespace RuleEditResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -4415,90 +7291,106 @@ export namespace RuleEditResponse { logging?: RulesAPI.Logging; /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsForceConnectionCloseRule { - /** - * The timestamp of when the rule was last modified. + * An object configuring the rule's ratelimit behavior. */ - last_updated: string; + ratelimit?: RulesetsJSChallengeRule.Ratelimit; /** - * The version of the rule. + * The reference of the rule (the rule ID by default). */ - version: string; + ref?: string; + } + export namespace RulesetsJSChallengeRule { /** - * The unique ID of the rule. + * Configure checks for exposed credentials. */ - id?: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The action to perform when the rule matches. - */ - action?: 'force_connection_close'; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The parameters configuring the rule's action. + * An object configuring the rule's ratelimit behavior. */ - action_parameters?: unknown; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } export type RuleCreateParams = | RuleCreateParams.BlockRule | RuleCreateParams.ChallengeRule - | RuleCreateParams.CompressResponseRule + | RuleCreateParams.CompressionRule | RuleCreateParams.ExecuteRule - | RuleCreateParams.JSChallengeRule + | RuleCreateParams.JavascriptChallengeRule | RuleCreateParams.LogRule | RuleCreateParams.ManagedChallengeRule | RuleCreateParams.RedirectRule | RuleCreateParams.RewriteRule - | RuleCreateParams.RouteRule + | RuleCreateParams.OriginRule | RuleCreateParams.ScoreRule | RuleCreateParams.ServeErrorRule | RuleCreateParams.SetConfigRule | RuleCreateParams.SkipRule | RuleCreateParams.SetCacheSettingsRule - | RuleCreateParams.RulesetsLogCustomFieldRule - | RuleCreateParams.RulesetsDDoSDynamicRule - | RuleCreateParams.RulesetsForceConnectionCloseRule; + | RuleCreateParams.LogCustomFieldRule + | RuleCreateParams.DDoSDynamicRule + | RuleCreateParams.ForceConnectionCloseRule; -export namespace RuleCreateParams { +export declare namespace RuleCreateParams { export interface BlockRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the @@ -4537,6 +7429,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.BlockRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -4547,6 +7444,19 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.BlockRule.BeforePosition + | RuleCreateParams.BlockRule.AfterPosition + | RuleCreateParams.BlockRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.BlockRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -4585,6 +7495,104 @@ export namespace RuleCreateParams { status_code: number; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface ChallengeRule { @@ -4625,6 +7633,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.ChallengeRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -4635,13 +7648,126 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.ChallengeRule.BeforePosition + | RuleCreateParams.ChallengeRule.AfterPosition + | RuleCreateParams.ChallengeRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.ChallengeRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export interface CompressResponseRule { + export namespace ChallengeRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + + export interface CompressionRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -4667,7 +7793,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.CompressResponseRule.ActionParameters; + action_parameters?: RuleCreateParams.CompressionRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -4679,6 +7805,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.CompressionRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -4689,13 +7820,26 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.CompressionRule.BeforePosition + | RuleCreateParams.CompressionRule.AfterPosition + | RuleCreateParams.CompressionRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.CompressionRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace CompressResponseRule { + export namespace CompressionRule { /** * The parameters configuring the rule's action. */ @@ -4717,6 +7861,104 @@ export namespace RuleCreateParams { name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface ExecuteRule { @@ -4757,6 +7999,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.ExecuteRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -4767,6 +8014,19 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.ExecuteRule.BeforePosition + | RuleCreateParams.ExecuteRule.AfterPosition + | RuleCreateParams.ExecuteRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.ExecuteRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -4896,9 +8156,107 @@ export namespace RuleCreateParams { } } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface JSChallengeRule { + export interface JavascriptChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -4936,6 +8294,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.JavascriptChallengeRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -4946,12 +8309,125 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.JavascriptChallengeRule.BeforePosition + | RuleCreateParams.JavascriptChallengeRule.AfterPosition + | RuleCreateParams.JavascriptChallengeRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.JavascriptChallengeRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } + export namespace JavascriptChallengeRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + export interface LogRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the @@ -4990,6 +8466,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.LogRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -5000,12 +8481,125 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.LogRule.BeforePosition + | RuleCreateParams.LogRule.AfterPosition + | RuleCreateParams.LogRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.LogRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } + export namespace LogRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + export interface ManagedChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the @@ -5044,6 +8638,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.ManagedChallengeRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -5054,12 +8653,125 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.ManagedChallengeRule.BeforePosition + | RuleCreateParams.ManagedChallengeRule.AfterPosition + | RuleCreateParams.ManagedChallengeRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.ManagedChallengeRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } + export namespace ManagedChallengeRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + export interface RedirectRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the @@ -5098,6 +8810,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.RedirectRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -5108,6 +8825,19 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.RedirectRule.BeforePosition + | RuleCreateParams.RedirectRule.AfterPosition + | RuleCreateParams.RedirectRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.RedirectRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -5182,6 +8912,104 @@ export namespace RuleCreateParams { } } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface RewriteRule { @@ -5222,6 +9050,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.RewriteRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -5232,6 +9065,19 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.RewriteRule.BeforePosition + | RuleCreateParams.RewriteRule.AfterPosition + | RuleCreateParams.RewriteRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.RewriteRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -5304,9 +9150,107 @@ export namespace RuleCreateParams { query?: RulesAPI.RewriteURIPartParam; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface RouteRule { + export interface OriginRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -5332,7 +9276,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RouteRule.ActionParameters; + action_parameters?: RuleCreateParams.OriginRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -5344,6 +9288,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.OriginRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -5354,13 +9303,26 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.OriginRule.BeforePosition + | RuleCreateParams.OriginRule.AfterPosition + | RuleCreateParams.OriginRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.OriginRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RouteRule { + export namespace OriginRule { /** * The parameters configuring the rule's action. */ @@ -5407,9 +9369,290 @@ export namespace RuleCreateParams { value: string; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + + export interface ScoreRule { + /** + * Path param: The Account ID to use for this endpoint. Mutually exclusive with the + * Zone ID. + */ + account_id?: string; + + /** + * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the + * Account ID. + */ + zone_id?: string; + + /** + * Body param: The unique ID of the rule. + */ + id?: string; + + /** + * Body param: The action to perform when the rule matches. + */ + action?: 'score'; + + /** + * Body param: The parameters configuring the rule's action. + */ + action_parameters?: RuleCreateParams.ScoreRule.ActionParameters; + + /** + * Body param: An informative description of the rule. + */ + description?: string; + + /** + * Body param: Whether the rule should be executed. + */ + enabled?: boolean; + + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.ScoreRule.ExposedCredentialCheck; + + /** + * Body param: The expression defining which traffic will match the rule. + */ + expression?: string; + + /** + * Body param: An object configuring the rule's logging behavior. + */ + logging?: LoggingParam; + + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.ScoreRule.BeforePosition + | RuleCreateParams.ScoreRule.AfterPosition + | RuleCreateParams.ScoreRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.ScoreRule.Ratelimit; + + /** + * Body param: The reference of the rule (the rule ID by default). + */ + ref?: string; + } + + export namespace ScoreRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { + /** + * Increment contains the delta to change the score and can be either positive or + * negative. + */ + increment?: number; + } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface ScoreRule { + export interface ServeErrorRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -5430,12 +9673,12 @@ export namespace RuleCreateParams { /** * Body param: The action to perform when the rule matches. */ - action?: 'score'; + action?: 'serve_error'; /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.ScoreRule.ActionParameters; + action_parameters?: RuleCreateParams.ServeErrorRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -5447,6 +9690,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.ServeErrorRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -5457,98 +9705,142 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.ServeErrorRule.BeforePosition + | RuleCreateParams.ServeErrorRule.AfterPosition + | RuleCreateParams.ServeErrorRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.ServeErrorRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace ScoreRule { + export namespace ServeErrorRule { /** * The parameters configuring the rule's action. */ export interface ActionParameters { /** - * Increment contains the delta to change the score and can be either positive or - * negative. + * Error response content. */ - increment?: number; + content?: string; + + /** + * Content-type header to set with the response. + */ + content_type?: 'application/json' | 'text/xml' | 'text/plain' | 'text/html'; + + /** + * The status code to use for the error. + */ + status_code?: number; } - } - export interface ServeErrorRule { /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. + * Configure checks for exposed credentials. */ - account_id?: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * Body param: The unique ID of the rule. + * An object configuring where the rule will be placed. */ - id?: string; + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } /** - * Body param: The action to perform when the rule matches. + * An object configuring where the rule will be placed. */ - action?: 'serve_error'; + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } /** - * Body param: The parameters configuring the rule's action. + * An object configuring where the rule will be placed. */ - action_parameters?: RuleCreateParams.ServeErrorRule.ActionParameters; + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } /** - * Body param: An informative description of the rule. + * An object configuring the rule's ratelimit behavior. */ - description?: string; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * Body param: Whether the rule should be executed. - */ - enabled?: boolean; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * Body param: The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * Body param: An object configuring the rule's logging behavior. - */ - logging?: LoggingParam; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Body param: The reference of the rule (the rule ID by default). - */ - ref?: string; - } + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - export namespace ServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { /** - * Error response content. + * Defines if ratelimit counting is only done when an origin is reached. */ - content?: string; + requests_to_origin?: boolean; /** - * Content-type header to set with the response. + * The score threshold per period for which the action will be executed the first + * time. */ - content_type?: 'application/json' | 'text/xml' | 'text/plain' | 'text/html'; + score_per_period?: number; /** - * The status code to use for the error. + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. */ - status_code?: number; + score_response_header_name?: string; } } @@ -5590,6 +9882,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.SetConfigRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -5600,6 +9897,19 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.SetConfigRule.BeforePosition + | RuleCreateParams.SetConfigRule.AfterPosition + | RuleCreateParams.SetConfigRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.SetConfigRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -5718,6 +10028,104 @@ export namespace RuleCreateParams { js?: boolean; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface SkipRule { @@ -5758,6 +10166,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.SkipRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -5768,6 +10181,19 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.SkipRule.BeforePosition + | RuleCreateParams.SkipRule.AfterPosition + | RuleCreateParams.SkipRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.SkipRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -5808,6 +10234,104 @@ export namespace RuleCreateParams { */ rulesets?: Array; } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface SetCacheSettingsRule { @@ -5848,6 +10372,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.SetCacheSettingsRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -5858,6 +10387,19 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.SetCacheSettingsRule.BeforePosition + | RuleCreateParams.SetCacheSettingsRule.AfterPosition + | RuleCreateParams.SetCacheSettingsRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.SetCacheSettingsRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -6009,10 +10551,9 @@ export namespace RuleCreateParams { host?: CustomKey.Host; /** - * Use the presence or absence of parameters in the query string to build the cache - * key. + * Use the presence of parameters in the query string to build the cache key. */ - query_string?: CustomKey.QueryString; + query_string?: CustomKey.IncludedQueryStringParameters | CustomKey.ExcludedQueryStringParameters; /** * Characteristics of the request user agent used in building the cache key. @@ -6079,56 +10620,69 @@ export namespace RuleCreateParams { } /** - * Use the presence or absence of parameters in the query string to build the cache - * key. + * Use the presence of parameters in the query string to build the cache key. */ - export interface QueryString { + export interface IncludedQueryStringParameters { /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters + * A list of query string parameters used to build the cache key. */ - exclude?: QueryString.Exclude; + include?: + | IncludedQueryStringParameters.SomeQueryStringParameters + | IncludedQueryStringParameters.AllQueryStringParameters; + } + export namespace IncludedQueryStringParameters { /** - * build the cache key using a list of query string parameters that ARE in the - * request. + * A list of query string parameters used to build the cache key. + */ + export interface SomeQueryStringParameters { + list?: Array; + } + + /** + * Build the cache key using ALL query string parameters that are in the request. + */ + export interface AllQueryStringParameters { + /** + * Determines whether to include all query string parameters in the cache key. + */ + all?: boolean; + } + } + + /** + * Use the absence of parameters in the query string to build the cache key. + */ + export interface ExcludedQueryStringParameters { + /** + * A list of query string parameters NOT used to build the cache key. All + * parameters present in the request but missing in this list will be used to build + * the cache key. */ - include?: QueryString.Include; + exclude?: + | ExcludedQueryStringParameters.SomeQueryStringParameters + | ExcludedQueryStringParameters.AllQueryStringParameters; } - export namespace QueryString { + export namespace ExcludedQueryStringParameters { /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters + * A list of query string parameters NOT used to build the cache key. All + * parameters present in the request but missing in this list will be used to build + * the cache key. */ - export interface Exclude { - /** - * Exclude all query string parameters from use in building the cache key. - */ - all?: boolean; - - /** - * A list of query string parameters NOT used to build the cache key. All - * parameters present in the request but missing in this list will be used to build - * the cache key. - */ + export interface SomeQueryStringParameters { list?: Array; } /** - * build the cache key using a list of query string parameters that ARE in the + * Build the cache key excluding ALL query string parameters that are in the * request. */ - export interface Include { + export interface AllQueryStringParameters { /** - * Use all query string parameters in the cache key. + * Determines whether to exclude all query string parameters from the cache key. */ all?: boolean; - - /** - * A list of query string parameters used to build the cache key. - */ - list?: Array; } } @@ -6168,7 +10722,7 @@ export namespace RuleCreateParams { /** * The minimum file size eligible for store in cache reserve. */ - min_file_size: number; + minimum_file_size: number; } /** @@ -6248,9 +10802,107 @@ export namespace RuleCreateParams { disable_stale_while_updating: boolean; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface RulesetsLogCustomFieldRule { + export interface LogCustomFieldRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -6276,7 +10928,7 @@ export namespace RuleCreateParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleCreateParams.RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: RuleCreateParams.LogCustomFieldRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -6288,6 +10940,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.LogCustomFieldRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -6298,13 +10955,26 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.LogCustomFieldRule.BeforePosition + | RuleCreateParams.LogCustomFieldRule.AfterPosition + | RuleCreateParams.LogCustomFieldRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.LogCustomFieldRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace LogCustomFieldRule { /** * The parameters configuring the rule's action. */ @@ -6356,9 +11026,107 @@ export namespace RuleCreateParams { name: string; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface RulesetsDDoSDynamicRule { + export interface DDoSDynamicRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -6396,6 +11164,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.DDoSDynamicRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -6406,13 +11179,126 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.DDoSDynamicRule.BeforePosition + | RuleCreateParams.DDoSDynamicRule.AfterPosition + | RuleCreateParams.DDoSDynamicRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.DDoSDynamicRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export interface RulesetsForceConnectionCloseRule { + export namespace DDoSDynamicRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + + export interface ForceConnectionCloseRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -6450,6 +11336,11 @@ export namespace RuleCreateParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleCreateParams.ForceConnectionCloseRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -6460,11 +11351,124 @@ export namespace RuleCreateParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleCreateParams.ForceConnectionCloseRule.BeforePosition + | RuleCreateParams.ForceConnectionCloseRule.AfterPosition + | RuleCreateParams.ForceConnectionCloseRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleCreateParams.ForceConnectionCloseRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } + + export namespace ForceConnectionCloseRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } } export interface RuleDeleteParams { @@ -6482,24 +11486,24 @@ export interface RuleDeleteParams { export type RuleEditParams = | RuleEditParams.BlockRule | RuleEditParams.ChallengeRule - | RuleEditParams.CompressResponseRule + | RuleEditParams.CompressionRule | RuleEditParams.ExecuteRule - | RuleEditParams.JSChallengeRule + | RuleEditParams.JavascriptChallengeRule | RuleEditParams.LogRule | RuleEditParams.ManagedChallengeRule | RuleEditParams.RedirectRule | RuleEditParams.RewriteRule - | RuleEditParams.RouteRule + | RuleEditParams.OriginRule | RuleEditParams.ScoreRule | RuleEditParams.ServeErrorRule | RuleEditParams.SetConfigRule | RuleEditParams.SkipRule | RuleEditParams.SetCacheSettingsRule - | RuleEditParams.RulesetsLogCustomFieldRule - | RuleEditParams.RulesetsDDoSDynamicRule - | RuleEditParams.RulesetsForceConnectionCloseRule; + | RuleEditParams.LogCustomFieldRule + | RuleEditParams.DDoSDynamicRule + | RuleEditParams.ForceConnectionCloseRule; -export namespace RuleEditParams { +export declare namespace RuleEditParams { export interface BlockRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the @@ -6538,6 +11542,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.BlockRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -6548,6 +11557,19 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.BlockRule.BeforePosition + | RuleEditParams.BlockRule.AfterPosition + | RuleEditParams.BlockRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.BlockRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -6586,6 +11608,104 @@ export namespace RuleEditParams { status_code: number; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface ChallengeRule { @@ -6626,6 +11746,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.ChallengeRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -6636,13 +11761,126 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.ChallengeRule.BeforePosition + | RuleEditParams.ChallengeRule.AfterPosition + | RuleEditParams.ChallengeRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.ChallengeRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export interface CompressResponseRule { + export namespace ChallengeRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + + export interface CompressionRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -6668,7 +11906,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.CompressResponseRule.ActionParameters; + action_parameters?: RuleEditParams.CompressionRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -6680,6 +11918,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.CompressionRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -6690,13 +11933,26 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.CompressionRule.BeforePosition + | RuleEditParams.CompressionRule.AfterPosition + | RuleEditParams.CompressionRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.CompressionRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace CompressResponseRule { + export namespace CompressionRule { /** * The parameters configuring the rule's action. */ @@ -6718,6 +11974,104 @@ export namespace RuleEditParams { name?: 'none' | 'auto' | 'default' | 'gzip' | 'brotli'; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface ExecuteRule { @@ -6758,6 +12112,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.ExecuteRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -6768,6 +12127,19 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.ExecuteRule.BeforePosition + | RuleEditParams.ExecuteRule.AfterPosition + | RuleEditParams.ExecuteRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.ExecuteRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -6897,9 +12269,107 @@ export namespace RuleEditParams { } } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface JSChallengeRule { + export interface JavascriptChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -6937,6 +12407,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.JavascriptChallengeRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -6947,12 +12422,125 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.JavascriptChallengeRule.BeforePosition + | RuleEditParams.JavascriptChallengeRule.AfterPosition + | RuleEditParams.JavascriptChallengeRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.JavascriptChallengeRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } + export namespace JavascriptChallengeRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + export interface LogRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the @@ -6991,6 +12579,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.LogRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -7001,12 +12594,125 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.LogRule.BeforePosition + | RuleEditParams.LogRule.AfterPosition + | RuleEditParams.LogRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.LogRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } + export namespace LogRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + export interface ManagedChallengeRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the @@ -7045,6 +12751,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.ManagedChallengeRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -7055,12 +12766,125 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.ManagedChallengeRule.BeforePosition + | RuleEditParams.ManagedChallengeRule.AfterPosition + | RuleEditParams.ManagedChallengeRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.ManagedChallengeRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } + export namespace ManagedChallengeRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + export interface RedirectRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the @@ -7099,6 +12923,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.RedirectRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -7109,6 +12938,19 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.RedirectRule.BeforePosition + | RuleEditParams.RedirectRule.AfterPosition + | RuleEditParams.RedirectRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.RedirectRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -7183,6 +13025,104 @@ export namespace RuleEditParams { } } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface RewriteRule { @@ -7223,6 +13163,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.RewriteRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -7233,6 +13178,19 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.RewriteRule.BeforePosition + | RuleEditParams.RewriteRule.AfterPosition + | RuleEditParams.RewriteRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.RewriteRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -7305,9 +13263,107 @@ export namespace RuleEditParams { query?: RulesAPI.RewriteURIPartParam; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface RouteRule { + export interface OriginRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7333,7 +13389,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RouteRule.ActionParameters; + action_parameters?: RuleEditParams.OriginRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -7345,6 +13401,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.OriginRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -7355,13 +13416,26 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.OriginRule.BeforePosition + | RuleEditParams.OriginRule.AfterPosition + | RuleEditParams.OriginRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.OriginRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RouteRule { + export namespace OriginRule { /** * The parameters configuring the rule's action. */ @@ -7408,9 +13482,290 @@ export namespace RuleEditParams { value: string; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + + export interface ScoreRule { + /** + * Path param: The Account ID to use for this endpoint. Mutually exclusive with the + * Zone ID. + */ + account_id?: string; + + /** + * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the + * Account ID. + */ + zone_id?: string; + + /** + * Body param: The unique ID of the rule. + */ + id?: string; + + /** + * Body param: The action to perform when the rule matches. + */ + action?: 'score'; + + /** + * Body param: The parameters configuring the rule's action. + */ + action_parameters?: RuleEditParams.ScoreRule.ActionParameters; + + /** + * Body param: An informative description of the rule. + */ + description?: string; + + /** + * Body param: Whether the rule should be executed. + */ + enabled?: boolean; + + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.ScoreRule.ExposedCredentialCheck; + + /** + * Body param: The expression defining which traffic will match the rule. + */ + expression?: string; + + /** + * Body param: An object configuring the rule's logging behavior. + */ + logging?: LoggingParam; + + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.ScoreRule.BeforePosition + | RuleEditParams.ScoreRule.AfterPosition + | RuleEditParams.ScoreRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.ScoreRule.Ratelimit; + + /** + * Body param: The reference of the rule (the rule ID by default). + */ + ref?: string; + } + + export namespace ScoreRule { + /** + * The parameters configuring the rule's action. + */ + export interface ActionParameters { + /** + * Increment contains the delta to change the score and can be either positive or + * negative. + */ + increment?: number; + } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface ScoreRule { + export interface ServeErrorRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -7431,12 +13786,12 @@ export namespace RuleEditParams { /** * Body param: The action to perform when the rule matches. */ - action?: 'score'; + action?: 'serve_error'; /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.ScoreRule.ActionParameters; + action_parameters?: RuleEditParams.ServeErrorRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -7448,6 +13803,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.ServeErrorRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -7458,98 +13818,142 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.ServeErrorRule.BeforePosition + | RuleEditParams.ServeErrorRule.AfterPosition + | RuleEditParams.ServeErrorRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.ServeErrorRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace ScoreRule { + export namespace ServeErrorRule { /** * The parameters configuring the rule's action. */ export interface ActionParameters { /** - * Increment contains the delta to change the score and can be either positive or - * negative. + * Error response content. */ - increment?: number; + content?: string; + + /** + * Content-type header to set with the response. + */ + content_type?: 'application/json' | 'text/xml' | 'text/plain' | 'text/html'; + + /** + * The status code to use for the error. + */ + status_code?: number; } - } - export interface ServeErrorRule { /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. + * Configure checks for exposed credentials. */ - account_id?: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. - */ - zone_id?: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * Body param: The unique ID of the rule. + * An object configuring where the rule will be placed. */ - id?: string; + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } /** - * Body param: The action to perform when the rule matches. + * An object configuring where the rule will be placed. */ - action?: 'serve_error'; + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } /** - * Body param: The parameters configuring the rule's action. + * An object configuring where the rule will be placed. */ - action_parameters?: RuleEditParams.ServeErrorRule.ActionParameters; + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } /** - * Body param: An informative description of the rule. + * An object configuring the rule's ratelimit behavior. */ - description?: string; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * Body param: Whether the rule should be executed. - */ - enabled?: boolean; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * Body param: The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * Body param: An object configuring the rule's logging behavior. - */ - logging?: LoggingParam; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Body param: The reference of the rule (the rule ID by default). - */ - ref?: string; - } + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - export namespace ServeErrorRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { /** - * Error response content. + * Defines if ratelimit counting is only done when an origin is reached. */ - content?: string; + requests_to_origin?: boolean; /** - * Content-type header to set with the response. + * The score threshold per period for which the action will be executed the first + * time. */ - content_type?: 'application/json' | 'text/xml' | 'text/plain' | 'text/html'; + score_per_period?: number; /** - * The status code to use for the error. + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. */ - status_code?: number; + score_response_header_name?: string; } } @@ -7591,6 +13995,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.SetConfigRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -7601,6 +14010,19 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.SetConfigRule.BeforePosition + | RuleEditParams.SetConfigRule.AfterPosition + | RuleEditParams.SetConfigRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.SetConfigRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -7719,6 +14141,104 @@ export namespace RuleEditParams { js?: boolean; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface SkipRule { @@ -7759,6 +14279,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.SkipRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -7769,6 +14294,19 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.SkipRule.BeforePosition + | RuleEditParams.SkipRule.AfterPosition + | RuleEditParams.SkipRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.SkipRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -7809,6 +14347,104 @@ export namespace RuleEditParams { */ rulesets?: Array; } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } export interface SetCacheSettingsRule { @@ -7849,6 +14485,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.SetCacheSettingsRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -7859,6 +14500,19 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.SetCacheSettingsRule.BeforePosition + | RuleEditParams.SetCacheSettingsRule.AfterPosition + | RuleEditParams.SetCacheSettingsRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.SetCacheSettingsRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ @@ -8010,10 +14664,9 @@ export namespace RuleEditParams { host?: CustomKey.Host; /** - * Use the presence or absence of parameters in the query string to build the cache - * key. + * Use the presence of parameters in the query string to build the cache key. */ - query_string?: CustomKey.QueryString; + query_string?: CustomKey.IncludedQueryStringParameters | CustomKey.ExcludedQueryStringParameters; /** * Characteristics of the request user agent used in building the cache key. @@ -8080,56 +14733,69 @@ export namespace RuleEditParams { } /** - * Use the presence or absence of parameters in the query string to build the cache - * key. + * Use the presence of parameters in the query string to build the cache key. */ - export interface QueryString { + export interface IncludedQueryStringParameters { /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters + * A list of query string parameters used to build the cache key. */ - exclude?: QueryString.Exclude; + include?: + | IncludedQueryStringParameters.SomeQueryStringParameters + | IncludedQueryStringParameters.AllQueryStringParameters; + } + export namespace IncludedQueryStringParameters { /** - * build the cache key using a list of query string parameters that ARE in the - * request. + * A list of query string parameters used to build the cache key. */ - include?: QueryString.Include; - } + export interface SomeQueryStringParameters { + list?: Array; + } - export namespace QueryString { /** - * build the cache key using all query string parameters EXCECPT these excluded - * parameters + * Build the cache key using ALL query string parameters that are in the request. */ - export interface Exclude { + export interface AllQueryStringParameters { /** - * Exclude all query string parameters from use in building the cache key. + * Determines whether to include all query string parameters in the cache key. */ all?: boolean; + } + } + + /** + * Use the absence of parameters in the query string to build the cache key. + */ + export interface ExcludedQueryStringParameters { + /** + * A list of query string parameters NOT used to build the cache key. All + * parameters present in the request but missing in this list will be used to build + * the cache key. + */ + exclude?: + | ExcludedQueryStringParameters.SomeQueryStringParameters + | ExcludedQueryStringParameters.AllQueryStringParameters; + } - /** - * A list of query string parameters NOT used to build the cache key. All - * parameters present in the request but missing in this list will be used to build - * the cache key. - */ + export namespace ExcludedQueryStringParameters { + /** + * A list of query string parameters NOT used to build the cache key. All + * parameters present in the request but missing in this list will be used to build + * the cache key. + */ + export interface SomeQueryStringParameters { list?: Array; } /** - * build the cache key using a list of query string parameters that ARE in the + * Build the cache key excluding ALL query string parameters that are in the * request. */ - export interface Include { + export interface AllQueryStringParameters { /** - * Use all query string parameters in the cache key. + * Determines whether to exclude all query string parameters from the cache key. */ all?: boolean; - - /** - * A list of query string parameters used to build the cache key. - */ - list?: Array; } } @@ -8169,7 +14835,7 @@ export namespace RuleEditParams { /** * The minimum file size eligible for store in cache reserve. */ - min_file_size: number; + minimum_file_size: number; } /** @@ -8249,9 +14915,107 @@ export namespace RuleEditParams { disable_stale_while_updating: boolean; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface RulesetsLogCustomFieldRule { + export interface LogCustomFieldRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -8277,7 +15041,7 @@ export namespace RuleEditParams { /** * Body param: The parameters configuring the rule's action. */ - action_parameters?: RuleEditParams.RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: RuleEditParams.LogCustomFieldRule.ActionParameters; /** * Body param: An informative description of the rule. @@ -8289,6 +15053,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.LogCustomFieldRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -8299,13 +15068,26 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.LogCustomFieldRule.BeforePosition + | RuleEditParams.LogCustomFieldRule.AfterPosition + | RuleEditParams.LogCustomFieldRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.LogCustomFieldRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace LogCustomFieldRule { /** * The parameters configuring the rule's action. */ @@ -8357,9 +15139,107 @@ export namespace RuleEditParams { name: string; } } + + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } - export interface RulesetsDDoSDynamicRule { + export interface DDoSDynamicRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -8397,6 +15277,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.DDoSDynamicRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -8407,13 +15292,126 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.DDoSDynamicRule.BeforePosition + | RuleEditParams.DDoSDynamicRule.AfterPosition + | RuleEditParams.DDoSDynamicRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.DDoSDynamicRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } - export interface RulesetsForceConnectionCloseRule { + export namespace DDoSDynamicRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } + + export interface ForceConnectionCloseRule { /** * Path param: The Account ID to use for this endpoint. Mutually exclusive with the * Zone ID. @@ -8451,6 +15449,11 @@ export namespace RuleEditParams { */ enabled?: boolean; + /** + * Body param: Configure checks for exposed credentials. + */ + exposed_credential_check?: RuleEditParams.ForceConnectionCloseRule.ExposedCredentialCheck; + /** * Body param: The expression defining which traffic will match the rule. */ @@ -8461,36 +15464,152 @@ export namespace RuleEditParams { */ logging?: LoggingParam; + /** + * Body param: An object configuring where the rule will be placed. + */ + position?: + | RuleEditParams.ForceConnectionCloseRule.BeforePosition + | RuleEditParams.ForceConnectionCloseRule.AfterPosition + | RuleEditParams.ForceConnectionCloseRule.IndexPosition; + + /** + * Body param: An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RuleEditParams.ForceConnectionCloseRule.Ratelimit; + /** * Body param: The reference of the rule (the rule ID by default). */ ref?: string; } + + export namespace ForceConnectionCloseRule { + /** + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface BeforePosition { + /** + * The ID of another rule to place the rule before. An empty value causes the rule + * to be placed at the top. + */ + before?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface AfterPosition { + /** + * The ID of another rule to place the rule after. An empty value causes the rule + * to be placed at the bottom. + */ + after?: string; + } + + /** + * An object configuring where the rule will be placed. + */ + export interface IndexPosition { + /** + * An index at which to place the rule, where index 1 is the first rule. + */ + index?: number; + } + + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } + } } -export namespace Rules { - export import BlockRule = RulesAPI.BlockRule; - export import ChallengeRule = RulesAPI.ChallengeRule; - export import CompressResponseRule = RulesAPI.CompressResponseRule; - export import ExecuteRule = RulesAPI.ExecuteRule; - export import JSChallengeRule = RulesAPI.JSChallengeRule; - export import LogRule = RulesAPI.LogRule; - export import Logging = RulesAPI.Logging; - export import ManagedChallengeRule = RulesAPI.ManagedChallengeRule; - export import RedirectRule = RulesAPI.RedirectRule; - export import RewriteRule = RulesAPI.RewriteRule; - export import RewriteURIPart = RulesAPI.RewriteURIPart; - export import RouteRule = RulesAPI.RouteRule; - export import RulesetRule = RulesAPI.RulesetRule; - export import ScoreRule = RulesAPI.ScoreRule; - export import ServeErrorRule = RulesAPI.ServeErrorRule; - export import SetCacheSettingsRule = RulesAPI.SetCacheSettingsRule; - export import SetConfigRule = RulesAPI.SetConfigRule; - export import SkipRule = RulesAPI.SkipRule; - export import RuleCreateResponse = RulesAPI.RuleCreateResponse; - export import RuleDeleteResponse = RulesAPI.RuleDeleteResponse; - export import RuleEditResponse = RulesAPI.RuleEditResponse; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleDeleteParams = RulesAPI.RuleDeleteParams; - export import RuleEditParams = RulesAPI.RuleEditParams; +export declare namespace Rules { + export { + type BlockRule as BlockRule, + type CompressResponseRule as CompressResponseRule, + type DDoSDynamicRule as DDoSDynamicRule, + type ExecuteRule as ExecuteRule, + type ForceConnectionCloseRule as ForceConnectionCloseRule, + type LogCustomFieldRule as LogCustomFieldRule, + type LogRule as LogRule, + type Logging as Logging, + type ManagedChallengeRule as ManagedChallengeRule, + type RedirectRule as RedirectRule, + type RewriteRule as RewriteRule, + type RewriteURIPart as RewriteURIPart, + type RouteRule as RouteRule, + type RulesetRule as RulesetRule, + type ScoreRule as ScoreRule, + type ServeErrorRule as ServeErrorRule, + type SetCacheSettingsRule as SetCacheSettingsRule, + type SetConfigRule as SetConfigRule, + type SkipRule as SkipRule, + type RuleCreateResponse as RuleCreateResponse, + type RuleDeleteResponse as RuleDeleteResponse, + type RuleEditResponse as RuleEditResponse, + type RuleCreateParams as RuleCreateParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleEditParams as RuleEditParams, + }; } diff --git a/src/resources/rulesets/rulesets.ts b/src/resources/rulesets/rulesets.ts index 76fb791314..5c5b604cba 100644 --- a/src/resources/rulesets/rulesets.ts +++ b/src/resources/rulesets/rulesets.ts @@ -3,10 +3,54 @@ import { APIResource } from '../../resource'; import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import { CloudflareError } from '../../error'; +import { CloudflareError } from 'cloudflare/error'; import * as RulesAPI from './rules'; +import { + BlockRule, + CompressResponseRule, + DDoSDynamicRule, + ExecuteRule, + ForceConnectionCloseRule, + LogCustomFieldRule, + LogRule, + Logging, + ManagedChallengeRule, + RedirectRule, + RewriteRule, + RewriteURIPart, + RouteRule, + RuleCreateParams, + RuleCreateResponse, + RuleDeleteParams, + RuleDeleteResponse, + RuleEditParams, + RuleEditResponse, + Rules, + RulesetRule, + ScoreRule, + ServeErrorRule, + SetCacheSettingsRule, + SetConfigRule, + SkipRule, +} from './rules'; +import * as VersionsAPI from './versions'; +import { + VersionDeleteParams, + VersionGetParams, + VersionGetResponse, + VersionListParams, + VersionListResponse, + VersionListResponsesSinglePage, + Versions, +} from './versions'; import * as PhasesAPI from './phases/phases'; -import * as VersionsAPI from './versions/versions'; +import { + PhaseGetParams, + PhaseGetResponse, + PhaseUpdateParams, + PhaseUpdateResponse, + Phases, +} from './phases/phases'; import { SinglePage } from '../../pagination'; export class Rulesets extends APIResource { @@ -229,14 +273,14 @@ export type Phase = | 'http_request_redirect' | 'http_request_sanitize' | 'http_request_sbfm' - | 'http_request_select_configuration' | 'http_request_transform' | 'http_response_compression' | 'http_response_firewall_managed' | 'http_response_headers_transform' | 'magic_transit' | 'magic_transit_ids_managed' - | 'magic_transit_managed'; + | 'magic_transit_managed' + | 'magic_transit_ratelimit'; /** * The phase of the ruleset. @@ -257,14 +301,14 @@ export type PhaseParam = | 'http_request_redirect' | 'http_request_sanitize' | 'http_request_sbfm' - | 'http_request_select_configuration' | 'http_request_transform' | 'http_response_compression' | 'http_response_firewall_managed' | 'http_response_headers_transform' | 'magic_transit' | 'magic_transit_ids_managed' - | 'magic_transit_managed'; + | 'magic_transit_managed' + | 'magic_transit_ratelimit'; /** * A ruleset object. @@ -330,10 +374,10 @@ export interface RulesetCreateResponse { */ rules: Array< | RulesAPI.BlockRule - | RulesAPI.ChallengeRule + | RulesetCreateResponse.RulesetsChallengeRule | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | RulesAPI.JSChallengeRule + | RulesetCreateResponse.RulesetsJSChallengeRule | RulesAPI.LogRule | RulesAPI.ManagedChallengeRule | RulesAPI.RedirectRule @@ -344,9 +388,9 @@ export interface RulesetCreateResponse { | RulesAPI.SetConfigRule | RulesAPI.SkipRule | RulesAPI.SetCacheSettingsRule - | RulesetCreateResponse.RulesetsLogCustomFieldRule - | RulesetCreateResponse.RulesetsDDoSDynamicRule - | RulesetCreateResponse.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRule + | RulesAPI.DDoSDynamicRule + | RulesAPI.ForceConnectionCloseRule >; /** @@ -361,7 +405,7 @@ export interface RulesetCreateResponse { } export namespace RulesetCreateResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -380,12 +424,12 @@ export namespace RulesetCreateResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -402,6 +446,11 @@ export namespace RulesetCreateResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -412,67 +461,86 @@ export namespace RulesetCreateResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - export namespace ActionParameters { /** - * The cookie field to log. + * The threshold of requests per period after which the action will be executed for + * the first time. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + requests_per_period?: number; /** - * The request field to log. + * Defines if ratelimit counting is only done when an origin is reached. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + requests_to_origin?: boolean; /** - * The response field to log. + * The score threshold per period for which the action will be executed the first + * time. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -491,7 +559,7 @@ export namespace RulesetCreateResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -513,6 +581,11 @@ export namespace RulesetCreateResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -524,66 +597,82 @@ export namespace RulesetCreateResponse { logging?: RulesAPI.Logging; /** - * The reference of the rule (the rule ID by default). + * An object configuring the rule's ratelimit behavior. */ - ref?: string; - } + ratelimit?: RulesetsJSChallengeRule.Ratelimit; - export interface RulesetsForceConnectionCloseRule { /** - * The timestamp of when the rule was last modified. + * The reference of the rule (the rule ID by default). */ - last_updated: string; + ref?: string; + } + export namespace RulesetsJSChallengeRule { /** - * The version of the rule. + * Configure checks for exposed credentials. */ - version: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The action to perform when the rule matches. + * An object configuring the rule's ratelimit behavior. */ - action?: 'force_connection_close'; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -621,10 +710,10 @@ export interface RulesetUpdateResponse { */ rules: Array< | RulesAPI.BlockRule - | RulesAPI.ChallengeRule + | RulesetUpdateResponse.RulesetsChallengeRule | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | RulesAPI.JSChallengeRule + | RulesetUpdateResponse.RulesetsJSChallengeRule | RulesAPI.LogRule | RulesAPI.ManagedChallengeRule | RulesAPI.RedirectRule @@ -635,9 +724,9 @@ export interface RulesetUpdateResponse { | RulesAPI.SetConfigRule | RulesAPI.SkipRule | RulesAPI.SetCacheSettingsRule - | RulesetUpdateResponse.RulesetsLogCustomFieldRule - | RulesetUpdateResponse.RulesetsDDoSDynamicRule - | RulesetUpdateResponse.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRule + | RulesAPI.DDoSDynamicRule + | RulesAPI.ForceConnectionCloseRule >; /** @@ -652,7 +741,7 @@ export interface RulesetUpdateResponse { } export namespace RulesetUpdateResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -671,12 +760,12 @@ export namespace RulesetUpdateResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -693,6 +782,11 @@ export namespace RulesetUpdateResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -703,67 +797,86 @@ export namespace RulesetUpdateResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; + + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - export namespace ActionParameters { /** - * The cookie field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; /** - * The request field to log. + * The threshold of requests per period after which the action will be executed for + * the first time. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + requests_per_period?: number; /** - * The response field to log. + * Defines if ratelimit counting is only done when an origin is reached. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -782,7 +895,7 @@ export namespace RulesetUpdateResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -804,6 +917,11 @@ export namespace RulesetUpdateResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -814,67 +932,83 @@ export namespace RulesetUpdateResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsJSChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export interface RulesetsForceConnectionCloseRule { + export namespace RulesetsJSChallengeRule { /** - * The timestamp of when the rule was last modified. + * Configure checks for exposed credentials. */ - last_updated: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The version of the rule. - */ - version: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The unique ID of the rule. + * An object configuring the rule's ratelimit behavior. */ - id?: string; - - /** - * The action to perform when the rule matches. - */ - action?: 'force_connection_close'; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -952,10 +1086,10 @@ export interface RulesetGetResponse { */ rules: Array< | RulesAPI.BlockRule - | RulesAPI.ChallengeRule + | RulesetGetResponse.RulesetsChallengeRule | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | RulesAPI.JSChallengeRule + | RulesetGetResponse.RulesetsJSChallengeRule | RulesAPI.LogRule | RulesAPI.ManagedChallengeRule | RulesAPI.RedirectRule @@ -966,9 +1100,9 @@ export interface RulesetGetResponse { | RulesAPI.SetConfigRule | RulesAPI.SkipRule | RulesAPI.SetCacheSettingsRule - | RulesetGetResponse.RulesetsLogCustomFieldRule - | RulesetGetResponse.RulesetsDDoSDynamicRule - | RulesetGetResponse.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRule + | RulesAPI.DDoSDynamicRule + | RulesAPI.ForceConnectionCloseRule >; /** @@ -983,7 +1117,7 @@ export interface RulesetGetResponse { } export namespace RulesetGetResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -1002,12 +1136,12 @@ export namespace RulesetGetResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -1024,6 +1158,11 @@ export namespace RulesetGetResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1034,67 +1173,86 @@ export namespace RulesetGetResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; + + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - export namespace ActionParameters { /** - * The cookie field to log. + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + counting_expression?: string; /** - * The request field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; /** - * The response field to log. + * The threshold of requests per period after which the action will be executed for + * the first time. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -1113,7 +1271,7 @@ export namespace RulesetGetResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -1135,6 +1293,11 @@ export namespace RulesetGetResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1146,66 +1309,82 @@ export namespace RulesetGetResponse { logging?: RulesAPI.Logging; /** - * The reference of the rule (the rule ID by default). + * An object configuring the rule's ratelimit behavior. */ - ref?: string; - } + ratelimit?: RulesetsJSChallengeRule.Ratelimit; - export interface RulesetsForceConnectionCloseRule { /** - * The timestamp of when the rule was last modified. + * The reference of the rule (the rule ID by default). */ - last_updated: string; + ref?: string; + } + export namespace RulesetsJSChallengeRule { /** - * The version of the rule. + * Configure checks for exposed credentials. */ - version: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The unique ID of the rule. - */ - id?: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The action to perform when the rule matches. + * An object configuring the rule's ratelimit behavior. */ - action?: 'force_connection_close'; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -1230,10 +1409,10 @@ export interface RulesetCreateParams { */ rules: Array< | RulesAPI.BlockRuleParam - | RulesAPI.ChallengeRuleParam + | RulesetCreateParams.RulesetsChallengeRule | RulesAPI.CompressResponseRuleParam | RulesAPI.ExecuteRuleParam - | RulesAPI.JSChallengeRuleParam + | RulesetCreateParams.RulesetsJSChallengeRule | RulesAPI.LogRuleParam | RulesAPI.ManagedChallengeRuleParam | RulesAPI.RedirectRuleParam @@ -1244,9 +1423,9 @@ export interface RulesetCreateParams { | RulesAPI.SetConfigRuleParam | RulesAPI.SkipRuleParam | RulesAPI.SetCacheSettingsRuleParam - | RulesetCreateParams.RulesetsLogCustomFieldRule - | RulesetCreateParams.RulesetsDDoSDynamicRule - | RulesetCreateParams.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRuleParam + | RulesAPI.DDoSDynamicRuleParam + | RulesAPI.ForceConnectionCloseRuleParam >; /** @@ -1268,7 +1447,7 @@ export interface RulesetCreateParams { } export namespace RulesetCreateParams { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The unique ID of the rule. */ @@ -1277,12 +1456,12 @@ export namespace RulesetCreateParams { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * An informative description of the rule. @@ -1294,6 +1473,11 @@ export namespace RulesetCreateParams { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1304,67 +1488,86 @@ export namespace RulesetCreateParams { */ logging?: RulesAPI.LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; - export namespace ActionParameters { /** - * The cookie field to log. + * Period in seconds over which the counter is being incremented. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + period: 10 | 60 | 600 | 3600; /** - * The request field to log. + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + counting_expression?: string; /** - * The response field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The unique ID of the rule. */ @@ -1373,7 +1576,7 @@ export namespace RulesetCreateParams { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -1390,6 +1593,11 @@ export namespace RulesetCreateParams { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1400,52 +1608,83 @@ export namespace RulesetCreateParams { */ logging?: RulesAPI.LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsJSChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export interface RulesetsForceConnectionCloseRule { + export namespace RulesetsJSChallengeRule { /** - * The unique ID of the rule. + * Configure checks for exposed credentials. */ - id?: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The action to perform when the rule matches. - */ - action?: 'force_connection_close'; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The parameters configuring the rule's action. + * An object configuring the rule's ratelimit behavior. */ - action_parameters?: unknown; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.LoggingParam; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -1455,10 +1694,10 @@ export interface RulesetUpdateParams { */ rules: Array< | RulesAPI.BlockRuleParam - | RulesAPI.ChallengeRuleParam + | RulesetUpdateParams.RulesetsChallengeRule | RulesAPI.CompressResponseRuleParam | RulesAPI.ExecuteRuleParam - | RulesAPI.JSChallengeRuleParam + | RulesetUpdateParams.RulesetsJSChallengeRule | RulesAPI.LogRuleParam | RulesAPI.ManagedChallengeRuleParam | RulesAPI.RedirectRuleParam @@ -1469,9 +1708,9 @@ export interface RulesetUpdateParams { | RulesAPI.SetConfigRuleParam | RulesAPI.SkipRuleParam | RulesAPI.SetCacheSettingsRuleParam - | RulesetUpdateParams.RulesetsLogCustomFieldRule - | RulesetUpdateParams.RulesetsDDoSDynamicRule - | RulesetUpdateParams.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRuleParam + | RulesAPI.DDoSDynamicRuleParam + | RulesAPI.ForceConnectionCloseRuleParam >; /** @@ -1508,7 +1747,7 @@ export interface RulesetUpdateParams { } export namespace RulesetUpdateParams { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The unique ID of the rule. */ @@ -1517,12 +1756,12 @@ export namespace RulesetUpdateParams { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * An informative description of the rule. @@ -1534,6 +1773,11 @@ export namespace RulesetUpdateParams { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1544,67 +1788,86 @@ export namespace RulesetUpdateParams { */ logging?: RulesAPI.LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. */ - export interface ActionParameters { + export interface ExposedCredentialCheck { /** - * The cookie fields to log. + * Expression that selects the password used in the credentials check. */ - cookie_fields?: Array; + password_expression: string; /** - * The request fields to log. + * Expression that selects the user ID used in the credentials check. */ - request_fields?: Array; + username_expression: string; + } + /** + * An object configuring the rule's ratelimit behavior. + */ + export interface Ratelimit { /** - * The response fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - response_fields?: Array; - } + characteristics: Array; - export namespace ActionParameters { /** - * The cookie field to log. + * Period in seconds over which the counter is being incremented. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + period: 10 | 60 | 600 | 3600; /** - * The request field to log. + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + counting_expression?: string; /** - * The response field to log. + * Period of time in seconds after which the action will be disabled following its + * first execution. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + mitigation_timeout?: number; + + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; + + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The unique ID of the rule. */ @@ -1613,7 +1876,7 @@ export namespace RulesetUpdateParams { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -1630,6 +1893,11 @@ export namespace RulesetUpdateParams { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -1640,52 +1908,83 @@ export namespace RulesetUpdateParams { */ logging?: RulesAPI.LoggingParam; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsJSChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export interface RulesetsForceConnectionCloseRule { + export namespace RulesetsJSChallengeRule { /** - * The unique ID of the rule. + * Configure checks for exposed credentials. */ - id?: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The action to perform when the rule matches. - */ - action?: 'force_connection_close'; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The parameters configuring the rule's action. + * An object configuring the rule's ratelimit behavior. */ - action_parameters?: unknown; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.LoggingParam; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; + + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -1725,42 +2024,56 @@ export interface RulesetGetParams { zone_id?: string; } -export namespace Rulesets { - export import Phases = PhasesAPI.Phases; - export import PhaseUpdateResponse = PhasesAPI.PhaseUpdateResponse; - export import PhaseGetResponse = PhasesAPI.PhaseGetResponse; - export import PhaseUpdateParams = PhasesAPI.PhaseUpdateParams; - export import PhaseGetParams = PhasesAPI.PhaseGetParams; - export import Rules = RulesAPI.Rules; - export import BlockRule = RulesAPI.BlockRule; - export import ChallengeRule = RulesAPI.ChallengeRule; - export import CompressResponseRule = RulesAPI.CompressResponseRule; - export import ExecuteRule = RulesAPI.ExecuteRule; - export import JSChallengeRule = RulesAPI.JSChallengeRule; - export import LogRule = RulesAPI.LogRule; - export import Logging = RulesAPI.Logging; - export import ManagedChallengeRule = RulesAPI.ManagedChallengeRule; - export import RedirectRule = RulesAPI.RedirectRule; - export import RewriteRule = RulesAPI.RewriteRule; - export import RewriteURIPart = RulesAPI.RewriteURIPart; - export import RouteRule = RulesAPI.RouteRule; - export import RulesetRule = RulesAPI.RulesetRule; - export import ScoreRule = RulesAPI.ScoreRule; - export import ServeErrorRule = RulesAPI.ServeErrorRule; - export import SetCacheSettingsRule = RulesAPI.SetCacheSettingsRule; - export import SetConfigRule = RulesAPI.SetConfigRule; - export import SkipRule = RulesAPI.SkipRule; - export import RuleCreateResponse = RulesAPI.RuleCreateResponse; - export import RuleDeleteResponse = RulesAPI.RuleDeleteResponse; - export import RuleEditResponse = RulesAPI.RuleEditResponse; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleDeleteParams = RulesAPI.RuleDeleteParams; - export import RuleEditParams = RulesAPI.RuleEditParams; - export import Versions = VersionsAPI.Versions; - export import VersionListResponse = VersionsAPI.VersionListResponse; - export import VersionGetResponse = VersionsAPI.VersionGetResponse; - export import VersionListResponsesSinglePage = VersionsAPI.VersionListResponsesSinglePage; - export import VersionListParams = VersionsAPI.VersionListParams; - export import VersionDeleteParams = VersionsAPI.VersionDeleteParams; - export import VersionGetParams = VersionsAPI.VersionGetParams; +Rulesets.Phases = Phases; +Rulesets.Rules = Rules; +Rulesets.Versions = Versions; +Rulesets.VersionListResponsesSinglePage = VersionListResponsesSinglePage; + +export declare namespace Rulesets { + export { + Phases as Phases, + type PhaseUpdateResponse as PhaseUpdateResponse, + type PhaseGetResponse as PhaseGetResponse, + type PhaseUpdateParams as PhaseUpdateParams, + type PhaseGetParams as PhaseGetParams, + }; + + export { + Rules as Rules, + type BlockRule as BlockRule, + type CompressResponseRule as CompressResponseRule, + type DDoSDynamicRule as DDoSDynamicRule, + type ExecuteRule as ExecuteRule, + type ForceConnectionCloseRule as ForceConnectionCloseRule, + type LogCustomFieldRule as LogCustomFieldRule, + type LogRule as LogRule, + type Logging as Logging, + type ManagedChallengeRule as ManagedChallengeRule, + type RedirectRule as RedirectRule, + type RewriteRule as RewriteRule, + type RewriteURIPart as RewriteURIPart, + type RouteRule as RouteRule, + type RulesetRule as RulesetRule, + type ScoreRule as ScoreRule, + type ServeErrorRule as ServeErrorRule, + type SetCacheSettingsRule as SetCacheSettingsRule, + type SetConfigRule as SetConfigRule, + type SkipRule as SkipRule, + type RuleCreateResponse as RuleCreateResponse, + type RuleDeleteResponse as RuleDeleteResponse, + type RuleEditResponse as RuleEditResponse, + type RuleCreateParams as RuleCreateParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleEditParams as RuleEditParams, + }; + + export { + Versions as Versions, + type VersionListResponse as VersionListResponse, + type VersionGetResponse as VersionGetResponse, + VersionListResponsesSinglePage as VersionListResponsesSinglePage, + type VersionListParams as VersionListParams, + type VersionDeleteParams as VersionDeleteParams, + type VersionGetParams as VersionGetParams, + }; } diff --git a/src/resources/rulesets/versions/versions.ts b/src/resources/rulesets/versions.ts similarity index 64% rename from src/resources/rulesets/versions/versions.ts rename to src/resources/rulesets/versions.ts index ec39873bac..b2b121911d 100644 --- a/src/resources/rulesets/versions/versions.ts +++ b/src/resources/rulesets/versions.ts @@ -1,18 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import { isRequestOptions } from '../../../core'; -import * as Core from '../../../core'; -import { CloudflareError } from '../../../error'; -import * as VersionsAPI from './versions'; -import * as RulesAPI from '../rules'; -import * as RulesetsAPI from '../rulesets'; -import * as ByTagAPI from './by-tag'; -import { SinglePage } from '../../../pagination'; +import { APIResource } from '../../resource'; +import { isRequestOptions } from '../../core'; +import * as Core from '../../core'; +import { CloudflareError } from 'cloudflare/error'; +import * as RulesAPI from './rules'; +import * as RulesetsAPI from './rulesets'; +import { SinglePage } from '../../pagination'; export class Versions extends APIResource { - byTag: ByTagAPI.ByTag = new ByTagAPI.ByTag(this._client); - /** * Fetches the versions of an account or zone ruleset. */ @@ -224,10 +220,10 @@ export interface VersionGetResponse { */ rules: Array< | RulesAPI.BlockRule - | RulesAPI.ChallengeRule + | VersionGetResponse.RulesetsChallengeRule | RulesAPI.CompressResponseRule | RulesAPI.ExecuteRule - | RulesAPI.JSChallengeRule + | VersionGetResponse.RulesetsJSChallengeRule | RulesAPI.LogRule | RulesAPI.ManagedChallengeRule | RulesAPI.RedirectRule @@ -238,9 +234,9 @@ export interface VersionGetResponse { | RulesAPI.SetConfigRule | RulesAPI.SkipRule | RulesAPI.SetCacheSettingsRule - | VersionGetResponse.RulesetsLogCustomFieldRule - | VersionGetResponse.RulesetsDDoSDynamicRule - | VersionGetResponse.RulesetsForceConnectionCloseRule + | RulesAPI.LogCustomFieldRule + | RulesAPI.DDoSDynamicRule + | RulesAPI.ForceConnectionCloseRule >; /** @@ -255,7 +251,7 @@ export interface VersionGetResponse { } export namespace VersionGetResponse { - export interface RulesetsLogCustomFieldRule { + export interface RulesetsChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -274,12 +270,12 @@ export namespace VersionGetResponse { /** * The action to perform when the rule matches. */ - action?: 'log_custom_field'; + action?: 'challenge'; /** * The parameters configuring the rule's action. */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; + action_parameters?: unknown; /** * The categories of the rule. @@ -296,6 +292,11 @@ export namespace VersionGetResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -306,67 +307,86 @@ export namespace VersionGetResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export namespace RulesetsLogCustomFieldRule { + export namespace RulesetsChallengeRule { /** - * The parameters configuring the rule's action. + * Configure checks for exposed credentials. + */ + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; + + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } + + /** + * An object configuring the rule's ratelimit behavior. */ - export interface ActionParameters { + export interface Ratelimit { /** - * The cookie fields to log. + * Characteristics of the request on which the ratelimiter counter will be + * incremented. */ - cookie_fields?: Array; + characteristics: Array; /** - * The request fields to log. + * Period in seconds over which the counter is being incremented. */ - request_fields?: Array; + period: 10 | 60 | 600 | 3600; /** - * The response fields to log. + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. */ - response_fields?: Array; - } + counting_expression?: string; + + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - export namespace ActionParameters { /** - * The cookie field to log. + * The threshold of requests per period after which the action will be executed for + * the first time. */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } + requests_per_period?: number; /** - * The request field to log. + * Defines if ratelimit counting is only done when an origin is reached. */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } + requests_to_origin?: boolean; /** - * The response field to log. + * The score threshold per period for which the action will be executed the first + * time. */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } + score_per_period?: number; + + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; } } - export interface RulesetsDDoSDynamicRule { + export interface RulesetsJSChallengeRule { /** * The timestamp of when the rule was last modified. */ @@ -385,7 +405,7 @@ export namespace VersionGetResponse { /** * The action to perform when the rule matches. */ - action?: 'ddos_dynamic'; + action?: 'js_challenge'; /** * The parameters configuring the rule's action. @@ -407,6 +427,11 @@ export namespace VersionGetResponse { */ enabled?: boolean; + /** + * Configure checks for exposed credentials. + */ + exposed_credential_check?: RulesetsJSChallengeRule.ExposedCredentialCheck; + /** * The expression defining which traffic will match the rule. */ @@ -417,67 +442,83 @@ export namespace VersionGetResponse { */ logging?: RulesAPI.Logging; + /** + * An object configuring the rule's ratelimit behavior. + */ + ratelimit?: RulesetsJSChallengeRule.Ratelimit; + /** * The reference of the rule (the rule ID by default). */ ref?: string; } - export interface RulesetsForceConnectionCloseRule { + export namespace RulesetsJSChallengeRule { /** - * The timestamp of when the rule was last modified. + * Configure checks for exposed credentials. */ - last_updated: string; + export interface ExposedCredentialCheck { + /** + * Expression that selects the password used in the credentials check. + */ + password_expression: string; - /** - * The version of the rule. - */ - version: string; + /** + * Expression that selects the user ID used in the credentials check. + */ + username_expression: string; + } /** - * The unique ID of the rule. + * An object configuring the rule's ratelimit behavior. */ - id?: string; - - /** - * The action to perform when the rule matches. - */ - action?: 'force_connection_close'; + export interface Ratelimit { + /** + * Characteristics of the request on which the ratelimiter counter will be + * incremented. + */ + characteristics: Array; - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; + /** + * Period in seconds over which the counter is being incremented. + */ + period: 10 | 60 | 600 | 3600; - /** - * The categories of the rule. - */ - categories?: Array; + /** + * Defines when the ratelimit counter should be incremented. It is optional and + * defaults to the same as the rule's expression. + */ + counting_expression?: string; - /** - * An informative description of the rule. - */ - description?: string; + /** + * Period of time in seconds after which the action will be disabled following its + * first execution. + */ + mitigation_timeout?: number; - /** - * Whether the rule should be executed. - */ - enabled?: boolean; + /** + * The threshold of requests per period after which the action will be executed for + * the first time. + */ + requests_per_period?: number; - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; + /** + * Defines if ratelimit counting is only done when an origin is reached. + */ + requests_to_origin?: boolean; - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; + /** + * The score threshold per period for which the action will be executed the first + * time. + */ + score_per_period?: number; - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; + /** + * The response header name provided by the origin which should contain the score + * to increment ratelimit counter on. + */ + score_response_header_name?: string; + } } } @@ -517,14 +558,15 @@ export interface VersionGetParams { zone_id?: string; } -export namespace Versions { - export import VersionListResponse = VersionsAPI.VersionListResponse; - export import VersionGetResponse = VersionsAPI.VersionGetResponse; - export import VersionListResponsesSinglePage = VersionsAPI.VersionListResponsesSinglePage; - export import VersionListParams = VersionsAPI.VersionListParams; - export import VersionDeleteParams = VersionsAPI.VersionDeleteParams; - export import VersionGetParams = VersionsAPI.VersionGetParams; - export import ByTag = ByTagAPI.ByTag; - export import ByTagGetResponse = ByTagAPI.ByTagGetResponse; - export import ByTagGetParams = ByTagAPI.ByTagGetParams; +Versions.VersionListResponsesSinglePage = VersionListResponsesSinglePage; + +export declare namespace Versions { + export { + type VersionListResponse as VersionListResponse, + type VersionGetResponse as VersionGetResponse, + VersionListResponsesSinglePage as VersionListResponsesSinglePage, + type VersionListParams as VersionListParams, + type VersionDeleteParams as VersionDeleteParams, + type VersionGetParams as VersionGetParams, + }; } diff --git a/src/resources/rulesets/versions/by-tag.ts b/src/resources/rulesets/versions/by-tag.ts deleted file mode 100644 index 603178ea11..0000000000 --- a/src/resources/rulesets/versions/by-tag.ts +++ /dev/null @@ -1,331 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as ByTagAPI from './by-tag'; -import * as RulesAPI from '../rules'; -import * as RulesetsAPI from '../rulesets'; - -export class ByTag extends APIResource { - /** - * Fetches the rules of a managed account ruleset version for a given tag. - */ - get( - rulesetId: string, - rulesetVersion: string, - ruleTag: string, - params: ByTagGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get( - `/accounts/${account_id}/rulesets/${rulesetId}/versions/${rulesetVersion}/by_tag/${ruleTag}`, - options, - ) as Core.APIPromise<{ result: ByTagGetResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -/** - * A ruleset object. - */ -export interface ByTagGetResponse { - /** - * The unique ID of the ruleset. - */ - id: string; - - /** - * The kind of the ruleset. - */ - kind: RulesetsAPI.Kind; - - /** - * The timestamp of when the ruleset was last modified. - */ - last_updated: string; - - /** - * The human-readable name of the ruleset. - */ - name: string; - - /** - * The phase of the ruleset. - */ - phase: RulesetsAPI.Phase; - - /** - * The list of rules in the ruleset. - */ - rules: Array< - | RulesAPI.BlockRule - | RulesAPI.ChallengeRule - | RulesAPI.CompressResponseRule - | RulesAPI.ExecuteRule - | RulesAPI.JSChallengeRule - | RulesAPI.LogRule - | RulesAPI.ManagedChallengeRule - | RulesAPI.RedirectRule - | RulesAPI.RewriteRule - | RulesAPI.RouteRule - | RulesAPI.ScoreRule - | RulesAPI.ServeErrorRule - | RulesAPI.SetConfigRule - | RulesAPI.SkipRule - | RulesAPI.SetCacheSettingsRule - | ByTagGetResponse.RulesetsLogCustomFieldRule - | ByTagGetResponse.RulesetsDDoSDynamicRule - | ByTagGetResponse.RulesetsForceConnectionCloseRule - >; - - /** - * The version of the ruleset. - */ - version: string; - - /** - * An informative description of the ruleset. - */ - description?: string; -} - -export namespace ByTagGetResponse { - export interface RulesetsLogCustomFieldRule { - /** - * The timestamp of when the rule was last modified. - */ - last_updated: string; - - /** - * The version of the rule. - */ - version: string; - - /** - * The unique ID of the rule. - */ - id?: string; - - /** - * The action to perform when the rule matches. - */ - action?: 'log_custom_field'; - - /** - * The parameters configuring the rule's action. - */ - action_parameters?: RulesetsLogCustomFieldRule.ActionParameters; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * An informative description of the rule. - */ - description?: string; - - /** - * Whether the rule should be executed. - */ - enabled?: boolean; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export namespace RulesetsLogCustomFieldRule { - /** - * The parameters configuring the rule's action. - */ - export interface ActionParameters { - /** - * The cookie fields to log. - */ - cookie_fields?: Array; - - /** - * The request fields to log. - */ - request_fields?: Array; - - /** - * The response fields to log. - */ - response_fields?: Array; - } - - export namespace ActionParameters { - /** - * The cookie field to log. - */ - export interface CookieField { - /** - * The name of the field. - */ - name: string; - } - - /** - * The request field to log. - */ - export interface RequestField { - /** - * The name of the field. - */ - name: string; - } - - /** - * The response field to log. - */ - export interface ResponseField { - /** - * The name of the field. - */ - name: string; - } - } - } - - export interface RulesetsDDoSDynamicRule { - /** - * The timestamp of when the rule was last modified. - */ - last_updated: string; - - /** - * The version of the rule. - */ - version: string; - - /** - * The unique ID of the rule. - */ - id?: string; - - /** - * The action to perform when the rule matches. - */ - action?: 'ddos_dynamic'; - - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * An informative description of the rule. - */ - description?: string; - - /** - * Whether the rule should be executed. - */ - enabled?: boolean; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } - - export interface RulesetsForceConnectionCloseRule { - /** - * The timestamp of when the rule was last modified. - */ - last_updated: string; - - /** - * The version of the rule. - */ - version: string; - - /** - * The unique ID of the rule. - */ - id?: string; - - /** - * The action to perform when the rule matches. - */ - action?: 'force_connection_close'; - - /** - * The parameters configuring the rule's action. - */ - action_parameters?: unknown; - - /** - * The categories of the rule. - */ - categories?: Array; - - /** - * An informative description of the rule. - */ - description?: string; - - /** - * Whether the rule should be executed. - */ - enabled?: boolean; - - /** - * The expression defining which traffic will match the rule. - */ - expression?: string; - - /** - * An object configuring the rule's logging behavior. - */ - logging?: RulesAPI.Logging; - - /** - * The reference of the rule (the rule ID by default). - */ - ref?: string; - } -} - -export interface ByTagGetParams { - /** - * The unique ID of the account. - */ - account_id: string; -} - -export namespace ByTag { - export import ByTagGetResponse = ByTagAPI.ByTagGetResponse; - export import ByTagGetParams = ByTagAPI.ByTagGetParams; -} diff --git a/src/resources/rulesets/versions/index.ts b/src/resources/rulesets/versions/index.ts deleted file mode 100644 index b5ad4ccbba..0000000000 --- a/src/resources/rulesets/versions/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { ByTagGetResponse, ByTagGetParams, ByTag } from './by-tag'; -export { - VersionListResponse, - VersionGetResponse, - VersionListParams, - VersionDeleteParams, - VersionGetParams, - VersionListResponsesSinglePage, - Versions, -} from './versions'; diff --git a/src/resources/rum/index.ts b/src/resources/rum/index.ts index 7db789fa80..3cebab350d 100644 --- a/src/resources/rum/index.ts +++ b/src/resources/rum/index.ts @@ -2,23 +2,25 @@ export { RUM } from './rum'; export { - RUMRule, - RuleListResponse, - RuleDeleteResponse, - RuleCreateParams, - RuleUpdateParams, - RuleListParams, - RuleDeleteParams, Rules, + type RUMRule, + type RuleListResponse, + type RuleDeleteResponse, + type RuleBulkCreateResponse, + type RuleCreateParams, + type RuleUpdateParams, + type RuleListParams, + type RuleDeleteParams, + type RuleBulkCreateParams, } from './rules'; export { - Site, - SiteInfoDeleteResponse, - SiteInfoCreateParams, - SiteInfoUpdateParams, - SiteInfoListParams, - SiteInfoDeleteParams, - SiteInfoGetParams, SitesV4PagePaginationArray, SiteInfo, + type Site, + type SiteInfoDeleteResponse, + type SiteInfoCreateParams, + type SiteInfoUpdateParams, + type SiteInfoListParams, + type SiteInfoDeleteParams, + type SiteInfoGetParams, } from './site-info'; diff --git a/src/resources/rum/rules.ts b/src/resources/rum/rules.ts index b91e5ad8e9..b3f2ac7e0e 100644 --- a/src/resources/rum/rules.ts +++ b/src/resources/rum/rules.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as RulesAPI from './rules'; export class Rules extends APIResource { /** @@ -73,6 +72,23 @@ export class Rules extends APIResource { ) as Core.APIPromise<{ result: RuleDeleteResponse }> )._thenUnwrap((obj) => obj.result); } + + /** + * Modifies one or more rules in a Web Analytics ruleset with a single request. + */ + bulkCreate( + rulesetId: string, + params: RuleBulkCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/rum/v2/${rulesetId}/rules`, { + body, + ...options, + }) as Core.APIPromise<{ result: RuleBulkCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } } export interface RUMRule { @@ -143,6 +159,36 @@ export interface RuleDeleteResponse { id?: string; } +export interface RuleBulkCreateResponse { + /** + * A list of rules. + */ + rules?: Array; + + ruleset?: RuleBulkCreateResponse.Ruleset; +} + +export namespace RuleBulkCreateResponse { + export interface Ruleset { + /** + * The Web Analytics ruleset identifier. + */ + id?: string; + + /** + * Whether the ruleset is enabled. + */ + enabled?: boolean; + + zone_name?: string; + + /** + * The zone identifier. + */ + zone_tag?: string; + } +} + export interface RuleCreateParams { /** * Path param: Identifier @@ -211,12 +257,50 @@ export interface RuleDeleteParams { account_id: string; } -export namespace Rules { - export import RUMRule = RulesAPI.RUMRule; - export import RuleListResponse = RulesAPI.RuleListResponse; - export import RuleDeleteResponse = RulesAPI.RuleDeleteResponse; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; - export import RuleDeleteParams = RulesAPI.RuleDeleteParams; +export interface RuleBulkCreateParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: A list of rule identifiers to delete. + */ + delete_rules?: Array; + + /** + * Body param: A list of rules to create or update. + */ + rules?: Array; +} + +export namespace RuleBulkCreateParams { + export interface Rule { + /** + * The Web Analytics rule identifier. + */ + id?: string; + + host?: string; + + inclusive?: boolean; + + is_paused?: boolean; + + paths?: Array; + } +} + +export declare namespace Rules { + export { + type RUMRule as RUMRule, + type RuleListResponse as RuleListResponse, + type RuleDeleteResponse as RuleDeleteResponse, + type RuleBulkCreateResponse as RuleBulkCreateResponse, + type RuleCreateParams as RuleCreateParams, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleBulkCreateParams as RuleBulkCreateParams, + }; } diff --git a/src/resources/rum/rum.ts b/src/resources/rum/rum.ts index 379996b3a1..9a1989e73c 100644 --- a/src/resources/rum/rum.ts +++ b/src/resources/rum/rum.ts @@ -2,29 +2,63 @@ import { APIResource } from '../../resource'; import * as RulesAPI from './rules'; +import { + RUMRule, + RuleBulkCreateParams, + RuleBulkCreateResponse, + RuleCreateParams, + RuleDeleteParams, + RuleDeleteResponse, + RuleListParams, + RuleListResponse, + RuleUpdateParams, + Rules, +} from './rules'; import * as SiteInfoAPI from './site-info'; +import { + Site, + SiteInfo, + SiteInfoCreateParams, + SiteInfoDeleteParams, + SiteInfoDeleteResponse, + SiteInfoGetParams, + SiteInfoListParams, + SiteInfoUpdateParams, + SitesV4PagePaginationArray, +} from './site-info'; export class RUM extends APIResource { siteInfo: SiteInfoAPI.SiteInfo = new SiteInfoAPI.SiteInfo(this._client); rules: RulesAPI.Rules = new RulesAPI.Rules(this._client); } -export namespace RUM { - export import SiteInfo = SiteInfoAPI.SiteInfo; - export import Site = SiteInfoAPI.Site; - export import SiteInfoDeleteResponse = SiteInfoAPI.SiteInfoDeleteResponse; - export import SitesV4PagePaginationArray = SiteInfoAPI.SitesV4PagePaginationArray; - export import SiteInfoCreateParams = SiteInfoAPI.SiteInfoCreateParams; - export import SiteInfoUpdateParams = SiteInfoAPI.SiteInfoUpdateParams; - export import SiteInfoListParams = SiteInfoAPI.SiteInfoListParams; - export import SiteInfoDeleteParams = SiteInfoAPI.SiteInfoDeleteParams; - export import SiteInfoGetParams = SiteInfoAPI.SiteInfoGetParams; - export import Rules = RulesAPI.Rules; - export import RUMRule = RulesAPI.RUMRule; - export import RuleListResponse = RulesAPI.RuleListResponse; - export import RuleDeleteResponse = RulesAPI.RuleDeleteResponse; - export import RuleCreateParams = RulesAPI.RuleCreateParams; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; - export import RuleDeleteParams = RulesAPI.RuleDeleteParams; +RUM.SiteInfo = SiteInfo; +RUM.SitesV4PagePaginationArray = SitesV4PagePaginationArray; +RUM.Rules = Rules; + +export declare namespace RUM { + export { + SiteInfo as SiteInfo, + type Site as Site, + type SiteInfoDeleteResponse as SiteInfoDeleteResponse, + SitesV4PagePaginationArray as SitesV4PagePaginationArray, + type SiteInfoCreateParams as SiteInfoCreateParams, + type SiteInfoUpdateParams as SiteInfoUpdateParams, + type SiteInfoListParams as SiteInfoListParams, + type SiteInfoDeleteParams as SiteInfoDeleteParams, + type SiteInfoGetParams as SiteInfoGetParams, + }; + + export { + Rules as Rules, + type RUMRule as RUMRule, + type RuleListResponse as RuleListResponse, + type RuleDeleteResponse as RuleDeleteResponse, + type RuleBulkCreateResponse as RuleBulkCreateResponse, + type RuleCreateParams as RuleCreateParams, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + type RuleBulkCreateParams as RuleBulkCreateParams, + }; } diff --git a/src/resources/rum/site-info.ts b/src/resources/rum/site-info.ts index 8a871cdfe0..0e1bb50e26 100644 --- a/src/resources/rum/site-info.ts +++ b/src/resources/rum/site-info.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SiteInfoAPI from './site-info'; import * as RulesAPI from './rules'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; @@ -209,13 +208,17 @@ export interface SiteInfoGetParams { account_id: string; } -export namespace SiteInfo { - export import Site = SiteInfoAPI.Site; - export import SiteInfoDeleteResponse = SiteInfoAPI.SiteInfoDeleteResponse; - export import SitesV4PagePaginationArray = SiteInfoAPI.SitesV4PagePaginationArray; - export import SiteInfoCreateParams = SiteInfoAPI.SiteInfoCreateParams; - export import SiteInfoUpdateParams = SiteInfoAPI.SiteInfoUpdateParams; - export import SiteInfoListParams = SiteInfoAPI.SiteInfoListParams; - export import SiteInfoDeleteParams = SiteInfoAPI.SiteInfoDeleteParams; - export import SiteInfoGetParams = SiteInfoAPI.SiteInfoGetParams; +SiteInfo.SitesV4PagePaginationArray = SitesV4PagePaginationArray; + +export declare namespace SiteInfo { + export { + type Site as Site, + type SiteInfoDeleteResponse as SiteInfoDeleteResponse, + SitesV4PagePaginationArray as SitesV4PagePaginationArray, + type SiteInfoCreateParams as SiteInfoCreateParams, + type SiteInfoUpdateParams as SiteInfoUpdateParams, + type SiteInfoListParams as SiteInfoListParams, + type SiteInfoDeleteParams as SiteInfoDeleteParams, + type SiteInfoGetParams as SiteInfoGetParams, + }; } diff --git a/src/resources/secondary-dns/index.ts b/src/resources/secondary-dns/index.ts deleted file mode 100644 index 8bf7098c70..0000000000 --- a/src/resources/secondary-dns/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { - ACL, - ACLDeleteResponse, - ACLCreateParams, - ACLUpdateParams, - ACLListParams, - ACLDeleteParams, - ACLGetParams, - ACLsSinglePage, - ACLs, -} from './acls'; -export { - DisableTransfer, - EnableTransfer, - Outgoing, - OutgoingStatus, - OutgoingCreateResponse, - OutgoingUpdateResponse, - OutgoingDeleteResponse, - OutgoingForceNotifyResponse, - OutgoingGetResponse, - OutgoingCreateParams, - OutgoingUpdateParams, - OutgoingDeleteParams, - OutgoingDisableParams, - OutgoingEnableParams, - OutgoingForceNotifyParams, - OutgoingGetParams, - OutgoingResource, -} from './outgoing/index'; -export { ForceAXFR, ForceAXFRCreateParams, ForceAXFRResource } from './force-axfr'; -export { - Incoming, - IncomingCreateResponse, - IncomingUpdateResponse, - IncomingDeleteResponse, - IncomingGetResponse, - IncomingCreateParams, - IncomingUpdateParams, - IncomingDeleteParams, - IncomingGetParams, - IncomingResource, -} from './incoming'; -export { - Peer, - PeerDeleteResponse, - PeerCreateParams, - PeerUpdateParams, - PeerListParams, - PeerDeleteParams, - PeerGetParams, - PeersSinglePage, - Peers, -} from './peers'; -export { SecondaryDNS } from './secondary-dns'; -export { - TSIG, - TSIGDeleteResponse, - TSIGCreateParams, - TSIGUpdateParams, - TSIGListParams, - TSIGDeleteParams, - TSIGGetParams, - TSIGsSinglePage, - TSIGs, -} from './tsigs'; diff --git a/src/resources/secondary-dns/outgoing/index.ts b/src/resources/secondary-dns/outgoing/index.ts deleted file mode 100644 index 029bf48f18..0000000000 --- a/src/resources/secondary-dns/outgoing/index.ts +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { - DisableTransfer, - EnableTransfer, - Outgoing, - OutgoingStatus, - OutgoingCreateResponse, - OutgoingUpdateResponse, - OutgoingDeleteResponse, - OutgoingForceNotifyResponse, - OutgoingGetResponse, - OutgoingCreateParams, - OutgoingUpdateParams, - OutgoingDeleteParams, - OutgoingDisableParams, - OutgoingEnableParams, - OutgoingForceNotifyParams, - OutgoingGetParams, - OutgoingResource, -} from './outgoing'; -export { StatusGetParams, Status } from './status'; diff --git a/src/resources/secondary-dns/secondary-dns.ts b/src/resources/secondary-dns/secondary-dns.ts deleted file mode 100644 index 7a730b3597..0000000000 --- a/src/resources/secondary-dns/secondary-dns.ts +++ /dev/null @@ -1,78 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import * as ACLsAPI from './acls'; -import * as ForceAXFRAPI from './force-axfr'; -import * as IncomingAPI from './incoming'; -import * as PeersAPI from './peers'; -import * as TSIGsAPI from './tsigs'; -import * as OutgoingAPI from './outgoing/outgoing'; - -export class SecondaryDNS extends APIResource { - forceAXFR: ForceAXFRAPI.ForceAXFRResource = new ForceAXFRAPI.ForceAXFRResource(this._client); - incoming: IncomingAPI.IncomingResource = new IncomingAPI.IncomingResource(this._client); - outgoing: OutgoingAPI.OutgoingResource = new OutgoingAPI.OutgoingResource(this._client); - acls: ACLsAPI.ACLs = new ACLsAPI.ACLs(this._client); - peers: PeersAPI.Peers = new PeersAPI.Peers(this._client); - tsigs: TSIGsAPI.TSIGs = new TSIGsAPI.TSIGs(this._client); -} - -export namespace SecondaryDNS { - export import ForceAXFRResource = ForceAXFRAPI.ForceAXFRResource; - export import ForceAXFR = ForceAXFRAPI.ForceAXFR; - export import ForceAXFRCreateParams = ForceAXFRAPI.ForceAXFRCreateParams; - export import IncomingResource = IncomingAPI.IncomingResource; - export import Incoming = IncomingAPI.Incoming; - export import IncomingCreateResponse = IncomingAPI.IncomingCreateResponse; - export import IncomingUpdateResponse = IncomingAPI.IncomingUpdateResponse; - export import IncomingDeleteResponse = IncomingAPI.IncomingDeleteResponse; - export import IncomingGetResponse = IncomingAPI.IncomingGetResponse; - export import IncomingCreateParams = IncomingAPI.IncomingCreateParams; - export import IncomingUpdateParams = IncomingAPI.IncomingUpdateParams; - export import IncomingDeleteParams = IncomingAPI.IncomingDeleteParams; - export import IncomingGetParams = IncomingAPI.IncomingGetParams; - export import OutgoingResource = OutgoingAPI.OutgoingResource; - export import DisableTransfer = OutgoingAPI.DisableTransfer; - export import EnableTransfer = OutgoingAPI.EnableTransfer; - export import Outgoing = OutgoingAPI.Outgoing; - export import OutgoingStatus = OutgoingAPI.OutgoingStatus; - export import OutgoingCreateResponse = OutgoingAPI.OutgoingCreateResponse; - export import OutgoingUpdateResponse = OutgoingAPI.OutgoingUpdateResponse; - export import OutgoingDeleteResponse = OutgoingAPI.OutgoingDeleteResponse; - export import OutgoingForceNotifyResponse = OutgoingAPI.OutgoingForceNotifyResponse; - export import OutgoingGetResponse = OutgoingAPI.OutgoingGetResponse; - export import OutgoingCreateParams = OutgoingAPI.OutgoingCreateParams; - export import OutgoingUpdateParams = OutgoingAPI.OutgoingUpdateParams; - export import OutgoingDeleteParams = OutgoingAPI.OutgoingDeleteParams; - export import OutgoingDisableParams = OutgoingAPI.OutgoingDisableParams; - export import OutgoingEnableParams = OutgoingAPI.OutgoingEnableParams; - export import OutgoingForceNotifyParams = OutgoingAPI.OutgoingForceNotifyParams; - export import OutgoingGetParams = OutgoingAPI.OutgoingGetParams; - export import ACLs = ACLsAPI.ACLs; - export import ACL = ACLsAPI.ACL; - export import ACLDeleteResponse = ACLsAPI.ACLDeleteResponse; - export import ACLsSinglePage = ACLsAPI.ACLsSinglePage; - export import ACLCreateParams = ACLsAPI.ACLCreateParams; - export import ACLUpdateParams = ACLsAPI.ACLUpdateParams; - export import ACLListParams = ACLsAPI.ACLListParams; - export import ACLDeleteParams = ACLsAPI.ACLDeleteParams; - export import ACLGetParams = ACLsAPI.ACLGetParams; - export import Peers = PeersAPI.Peers; - export import Peer = PeersAPI.Peer; - export import PeerDeleteResponse = PeersAPI.PeerDeleteResponse; - export import PeersSinglePage = PeersAPI.PeersSinglePage; - export import PeerCreateParams = PeersAPI.PeerCreateParams; - export import PeerUpdateParams = PeersAPI.PeerUpdateParams; - export import PeerListParams = PeersAPI.PeerListParams; - export import PeerDeleteParams = PeersAPI.PeerDeleteParams; - export import PeerGetParams = PeersAPI.PeerGetParams; - export import TSIGs = TSIGsAPI.TSIGs; - export import TSIG = TSIGsAPI.TSIG; - export import TSIGDeleteResponse = TSIGsAPI.TSIGDeleteResponse; - export import TSIGsSinglePage = TSIGsAPI.TSIGsSinglePage; - export import TSIGCreateParams = TSIGsAPI.TSIGCreateParams; - export import TSIGUpdateParams = TSIGsAPI.TSIGUpdateParams; - export import TSIGListParams = TSIGsAPI.TSIGListParams; - export import TSIGDeleteParams = TSIGsAPI.TSIGDeleteParams; - export import TSIGGetParams = TSIGsAPI.TSIGGetParams; -} diff --git a/src/resources/security-txt.ts b/src/resources/security-txt.ts new file mode 100644 index 0000000000..a66d691325 --- /dev/null +++ b/src/resources/security-txt.ts @@ -0,0 +1,149 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../resource'; +import * as Core from '../core'; +import * as Shared from './shared'; + +export class SecurityTXT extends APIResource { + /** + * Update security.txt + */ + update( + params: SecurityTXTUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return this._client.put(`/zones/${zone_id}/security-center/securitytxt`, { body, ...options }); + } + + /** + * Delete security.txt + */ + delete( + params: SecurityTXTDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id } = params; + return this._client.delete(`/zones/${zone_id}/security-center/securitytxt`, options); + } + + /** + * Get security.txt + */ + get(params: SecurityTXTGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/security-center/securitytxt`, options) as Core.APIPromise<{ + result: SecurityTXTGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface SecurityTXTUpdateResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; +} + +export interface SecurityTXTDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; +} + +export interface SecurityTXTGetResponse { + acknowledgments?: Array; + + canonical?: Array; + + contact?: Array; + + enabled?: boolean; + + encryption?: Array; + + expires?: string; + + hiring?: Array; + + policy?: Array; + + preferredLanguages?: string; +} + +export interface SecurityTXTUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: + */ + acknowledgments?: Array; + + /** + * Body param: + */ + canonical?: Array; + + /** + * Body param: + */ + contact?: Array; + + /** + * Body param: + */ + enabled?: boolean; + + /** + * Body param: + */ + encryption?: Array; + + /** + * Body param: + */ + expires?: string; + + /** + * Body param: + */ + hiring?: Array; + + /** + * Body param: + */ + policy?: Array; + + /** + * Body param: + */ + preferredLanguages?: string; +} + +export interface SecurityTXTDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +export interface SecurityTXTGetParams { + /** + * Identifier + */ + zone_id: string; +} diff --git a/src/resources/shared.ts b/src/resources/shared.ts index dc5b28b640..3feed67431 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -107,12 +107,12 @@ export namespace AuditLog { /** * The Certificate Authority that will issue the certificate */ -export type CertificateCA = 'digicert' | 'google' | 'lets_encrypt'; +export type CertificateCA = 'digicert' | 'google' | 'lets_encrypt' | 'ssl_com'; /** * The Certificate Authority that will issue the certificate */ -export type CertificateCAParam = 'digicert' | 'google' | 'lets_encrypt'; +export type CertificateCAParam = 'digicert' | 'google' | 'lets_encrypt' | 'ssl_com'; /** * Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), @@ -274,9 +274,14 @@ export interface Member { id?: string; /** - * Roles assigned to this member. + * Access policy for the membership */ - roles?: Array; + policies?: Array; + + /** + * Roles assigned to this Member. + */ + roles?: Array; /** * A member's status in the account. @@ -290,50 +295,125 @@ export interface Member { } export namespace Member { - export interface Role { + export interface Policy { /** - * Role identifier tag. + * Policy identifier. */ - id: string; + id?: string; /** - * Description of role's permissions. + * Allow or deny operations against the resources. */ - description: string; + access?: 'allow' | 'deny'; /** - * Role name. + * A set of permission groups that are specified to the policy. */ - name: string; + permission_groups?: Array; - permissions: Role.Permissions; + /** + * A list of resource groups that the policy applies to. + */ + resource_groups?: Array; } - export namespace Role { - export interface Permissions { - analytics?: Shared.PermissionGrant; - - billing?: Shared.PermissionGrant; - - cache_purge?: Shared.PermissionGrant; - - dns?: Shared.PermissionGrant; - - dns_records?: Shared.PermissionGrant; - - lb?: Shared.PermissionGrant; - - logs?: Shared.PermissionGrant; - - organization?: Shared.PermissionGrant; + export namespace Policy { + /** + * A named group of permissions that map to a group of operations against + * resources. + */ + export interface PermissionGroup { + /** + * Identifier of the group. + */ + id: string; + + /** + * Attributes associated to the permission group. + */ + meta?: PermissionGroup.Meta; + + /** + * Name of the group. + */ + name?: string; + } - ssl?: Shared.PermissionGrant; + export namespace PermissionGroup { + /** + * Attributes associated to the permission group. + */ + export interface Meta { + key?: string; - waf?: Shared.PermissionGrant; + value?: string; + } + } - zone_settings?: Shared.PermissionGrant; + /** + * A group of scoped resources. + */ + export interface ResourceGroup { + /** + * Identifier of the group. + */ + id: string; + + /** + * The scope associated to the resource group + */ + scope: Array; + + /** + * Attributes associated to the resource group. + */ + meta?: ResourceGroup.Meta; + + /** + * Name of the resource group. + */ + name?: string; + } - zones?: Shared.PermissionGrant; + export namespace ResourceGroup { + /** + * A scope is a combination of scope objects which provides additional context. + */ + export interface Scope { + /** + * This is a combination of pre-defined resource name and identifier (like Account + * ID etc.) + */ + key: string; + + /** + * A list of scope objects for additional context. + */ + objects: Array; + } + + export namespace Scope { + /** + * A scope object represents any resource that can have actions applied against + * invite. + */ + export interface Object { + /** + * This is a combination of pre-defined resource name and identifier (like Zone ID + * etc.) + */ + key: string; + } + } + + /** + * Attributes associated to the resource group. + */ + export interface Meta { + key?: string; + + value?: string; + } } } @@ -405,6 +485,86 @@ export interface PermissionGrantParam { write?: boolean; } +/** + * The rate plan applied to the subscription. + */ +export interface RatePlan { + /** + * The ID of the rate plan. + */ + id?: string; + + /** + * The currency applied to the rate plan subscription. + */ + currency?: string; + + /** + * Whether this rate plan is managed externally from Cloudflare. + */ + externally_managed?: boolean; + + /** + * Whether a rate plan is enterprise-based (or newly adopted term contract). + */ + is_contract?: boolean; + + /** + * The full name of the rate plan. + */ + public_name?: string; + + /** + * The scope that this rate plan applies to. + */ + scope?: string; + + /** + * The list of sets this rate plan applies to. + */ + sets?: Array; +} + +/** + * The rate plan applied to the subscription. + */ +export interface RatePlanParam { + /** + * The ID of the rate plan. + */ + id?: string; + + /** + * The currency applied to the rate plan subscription. + */ + currency?: string; + + /** + * Whether this rate plan is managed externally from Cloudflare. + */ + externally_managed?: boolean; + + /** + * Whether a rate plan is enterprise-based (or newly adopted term contract). + */ + is_contract?: boolean; + + /** + * The full name of the rate plan. + */ + public_name?: string; + + /** + * The scope that this rate plan applies to. + */ + scope?: string; + + /** + * The list of sets this rate plan applies to. + */ + sets?: Array; +} + export interface ResponseInfo { code: number; @@ -448,14 +608,46 @@ export interface Role { description: string; /** - * Role Name. + * Role name. */ name: string; + permissions: Role.Permissions; +} + +export namespace Role { + export interface Permissions { + analytics?: Shared.PermissionGrant; + + billing?: Shared.PermissionGrant; + + cache_purge?: Shared.PermissionGrant; + + dns?: Shared.PermissionGrant; + + dns_records?: Shared.PermissionGrant; + + lb?: Shared.PermissionGrant; + + logs?: Shared.PermissionGrant; + + organization?: Shared.PermissionGrant; + + ssl?: Shared.PermissionGrant; + + waf?: Shared.PermissionGrant; + + zone_settings?: Shared.PermissionGrant; + + zones?: Shared.PermissionGrant; + } +} + +export interface RoleParam { /** - * Access permissions for this User. + * Role identifier tag. */ - permissions: Array; + id: string; } /** @@ -468,6 +660,281 @@ export type SortDirection = 'asc' | 'desc'; */ export type SortDirectionParam = 'asc' | 'desc'; +export interface Subscription { + /** + * Subscription identifier tag. + */ + id?: string; + + /** + * The monetary unit in which pricing information is displayed. + */ + currency?: string; + + /** + * The end of the current period and also when the next billing is due. + */ + current_period_end?: string; + + /** + * When the current billing period started. May match initial_period_start if this + * is the first period. + */ + current_period_start?: string; + + /** + * How often the subscription is renewed automatically. + */ + frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; + + /** + * The price of the subscription that will be billed, in US dollars. + */ + price?: number; + + /** + * The rate plan applied to the subscription. + */ + rate_plan?: RatePlan; + + /** + * The state that the subscription is in. + */ + state?: 'Trial' | 'Provisioned' | 'Paid' | 'AwaitingPayment' | 'Cancelled' | 'Failed' | 'Expired'; +} + +/** + * A component value for a subscription. + */ +export interface SubscriptionComponent { + /** + * The default amount assigned. + */ + default?: number; + + /** + * The name of the component value. + */ + name?: string; + + /** + * The unit price for the component value. + */ + price?: number; + + /** + * The amount of the component value assigned. + */ + value?: number; +} + +/** + * A simple zone object. May have null properties if not a zone subscription. + */ +export interface SubscriptionZone { + /** + * Identifier + */ + id?: string; + + /** + * The domain name + */ + name?: string; +} + +export interface Token { + /** + * Token identifier tag. + */ + id?: string; + + condition?: Token.Condition; + + /** + * The expiration time on or after which the JWT MUST NOT be accepted for + * processing. + */ + expires_on?: string; + + /** + * The time on which the token was created. + */ + issued_on?: string; + + /** + * Last time the token was used. + */ + last_used_on?: string; + + /** + * Last time the token was modified. + */ + modified_on?: string; + + /** + * Token name. + */ + name?: string; + + /** + * The time before which the token MUST NOT be accepted for processing. + */ + not_before?: string; + + /** + * List of access policies assigned to the token. + */ + policies?: Array; + + /** + * Status of the token. + */ + status?: 'active' | 'disabled' | 'expired'; +} + +export namespace Token { + export interface Condition { + /** + * Client IP restrictions. + */ + request_ip?: Condition.RequestIP; + } + + export namespace Condition { + /** + * Client IP restrictions. + */ + export interface RequestIP { + /** + * List of IPv4/IPv6 CIDR addresses. + */ + in?: Array; + + /** + * List of IPv4/IPv6 CIDR addresses. + */ + not_in?: Array; + } + } +} + +/** + * IPv4/IPv6 CIDR. + */ +export type TokenConditionCIDRList = string; + +/** + * IPv4/IPv6 CIDR. + */ +export type TokenConditionCIDRListParam = string; + +export interface TokenPolicy { + /** + * Policy identifier. + */ + id: string; + + /** + * Allow or deny operations against the resources. + */ + effect: 'allow' | 'deny'; + + /** + * A set of permission groups that are specified to the policy. + */ + permission_groups: Array; + + /** + * A list of resource names that the policy applies to. + */ + resources: Record; +} + +export namespace TokenPolicy { + /** + * A named group of permissions that map to a group of operations against + * resources. + */ + export interface PermissionGroup { + /** + * Identifier of the group. + */ + id: string; + + /** + * Attributes associated to the permission group. + */ + meta?: PermissionGroup.Meta; + + /** + * Name of the group. + */ + name?: string; + } + + export namespace PermissionGroup { + /** + * Attributes associated to the permission group. + */ + export interface Meta { + key?: string; + + value?: string; + } + } +} + +export interface TokenPolicyParam { + /** + * Allow or deny operations against the resources. + */ + effect: 'allow' | 'deny'; + + /** + * A set of permission groups that are specified to the policy. + */ + permission_groups: Array; + + /** + * A list of resource names that the policy applies to. + */ + resources: Record; +} + +export namespace TokenPolicyParam { + /** + * A named group of permissions that map to a group of operations against + * resources. + */ + export interface PermissionGroup { + /** + * Attributes associated to the permission group. + */ + meta?: PermissionGroup.Meta; + } + + export namespace PermissionGroup { + /** + * Attributes associated to the permission group. + */ + export interface Meta { + key?: string; + + value?: string; + } + } +} + +/** + * The token value. + */ +export type TokenValue = string; + +export class MembersV4PagePaginationArray extends V4PagePaginationArray {} + export class RolesSinglePage extends SinglePage {} +export class TokensV4PagePaginationArray extends V4PagePaginationArray {} + export class AuditLogsV4PagePaginationArray extends V4PagePaginationArray {} diff --git a/src/resources/snippets/content.ts b/src/resources/snippets/content.ts index a2021c9486..464bcd13f1 100644 --- a/src/resources/snippets/content.ts +++ b/src/resources/snippets/content.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ContentAPI from './content'; import { type Response } from '../../_shims/index'; export class Content extends APIResource { @@ -17,6 +16,7 @@ export class Content extends APIResource { const { zone_id } = params; return this._client.get(`/zones/${zone_id}/snippets/${snippetName}/content`, { ...options, + headers: { Accept: 'multipart/form-data', ...options?.headers }, __binaryResponse: true, }); } @@ -29,6 +29,6 @@ export interface ContentGetParams { zone_id: string; } -export namespace Content { - export import ContentGetParams = ContentAPI.ContentGetParams; +export declare namespace Content { + export { type ContentGetParams as ContentGetParams }; } diff --git a/src/resources/snippets/index.ts b/src/resources/snippets/index.ts index ad2272b8a9..433fae26f0 100644 --- a/src/resources/snippets/index.ts +++ b/src/resources/snippets/index.ts @@ -1,12 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { ContentGetParams, Content } from './content'; +export { Content, type ContentGetParams } from './content'; export { - RuleUpdateResponse, - RuleListResponse, - RuleUpdateParams, - RuleListParams, RuleListResponsesSinglePage, Rules, + type RuleUpdateResponse, + type RuleListResponse, + type RuleDeleteResponse, + type RuleUpdateParams, + type RuleListParams, + type RuleDeleteParams, } from './rules'; export { Snippets } from './snippets'; diff --git a/src/resources/snippets/rules.ts b/src/resources/snippets/rules.ts index f0f259545e..7a1a45d41b 100644 --- a/src/resources/snippets/rules.ts +++ b/src/resources/snippets/rules.ts @@ -2,7 +2,7 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as RulesAPI from './rules'; +import * as Shared from '../shared'; import { SinglePage } from '../../pagination'; export class Rules extends APIResource { @@ -32,6 +32,14 @@ export class Rules extends APIResource { options, ); } + + /** + * Delete All Rules + */ + delete(params: RuleDeleteParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return this._client.delete(`/zones/${zone_id}/snippets/snippet_rules`, options); + } } export class RuleListResponsesSinglePage extends SinglePage {} @@ -69,6 +77,17 @@ export interface RuleListResponse { snippet_name?: string; } +export interface RuleDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful + */ + success: true; +} + export interface RuleUpdateParams { /** * Path param: Identifier @@ -103,10 +122,23 @@ export interface RuleListParams { zone_id: string; } -export namespace Rules { - export import RuleUpdateResponse = RulesAPI.RuleUpdateResponse; - export import RuleListResponse = RulesAPI.RuleListResponse; - export import RuleListResponsesSinglePage = RulesAPI.RuleListResponsesSinglePage; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; +export interface RuleDeleteParams { + /** + * Identifier + */ + zone_id: string; +} + +Rules.RuleListResponsesSinglePage = RuleListResponsesSinglePage; + +export declare namespace Rules { + export { + type RuleUpdateResponse as RuleUpdateResponse, + type RuleListResponse as RuleListResponse, + type RuleDeleteResponse as RuleDeleteResponse, + RuleListResponsesSinglePage as RuleListResponsesSinglePage, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + }; } diff --git a/src/resources/snippets/snippets.ts b/src/resources/snippets/snippets.ts index d5525dd24e..311a500b3e 100644 --- a/src/resources/snippets/snippets.ts +++ b/src/resources/snippets/snippets.ts @@ -4,7 +4,18 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as Shared from '../shared'; import * as ContentAPI from './content'; +import { Content, ContentGetParams } from './content'; import * as RulesAPI from './rules'; +import { + RuleDeleteParams, + RuleDeleteResponse, + RuleListParams, + RuleListResponse, + RuleListResponsesSinglePage, + RuleUpdateParams, + RuleUpdateResponse, + Rules, +} from './rules'; import { SinglePage } from '../../pagination'; export class Snippets extends APIResource { @@ -148,13 +159,21 @@ export interface SnippetGetParams { zone_id: string; } -export namespace Snippets { - export import Content = ContentAPI.Content; - export import ContentGetParams = ContentAPI.ContentGetParams; - export import Rules = RulesAPI.Rules; - export import RuleUpdateResponse = RulesAPI.RuleUpdateResponse; - export import RuleListResponse = RulesAPI.RuleListResponse; - export import RuleListResponsesSinglePage = RulesAPI.RuleListResponsesSinglePage; - export import RuleUpdateParams = RulesAPI.RuleUpdateParams; - export import RuleListParams = RulesAPI.RuleListParams; +Snippets.Content = Content; +Snippets.Rules = Rules; +Snippets.RuleListResponsesSinglePage = RuleListResponsesSinglePage; + +export declare namespace Snippets { + export { Content as Content, type ContentGetParams as ContentGetParams }; + + export { + Rules as Rules, + type RuleUpdateResponse as RuleUpdateResponse, + type RuleListResponse as RuleListResponse, + type RuleDeleteResponse as RuleDeleteResponse, + RuleListResponsesSinglePage as RuleListResponsesSinglePage, + type RuleUpdateParams as RuleUpdateParams, + type RuleListParams as RuleListParams, + type RuleDeleteParams as RuleDeleteParams, + }; } diff --git a/src/resources/spectrum/analytics/aggregates/aggregates.ts b/src/resources/spectrum/analytics/aggregates/aggregates.ts index 815bca4142..3da05b84e8 100644 --- a/src/resources/spectrum/analytics/aggregates/aggregates.ts +++ b/src/resources/spectrum/analytics/aggregates/aggregates.ts @@ -2,13 +2,18 @@ import { APIResource } from '../../../../resource'; import * as CurrentsAPI from './currents'; +import { CurrentGetParams, CurrentGetResponse, Currents } from './currents'; export class Aggregates extends APIResource { currents: CurrentsAPI.Currents = new CurrentsAPI.Currents(this._client); } -export namespace Aggregates { - export import Currents = CurrentsAPI.Currents; - export import CurrentGetResponse = CurrentsAPI.CurrentGetResponse; - export import CurrentGetParams = CurrentsAPI.CurrentGetParams; +Aggregates.Currents = Currents; + +export declare namespace Aggregates { + export { + Currents as Currents, + type CurrentGetResponse as CurrentGetResponse, + type CurrentGetParams as CurrentGetParams, + }; } diff --git a/src/resources/spectrum/analytics/aggregates/currents.ts b/src/resources/spectrum/analytics/aggregates/currents.ts index 4b30d28438..56402ece64 100644 --- a/src/resources/spectrum/analytics/aggregates/currents.ts +++ b/src/resources/spectrum/analytics/aggregates/currents.ts @@ -1,31 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../resource'; -import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as CurrentsAPI from './currents'; export class Currents extends APIResource { /** * Retrieves analytics aggregated from the last minute of usage on Spectrum * applications underneath a given zone. */ - get( - zone: string, - query?: CurrentGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - get(zone: string, options?: Core.RequestOptions): Core.APIPromise; - get( - zone: string, - query: CurrentGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.get(zone, {}, query); - } + get(params: CurrentGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...query } = params; return ( - this._client.get(`/zones/${zone}/spectrum/analytics/aggregate/current`, { + this._client.get(`/zones/${zone_id}/spectrum/analytics/aggregate/current`, { query, ...options, }) as Core.APIPromise<{ result: CurrentGetResponse }> @@ -33,28 +19,55 @@ export class Currents extends APIResource { } } -export type CurrentGetResponse = Array; +export type CurrentGetResponse = Array; + +export namespace CurrentGetResponse { + export interface CurrentGetResponseItem { + /** + * Application identifier. + */ + appID: string; + + /** + * Number of bytes sent + */ + bytesEgress: number; + + /** + * Number of bytes received + */ + bytesIngress: number; + + /** + * Number of connections + */ + connections: number; + + /** + * Average duration of connections + */ + durationAvg: number; + } +} export interface CurrentGetParams { /** - * Comma-delimited list of Spectrum Application Id(s). If provided, the response - * will be limited to Spectrum Application Id(s) that match. + * Path param: Identifier */ - app_id_param?: string; + zone_id: string; /** - * Comma-delimited list of Spectrum Application Id(s). If provided, the response - * will be limited to Spectrum Application Id(s) that match. + * Query param: Comma-delimited list of Spectrum Application Id(s). If provided, + * the response will be limited to Spectrum Application Id(s) that match. */ appID?: string; /** - * Co-location identifier. + * Query param: Co-location identifier. */ colo_name?: string; } -export namespace Currents { - export import CurrentGetResponse = CurrentsAPI.CurrentGetResponse; - export import CurrentGetParams = CurrentsAPI.CurrentGetParams; +export declare namespace Currents { + export { type CurrentGetResponse as CurrentGetResponse, type CurrentGetParams as CurrentGetParams }; } diff --git a/src/resources/spectrum/analytics/aggregates/index.ts b/src/resources/spectrum/analytics/aggregates/index.ts index 3dd0c41f32..e1e69abee4 100644 --- a/src/resources/spectrum/analytics/aggregates/index.ts +++ b/src/resources/spectrum/analytics/aggregates/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { Aggregates } from './aggregates'; -export { CurrentGetResponse, CurrentGetParams, Currents } from './currents'; +export { Currents, type CurrentGetResponse, type CurrentGetParams } from './currents'; diff --git a/src/resources/spectrum/analytics/analytics.ts b/src/resources/spectrum/analytics/analytics.ts index 3981cfdf8d..7651ad430d 100644 --- a/src/resources/spectrum/analytics/analytics.ts +++ b/src/resources/spectrum/analytics/analytics.ts @@ -2,15 +2,20 @@ import { APIResource } from '../../../resource'; import * as AggregatesAPI from './aggregates/aggregates'; +import { Aggregates } from './aggregates/aggregates'; import * as EventsAPI from './events/events'; +import { Dimension, Events } from './events/events'; export class Analytics extends APIResource { aggregates: AggregatesAPI.Aggregates = new AggregatesAPI.Aggregates(this._client); events: EventsAPI.Events = new EventsAPI.Events(this._client); } -export namespace Analytics { - export import Aggregates = AggregatesAPI.Aggregates; - export import Events = EventsAPI.Events; - export import Dimension = EventsAPI.Dimension; +Analytics.Aggregates = Aggregates; +Analytics.Events = Events; + +export declare namespace Analytics { + export { Aggregates as Aggregates }; + + export { Events as Events, type Dimension as Dimension }; } diff --git a/src/resources/spectrum/analytics/events/bytimes.ts b/src/resources/spectrum/analytics/events/bytimes.ts index 95d570b8d4..8180edbc90 100644 --- a/src/resources/spectrum/analytics/events/bytimes.ts +++ b/src/resources/spectrum/analytics/events/bytimes.ts @@ -1,43 +1,165 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../resource'; -import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as BytimesAPI from './bytimes'; import * as EventsAPI from './events'; export class Bytimes extends APIResource { /** * Retrieves a list of aggregate metrics grouped by time interval. */ - get( - zone: string, - query?: BytimeGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - get(zone: string, options?: Core.RequestOptions): Core.APIPromise; - get( - zone: string, - query: BytimeGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.get(zone, {}, query); - } + get(params: BytimeGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...query } = params; return ( - this._client.get(`/zones/${zone}/spectrum/analytics/events/bytime`, { + this._client.get(`/zones/${zone_id}/spectrum/analytics/events/bytime`, { query, ...options, - }) as Core.APIPromise<{ result: BytimeGetResponse | null }> + }) as Core.APIPromise<{ result: BytimeGetResponse }> )._thenUnwrap((obj) => obj.result); } } -export type BytimeGetResponse = unknown | string; +export interface BytimeGetResponse { + /** + * List of columns returned by the analytics query. + */ + data: Array; + + /** + * Number of seconds between current time and last processed event, i.e. how many + * seconds of data could be missing. + */ + data_lag: number; + + /** + * Maximum result for each selected metrics across all data. + */ + max: Record; + + /** + * Minimum result for each selected metrics across all data. + */ + min: Record; + + query: BytimeGetResponse.Query; + + /** + * Total number of rows in the result. + */ + rows: number; + + /** + * Total result for each selected metrics across all data. + */ + totals: Record; + + /** + * List of time interval buckets: [start, end] + */ + time_intervals?: Array>; +} + +export namespace BytimeGetResponse { + export interface Data { + dimensions?: Array; + + metrics?: Array | Array>; + } + + export interface Query { + /** + * Can be used to break down the data by given attributes. Options are: + * + * | Dimension | Name | Example | + * | --------- | ----------------------------- | ---------------------------------------------------------- | + * | event | Connection Event | connect, progress, disconnect, originError, clientFiltered | + * | appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 | + * | coloName | Colo Name | SFO | + * | ipVersion | IP version used by the client | 4, 6. | + */ + dimensions?: Array; + + /** + * Used to filter rows by one or more dimensions. Filters can be combined using OR + * and AND boolean logic. AND takes precedence over OR in all the expressions. The + * OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. + * The AND operator is defined using a semicolon (;) or AND keyword surrounded by + * whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) + * and needs to be percent-encoded as %3B. Comparison options are: + * + * | Operator | Name | URL Encoded | + * | -------- | ------------------------ | ----------- | + * | == | Equals | %3D%3D | + * | != | Does not equals | !%3D | + * | \> | Greater Than | %3E | + * | \< | Less Than | %3C | + * | \>= | Greater than or equal to | %3E%3D | + * | \<= | Less than or equal to | %3C%3D | + */ + filters?: string; + + /** + * Limit number of returned metrics. + */ + limit?: number; + + /** + * One or more metrics to compute. Options are: + * + * | Metric | Name | Example | Unit | + * | -------------- | ----------------------------------- | ------- | --------------------- | + * | count | Count of total events | 1000 | Count | + * | bytesIngress | Sum of ingress bytes | 1000 | Sum | + * | bytesEgress | Sum of egress bytes | 1000 | Sum | + * | durationAvg | Average connection duration | 1.0 | Time in milliseconds | + * | durationMedian | Median connection duration | 1.0 | Time in milliseconds | + * | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds | + * | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. | + */ + metrics?: Array< + | 'count' + | 'bytesIngress' + | 'bytesEgress' + | 'durationAvg' + | 'durationMedian' + | 'duration90th' + | 'duration99th' + >; + + /** + * Start of time interval to query, defaults to `until` - 6 hours. Timestamp must + * be in RFC3339 format and uses UTC unless otherwise specified. + */ + since?: string; + + /** + * The sort order for the result set; sort fields must be included in `metrics` or + * `dimensions`. + */ + sort?: Array; + + /** + * End of time interval to query, defaults to current time. Timestamp must be in + * RFC3339 format and uses UTC unless otherwise specified. + */ + until?: string; + } +} export interface BytimeGetParams { /** - * Can be used to break down the data by given attributes. Options are: + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Used to select time series resolution. + */ + time_delta: 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'dekaminute' | 'minute'; + + /** + * Query param: Can be used to break down the data by given attributes. Options + * are: * * | Dimension | Name | Example | * | --------- | ----------------------------- | ---------------------------------------------------------- | @@ -49,26 +171,27 @@ export interface BytimeGetParams { dimensions?: Array; /** - * Used to filter rows by one or more dimensions. Filters can be combined using OR - * and AND boolean logic. AND takes precedence over OR in all the expressions. The - * OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. - * The AND operator is defined using a semicolon (;) or AND keyword surrounded by - * whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) - * and needs to be percent-encoded as %3B. Comparison options are: + * Query param: Used to filter rows by one or more dimensions. Filters can be + * combined using OR and AND boolean logic. AND takes precedence over OR in all the + * expressions. The OR operator is defined using a comma (,) or OR keyword + * surrounded by whitespace. The AND operator is defined using a semicolon (;) or + * AND keyword surrounded by whitespace. Note that the semicolon is a reserved + * character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison + * options are: * * | Operator | Name | URL Encoded | * | -------- | ------------------------ | ----------- | * | == | Equals | %3D%3D | * | != | Does not equals | !%3D | - * | > | Greater Than | %3E | - * | < | Less Than | %3C | - * | >= | Greater than or equal to | %3E%3D | - * | <= | Less than or equal to | %3C%3D . | + * | \> | Greater Than | %3E | + * | \< | Less Than | %3C | + * | \>= | Greater than or equal to | %3E%3D | + * | \<= | Less than or equal to | %3C%3D | */ filters?: string; /** - * One or more metrics to compute. Options are: + * Query param: One or more metrics to compute. Options are: * * | Metric | Name | Example | Unit | * | -------------- | ----------------------------------- | ------- | --------------------- | @@ -91,30 +214,22 @@ export interface BytimeGetParams { >; /** - * Start of time interval to query, defaults to `until` - 6 hours. Timestamp must - * be in RFC3339 format and uses UTC unless otherwise specified. + * Query param: */ since?: string; /** - * The sort order for the result set; sort fields must be included in `metrics` or - * `dimensions`. - */ - sort?: Array; - - /** - * Used to select time series resolution. + * Query param: The sort order for the result set; sort fields must be included in + * `metrics` or `dimensions`. */ - time_delta?: 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'dekaminute' | 'minute'; + sort?: Array; /** - * End of time interval to query, defaults to current time. Timestamp must be in - * RFC3339 format and uses UTC unless otherwise specified. + * Query param: */ until?: string; } -export namespace Bytimes { - export import BytimeGetResponse = BytimesAPI.BytimeGetResponse; - export import BytimeGetParams = BytimesAPI.BytimeGetParams; +export declare namespace Bytimes { + export { type BytimeGetResponse as BytimeGetResponse, type BytimeGetParams as BytimeGetParams }; } diff --git a/src/resources/spectrum/analytics/events/events.ts b/src/resources/spectrum/analytics/events/events.ts index ab7c699dc2..cf63853690 100644 --- a/src/resources/spectrum/analytics/events/events.ts +++ b/src/resources/spectrum/analytics/events/events.ts @@ -1,9 +1,10 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../resource'; -import * as EventsAPI from './events'; import * as BytimesAPI from './bytimes'; +import { BytimeGetParams, BytimeGetResponse, Bytimes } from './bytimes'; import * as SummariesAPI from './summaries'; +import { Summaries, SummaryGetParams, SummaryGetResponse } from './summaries'; export class Events extends APIResource { bytimes: BytimesAPI.Bytimes = new BytimesAPI.Bytimes(this._client); @@ -14,12 +15,21 @@ export type Dimension = 'event' | 'appID' | 'coloName' | 'ipVersion'; export type DimensionParam = 'event' | 'appID' | 'coloName' | 'ipVersion'; -export namespace Events { - export import Dimension = EventsAPI.Dimension; - export import Bytimes = BytimesAPI.Bytimes; - export import BytimeGetResponse = BytimesAPI.BytimeGetResponse; - export import BytimeGetParams = BytimesAPI.BytimeGetParams; - export import Summaries = SummariesAPI.Summaries; - export import SummaryGetResponse = SummariesAPI.SummaryGetResponse; - export import SummaryGetParams = SummariesAPI.SummaryGetParams; +Events.Bytimes = Bytimes; +Events.Summaries = Summaries; + +export declare namespace Events { + export { type Dimension as Dimension }; + + export { + Bytimes as Bytimes, + type BytimeGetResponse as BytimeGetResponse, + type BytimeGetParams as BytimeGetParams, + }; + + export { + Summaries as Summaries, + type SummaryGetResponse as SummaryGetResponse, + type SummaryGetParams as SummaryGetParams, + }; } diff --git a/src/resources/spectrum/analytics/events/index.ts b/src/resources/spectrum/analytics/events/index.ts index b78ac6e3de..6ba8f3d34b 100644 --- a/src/resources/spectrum/analytics/events/index.ts +++ b/src/resources/spectrum/analytics/events/index.ts @@ -1,5 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { BytimeGetResponse, BytimeGetParams, Bytimes } from './bytimes'; -export { Dimension, Events } from './events'; -export { SummaryGetResponse, SummaryGetParams, Summaries } from './summaries'; +export { Bytimes, type BytimeGetResponse, type BytimeGetParams } from './bytimes'; +export { Events, type Dimension } from './events'; +export { Summaries, type SummaryGetResponse, type SummaryGetParams } from './summaries'; diff --git a/src/resources/spectrum/analytics/events/summaries.ts b/src/resources/spectrum/analytics/events/summaries.ts index 5741729e79..d5268e679a 100644 --- a/src/resources/spectrum/analytics/events/summaries.ts +++ b/src/resources/spectrum/analytics/events/summaries.ts @@ -1,43 +1,160 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../resource'; -import { isRequestOptions } from '../../../../core'; import * as Core from '../../../../core'; -import * as SummariesAPI from './summaries'; import * as EventsAPI from './events'; export class Summaries extends APIResource { /** * Retrieves a list of summarised aggregate metrics over a given time period. */ - get( - zone: string, - query?: SummaryGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - get(zone: string, options?: Core.RequestOptions): Core.APIPromise; - get( - zone: string, - query: SummaryGetParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.get(zone, {}, query); - } + get(params: SummaryGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...query } = params; return ( - this._client.get(`/zones/${zone}/spectrum/analytics/events/summary`, { + this._client.get(`/zones/${zone_id}/spectrum/analytics/events/summary`, { query, ...options, - }) as Core.APIPromise<{ result: SummaryGetResponse | null }> + }) as Core.APIPromise<{ result: SummaryGetResponse }> )._thenUnwrap((obj) => obj.result); } } -export type SummaryGetResponse = unknown | string; +export interface SummaryGetResponse { + /** + * List of columns returned by the analytics query. + */ + data: Array; + + /** + * Number of seconds between current time and last processed event, i.e. how many + * seconds of data could be missing. + */ + data_lag: number; + + /** + * Maximum result for each selected metrics across all data. + */ + max: Record; + + /** + * Minimum result for each selected metrics across all data. + */ + min: Record; + + query: SummaryGetResponse.Query; + + /** + * Total number of rows in the result. + */ + rows: number; + + /** + * Total result for each selected metrics across all data. + */ + totals: Record; + + /** + * List of time interval buckets: [start, end] + */ + time_intervals?: Array>; +} + +export namespace SummaryGetResponse { + export interface Data { + dimensions?: Array; + + metrics?: Array | Array>; + } + + export interface Query { + /** + * Can be used to break down the data by given attributes. Options are: + * + * | Dimension | Name | Example | + * | --------- | ----------------------------- | ---------------------------------------------------------- | + * | event | Connection Event | connect, progress, disconnect, originError, clientFiltered | + * | appID | Application ID | 40d67c87c6cd4b889a4fd57805225e85 | + * | coloName | Colo Name | SFO | + * | ipVersion | IP version used by the client | 4, 6. | + */ + dimensions?: Array; + + /** + * Used to filter rows by one or more dimensions. Filters can be combined using OR + * and AND boolean logic. AND takes precedence over OR in all the expressions. The + * OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. + * The AND operator is defined using a semicolon (;) or AND keyword surrounded by + * whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) + * and needs to be percent-encoded as %3B. Comparison options are: + * + * | Operator | Name | URL Encoded | + * | -------- | ------------------------ | ----------- | + * | == | Equals | %3D%3D | + * | != | Does not equals | !%3D | + * | \> | Greater Than | %3E | + * | \< | Less Than | %3C | + * | \>= | Greater than or equal to | %3E%3D | + * | \<= | Less than or equal to | %3C%3D | + */ + filters?: string; + + /** + * Limit number of returned metrics. + */ + limit?: number; + + /** + * One or more metrics to compute. Options are: + * + * | Metric | Name | Example | Unit | + * | -------------- | ----------------------------------- | ------- | --------------------- | + * | count | Count of total events | 1000 | Count | + * | bytesIngress | Sum of ingress bytes | 1000 | Sum | + * | bytesEgress | Sum of egress bytes | 1000 | Sum | + * | durationAvg | Average connection duration | 1.0 | Time in milliseconds | + * | durationMedian | Median connection duration | 1.0 | Time in milliseconds | + * | duration90th | 90th percentile connection duration | 1.0 | Time in milliseconds | + * | duration99th | 99th percentile connection duration | 1.0 | Time in milliseconds. | + */ + metrics?: Array< + | 'count' + | 'bytesIngress' + | 'bytesEgress' + | 'durationAvg' + | 'durationMedian' + | 'duration90th' + | 'duration99th' + >; + + /** + * Start of time interval to query, defaults to `until` - 6 hours. Timestamp must + * be in RFC3339 format and uses UTC unless otherwise specified. + */ + since?: string; + + /** + * The sort order for the result set; sort fields must be included in `metrics` or + * `dimensions`. + */ + sort?: Array; + + /** + * End of time interval to query, defaults to current time. Timestamp must be in + * RFC3339 format and uses UTC unless otherwise specified. + */ + until?: string; + } +} export interface SummaryGetParams { /** - * Can be used to break down the data by given attributes. Options are: + * Path param: Identifier + */ + zone_id: string; + + /** + * Query param: Can be used to break down the data by given attributes. Options + * are: * * | Dimension | Name | Example | * | --------- | ----------------------------- | ---------------------------------------------------------- | @@ -49,26 +166,27 @@ export interface SummaryGetParams { dimensions?: Array; /** - * Used to filter rows by one or more dimensions. Filters can be combined using OR - * and AND boolean logic. AND takes precedence over OR in all the expressions. The - * OR operator is defined using a comma (,) or OR keyword surrounded by whitespace. - * The AND operator is defined using a semicolon (;) or AND keyword surrounded by - * whitespace. Note that the semicolon is a reserved character in URLs (rfc1738) - * and needs to be percent-encoded as %3B. Comparison options are: + * Query param: Used to filter rows by one or more dimensions. Filters can be + * combined using OR and AND boolean logic. AND takes precedence over OR in all the + * expressions. The OR operator is defined using a comma (,) or OR keyword + * surrounded by whitespace. The AND operator is defined using a semicolon (;) or + * AND keyword surrounded by whitespace. Note that the semicolon is a reserved + * character in URLs (rfc1738) and needs to be percent-encoded as %3B. Comparison + * options are: * * | Operator | Name | URL Encoded | * | -------- | ------------------------ | ----------- | * | == | Equals | %3D%3D | * | != | Does not equals | !%3D | - * | > | Greater Than | %3E | - * | < | Less Than | %3C | - * | >= | Greater than or equal to | %3E%3D | - * | <= | Less than or equal to | %3C%3D . | + * | \> | Greater Than | %3E | + * | \< | Less Than | %3C | + * | \>= | Greater than or equal to | %3E%3D | + * | \<= | Less than or equal to | %3C%3D | */ filters?: string; /** - * One or more metrics to compute. Options are: + * Query param: One or more metrics to compute. Options are: * * | Metric | Name | Example | Unit | * | -------------- | ----------------------------------- | ------- | --------------------- | @@ -91,25 +209,22 @@ export interface SummaryGetParams { >; /** - * Start of time interval to query, defaults to `until` - 6 hours. Timestamp must - * be in RFC3339 format and uses UTC unless otherwise specified. + * Query param: */ since?: string; /** - * The sort order for the result set; sort fields must be included in `metrics` or - * `dimensions`. + * Query param: The sort order for the result set; sort fields must be included in + * `metrics` or `dimensions`. */ - sort?: Array; + sort?: Array; /** - * End of time interval to query, defaults to current time. Timestamp must be in - * RFC3339 format and uses UTC unless otherwise specified. + * Query param: */ until?: string; } -export namespace Summaries { - export import SummaryGetResponse = SummariesAPI.SummaryGetResponse; - export import SummaryGetParams = SummariesAPI.SummaryGetParams; +export declare namespace Summaries { + export { type SummaryGetResponse as SummaryGetResponse, type SummaryGetParams as SummaryGetParams }; } diff --git a/src/resources/spectrum/analytics/index.ts b/src/resources/spectrum/analytics/index.ts index ead2c8761e..3aba748f04 100644 --- a/src/resources/spectrum/analytics/index.ts +++ b/src/resources/spectrum/analytics/index.ts @@ -2,4 +2,4 @@ export { Aggregates } from './aggregates/index'; export { Analytics } from './analytics'; -export { Dimension, Events } from './events/index'; +export { Events, type Dimension } from './events/index'; diff --git a/src/resources/spectrum/apps.ts b/src/resources/spectrum/apps.ts index bfb4e748aa..1347befe22 100644 --- a/src/resources/spectrum/apps.ts +++ b/src/resources/spectrum/apps.ts @@ -1,9 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; -import * as AppsAPI from './apps'; import * as SpectrumAPI from './spectrum'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; @@ -12,14 +10,11 @@ export class Apps extends APIResource { * Creates a new Spectrum application from a configuration using a name for the * origin. */ - create( - zone: string, - body: AppCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { + create(params: AppCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zone}/spectrum/apps`, { body, ...options }) as Core.APIPromise<{ - result: AppCreateResponse | null; + this._client.post(`/zones/${zone_id}/spectrum/apps`, { body, ...options }) as Core.APIPromise<{ + result: AppCreateResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -29,14 +24,14 @@ export class Apps extends APIResource { * the origin. */ update( - zone: string, appId: string, - body: AppUpdateParams, + params: AppUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { + const { zone_id, ...body } = params; return ( - this._client.put(`/zones/${zone}/spectrum/apps/${appId}`, { body, ...options }) as Core.APIPromise<{ - result: AppUpdateResponse | null; + this._client.put(`/zones/${zone_id}/spectrum/apps/${appId}`, { body, ...options }) as Core.APIPromise<{ + result: AppUpdateResponse; }> )._thenUnwrap((obj) => obj.result); } @@ -45,23 +40,11 @@ export class Apps extends APIResource { * Retrieves a list of currently existing Spectrum applications inside a zone. */ list( - zone: string, - query?: AppListParams, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zone: string, - options?: Core.RequestOptions, - ): Core.PagePromise; - list( - zone: string, - query: AppListParams | Core.RequestOptions = {}, + params: AppListParams, options?: Core.RequestOptions, ): Core.PagePromise { - if (isRequestOptions(query)) { - return this.list(zone, {}, query); - } - return this._client.getAPIList(`/zones/${zone}/spectrum/apps`, AppListResponsesV4PagePaginationArray, { + const { zone_id, ...query } = params; + return this._client.getAPIList(`/zones/${zone_id}/spectrum/apps`, AppListResponsesV4PagePaginationArray, { query, ...options, }); @@ -71,12 +54,13 @@ export class Apps extends APIResource { * Deletes a previously existing application. */ delete( - zone: string, appId: string, + params: AppDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { + const { zone_id } = params; return ( - this._client.delete(`/zones/${zone}/spectrum/apps/${appId}`, options) as Core.APIPromise<{ + this._client.delete(`/zones/${zone_id}/spectrum/apps/${appId}`, options) as Core.APIPromise<{ result: AppDeleteResponse | null; }> )._thenUnwrap((obj) => obj.result); @@ -85,9 +69,10 @@ export class Apps extends APIResource { /** * Gets the application configuration of a specific application inside a zone. */ - get(zone: string, appId: string, options?: Core.RequestOptions): Core.APIPromise { + get(appId: string, params: AppGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; return ( - this._client.get(`/zones/${zone}/spectrum/apps/${appId}`, options) as Core.APIPromise<{ + this._client.get(`/zones/${zone_id}/spectrum/apps/${appId}`, options) as Core.APIPromise<{ result: AppGetResponse; }> )._thenUnwrap((obj) => obj.result); @@ -96,331 +81,770 @@ export class Apps extends APIResource { export class AppListResponsesV4PagePaginationArray extends V4PagePaginationArray {} -export interface AppCreateResponse { - /** - * Application identifier. - */ - id?: string; - - /** - * Enables Argo Smart Routing for this application. Notes: Only available for TCP - * applications with traffic_type set to "direct". - */ - argo_smart_routing?: boolean; - - /** - * When the Application was created. - */ - created_on?: string; - - /** - * The name and type of DNS record for the Spectrum application. - */ - dns?: SpectrumAPI.DNS; - - /** - * The anycast edge IP configuration for the hostname of this application. - */ - edge_ips?: SpectrumAPI.EdgeIPs; - - /** - * Enables IP Access Rules for this application. Notes: Only available for TCP - * applications. - */ - ip_firewall?: boolean; - - /** - * When the Application was last modified. - */ - modified_on?: string; +export type AppCreateResponse = + | AppCreateResponse.SpectrumConfigAppConfig + | AppCreateResponse.SpectrumConfigPaygoAppConfig; + +export namespace AppCreateResponse { + export interface SpectrumConfigAppConfig { + /** + * App identifier. + */ + id: string; + + /** + * When the Application was created. + */ + created_on: string; + + /** + * The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNS; + + /** + * Enables IP Access Rules for this application. Notes: Only available for TCP + * applications. + */ + ip_firewall: boolean; + + /** + * When the Application was last modified. + */ + modified_on: string; + + /** + * The port configuration at Cloudflare's edge. May specify a single port, for + * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. + */ + protocol: string; + + /** + * Enables Proxy Protocol to the origin. Refer to + * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) + * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple + * Proxy Protocol. + */ + proxy_protocol: 'off' | 'v1' | 'v2' | 'simple'; + + /** + * The type of TLS termination associated with the application. + */ + tls: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Determines how data travels from the edge to your origin. When set to "direct", + * Spectrum will send traffic directly to your origin, and the application's type + * is derived from the `protocol`. When set to "http" or "https", Spectrum will + * apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and + * the application type matches this property exactly. + */ + traffic_type: 'direct' | 'http' | 'https'; + + /** + * Enables Argo Smart Routing for this application. Notes: Only available for TCP + * applications with traffic_type set to "direct". + */ + argo_smart_routing?: boolean; + + /** + * The anycast edge IP configuration for the hostname of this application. + */ + edge_ips?: SpectrumAPI.EdgeIPs; + + /** + * List of origin IP addresses. Array may contain multiple IP addresses for load + * balancing. + */ + origin_direct?: Array; + + /** + * The name and type of DNS record for the Spectrum application. + */ + origin_dns?: SpectrumAPI.OriginDNS; + + /** + * The destination port at the origin. Only specified in conjunction with + * origin_dns. May use an integer to specify a single origin port, for example + * `1000`, or a string to specify a range of origin ports, for example + * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the + * range must match the number of ports specified in the "protocol" field. + */ + origin_port?: SpectrumAPI.OriginPort; + } - /** - * The name and type of DNS record for the Spectrum application. - */ - origin_dns?: SpectrumAPI.OriginDNS; + export interface SpectrumConfigPaygoAppConfig { + /** + * Identifier + */ + id: string; - /** - * The destination port at the origin. Only specified in conjunction with - * origin_dns. May use an integer to specify a single origin port, for example - * `1000`, or a string to specify a range of origin ports, for example - * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the - * range must match the number of ports specified in the "protocol" field. - */ - origin_port?: SpectrumAPI.OriginPort; + created_on: string; - /** - * The port configuration at Cloudflare’s edge. May specify a single port, for - * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. - */ - protocol?: string; + /** + * The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNS; - /** - * Enables Proxy Protocol to the origin. Refer to - * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) - * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple - * Proxy Protocol. - */ - proxy_protocol?: 'off' | 'v1' | 'v2' | 'simple'; + modified_on: string; - /** - * The type of TLS termination associated with the application. - */ - tls?: 'off' | 'flexible' | 'full' | 'strict'; + /** + * The port configuration at Cloudflare's edge. May specify a single port, for + * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. + */ + protocol: string; - /** - * Determines how data travels from the edge to your origin. When set to "direct", - * Spectrum will send traffic directly to your origin, and the application's type - * is derived from the `protocol`. When set to "http" or "https", Spectrum will - * apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and - * the application type matches this property exactly. - */ - traffic_type?: 'direct' | 'http' | 'https'; + /** + * List of origin IP addresses. Array may contain multiple IP addresses for load + * balancing. + */ + origin_direct?: Array; + } } -export interface AppUpdateResponse { - /** - * Application identifier. - */ - id?: string; +export type AppUpdateResponse = + | AppUpdateResponse.SpectrumConfigAppConfig + | AppUpdateResponse.SpectrumConfigPaygoAppConfig; + +export namespace AppUpdateResponse { + export interface SpectrumConfigAppConfig { + /** + * App identifier. + */ + id: string; + + /** + * When the Application was created. + */ + created_on: string; + + /** + * The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNS; + + /** + * Enables IP Access Rules for this application. Notes: Only available for TCP + * applications. + */ + ip_firewall: boolean; + + /** + * When the Application was last modified. + */ + modified_on: string; + + /** + * The port configuration at Cloudflare's edge. May specify a single port, for + * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. + */ + protocol: string; + + /** + * Enables Proxy Protocol to the origin. Refer to + * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) + * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple + * Proxy Protocol. + */ + proxy_protocol: 'off' | 'v1' | 'v2' | 'simple'; + + /** + * The type of TLS termination associated with the application. + */ + tls: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Determines how data travels from the edge to your origin. When set to "direct", + * Spectrum will send traffic directly to your origin, and the application's type + * is derived from the `protocol`. When set to "http" or "https", Spectrum will + * apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and + * the application type matches this property exactly. + */ + traffic_type: 'direct' | 'http' | 'https'; + + /** + * Enables Argo Smart Routing for this application. Notes: Only available for TCP + * applications with traffic_type set to "direct". + */ + argo_smart_routing?: boolean; + + /** + * The anycast edge IP configuration for the hostname of this application. + */ + edge_ips?: SpectrumAPI.EdgeIPs; + + /** + * List of origin IP addresses. Array may contain multiple IP addresses for load + * balancing. + */ + origin_direct?: Array; + + /** + * The name and type of DNS record for the Spectrum application. + */ + origin_dns?: SpectrumAPI.OriginDNS; + + /** + * The destination port at the origin. Only specified in conjunction with + * origin_dns. May use an integer to specify a single origin port, for example + * `1000`, or a string to specify a range of origin ports, for example + * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the + * range must match the number of ports specified in the "protocol" field. + */ + origin_port?: SpectrumAPI.OriginPort; + } - /** - * Enables Argo Smart Routing for this application. Notes: Only available for TCP - * applications with traffic_type set to "direct". - */ - argo_smart_routing?: boolean; + export interface SpectrumConfigPaygoAppConfig { + /** + * Identifier + */ + id: string; - /** - * When the Application was created. - */ - created_on?: string; + created_on: string; - /** - * The name and type of DNS record for the Spectrum application. - */ - dns?: SpectrumAPI.DNS; + /** + * The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNS; - /** - * The anycast edge IP configuration for the hostname of this application. - */ - edge_ips?: SpectrumAPI.EdgeIPs; + modified_on: string; - /** - * Enables IP Access Rules for this application. Notes: Only available for TCP - * applications. - */ - ip_firewall?: boolean; + /** + * The port configuration at Cloudflare's edge. May specify a single port, for + * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. + */ + protocol: string; - /** - * When the Application was last modified. - */ - modified_on?: string; + /** + * List of origin IP addresses. Array may contain multiple IP addresses for load + * balancing. + */ + origin_direct?: Array; + } +} - /** - * The name and type of DNS record for the Spectrum application. - */ - origin_dns?: SpectrumAPI.OriginDNS; +export type AppListResponse = Array | Array; + +export namespace AppListResponse { + export interface UnionMember0 { + /** + * App identifier. + */ + id: string; + + /** + * When the Application was created. + */ + created_on: string; + + /** + * The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNS; + + /** + * Enables IP Access Rules for this application. Notes: Only available for TCP + * applications. + */ + ip_firewall: boolean; + + /** + * When the Application was last modified. + */ + modified_on: string; + + /** + * The port configuration at Cloudflare's edge. May specify a single port, for + * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. + */ + protocol: string; + + /** + * Enables Proxy Protocol to the origin. Refer to + * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) + * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple + * Proxy Protocol. + */ + proxy_protocol: 'off' | 'v1' | 'v2' | 'simple'; + + /** + * The type of TLS termination associated with the application. + */ + tls: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Determines how data travels from the edge to your origin. When set to "direct", + * Spectrum will send traffic directly to your origin, and the application's type + * is derived from the `protocol`. When set to "http" or "https", Spectrum will + * apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and + * the application type matches this property exactly. + */ + traffic_type: 'direct' | 'http' | 'https'; + + /** + * Enables Argo Smart Routing for this application. Notes: Only available for TCP + * applications with traffic_type set to "direct". + */ + argo_smart_routing?: boolean; + + /** + * The anycast edge IP configuration for the hostname of this application. + */ + edge_ips?: SpectrumAPI.EdgeIPs; + + /** + * List of origin IP addresses. Array may contain multiple IP addresses for load + * balancing. + */ + origin_direct?: Array; + + /** + * The name and type of DNS record for the Spectrum application. + */ + origin_dns?: SpectrumAPI.OriginDNS; + + /** + * The destination port at the origin. Only specified in conjunction with + * origin_dns. May use an integer to specify a single origin port, for example + * `1000`, or a string to specify a range of origin ports, for example + * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the + * range must match the number of ports specified in the "protocol" field. + */ + origin_port?: SpectrumAPI.OriginPort; + } - /** - * The destination port at the origin. Only specified in conjunction with - * origin_dns. May use an integer to specify a single origin port, for example - * `1000`, or a string to specify a range of origin ports, for example - * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the - * range must match the number of ports specified in the "protocol" field. - */ - origin_port?: SpectrumAPI.OriginPort; + export interface UnionMember1 { + /** + * Identifier + */ + id: string; - /** - * The port configuration at Cloudflare’s edge. May specify a single port, for - * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. - */ - protocol?: string; + created_on: string; - /** - * Enables Proxy Protocol to the origin. Refer to - * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) - * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple - * Proxy Protocol. - */ - proxy_protocol?: 'off' | 'v1' | 'v2' | 'simple'; + /** + * The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNS; - /** - * The type of TLS termination associated with the application. - */ - tls?: 'off' | 'flexible' | 'full' | 'strict'; + modified_on: string; - /** - * Determines how data travels from the edge to your origin. When set to "direct", - * Spectrum will send traffic directly to your origin, and the application's type - * is derived from the `protocol`. When set to "http" or "https", Spectrum will - * apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and - * the application type matches this property exactly. - */ - traffic_type?: 'direct' | 'http' | 'https'; -} + /** + * The port configuration at Cloudflare's edge. May specify a single port, for + * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. + */ + protocol: string; -export type AppListResponse = unknown; + /** + * List of origin IP addresses. Array may contain multiple IP addresses for load + * balancing. + */ + origin_direct?: Array; + } +} export interface AppDeleteResponse { /** - * Application identifier. + * Identifier */ - id?: string; + id: string; } -export type AppGetResponse = unknown | string | null; - -export interface AppCreateParams { - /** - * The name and type of DNS record for the Spectrum application. - */ - dns: SpectrumAPI.DNSParam; - - /** - * The name and type of DNS record for the Spectrum application. - */ - origin_dns: SpectrumAPI.OriginDNSParam; - - /** - * The destination port at the origin. Only specified in conjunction with - * origin_dns. May use an integer to specify a single origin port, for example - * `1000`, or a string to specify a range of origin ports, for example - * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the - * range must match the number of ports specified in the "protocol" field. - */ - origin_port: SpectrumAPI.OriginPortParam; - - /** - * The port configuration at Cloudflare’s edge. May specify a single port, for - * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. - */ - protocol: string; +export type AppGetResponse = + | AppGetResponse.SpectrumConfigAppConfig + | AppGetResponse.SpectrumConfigPaygoAppConfig; + +export namespace AppGetResponse { + export interface SpectrumConfigAppConfig { + /** + * App identifier. + */ + id: string; + + /** + * When the Application was created. + */ + created_on: string; + + /** + * The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNS; + + /** + * Enables IP Access Rules for this application. Notes: Only available for TCP + * applications. + */ + ip_firewall: boolean; + + /** + * When the Application was last modified. + */ + modified_on: string; + + /** + * The port configuration at Cloudflare's edge. May specify a single port, for + * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. + */ + protocol: string; + + /** + * Enables Proxy Protocol to the origin. Refer to + * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) + * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple + * Proxy Protocol. + */ + proxy_protocol: 'off' | 'v1' | 'v2' | 'simple'; + + /** + * The type of TLS termination associated with the application. + */ + tls: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Determines how data travels from the edge to your origin. When set to "direct", + * Spectrum will send traffic directly to your origin, and the application's type + * is derived from the `protocol`. When set to "http" or "https", Spectrum will + * apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and + * the application type matches this property exactly. + */ + traffic_type: 'direct' | 'http' | 'https'; + + /** + * Enables Argo Smart Routing for this application. Notes: Only available for TCP + * applications with traffic_type set to "direct". + */ + argo_smart_routing?: boolean; + + /** + * The anycast edge IP configuration for the hostname of this application. + */ + edge_ips?: SpectrumAPI.EdgeIPs; + + /** + * List of origin IP addresses. Array may contain multiple IP addresses for load + * balancing. + */ + origin_direct?: Array; + + /** + * The name and type of DNS record for the Spectrum application. + */ + origin_dns?: SpectrumAPI.OriginDNS; + + /** + * The destination port at the origin. Only specified in conjunction with + * origin_dns. May use an integer to specify a single origin port, for example + * `1000`, or a string to specify a range of origin ports, for example + * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the + * range must match the number of ports specified in the "protocol" field. + */ + origin_port?: SpectrumAPI.OriginPort; + } - /** - * Enables Argo Smart Routing for this application. Notes: Only available for TCP - * applications with traffic_type set to "direct". - */ - argo_smart_routing?: boolean; + export interface SpectrumConfigPaygoAppConfig { + /** + * Identifier + */ + id: string; - /** - * The anycast edge IP configuration for the hostname of this application. - */ - edge_ips?: SpectrumAPI.EdgeIPsParam; + created_on: string; - /** - * Enables IP Access Rules for this application. Notes: Only available for TCP - * applications. - */ - ip_firewall?: boolean; + /** + * The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNS; - /** - * Enables Proxy Protocol to the origin. Refer to - * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) - * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple - * Proxy Protocol. - */ - proxy_protocol?: 'off' | 'v1' | 'v2' | 'simple'; + modified_on: string; - /** - * The type of TLS termination associated with the application. - */ - tls?: 'off' | 'flexible' | 'full' | 'strict'; + /** + * The port configuration at Cloudflare's edge. May specify a single port, for + * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. + */ + protocol: string; - /** - * Determines how data travels from the edge to your origin. When set to "direct", - * Spectrum will send traffic directly to your origin, and the application's type - * is derived from the `protocol`. When set to "http" or "https", Spectrum will - * apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and - * the application type matches this property exactly. - */ - traffic_type?: 'direct' | 'http' | 'https'; + /** + * List of origin IP addresses. Array may contain multiple IP addresses for load + * balancing. + */ + origin_direct?: Array; + } } -export interface AppUpdateParams { - /** - * The name and type of DNS record for the Spectrum application. - */ - dns: SpectrumAPI.DNSParam; - - /** - * The name and type of DNS record for the Spectrum application. - */ - origin_dns: SpectrumAPI.OriginDNSParam; - - /** - * The destination port at the origin. Only specified in conjunction with - * origin_dns. May use an integer to specify a single origin port, for example - * `1000`, or a string to specify a range of origin ports, for example - * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the - * range must match the number of ports specified in the "protocol" field. - */ - origin_port: SpectrumAPI.OriginPortParam; - - /** - * The port configuration at Cloudflare’s edge. May specify a single port, for - * example `"tcp/1000"`, or a range of ports, for example `"tcp/1000-2000"`. - */ - protocol: string; +export type AppCreateParams = + | AppCreateParams.SpectrumConfigAppConfig + | AppCreateParams.SpectrumConfigPaygoAppConfig; + +export declare namespace AppCreateParams { + export interface SpectrumConfigAppConfig { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNSParam; + + /** + * Body param: Enables IP Access Rules for this application. Notes: Only available + * for TCP applications. + */ + ip_firewall: boolean; + + /** + * Body param: The port configuration at Cloudflare's edge. May specify a single + * port, for example `"tcp/1000"`, or a range of ports, for example + * `"tcp/1000-2000"`. + */ + protocol: string; + + /** + * Body param: Enables Proxy Protocol to the origin. Refer to + * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) + * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple + * Proxy Protocol. + */ + proxy_protocol: 'off' | 'v1' | 'v2' | 'simple'; + + /** + * Body param: The type of TLS termination associated with the application. + */ + tls: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Body param: Determines how data travels from the edge to your origin. When set + * to "direct", Spectrum will send traffic directly to your origin, and the + * application's type is derived from the `protocol`. When set to "http" or + * "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends + * traffic to your origin, and the application type matches this property exactly. + */ + traffic_type: 'direct' | 'http' | 'https'; + + /** + * Body param: Enables Argo Smart Routing for this application. Notes: Only + * available for TCP applications with traffic_type set to "direct". + */ + argo_smart_routing?: boolean; + + /** + * Body param: The anycast edge IP configuration for the hostname of this + * application. + */ + edge_ips?: SpectrumAPI.EdgeIPsParam; + + /** + * Body param: List of origin IP addresses. Array may contain multiple IP addresses + * for load balancing. + */ + origin_direct?: Array; + + /** + * Body param: The name and type of DNS record for the Spectrum application. + */ + origin_dns?: SpectrumAPI.OriginDNSParam; + + /** + * Body param: The destination port at the origin. Only specified in conjunction + * with origin_dns. May use an integer to specify a single origin port, for example + * `1000`, or a string to specify a range of origin ports, for example + * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the + * range must match the number of ports specified in the "protocol" field. + */ + origin_port?: SpectrumAPI.OriginPortParam; + } - /** - * Enables Argo Smart Routing for this application. Notes: Only available for TCP - * applications with traffic_type set to "direct". - */ - argo_smart_routing?: boolean; + export interface SpectrumConfigPaygoAppConfig { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Identifier + */ + id: string; + + /** + * Body param: The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNSParam; + + /** + * Body param: The port configuration at Cloudflare's edge. May specify a single + * port, for example `"tcp/1000"`, or a range of ports, for example + * `"tcp/1000-2000"`. + */ + protocol: string; + + /** + * Body param: List of origin IP addresses. Array may contain multiple IP addresses + * for load balancing. + */ + origin_direct?: Array; + } +} - /** - * The anycast edge IP configuration for the hostname of this application. - */ - edge_ips?: SpectrumAPI.EdgeIPsParam; +export type AppUpdateParams = + | AppUpdateParams.SpectrumConfigAppConfig + | AppUpdateParams.SpectrumConfigPaygoAppConfig; + +export declare namespace AppUpdateParams { + export interface SpectrumConfigAppConfig { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNSParam; + + /** + * Body param: Enables IP Access Rules for this application. Notes: Only available + * for TCP applications. + */ + ip_firewall: boolean; + + /** + * Body param: The port configuration at Cloudflare's edge. May specify a single + * port, for example `"tcp/1000"`, or a range of ports, for example + * `"tcp/1000-2000"`. + */ + protocol: string; + + /** + * Body param: Enables Proxy Protocol to the origin. Refer to + * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) + * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple + * Proxy Protocol. + */ + proxy_protocol: 'off' | 'v1' | 'v2' | 'simple'; + + /** + * Body param: The type of TLS termination associated with the application. + */ + tls: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Body param: Determines how data travels from the edge to your origin. When set + * to "direct", Spectrum will send traffic directly to your origin, and the + * application's type is derived from the `protocol`. When set to "http" or + * "https", Spectrum will apply Cloudflare's HTTP/HTTPS features as it sends + * traffic to your origin, and the application type matches this property exactly. + */ + traffic_type: 'direct' | 'http' | 'https'; + + /** + * Body param: Enables Argo Smart Routing for this application. Notes: Only + * available for TCP applications with traffic_type set to "direct". + */ + argo_smart_routing?: boolean; + + /** + * Body param: The anycast edge IP configuration for the hostname of this + * application. + */ + edge_ips?: SpectrumAPI.EdgeIPsParam; + + /** + * Body param: List of origin IP addresses. Array may contain multiple IP addresses + * for load balancing. + */ + origin_direct?: Array; + + /** + * Body param: The name and type of DNS record for the Spectrum application. + */ + origin_dns?: SpectrumAPI.OriginDNSParam; + + /** + * Body param: The destination port at the origin. Only specified in conjunction + * with origin_dns. May use an integer to specify a single origin port, for example + * `1000`, or a string to specify a range of origin ports, for example + * `"1000-2000"`. Notes: If specifying a port range, the number of ports in the + * range must match the number of ports specified in the "protocol" field. + */ + origin_port?: SpectrumAPI.OriginPortParam; + } - /** - * Enables IP Access Rules for this application. Notes: Only available for TCP - * applications. - */ - ip_firewall?: boolean; + export interface SpectrumConfigPaygoAppConfig { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Identifier + */ + id: string; + + /** + * Body param: The name and type of DNS record for the Spectrum application. + */ + dns: SpectrumAPI.DNSParam; + + /** + * Body param: The port configuration at Cloudflare's edge. May specify a single + * port, for example `"tcp/1000"`, or a range of ports, for example + * `"tcp/1000-2000"`. + */ + protocol: string; + + /** + * Body param: List of origin IP addresses. Array may contain multiple IP addresses + * for load balancing. + */ + origin_direct?: Array; + } +} +export interface AppListParams extends V4PagePaginationArrayParams { /** - * Enables Proxy Protocol to the origin. Refer to - * [Enable Proxy protocol](https://developers.cloudflare.com/spectrum/getting-started/proxy-protocol/) - * for implementation details on PROXY Protocol V1, PROXY Protocol V2, and Simple - * Proxy Protocol. + * Path param: Identifier */ - proxy_protocol?: 'off' | 'v1' | 'v2' | 'simple'; + zone_id: string; /** - * The type of TLS termination associated with the application. + * Query param: Sets the direction by which results are ordered. */ - tls?: 'off' | 'flexible' | 'full' | 'strict'; + direction?: 'asc' | 'desc'; /** - * Determines how data travels from the edge to your origin. When set to "direct", - * Spectrum will send traffic directly to your origin, and the application's type - * is derived from the `protocol`. When set to "http" or "https", Spectrum will - * apply Cloudflare's HTTP/HTTPS features as it sends traffic to your origin, and - * the application type matches this property exactly. + * Query param: Application field by which results are ordered. */ - traffic_type?: 'direct' | 'http' | 'https'; + order?: 'protocol' | 'app_id' | 'created_on' | 'modified_on' | 'dns'; } -export interface AppListParams extends V4PagePaginationArrayParams { +export interface AppDeleteParams { /** - * Sets the direction by which results are ordered. + * Identifier */ - direction?: 'asc' | 'desc'; + zone_id: string; +} +export interface AppGetParams { /** - * Application field by which results are ordered. + * Identifier */ - order?: 'protocol' | 'app_id' | 'created_on' | 'modified_on' | 'dns'; + zone_id: string; } -export namespace Apps { - export import AppCreateResponse = AppsAPI.AppCreateResponse; - export import AppUpdateResponse = AppsAPI.AppUpdateResponse; - export import AppListResponse = AppsAPI.AppListResponse; - export import AppDeleteResponse = AppsAPI.AppDeleteResponse; - export import AppGetResponse = AppsAPI.AppGetResponse; - export import AppListResponsesV4PagePaginationArray = AppsAPI.AppListResponsesV4PagePaginationArray; - export import AppCreateParams = AppsAPI.AppCreateParams; - export import AppUpdateParams = AppsAPI.AppUpdateParams; - export import AppListParams = AppsAPI.AppListParams; +Apps.AppListResponsesV4PagePaginationArray = AppListResponsesV4PagePaginationArray; + +export declare namespace Apps { + export { + type AppCreateResponse as AppCreateResponse, + type AppUpdateResponse as AppUpdateResponse, + type AppListResponse as AppListResponse, + type AppDeleteResponse as AppDeleteResponse, + type AppGetResponse as AppGetResponse, + AppListResponsesV4PagePaginationArray as AppListResponsesV4PagePaginationArray, + type AppCreateParams as AppCreateParams, + type AppUpdateParams as AppUpdateParams, + type AppListParams as AppListParams, + type AppDeleteParams as AppDeleteParams, + type AppGetParams as AppGetParams, + }; } diff --git a/src/resources/spectrum/index.ts b/src/resources/spectrum/index.ts index 92a4dd4bea..ed182f1520 100644 --- a/src/resources/spectrum/index.ts +++ b/src/resources/spectrum/index.ts @@ -2,15 +2,17 @@ export { Analytics } from './analytics/index'; export { - AppCreateResponse, - AppUpdateResponse, - AppListResponse, - AppDeleteResponse, - AppGetResponse, - AppCreateParams, - AppUpdateParams, - AppListParams, AppListResponsesV4PagePaginationArray, Apps, + type AppCreateResponse, + type AppUpdateResponse, + type AppListResponse, + type AppDeleteResponse, + type AppGetResponse, + type AppCreateParams, + type AppUpdateParams, + type AppListParams, + type AppDeleteParams, + type AppGetParams, } from './apps'; export { Spectrum } from './spectrum'; diff --git a/src/resources/spectrum/spectrum.ts b/src/resources/spectrum/spectrum.ts index 27b0055b81..ebf735cf81 100644 --- a/src/resources/spectrum/spectrum.ts +++ b/src/resources/spectrum/spectrum.ts @@ -2,7 +2,22 @@ import { APIResource } from '../../resource'; import * as AppsAPI from './apps'; +import { + AppCreateParams, + AppCreateResponse, + AppDeleteParams, + AppDeleteResponse, + AppGetParams, + AppGetResponse, + AppListParams, + AppListResponse, + AppListResponsesV4PagePaginationArray, + AppUpdateParams, + AppUpdateResponse, + Apps, +} from './apps'; import * as AnalyticsAPI from './analytics/analytics'; +import { Analytics } from './analytics/analytics'; export class Spectrum extends APIResource { analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client); @@ -42,10 +57,10 @@ export interface DNSParam { /** * The anycast edge IP configuration for the hostname of this application. */ -export type EdgeIPs = EdgeIPs.EyeballIPs | EdgeIPs.CustomerOwnedIPs; +export type EdgeIPs = EdgeIPs.UnionMember0 | EdgeIPs.UnionMember1; export namespace EdgeIPs { - export interface EyeballIPs { + export interface UnionMember0 { /** * The IP versions supported for inbound connections on Spectrum anycast IPs. */ @@ -59,7 +74,7 @@ export namespace EdgeIPs { type?: 'dynamic'; } - export interface CustomerOwnedIPs { + export interface UnionMember1 { /** * The array of customer owned IPs we broadcast via anycast for this hostname and * application. @@ -78,10 +93,10 @@ export namespace EdgeIPs { /** * The anycast edge IP configuration for the hostname of this application. */ -export type EdgeIPsParam = EdgeIPsParam.EyeballIPs | EdgeIPsParam.CustomerOwnedIPs; +export type EdgeIPsParam = EdgeIPsParam.UnionMember0 | EdgeIPsParam.UnionMember1; export namespace EdgeIPsParam { - export interface EyeballIPs { + export interface UnionMember0 { /** * The IP versions supported for inbound connections on Spectrum anycast IPs. */ @@ -95,7 +110,7 @@ export namespace EdgeIPsParam { type?: 'dynamic'; } - export interface CustomerOwnedIPs { + export interface UnionMember1 { /** * The array of customer owned IPs we broadcast via anycast for this hostname and * application. @@ -171,16 +186,25 @@ export type OriginPort = number | string; */ export type OriginPortParam = number | string; -export namespace Spectrum { - export import Analytics = AnalyticsAPI.Analytics; - export import Apps = AppsAPI.Apps; - export import AppCreateResponse = AppsAPI.AppCreateResponse; - export import AppUpdateResponse = AppsAPI.AppUpdateResponse; - export import AppListResponse = AppsAPI.AppListResponse; - export import AppDeleteResponse = AppsAPI.AppDeleteResponse; - export import AppGetResponse = AppsAPI.AppGetResponse; - export import AppListResponsesV4PagePaginationArray = AppsAPI.AppListResponsesV4PagePaginationArray; - export import AppCreateParams = AppsAPI.AppCreateParams; - export import AppUpdateParams = AppsAPI.AppUpdateParams; - export import AppListParams = AppsAPI.AppListParams; +Spectrum.Analytics = Analytics; +Spectrum.Apps = Apps; +Spectrum.AppListResponsesV4PagePaginationArray = AppListResponsesV4PagePaginationArray; + +export declare namespace Spectrum { + export { Analytics as Analytics }; + + export { + Apps as Apps, + type AppCreateResponse as AppCreateResponse, + type AppUpdateResponse as AppUpdateResponse, + type AppListResponse as AppListResponse, + type AppDeleteResponse as AppDeleteResponse, + type AppGetResponse as AppGetResponse, + AppListResponsesV4PagePaginationArray as AppListResponsesV4PagePaginationArray, + type AppCreateParams as AppCreateParams, + type AppUpdateParams as AppUpdateParams, + type AppListParams as AppListParams, + type AppDeleteParams as AppDeleteParams, + type AppGetParams as AppGetParams, + }; } diff --git a/src/resources/speed/availabilities.ts b/src/resources/speed/availabilities.ts index e74cc85c97..a756466e00 100644 --- a/src/resources/speed/availabilities.ts +++ b/src/resources/speed/availabilities.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as AvailabilitiesAPI from './availabilities'; import * as SpeedAPI from './speed'; export class Availabilities extends APIResource { @@ -24,7 +23,10 @@ export interface Availability { regions?: Array; - regionsPerPlan?: unknown; + /** + * Available regions. + */ + regionsPerPlan?: Availability.RegionsPerPlan; } export namespace Availability { @@ -37,7 +39,7 @@ export namespace Availability { /** * The number of tests available per plan. */ - quotasPerPlan?: Record; + quotasPerPlan?: Quota.QuotasPerPlan; /** * The number of remaining schedules available. @@ -52,7 +54,72 @@ export namespace Availability { /** * The number of schedules available per plan. */ - scheduleQuotasPerPlan?: Record; + scheduleQuotasPerPlan?: Quota.ScheduleQuotasPerPlan; + } + + export namespace Quota { + /** + * The number of tests available per plan. + */ + export interface QuotasPerPlan { + /** + * Counts per account plan. + */ + value?: QuotasPerPlan.Value; + } + + export namespace QuotasPerPlan { + /** + * Counts per account plan. + */ + export interface Value { + business?: number; + + enterprise?: number; + + free?: number; + + pro?: number; + } + } + + /** + * The number of schedules available per plan. + */ + export interface ScheduleQuotasPerPlan { + /** + * Counts per account plan. + */ + value?: ScheduleQuotasPerPlan.Value; + } + + export namespace ScheduleQuotasPerPlan { + /** + * Counts per account plan. + */ + export interface Value { + business?: number; + + enterprise?: number; + + free?: number; + + pro?: number; + } + } + } + + /** + * Available regions. + */ + export interface RegionsPerPlan { + business?: Array; + + enterprise?: Array; + + free?: Array; + + pro?: Array; } } @@ -63,7 +130,6 @@ export interface AvailabilityListParams { zone_id: string; } -export namespace Availabilities { - export import Availability = AvailabilitiesAPI.Availability; - export import AvailabilityListParams = AvailabilitiesAPI.AvailabilityListParams; +export declare namespace Availabilities { + export { type Availability as Availability, type AvailabilityListParams as AvailabilityListParams }; } diff --git a/src/resources/speed/index.ts b/src/resources/speed/index.ts index 8ec4511be4..d0fdfe4e77 100644 --- a/src/resources/speed/index.ts +++ b/src/resources/speed/index.ts @@ -1,20 +1,20 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Availability, AvailabilityListParams, Availabilities } from './availabilities'; +export { Availabilities, type Availability, type AvailabilityListParams } from './availabilities'; export { - PageListResponse, - PageListParams, - PageTrendParams, PageListResponsesSinglePage, Pages, + type PageListResponse, + type PageListParams, + type PageTrendParams, } from './pages/index'; export { - Schedule, - ScheduleCreateResponse, - ScheduleDeleteResponse, - ScheduleCreateParams, - ScheduleDeleteParams, - ScheduleGetParams, ScheduleResource, + type Schedule, + type ScheduleCreateResponse, + type ScheduleDeleteResponse, + type ScheduleCreateParams, + type ScheduleDeleteParams, + type ScheduleGetParams, } from './schedule'; export { Speed } from './speed'; diff --git a/src/resources/speed/pages/index.ts b/src/resources/speed/pages/index.ts index 670d3863fe..2b68fb9b92 100644 --- a/src/resources/speed/pages/index.ts +++ b/src/resources/speed/pages/index.ts @@ -1,19 +1,19 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - PageListResponse, - PageListParams, - PageTrendParams, PageListResponsesSinglePage, Pages, + type PageListResponse, + type PageListParams, + type PageTrendParams, } from './pages'; export { - Test, - TestListResponse, - TestDeleteResponse, - TestCreateParams, - TestListParams, - TestDeleteParams, - TestGetParams, + TestsV4PagePaginationArray, Tests, + type Test, + type TestDeleteResponse, + type TestCreateParams, + type TestListParams, + type TestDeleteParams, + type TestGetParams, } from './tests'; diff --git a/src/resources/speed/pages/pages.ts b/src/resources/speed/pages/pages.ts index 218cf99607..35c4684dba 100644 --- a/src/resources/speed/pages/pages.ts +++ b/src/resources/speed/pages/pages.ts @@ -2,9 +2,18 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as PagesAPI from './pages'; import * as SpeedAPI from '../speed'; import * as TestsAPI from './tests'; +import { + Test, + TestCreateParams, + TestDeleteParams, + TestDeleteResponse, + TestGetParams, + TestListParams, + Tests, + TestsV4PagePaginationArray, +} from './tests'; import { SinglePage } from '../../../pagination'; export class Pages extends APIResource { @@ -125,17 +134,26 @@ export interface PageTrendParams { end?: string; } -export namespace Pages { - export import PageListResponse = PagesAPI.PageListResponse; - export import PageListResponsesSinglePage = PagesAPI.PageListResponsesSinglePage; - export import PageListParams = PagesAPI.PageListParams; - export import PageTrendParams = PagesAPI.PageTrendParams; - export import Tests = TestsAPI.Tests; - export import Test = TestsAPI.Test; - export import TestListResponse = TestsAPI.TestListResponse; - export import TestDeleteResponse = TestsAPI.TestDeleteResponse; - export import TestCreateParams = TestsAPI.TestCreateParams; - export import TestListParams = TestsAPI.TestListParams; - export import TestDeleteParams = TestsAPI.TestDeleteParams; - export import TestGetParams = TestsAPI.TestGetParams; +Pages.PageListResponsesSinglePage = PageListResponsesSinglePage; +Pages.Tests = Tests; +Pages.TestsV4PagePaginationArray = TestsV4PagePaginationArray; + +export declare namespace Pages { + export { + type PageListResponse as PageListResponse, + PageListResponsesSinglePage as PageListResponsesSinglePage, + type PageListParams as PageListParams, + type PageTrendParams as PageTrendParams, + }; + + export { + Tests as Tests, + type Test as Test, + type TestDeleteResponse as TestDeleteResponse, + TestsV4PagePaginationArray as TestsV4PagePaginationArray, + type TestCreateParams as TestCreateParams, + type TestListParams as TestListParams, + type TestDeleteParams as TestDeleteParams, + type TestGetParams as TestGetParams, + }; } diff --git a/src/resources/speed/pages/tests.ts b/src/resources/speed/pages/tests.ts index fe4fe4708e..2dcbfca15e 100644 --- a/src/resources/speed/pages/tests.ts +++ b/src/resources/speed/pages/tests.ts @@ -2,9 +2,8 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as TestsAPI from './tests'; -import * as Shared from '../../shared'; import * as SpeedAPI from '../speed'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; export class Tests extends APIResource { /** @@ -27,9 +26,13 @@ export class Tests extends APIResource { url: string, params: TestListParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.PagePromise { const { zone_id, ...query } = params; - return this._client.get(`/zones/${zone_id}/speed_api/pages/${url}/tests`, { query, ...options }); + return this._client.getAPIList( + `/zones/${zone_id}/speed_api/pages/${url}/tests`, + TestsV4PagePaginationArray, + { query, ...options }, + ); } /** @@ -69,6 +72,8 @@ export class Tests extends APIResource { } } +export class TestsV4PagePaginationArray extends V4PagePaginationArray {} + export interface Test { /** * UUID @@ -103,31 +108,6 @@ export interface Test { url?: string; } -export interface TestListResponse { - errors: Array; - - messages: Array; - - /** - * Whether the API call was successful. - */ - success: boolean; - - result_info?: TestListResponse.ResultInfo; -} - -export namespace TestListResponse { - export interface ResultInfo { - count?: number; - - page?: number; - - per_page?: number; - - total_count?: number; - } -} - export interface TestDeleteResponse { /** * Number of items affected. @@ -168,22 +148,12 @@ export interface TestCreateParams { | 'us-west1'; } -export interface TestListParams { +export interface TestListParams extends V4PagePaginationArrayParams { /** * Path param: Identifier */ zone_id: string; - /** - * Query param: - */ - page?: number; - - /** - * Query param: - */ - per_page?: number; - /** * Query param: A test region. */ @@ -251,12 +221,16 @@ export interface TestGetParams { zone_id: string; } -export namespace Tests { - export import Test = TestsAPI.Test; - export import TestListResponse = TestsAPI.TestListResponse; - export import TestDeleteResponse = TestsAPI.TestDeleteResponse; - export import TestCreateParams = TestsAPI.TestCreateParams; - export import TestListParams = TestsAPI.TestListParams; - export import TestDeleteParams = TestsAPI.TestDeleteParams; - export import TestGetParams = TestsAPI.TestGetParams; +Tests.TestsV4PagePaginationArray = TestsV4PagePaginationArray; + +export declare namespace Tests { + export { + type Test as Test, + type TestDeleteResponse as TestDeleteResponse, + TestsV4PagePaginationArray as TestsV4PagePaginationArray, + type TestCreateParams as TestCreateParams, + type TestListParams as TestListParams, + type TestDeleteParams as TestDeleteParams, + type TestGetParams as TestGetParams, + }; } diff --git a/src/resources/speed/schedule.ts b/src/resources/speed/schedule.ts index 49de866f2b..55aba278ad 100644 --- a/src/resources/speed/schedule.ts +++ b/src/resources/speed/schedule.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as ScheduleAPI from './schedule'; import * as TestsAPI from './pages/tests'; export class ScheduleResource extends APIResource { @@ -210,11 +209,13 @@ export interface ScheduleGetParams { | 'us-west1'; } -export namespace ScheduleResource { - export import Schedule = ScheduleAPI.Schedule; - export import ScheduleCreateResponse = ScheduleAPI.ScheduleCreateResponse; - export import ScheduleDeleteResponse = ScheduleAPI.ScheduleDeleteResponse; - export import ScheduleCreateParams = ScheduleAPI.ScheduleCreateParams; - export import ScheduleDeleteParams = ScheduleAPI.ScheduleDeleteParams; - export import ScheduleGetParams = ScheduleAPI.ScheduleGetParams; +export declare namespace ScheduleResource { + export { + type Schedule as Schedule, + type ScheduleCreateResponse as ScheduleCreateResponse, + type ScheduleDeleteResponse as ScheduleDeleteResponse, + type ScheduleCreateParams as ScheduleCreateParams, + type ScheduleDeleteParams as ScheduleDeleteParams, + type ScheduleGetParams as ScheduleGetParams, + }; } diff --git a/src/resources/speed/speed.ts b/src/resources/speed/speed.ts index a4c930f26e..15067dd816 100644 --- a/src/resources/speed/speed.ts +++ b/src/resources/speed/speed.ts @@ -2,8 +2,25 @@ import { APIResource } from '../../resource'; import * as AvailabilitiesAPI from './availabilities'; +import { Availabilities, Availability, AvailabilityListParams } from './availabilities'; import * as ScheduleAPI from './schedule'; +import { + Schedule, + ScheduleCreateParams, + ScheduleCreateResponse, + ScheduleDeleteParams, + ScheduleDeleteResponse, + ScheduleGetParams, + ScheduleResource, +} from './schedule'; import * as PagesAPI from './pages/pages'; +import { + PageListParams, + PageListResponse, + PageListResponsesSinglePage, + PageTrendParams, + Pages, +} from './pages/pages'; export class Speed extends APIResource { schedule: ScheduleAPI.ScheduleResource = new ScheduleAPI.ScheduleResource(this._client); @@ -167,20 +184,33 @@ export interface Trend { tti?: Array; } -export namespace Speed { - export import ScheduleResource = ScheduleAPI.ScheduleResource; - export import Schedule = ScheduleAPI.Schedule; - export import ScheduleCreateResponse = ScheduleAPI.ScheduleCreateResponse; - export import ScheduleDeleteResponse = ScheduleAPI.ScheduleDeleteResponse; - export import ScheduleCreateParams = ScheduleAPI.ScheduleCreateParams; - export import ScheduleDeleteParams = ScheduleAPI.ScheduleDeleteParams; - export import ScheduleGetParams = ScheduleAPI.ScheduleGetParams; - export import Availabilities = AvailabilitiesAPI.Availabilities; - export import Availability = AvailabilitiesAPI.Availability; - export import AvailabilityListParams = AvailabilitiesAPI.AvailabilityListParams; - export import Pages = PagesAPI.Pages; - export import PageListResponse = PagesAPI.PageListResponse; - export import PageListResponsesSinglePage = PagesAPI.PageListResponsesSinglePage; - export import PageListParams = PagesAPI.PageListParams; - export import PageTrendParams = PagesAPI.PageTrendParams; +Speed.ScheduleResource = ScheduleResource; +Speed.Availabilities = Availabilities; +Speed.Pages = Pages; +Speed.PageListResponsesSinglePage = PageListResponsesSinglePage; + +export declare namespace Speed { + export { + ScheduleResource as ScheduleResource, + type Schedule as Schedule, + type ScheduleCreateResponse as ScheduleCreateResponse, + type ScheduleDeleteResponse as ScheduleDeleteResponse, + type ScheduleCreateParams as ScheduleCreateParams, + type ScheduleDeleteParams as ScheduleDeleteParams, + type ScheduleGetParams as ScheduleGetParams, + }; + + export { + Availabilities as Availabilities, + type Availability as Availability, + type AvailabilityListParams as AvailabilityListParams, + }; + + export { + Pages as Pages, + type PageListResponse as PageListResponse, + PageListResponsesSinglePage as PageListResponsesSinglePage, + type PageListParams as PageListParams, + type PageTrendParams as PageTrendParams, + }; } diff --git a/src/resources/ssl/analyze.ts b/src/resources/ssl/analyze.ts index 6028577546..fe1ab850e1 100644 --- a/src/resources/ssl/analyze.ts +++ b/src/resources/ssl/analyze.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as AnalyzeAPI from './analyze'; import * as CustomHostnamesAPI from '../custom-hostnames/custom-hostnames'; export class Analyze extends APIResource { @@ -20,7 +19,7 @@ export class Analyze extends APIResource { } } -export type AnalyzeCreateResponse = unknown | string | null; +export type AnalyzeCreateResponse = unknown; export interface AnalyzeCreateParams { /** @@ -42,7 +41,9 @@ export interface AnalyzeCreateParams { certificate?: string; } -export namespace Analyze { - export import AnalyzeCreateResponse = AnalyzeAPI.AnalyzeCreateResponse; - export import AnalyzeCreateParams = AnalyzeAPI.AnalyzeCreateParams; +export declare namespace Analyze { + export { + type AnalyzeCreateResponse as AnalyzeCreateResponse, + type AnalyzeCreateParams as AnalyzeCreateParams, + }; } diff --git a/src/resources/ssl/certificate-packs/certificate-packs.ts b/src/resources/ssl/certificate-packs/certificate-packs.ts index 5fde94b931..58c94ba795 100644 --- a/src/resources/ssl/certificate-packs/certificate-packs.ts +++ b/src/resources/ssl/certificate-packs/certificate-packs.ts @@ -2,15 +2,29 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as CertificatePacksAPI from './certificate-packs'; -import * as OrderAPI from './order'; import * as QuotaAPI from './quota'; +import { Quota, QuotaGetParams, QuotaGetResponse } from './quota'; import { SinglePage } from '../../../pagination'; export class CertificatePacks extends APIResource { - order: OrderAPI.Order = new OrderAPI.Order(this._client); quota: QuotaAPI.Quota = new QuotaAPI.Quota(this._client); + /** + * For a given zone, order an advanced certificate pack. + */ + create( + params: CertificatePackCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/ssl/certificate_packs/order`, { + body, + ...options, + }) as Core.APIPromise<{ result: CertificatePackCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + /** * For a given zone, list all active certificate packs. */ @@ -44,19 +58,19 @@ export class CertificatePacks extends APIResource { } /** - * For a given zone, restart validation for an advanced certificate pack. This is - * only a validation operation for a Certificate Pack in a validation_timed_out - * status. + * For a given zone, restart validation or add cloudflare branding for an advanced + * certificate pack. The former is only a validation operation for a Certificate + * Pack in a validation_timed_out status. */ edit( certificatePackId: string, params: CertificatePackEditParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { zone_id, body } = params; + const { zone_id, ...body } = params; return ( this._client.patch(`/zones/${zone_id}/ssl/certificate_packs/${certificatePackId}`, { - body: body, + body, ...options, }) as Core.APIPromise<{ result: CertificatePackEditResponse }> )._thenUnwrap((obj) => obj.result); @@ -127,6 +141,52 @@ export type Status = */ export type ValidationMethod = 'http' | 'cname' | 'txt'; +export interface CertificatePackCreateResponse { + /** + * Identifier + */ + id?: string; + + /** + * Certificate Authority selected for the order. For information on any certificate + * authority specific details or restrictions + * [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) + */ + certificate_authority?: 'google' | 'lets_encrypt' | 'ssl_com'; + + /** + * Whether or not to add Cloudflare Branding for the order. This will add a + * subdomain of sni.cloudflaressl.com as the Common Name if set to true. + */ + cloudflare_branding?: boolean; + + /** + * Comma separated list of valid host names for the certificate packs. Must contain + * the zone apex, may not contain more than 50 hosts, and may not be empty. + */ + hosts?: Array; + + /** + * Status of certificate pack. + */ + status?: Status; + + /** + * Type of certificate pack. + */ + type?: 'advanced'; + + /** + * Validation Method selected for the order. + */ + validation_method?: 'txt' | 'http' | 'email'; + + /** + * Validity Days selected for the order. + */ + validity_days?: 14 | 30 | 90 | 365; +} + export type CertificatePackListResponse = unknown; export interface CertificatePackDeleteResponse { @@ -147,11 +207,11 @@ export interface CertificatePackEditResponse { * authority specific details or restrictions * [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) */ - certificate_authority?: 'google' | 'lets_encrypt'; + certificate_authority?: 'google' | 'lets_encrypt' | 'ssl_com'; /** - * Whether or not to add Cloudflare Branding for the order. This will add - * sni.cloudflaressl.com as the Common Name if set true. + * Whether or not to add Cloudflare Branding for the order. This will add a + * subdomain of sni.cloudflaressl.com as the Common Name if set to true. */ cloudflare_branding?: boolean; @@ -182,7 +242,49 @@ export interface CertificatePackEditResponse { validity_days?: 14 | 30 | 90 | 365; } -export type CertificatePackGetResponse = unknown | string | null; +export type CertificatePackGetResponse = unknown; + +export interface CertificatePackCreateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: Certificate Authority selected for the order. For information on any + * certificate authority specific details or restrictions + * [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) + */ + certificate_authority: 'google' | 'lets_encrypt' | 'ssl_com'; + + /** + * Body param: Comma separated list of valid host names for the certificate packs. + * Must contain the zone apex, may not contain more than 50 hosts, and may not be + * empty. + */ + hosts: Array; + + /** + * Body param: Type of certificate pack. + */ + type: 'advanced'; + + /** + * Body param: Validation Method selected for the order. + */ + validation_method: 'txt' | 'http' | 'email'; + + /** + * Body param: Validity Days selected for the order. + */ + validity_days: 14 | 30 | 90 | 365; + + /** + * Body param: Whether or not to add Cloudflare Branding for the order. This will + * add a subdomain of sni.cloudflaressl.com as the Common Name if set to true. + */ + cloudflare_branding?: boolean; +} export interface CertificatePackListParams { /** @@ -210,9 +312,10 @@ export interface CertificatePackEditParams { zone_id: string; /** - * Body param: + * Body param: Whether or not to add Cloudflare Branding for the order. This will + * add a subdomain of sni.cloudflaressl.com as the Common Name if set to true. */ - body: unknown; + cloudflare_branding?: boolean; } export interface CertificatePackGetParams { @@ -222,24 +325,27 @@ export interface CertificatePackGetParams { zone_id: string; } -export namespace CertificatePacks { - export import Host = CertificatePacksAPI.Host; - export import RequestValidity = CertificatePacksAPI.RequestValidity; - export import Status = CertificatePacksAPI.Status; - export import ValidationMethod = CertificatePacksAPI.ValidationMethod; - export import CertificatePackListResponse = CertificatePacksAPI.CertificatePackListResponse; - export import CertificatePackDeleteResponse = CertificatePacksAPI.CertificatePackDeleteResponse; - export import CertificatePackEditResponse = CertificatePacksAPI.CertificatePackEditResponse; - export import CertificatePackGetResponse = CertificatePacksAPI.CertificatePackGetResponse; - export import CertificatePackListResponsesSinglePage = CertificatePacksAPI.CertificatePackListResponsesSinglePage; - export import CertificatePackListParams = CertificatePacksAPI.CertificatePackListParams; - export import CertificatePackDeleteParams = CertificatePacksAPI.CertificatePackDeleteParams; - export import CertificatePackEditParams = CertificatePacksAPI.CertificatePackEditParams; - export import CertificatePackGetParams = CertificatePacksAPI.CertificatePackGetParams; - export import Order = OrderAPI.Order; - export import OrderCreateResponse = OrderAPI.OrderCreateResponse; - export import OrderCreateParams = OrderAPI.OrderCreateParams; - export import Quota = QuotaAPI.Quota; - export import QuotaGetResponse = QuotaAPI.QuotaGetResponse; - export import QuotaGetParams = QuotaAPI.QuotaGetParams; +CertificatePacks.CertificatePackListResponsesSinglePage = CertificatePackListResponsesSinglePage; +CertificatePacks.Quota = Quota; + +export declare namespace CertificatePacks { + export { + type Host as Host, + type RequestValidity as RequestValidity, + type Status as Status, + type ValidationMethod as ValidationMethod, + type CertificatePackCreateResponse as CertificatePackCreateResponse, + type CertificatePackListResponse as CertificatePackListResponse, + type CertificatePackDeleteResponse as CertificatePackDeleteResponse, + type CertificatePackEditResponse as CertificatePackEditResponse, + type CertificatePackGetResponse as CertificatePackGetResponse, + CertificatePackListResponsesSinglePage as CertificatePackListResponsesSinglePage, + type CertificatePackCreateParams as CertificatePackCreateParams, + type CertificatePackListParams as CertificatePackListParams, + type CertificatePackDeleteParams as CertificatePackDeleteParams, + type CertificatePackEditParams as CertificatePackEditParams, + type CertificatePackGetParams as CertificatePackGetParams, + }; + + export { Quota as Quota, type QuotaGetResponse as QuotaGetResponse, type QuotaGetParams as QuotaGetParams }; } diff --git a/src/resources/ssl/certificate-packs/index.ts b/src/resources/ssl/certificate-packs/index.ts index d2ba8a3596..78584a384f 100644 --- a/src/resources/ssl/certificate-packs/index.ts +++ b/src/resources/ssl/certificate-packs/index.ts @@ -1,20 +1,21 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { - Host, - RequestValidity, - Status, - ValidationMethod, - CertificatePackListResponse, - CertificatePackDeleteResponse, - CertificatePackEditResponse, - CertificatePackGetResponse, - CertificatePackListParams, - CertificatePackDeleteParams, - CertificatePackEditParams, - CertificatePackGetParams, CertificatePackListResponsesSinglePage, CertificatePacks, + type Host, + type RequestValidity, + type Status, + type ValidationMethod, + type CertificatePackCreateResponse, + type CertificatePackListResponse, + type CertificatePackDeleteResponse, + type CertificatePackEditResponse, + type CertificatePackGetResponse, + type CertificatePackCreateParams, + type CertificatePackListParams, + type CertificatePackDeleteParams, + type CertificatePackEditParams, + type CertificatePackGetParams, } from './certificate-packs'; -export { OrderCreateResponse, OrderCreateParams, Order } from './order'; -export { QuotaGetResponse, QuotaGetParams, Quota } from './quota'; +export { Quota, type QuotaGetResponse, type QuotaGetParams } from './quota'; diff --git a/src/resources/ssl/certificate-packs/order.ts b/src/resources/ssl/certificate-packs/order.ts deleted file mode 100644 index 894341ce70..0000000000 --- a/src/resources/ssl/certificate-packs/order.ts +++ /dev/null @@ -1,114 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as OrderAPI from './order'; -import * as CertificatePacksAPI from './certificate-packs'; - -export class Order extends APIResource { - /** - * For a given zone, order an advanced certificate pack. - */ - create(params: OrderCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { zone_id, ...body } = params; - return ( - this._client.post(`/zones/${zone_id}/ssl/certificate_packs/order`, { - body, - ...options, - }) as Core.APIPromise<{ result: OrderCreateResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export interface OrderCreateResponse { - /** - * Identifier - */ - id?: string; - - /** - * Certificate Authority selected for the order. For information on any certificate - * authority specific details or restrictions - * [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) - */ - certificate_authority?: 'google' | 'lets_encrypt'; - - /** - * Whether or not to add Cloudflare Branding for the order. This will add - * sni.cloudflaressl.com as the Common Name if set true. - */ - cloudflare_branding?: boolean; - - /** - * Comma separated list of valid host names for the certificate packs. Must contain - * the zone apex, may not contain more than 50 hosts, and may not be empty. - */ - hosts?: Array; - - /** - * Status of certificate pack. - */ - status?: CertificatePacksAPI.Status; - - /** - * Type of certificate pack. - */ - type?: 'advanced'; - - /** - * Validation Method selected for the order. - */ - validation_method?: 'txt' | 'http' | 'email'; - - /** - * Validity Days selected for the order. - */ - validity_days?: 14 | 30 | 90 | 365; -} - -export interface OrderCreateParams { - /** - * Path param: Identifier - */ - zone_id: string; - - /** - * Body param: Certificate Authority selected for the order. For information on any - * certificate authority specific details or restrictions - * [see this page for more details.](https://developers.cloudflare.com/ssl/reference/certificate-authorities) - */ - certificate_authority: 'google' | 'lets_encrypt'; - - /** - * Body param: Comma separated list of valid host names for the certificate packs. - * Must contain the zone apex, may not contain more than 50 hosts, and may not be - * empty. - */ - hosts: Array; - - /** - * Body param: Type of certificate pack. - */ - type: 'advanced'; - - /** - * Body param: Validation Method selected for the order. - */ - validation_method: 'txt' | 'http' | 'email'; - - /** - * Body param: Validity Days selected for the order. - */ - validity_days: 14 | 30 | 90 | 365; - - /** - * Body param: Whether or not to add Cloudflare Branding for the order. This will - * add sni.cloudflaressl.com as the Common Name if set true. - */ - cloudflare_branding?: boolean; -} - -export namespace Order { - export import OrderCreateResponse = OrderAPI.OrderCreateResponse; - export import OrderCreateParams = OrderAPI.OrderCreateParams; -} diff --git a/src/resources/ssl/certificate-packs/quota.ts b/src/resources/ssl/certificate-packs/quota.ts index 3eb67e5315..206f628361 100644 --- a/src/resources/ssl/certificate-packs/quota.ts +++ b/src/resources/ssl/certificate-packs/quota.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as QuotaAPI from './quota'; export class Quota extends APIResource { /** @@ -43,7 +42,6 @@ export interface QuotaGetParams { zone_id: string; } -export namespace Quota { - export import QuotaGetResponse = QuotaAPI.QuotaGetResponse; - export import QuotaGetParams = QuotaAPI.QuotaGetParams; +export declare namespace Quota { + export { type QuotaGetResponse as QuotaGetResponse, type QuotaGetParams as QuotaGetParams }; } diff --git a/src/resources/ssl/index.ts b/src/resources/ssl/index.ts index 65df5f4166..84bfc662a2 100644 --- a/src/resources/ssl/index.ts +++ b/src/resources/ssl/index.ts @@ -1,30 +1,32 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { AnalyzeCreateResponse, AnalyzeCreateParams, Analyze } from './analyze'; +export { Analyze, type AnalyzeCreateResponse, type AnalyzeCreateParams } from './analyze'; export { - Host, - RequestValidity, - Status, - ValidationMethod, - CertificatePackListResponse, - CertificatePackDeleteResponse, - CertificatePackEditResponse, - CertificatePackGetResponse, - CertificatePackListParams, - CertificatePackDeleteParams, - CertificatePackEditParams, - CertificatePackGetParams, CertificatePackListResponsesSinglePage, CertificatePacks, + type Host, + type RequestValidity, + type Status, + type ValidationMethod, + type CertificatePackCreateResponse, + type CertificatePackListResponse, + type CertificatePackDeleteResponse, + type CertificatePackEditResponse, + type CertificatePackGetResponse, + type CertificatePackCreateParams, + type CertificatePackListParams, + type CertificatePackDeleteParams, + type CertificatePackEditParams, + type CertificatePackGetParams, } from './certificate-packs/index'; -export { RecommendationGetResponse, Recommendations } from './recommendations'; +export { Recommendations, type RecommendationGetResponse } from './recommendations'; export { SSL } from './ssl'; export { Universal } from './universal/index'; export { - Verification, - VerificationEditResponse, - VerificationGetResponse, - VerificationEditParams, - VerificationGetParams, VerificationResource, + type Verification, + type VerificationEditResponse, + type VerificationGetResponse, + type VerificationEditParams, + type VerificationGetParams, } from './verification'; diff --git a/src/resources/ssl/recommendations.ts b/src/resources/ssl/recommendations.ts index 5de8755659..18d2f55971 100644 --- a/src/resources/ssl/recommendations.ts +++ b/src/resources/ssl/recommendations.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as RecommendationsAPI from './recommendations'; export class Recommendations extends APIResource { /** @@ -31,6 +30,6 @@ export interface RecommendationGetResponse { value?: 'flexible' | 'full' | 'strict'; } -export namespace Recommendations { - export import RecommendationGetResponse = RecommendationsAPI.RecommendationGetResponse; +export declare namespace Recommendations { + export { type RecommendationGetResponse as RecommendationGetResponse }; } diff --git a/src/resources/ssl/ssl.ts b/src/resources/ssl/ssl.ts index f0b563ed37..ca01db919c 100644 --- a/src/resources/ssl/ssl.ts +++ b/src/resources/ssl/ssl.ts @@ -2,10 +2,39 @@ import { APIResource } from '../../resource'; import * as AnalyzeAPI from './analyze'; +import { Analyze, AnalyzeCreateParams, AnalyzeCreateResponse } from './analyze'; import * as RecommendationsAPI from './recommendations'; +import { RecommendationGetResponse, Recommendations } from './recommendations'; import * as VerificationAPI from './verification'; +import { + Verification, + VerificationEditParams, + VerificationEditResponse, + VerificationGetParams, + VerificationGetResponse, + VerificationResource, +} from './verification'; import * as CertificatePacksAPI from './certificate-packs/certificate-packs'; +import { + CertificatePackCreateParams, + CertificatePackCreateResponse, + CertificatePackDeleteParams, + CertificatePackDeleteResponse, + CertificatePackEditParams, + CertificatePackEditResponse, + CertificatePackGetParams, + CertificatePackGetResponse, + CertificatePackListParams, + CertificatePackListResponse, + CertificatePackListResponsesSinglePage, + CertificatePacks, + Host, + RequestValidity, + Status, + ValidationMethod, +} from './certificate-packs/certificate-packs'; import * as UniversalAPI from './universal/universal'; +import { Universal } from './universal/universal'; export class SSL extends APIResource { analyze: AnalyzeAPI.Analyze = new AnalyzeAPI.Analyze(this._client); @@ -17,31 +46,49 @@ export class SSL extends APIResource { verification: VerificationAPI.VerificationResource = new VerificationAPI.VerificationResource(this._client); } -export namespace SSL { - export import Analyze = AnalyzeAPI.Analyze; - export import AnalyzeCreateResponse = AnalyzeAPI.AnalyzeCreateResponse; - export import AnalyzeCreateParams = AnalyzeAPI.AnalyzeCreateParams; - export import CertificatePacks = CertificatePacksAPI.CertificatePacks; - export import Host = CertificatePacksAPI.Host; - export import RequestValidity = CertificatePacksAPI.RequestValidity; - export import Status = CertificatePacksAPI.Status; - export import ValidationMethod = CertificatePacksAPI.ValidationMethod; - export import CertificatePackListResponse = CertificatePacksAPI.CertificatePackListResponse; - export import CertificatePackDeleteResponse = CertificatePacksAPI.CertificatePackDeleteResponse; - export import CertificatePackEditResponse = CertificatePacksAPI.CertificatePackEditResponse; - export import CertificatePackGetResponse = CertificatePacksAPI.CertificatePackGetResponse; - export import CertificatePackListResponsesSinglePage = CertificatePacksAPI.CertificatePackListResponsesSinglePage; - export import CertificatePackListParams = CertificatePacksAPI.CertificatePackListParams; - export import CertificatePackDeleteParams = CertificatePacksAPI.CertificatePackDeleteParams; - export import CertificatePackEditParams = CertificatePacksAPI.CertificatePackEditParams; - export import CertificatePackGetParams = CertificatePacksAPI.CertificatePackGetParams; - export import Recommendations = RecommendationsAPI.Recommendations; - export import RecommendationGetResponse = RecommendationsAPI.RecommendationGetResponse; - export import Universal = UniversalAPI.Universal; - export import VerificationResource = VerificationAPI.VerificationResource; - export import Verification = VerificationAPI.Verification; - export import VerificationEditResponse = VerificationAPI.VerificationEditResponse; - export import VerificationGetResponse = VerificationAPI.VerificationGetResponse; - export import VerificationEditParams = VerificationAPI.VerificationEditParams; - export import VerificationGetParams = VerificationAPI.VerificationGetParams; +SSL.Analyze = Analyze; +SSL.CertificatePacks = CertificatePacks; +SSL.CertificatePackListResponsesSinglePage = CertificatePackListResponsesSinglePage; +SSL.Recommendations = Recommendations; +SSL.Universal = Universal; +SSL.VerificationResource = VerificationResource; + +export declare namespace SSL { + export { + Analyze as Analyze, + type AnalyzeCreateResponse as AnalyzeCreateResponse, + type AnalyzeCreateParams as AnalyzeCreateParams, + }; + + export { + CertificatePacks as CertificatePacks, + type Host as Host, + type RequestValidity as RequestValidity, + type Status as Status, + type ValidationMethod as ValidationMethod, + type CertificatePackCreateResponse as CertificatePackCreateResponse, + type CertificatePackListResponse as CertificatePackListResponse, + type CertificatePackDeleteResponse as CertificatePackDeleteResponse, + type CertificatePackEditResponse as CertificatePackEditResponse, + type CertificatePackGetResponse as CertificatePackGetResponse, + CertificatePackListResponsesSinglePage as CertificatePackListResponsesSinglePage, + type CertificatePackCreateParams as CertificatePackCreateParams, + type CertificatePackListParams as CertificatePackListParams, + type CertificatePackDeleteParams as CertificatePackDeleteParams, + type CertificatePackEditParams as CertificatePackEditParams, + type CertificatePackGetParams as CertificatePackGetParams, + }; + + export { Recommendations as Recommendations, type RecommendationGetResponse as RecommendationGetResponse }; + + export { Universal as Universal }; + + export { + VerificationResource as VerificationResource, + type Verification as Verification, + type VerificationEditResponse as VerificationEditResponse, + type VerificationGetResponse as VerificationGetResponse, + type VerificationEditParams as VerificationEditParams, + type VerificationGetParams as VerificationGetParams, + }; } diff --git a/src/resources/ssl/universal/index.ts b/src/resources/ssl/universal/index.ts index 48571da9ae..ed26396eca 100644 --- a/src/resources/ssl/universal/index.ts +++ b/src/resources/ssl/universal/index.ts @@ -1,4 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { + Settings, + type UniversalSSLSettings, + type SettingEditParams, + type SettingGetParams, +} from './settings'; export { Universal } from './universal'; -export { UniversalSSLSettings, SettingEditParams, SettingGetParams, Settings } from './settings'; diff --git a/src/resources/ssl/universal/settings.ts b/src/resources/ssl/universal/settings.ts index 6f46c80431..5de5ae0034 100644 --- a/src/resources/ssl/universal/settings.ts +++ b/src/resources/ssl/universal/settings.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; -import * as SettingsAPI from './settings'; export class Settings extends APIResource { /** @@ -105,8 +104,10 @@ export interface SettingGetParams { zone_id: string; } -export namespace Settings { - export import UniversalSSLSettings = SettingsAPI.UniversalSSLSettings; - export import SettingEditParams = SettingsAPI.SettingEditParams; - export import SettingGetParams = SettingsAPI.SettingGetParams; +export declare namespace Settings { + export { + type UniversalSSLSettings as UniversalSSLSettings, + type SettingEditParams as SettingEditParams, + type SettingGetParams as SettingGetParams, + }; } diff --git a/src/resources/ssl/universal/universal.ts b/src/resources/ssl/universal/universal.ts index 6d2db0ea1b..92576ff69b 100644 --- a/src/resources/ssl/universal/universal.ts +++ b/src/resources/ssl/universal/universal.ts @@ -2,14 +2,19 @@ import { APIResource } from '../../../resource'; import * as SettingsAPI from './settings'; +import { SettingEditParams, SettingGetParams, Settings, UniversalSSLSettings } from './settings'; export class Universal extends APIResource { settings: SettingsAPI.Settings = new SettingsAPI.Settings(this._client); } -export namespace Universal { - export import Settings = SettingsAPI.Settings; - export import UniversalSSLSettings = SettingsAPI.UniversalSSLSettings; - export import SettingEditParams = SettingsAPI.SettingEditParams; - export import SettingGetParams = SettingsAPI.SettingGetParams; +Universal.Settings = Settings; + +export declare namespace Universal { + export { + Settings as Settings, + type UniversalSSLSettings as UniversalSSLSettings, + type SettingEditParams as SettingEditParams, + type SettingGetParams as SettingGetParams, + }; } diff --git a/src/resources/ssl/verification.ts b/src/resources/ssl/verification.ts index d54f7f6745..70b4c0495d 100644 --- a/src/resources/ssl/verification.ts +++ b/src/resources/ssl/verification.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as VerificationAPI from './verification'; import * as CertificatePacksAPI from './certificate-packs/certificate-packs'; export class VerificationResource extends APIResource { @@ -147,10 +146,12 @@ export interface VerificationGetParams { retry?: true; } -export namespace VerificationResource { - export import Verification = VerificationAPI.Verification; - export import VerificationEditResponse = VerificationAPI.VerificationEditResponse; - export import VerificationGetResponse = VerificationAPI.VerificationGetResponse; - export import VerificationEditParams = VerificationAPI.VerificationEditParams; - export import VerificationGetParams = VerificationAPI.VerificationGetParams; +export declare namespace VerificationResource { + export { + type Verification as Verification, + type VerificationEditResponse as VerificationEditResponse, + type VerificationGetResponse as VerificationGetResponse, + type VerificationEditParams as VerificationEditParams, + type VerificationGetParams as VerificationGetParams, + }; } diff --git a/src/resources/storage/index.ts b/src/resources/storage/index.ts deleted file mode 100644 index 8509672e8d..0000000000 --- a/src/resources/storage/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { Components, Schema, AnalyticsListParams, AnalyticsStoredParams, Analytics } from './analytics'; -export { Storage } from './storage'; diff --git a/src/resources/storage/storage.ts b/src/resources/storage/storage.ts deleted file mode 100644 index 4c8e515c96..0000000000 --- a/src/resources/storage/storage.ts +++ /dev/null @@ -1,16 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import * as AnalyticsAPI from './analytics'; - -export class Storage extends APIResource { - analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client); -} - -export namespace Storage { - export import Analytics = AnalyticsAPI.Analytics; - export import Components = AnalyticsAPI.Components; - export import Schema = AnalyticsAPI.Schema; - export import AnalyticsListParams = AnalyticsAPI.AnalyticsListParams; - export import AnalyticsStoredParams = AnalyticsAPI.AnalyticsStoredParams; -} diff --git a/src/resources/stream/audio-tracks.ts b/src/resources/stream/audio-tracks.ts index b3470c6cfb..9c240e5e1d 100644 --- a/src/resources/stream/audio-tracks.ts +++ b/src/resources/stream/audio-tracks.ts @@ -2,7 +2,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as AudioTracksAPI from './audio-tracks'; export class AudioTracks extends APIResource { /** @@ -102,7 +101,7 @@ export interface Audio { uid?: string; } -export type AudioTrackDeleteResponse = unknown | string; +export type AudioTrackDeleteResponse = string; export type AudioTrackGetResponse = Array