From 1605ea2a8e4c73f0c0d670a536bb311b5aa6b771 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 14:24:14 +0000 Subject: [PATCH 01/73] feat: feat: add resource library endpoints inside zero trust * feat: add resource library endpoints inside zero trust * fix: configure resource library endpoints as data sources only in terraform * feat: add terraform resource names for zero trust resource library endpoints * feat: restructure resource library endpoints to nest applications under subresources * fix: standardize account_id parameter naming in resource library endpoints * feat: add resource library endpoints inside zero trust --- .stats.yml | 4 +- scripts/detect-breaking-changes | 3 + src/resources/zero-trust/api.md | 26 ++ src/resources/zero-trust/index.ts | 1 + src/resources/zero-trust/resource-library.ts | 3 + .../resource-library/applications.ts | 291 ++++++++++++++++++ .../zero-trust/resource-library/categories.ts | 140 +++++++++ .../zero-trust/resource-library/index.ts | 19 ++ .../resource-library/resource-library.ts | 51 +++ src/resources/zero-trust/zero-trust.ts | 6 + .../resource-library/applications.test.ts | 56 ++++ .../resource-library/categories.test.ts | 54 ++++ 12 files changed, 652 insertions(+), 2 deletions(-) create mode 100644 src/resources/zero-trust/resource-library.ts create mode 100644 src/resources/zero-trust/resource-library/applications.ts create mode 100644 src/resources/zero-trust/resource-library/categories.ts create mode 100644 src/resources/zero-trust/resource-library/index.ts create mode 100644 src/resources/zero-trust/resource-library/resource-library.ts create mode 100644 tests/api-resources/zero-trust/resource-library/applications.test.ts create mode 100644 tests/api-resources/zero-trust/resource-library/categories.test.ts diff --git a/.stats.yml b/.stats.yml index ee8d50f22f..55ac9a83d0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2200 +configured_endpoints: 2204 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: e722ad1f58e3dfb3a928cf9890d48da4 -config_hash: ff549978909de2badc92845fea964f4b +config_hash: 20574d7a53e0349a3337a121a46638d4 diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index ea70ca8b9a..3e4cc25513 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -577,6 +577,9 @@ TEST_PATHS=( tests/api-resources/zero-trust/risk-scoring/summary.test.ts tests/api-resources/zero-trust/risk-scoring/integrations/integrations.test.ts tests/api-resources/zero-trust/risk-scoring/integrations/references.test.ts + tests/api-resources/zero-trust/resource-library/resource-library.test.ts + tests/api-resources/zero-trust/resource-library/applications.test.ts + tests/api-resources/zero-trust/resource-library/categories.test.ts tests/api-resources/turnstile/turnstile.test.ts tests/api-resources/turnstile/widgets.test.ts tests/api-resources/connectivity/connectivity.test.ts diff --git a/src/resources/zero-trust/api.md b/src/resources/zero-trust/api.md index 885b2910e7..495a10ec2a 100644 --- a/src/resources/zero-trust/api.md +++ b/src/resources/zero-trust/api.md @@ -1738,3 +1738,29 @@ Types: Methods: - client.zeroTrust.riskScoring.integrations.references.get(referenceId, { ...params }) -> ReferenceGetResponse + +## ResourceLibrary + +### Applications + +Types: + +- ApplicationListResponse +- ApplicationGetResponse + +Methods: + +- client.zeroTrust.resourceLibrary.applications.list({ ...params }) -> ApplicationListResponsesSinglePage +- client.zeroTrust.resourceLibrary.applications.get(id, { ...params }) -> ApplicationGetResponse + +### Categories + +Types: + +- CategoryListResponse +- CategoryGetResponse + +Methods: + +- client.zeroTrust.resourceLibrary.categories.list({ ...params }) -> CategoryListResponsesSinglePage +- client.zeroTrust.resourceLibrary.categories.get(id, { ...params }) -> CategoryGetResponse diff --git a/src/resources/zero-trust/index.ts b/src/resources/zero-trust/index.ts index 4c4c69ca79..b4ac2a8739 100644 --- a/src/resources/zero-trust/index.ts +++ b/src/resources/zero-trust/index.ts @@ -58,6 +58,7 @@ export { type OrganizationListParams, type OrganizationRevokeUsersParams, } from './organizations/index'; +export { ResourceLibrary } from './resource-library/index'; export { RiskScoring, type RiskScoringGetResponse, diff --git a/src/resources/zero-trust/resource-library.ts b/src/resources/zero-trust/resource-library.ts new file mode 100644 index 0000000000..5445725f53 --- /dev/null +++ b/src/resources/zero-trust/resource-library.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './resource-library/index'; diff --git a/src/resources/zero-trust/resource-library/applications.ts b/src/resources/zero-trust/resource-library/applications.ts new file mode 100644 index 0000000000..54bde713a9 --- /dev/null +++ b/src/resources/zero-trust/resource-library/applications.ts @@ -0,0 +1,291 @@ +// 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 Applications extends APIResource { + /** + * List applications with different filters. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const applicationListResponse of client.zeroTrust.resourceLibrary.applications.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: ApplicationListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/resource-library/applications`, + ApplicationListResponsesSinglePage, + { query, ...options }, + ); + } + + /** + * Get application by ID. + * + * @example + * ```ts + * const application = + * await client.zeroTrust.resourceLibrary.applications.get( + * '0b63249c-95bf-4cc0-a7cc-d7faaaf1dac0', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + id: string, + params: ApplicationGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/resource-library/applications/${id}`, + options, + ) as Core.APIPromise<{ result: ApplicationGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class ApplicationListResponsesSinglePage extends SinglePage {} + +export interface ApplicationListResponse { + /** + * Returns the application ID. + */ + id: string; + + /** + * Confidence score for the application. Returns -1 when no score is available. + */ + application_confidence_score: number; + + /** + * Returns the application source. + */ + application_source: string; + + /** + * Returns the application type. + */ + application_type: string; + + /** + * Returns the application type description. + */ + application_type_description: string; + + /** + * Returns the application creation time. + */ + created_at: string; + + /** + * GenAI score for the application. Returns -1 when no score is available. + */ + gen_ai_score: number; + + /** + * Returns the list of hostnames for the application. + */ + hostnames: Array; + + /** + * Returns the human readable ID. + */ + human_id: string; + + /** + * Returns the list of IP subnets for the application. + */ + ip_subnets: Array; + + /** + * Returns the application name. + */ + name: string; + + /** + * Returns the list of port protocols for the application. + */ + port_protocols: Array; + + /** + * Returns the list of support domains for the application. + */ + support_domains: Array; + + /** + * Returns the application update time. + */ + updated_at: string; + + /** + * Returns the application version. + */ + version: string; + + /** + * Returns the score composition breakdown for the application. + */ + application_score_composition?: unknown | null; + + /** + * Returns the Intel API ID for the application. + */ + intel_id?: number | null; +} + +export interface ApplicationGetResponse { + /** + * Returns the application ID. + */ + id: string; + + /** + * Confidence score for the application. Returns -1 when no score is available. + */ + application_confidence_score: number; + + /** + * Returns the application source. + */ + application_source: string; + + /** + * Returns the application type. + */ + application_type: string; + + /** + * Returns the application type description. + */ + application_type_description: string; + + /** + * Returns the application creation time. + */ + created_at: string; + + /** + * GenAI score for the application. Returns -1 when no score is available. + */ + gen_ai_score: number; + + /** + * Returns the list of hostnames for the application. + */ + hostnames: Array; + + /** + * Returns the human readable ID. + */ + human_id: string; + + /** + * Returns the list of IP subnets for the application. + */ + ip_subnets: Array; + + /** + * Returns the application name. + */ + name: string; + + /** + * Returns the list of port protocols for the application. + */ + port_protocols: Array; + + /** + * Returns the list of support domains for the application. + */ + support_domains: Array; + + /** + * Returns the application update time. + */ + updated_at: string; + + /** + * Returns the application version. + */ + version: string; + + /** + * Returns the score composition breakdown for the application. + */ + application_score_composition?: unknown | null; + + /** + * Returns the Intel API ID for the application. + */ + intel_id?: number | null; +} + +export interface ApplicationListParams { + /** + * Path param: Account ID. + */ + account_id: string; + + /** + * Query param: Filter applications using key:value format. Supported filter keys: + * + * - name: Filter by application name (e.g., name:HR) + * - id: Filter by application ID (e.g., id:0b63249c-95bf-4cc0-a7cc-d7faaaf1dac0) + * - human_id: Filter by human-readable ID (e.g., human_id:HR) + * - hostname: Filter by hostname or support domain (e.g., + * hostname:portal.example.com) + * - source: Filter by application source name (e.g., source:cloudflare) + * - ip_subnet: Filter by IP subnet using CIDR containment — returns applications + * where any stored subnet contains the search value (e.g., ip_subnet:10.0.1.5/32 + * matches apps with 10.0.0.0/16) + * - intel_id: Filter by Intel API ID (e.g., intel_id:498). . + */ + filter?: string; + + /** + * Query param: Limit of number of results to return (max 250). + */ + limit?: number; + + /** + * Query param: Offset of results to return. + */ + offset?: number; + + /** + * Query param: Order by result by field name and order (e.g., name:asc). + */ + order_by?: string; +} + +export interface ApplicationGetParams { + /** + * Account ID. + */ + account_id: string; +} + +Applications.ApplicationListResponsesSinglePage = ApplicationListResponsesSinglePage; + +export declare namespace Applications { + export { + type ApplicationListResponse as ApplicationListResponse, + type ApplicationGetResponse as ApplicationGetResponse, + ApplicationListResponsesSinglePage as ApplicationListResponsesSinglePage, + type ApplicationListParams as ApplicationListParams, + type ApplicationGetParams as ApplicationGetParams, + }; +} diff --git a/src/resources/zero-trust/resource-library/categories.ts b/src/resources/zero-trust/resource-library/categories.ts new file mode 100644 index 0000000000..927c47df2b --- /dev/null +++ b/src/resources/zero-trust/resource-library/categories.ts @@ -0,0 +1,140 @@ +// 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 Categories extends APIResource { + /** + * List application categories. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const categoryListResponse of client.zeroTrust.resourceLibrary.categories.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: CategoryListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/resource-library/categories`, + CategoryListResponsesSinglePage, + { query, ...options }, + ); + } + + /** + * Get application category by ID. + * + * @example + * ```ts + * const category = + * await client.zeroTrust.resourceLibrary.categories.get( + * '0b63249c-95bf-4cc0-a7cc-d7faaaf1dac0', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + id: string, + params: CategoryGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/resource-library/categories/${id}`, + options, + ) as Core.APIPromise<{ result: CategoryGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class CategoryListResponsesSinglePage extends SinglePage {} + +export interface CategoryListResponse { + /** + * Returns the category ID. + */ + id: string; + + /** + * Returns the category creation time. + */ + created_at: string; + + /** + * Returns the category description. + */ + description: string; + + /** + * Returns the category name. + */ + name: string; +} + +export interface CategoryGetResponse { + /** + * Returns the category ID. + */ + id: string; + + /** + * Returns the category creation time. + */ + created_at: string; + + /** + * Returns the category description. + */ + description: string; + + /** + * Returns the category name. + */ + name: string; +} + +export interface CategoryListParams { + /** + * Path param: Account ID. + */ + account_id: string; + + /** + * Query param: Limit of number of results to return. + */ + limit?: number; + + /** + * Query param: Offset of results to return. + */ + offset?: number; +} + +export interface CategoryGetParams { + /** + * Account ID. + */ + account_id: string; +} + +Categories.CategoryListResponsesSinglePage = CategoryListResponsesSinglePage; + +export declare namespace Categories { + export { + type CategoryListResponse as CategoryListResponse, + type CategoryGetResponse as CategoryGetResponse, + CategoryListResponsesSinglePage as CategoryListResponsesSinglePage, + type CategoryListParams as CategoryListParams, + type CategoryGetParams as CategoryGetParams, + }; +} diff --git a/src/resources/zero-trust/resource-library/index.ts b/src/resources/zero-trust/resource-library/index.ts new file mode 100644 index 0000000000..0d0499ddde --- /dev/null +++ b/src/resources/zero-trust/resource-library/index.ts @@ -0,0 +1,19 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + ApplicationListResponsesSinglePage, + Applications, + type ApplicationListResponse, + type ApplicationGetResponse, + type ApplicationListParams, + type ApplicationGetParams, +} from './applications'; +export { + CategoryListResponsesSinglePage, + Categories, + type CategoryListResponse, + type CategoryGetResponse, + type CategoryListParams, + type CategoryGetParams, +} from './categories'; +export { ResourceLibrary } from './resource-library'; diff --git a/src/resources/zero-trust/resource-library/resource-library.ts b/src/resources/zero-trust/resource-library/resource-library.ts new file mode 100644 index 0000000000..8303975072 --- /dev/null +++ b/src/resources/zero-trust/resource-library/resource-library.ts @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as ApplicationsAPI from './applications'; +import { + ApplicationGetParams, + ApplicationGetResponse, + ApplicationListParams, + ApplicationListResponse, + ApplicationListResponsesSinglePage, + Applications, +} from './applications'; +import * as CategoriesAPI from './categories'; +import { + Categories, + CategoryGetParams, + CategoryGetResponse, + CategoryListParams, + CategoryListResponse, + CategoryListResponsesSinglePage, +} from './categories'; + +export class ResourceLibrary extends APIResource { + applications: ApplicationsAPI.Applications = new ApplicationsAPI.Applications(this._client); + categories: CategoriesAPI.Categories = new CategoriesAPI.Categories(this._client); +} + +ResourceLibrary.Applications = Applications; +ResourceLibrary.ApplicationListResponsesSinglePage = ApplicationListResponsesSinglePage; +ResourceLibrary.Categories = Categories; +ResourceLibrary.CategoryListResponsesSinglePage = CategoryListResponsesSinglePage; + +export declare namespace ResourceLibrary { + export { + Applications as Applications, + type ApplicationListResponse as ApplicationListResponse, + type ApplicationGetResponse as ApplicationGetResponse, + ApplicationListResponsesSinglePage as ApplicationListResponsesSinglePage, + type ApplicationListParams as ApplicationListParams, + type ApplicationGetParams as ApplicationGetParams, + }; + + export { + Categories as Categories, + type CategoryListResponse as CategoryListResponse, + type CategoryGetResponse as CategoryGetResponse, + CategoryListResponsesSinglePage as CategoryListResponsesSinglePage, + type CategoryListParams as CategoryListParams, + type CategoryGetParams as CategoryGetParams, + }; +} diff --git a/src/resources/zero-trust/zero-trust.ts b/src/resources/zero-trust/zero-trust.ts index fd2a007279..725422769f 100644 --- a/src/resources/zero-trust/zero-trust.ts +++ b/src/resources/zero-trust/zero-trust.ts @@ -64,6 +64,8 @@ import { OrganizationUpdateParams, Organizations, } from './organizations/organizations'; +import * as ResourceLibraryAPI from './resource-library/resource-library'; +import { ResourceLibrary } from './resource-library/resource-library'; import * as RiskScoringAPI from './risk-scoring/risk-scoring'; import { RiskScoring, @@ -97,6 +99,7 @@ export class ZeroTrust extends APIResource { gateway: GatewayAPI.Gateway = new GatewayAPI.Gateway(this._client); networks: NetworksAPI.Networks = new NetworksAPI.Networks(this._client); riskScoring: RiskScoringAPI.RiskScoring = new RiskScoringAPI.RiskScoring(this._client); + resourceLibrary: ResourceLibraryAPI.ResourceLibrary = new ResourceLibraryAPI.ResourceLibrary(this._client); } ZeroTrust.Devices = Devices; @@ -116,6 +119,7 @@ ZeroTrust.DLP = DLP; ZeroTrust.Gateway = Gateway; ZeroTrust.Networks = Networks; ZeroTrust.RiskScoring = RiskScoring; +ZeroTrust.ResourceLibrary = ResourceLibrary; export declare namespace ZeroTrust { export { @@ -207,4 +211,6 @@ export declare namespace ZeroTrust { type RiskScoringGetParams as RiskScoringGetParams, type RiskScoringResetParams as RiskScoringResetParams, }; + + export { ResourceLibrary as ResourceLibrary }; } diff --git a/tests/api-resources/zero-trust/resource-library/applications.test.ts b/tests/api-resources/zero-trust/resource-library/applications.test.ts new file mode 100644 index 0000000000..fed1d750ea --- /dev/null +++ b/tests/api-resources/zero-trust/resource-library/applications.test.ts @@ -0,0 +1,56 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource applications', () => { + test('list: only required params', async () => { + const responsePromise = client.zeroTrust.resourceLibrary.applications.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.zeroTrust.resourceLibrary.applications.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + filter: 'filter', + limit: 0, + offset: 0, + order_by: 'order_by', + }); + }); + + test('get: only required params', async () => { + const responsePromise = client.zeroTrust.resourceLibrary.applications.get( + '0b63249c-95bf-4cc0-a7cc-d7faaaf1dac0', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.zeroTrust.resourceLibrary.applications.get( + '0b63249c-95bf-4cc0-a7cc-d7faaaf1dac0', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/zero-trust/resource-library/categories.test.ts b/tests/api-resources/zero-trust/resource-library/categories.test.ts new file mode 100644 index 0000000000..ce969c1afb --- /dev/null +++ b/tests/api-resources/zero-trust/resource-library/categories.test.ts @@ -0,0 +1,54 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource categories', () => { + test('list: only required params', async () => { + const responsePromise = client.zeroTrust.resourceLibrary.categories.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.zeroTrust.resourceLibrary.categories.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + limit: 0, + offset: 0, + }); + }); + + test('get: only required params', async () => { + const responsePromise = client.zeroTrust.resourceLibrary.categories.get( + '0b63249c-95bf-4cc0-a7cc-d7faaaf1dac0', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.zeroTrust.resourceLibrary.categories.get( + '0b63249c-95bf-4cc0-a7cc-d7faaaf1dac0', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); From 9ce391b44136632c1c0a933464ed6132b3943806 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 14:31:46 +0000 Subject: [PATCH 02/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/aisearch/instances/instances.ts | 91 ++++++++++++++----- .../namespaces/instances/instances.ts | 91 ++++++++++++++----- .../aisearch/instances/instances.test.ts | 14 ++- .../namespaces/instances/instances.test.ts | 14 ++- 5 files changed, 161 insertions(+), 51 deletions(-) diff --git a/.stats.yml b/.stats.yml index 55ac9a83d0..3c642fb30b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2204 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: e722ad1f58e3dfb3a928cf9890d48da4 +openapi_spec_hash: 42dd4ac0ac3f5c00bbe80e26fed2fa51 config_hash: 20574d7a53e0349a3337a121a46638d4 diff --git a/src/resources/aisearch/instances/instances.ts b/src/resources/aisearch/instances/instances.ts index f3f9a33ea8..3cc0f853ff 100644 --- a/src/resources/aisearch/instances/instances.ts +++ b/src/resources/aisearch/instances/instances.ts @@ -568,10 +568,16 @@ export namespace InstanceCreateResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -594,8 +600,9 @@ export namespace InstanceCreateResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -955,10 +962,16 @@ export namespace InstanceUpdateResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -981,8 +994,9 @@ export namespace InstanceUpdateResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -1342,10 +1356,16 @@ export namespace InstanceListResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -1368,8 +1388,9 @@ export namespace InstanceListResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -1729,10 +1750,16 @@ export namespace InstanceDeleteResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -1755,8 +1782,9 @@ export namespace InstanceDeleteResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -2186,10 +2214,16 @@ export namespace InstanceReadResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -2212,8 +2246,9 @@ export namespace InstanceReadResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -2742,10 +2777,16 @@ export namespace InstanceCreateParams { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -2768,8 +2809,9 @@ export namespace InstanceCreateParams { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -3228,10 +3270,16 @@ export namespace InstanceUpdateParams { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -3254,8 +3302,9 @@ export namespace InstanceUpdateParams { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } diff --git a/src/resources/aisearch/namespaces/instances/instances.ts b/src/resources/aisearch/namespaces/instances/instances.ts index fe5eaac0e1..222e627312 100644 --- a/src/resources/aisearch/namespaces/instances/instances.ts +++ b/src/resources/aisearch/namespaces/instances/instances.ts @@ -619,10 +619,16 @@ export namespace InstanceCreateResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -645,8 +651,9 @@ export namespace InstanceCreateResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -1006,10 +1013,16 @@ export namespace InstanceUpdateResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -1032,8 +1045,9 @@ export namespace InstanceUpdateResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -1393,10 +1407,16 @@ export namespace InstanceListResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -1419,8 +1439,9 @@ export namespace InstanceListResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -1780,10 +1801,16 @@ export namespace InstanceDeleteResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -1806,8 +1833,9 @@ export namespace InstanceDeleteResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -2237,10 +2265,16 @@ export namespace InstanceReadResponse { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -2263,8 +2297,9 @@ export namespace InstanceReadResponse { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -2793,10 +2828,16 @@ export namespace InstanceCreateParams { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -2819,8 +2860,9 @@ export namespace InstanceCreateParams { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } @@ -3279,10 +3321,16 @@ export namespace InstanceUpdateParams { /** * List of path-to-selector mappings for extracting specific content from crawled * pages. Each entry pairs a URL glob pattern with a CSS selector. The first - * matching path wins. Only the matched HTML fragment is stored and indexed. + * matching path wins. Only the matched HTML fragment is stored and indexed. Omit + * the field to disable content selection — empty arrays are rejected. */ content_selector?: Array; + /** + * Up to 5 custom HTTP headers sent with each crawl request. Names must be RFC-7230 + * token characters (no spaces, colons, or control characters); values must be + * HTAB + printable ASCII (no CR/LF). + */ include_headers?: { [key: string]: string }; include_images?: boolean; @@ -3305,8 +3353,9 @@ export namespace InstanceUpdateParams { path: string; /** - * CSS selector to extract content from pages matching the path pattern. Supports - * standard CSS selectors including class, ID, element, and attribute selectors. + * CSS selector to extract content from pages matching the path pattern. Must not + * contain disallowed characters (;, `, $, {, }, \). Must target a single element; + * if multiple elements match, the selector is ignored and the full page is used. */ selector: string; } diff --git a/tests/api-resources/aisearch/instances/instances.test.ts b/tests/api-resources/aisearch/instances/instances.test.ts index 75f560baea..a34ec577d5 100644 --- a/tests/api-resources/aisearch/instances/instances.test.ts +++ b/tests/api-resources/aisearch/instances/instances.test.ts @@ -77,8 +77,11 @@ describe('resource instances', () => { source: 'all', }, parse_options: { - content_selector: [{ path: '**/blog/**', selector: 'article .post-body' }], - include_headers: { foo: 'string' }, + content_selector: [ + { path: '**/blog/**', selector: 'article div.post-body' }, + { path: '**/docs/**', selector: 'main' }, + ], + include_headers: { 'cache-control': 'no-cache, no-store' }, include_images: true, specific_sitemaps: ['https://example.com/sitemap.xml', 'https://example.com/blog-sitemap.xml'], use_browser_rendering: true, @@ -161,8 +164,11 @@ describe('resource instances', () => { source: 'all', }, parse_options: { - content_selector: [{ path: '**/blog/**', selector: 'article .post-body' }], - include_headers: { foo: 'string' }, + content_selector: [ + { path: '**/blog/**', selector: 'article div.post-body' }, + { path: '**/docs/**', selector: 'main' }, + ], + include_headers: { 'cache-control': 'no-cache, no-store' }, include_images: true, specific_sitemaps: ['https://example.com/sitemap.xml', 'https://example.com/blog-sitemap.xml'], use_browser_rendering: true, diff --git a/tests/api-resources/aisearch/namespaces/instances/instances.test.ts b/tests/api-resources/aisearch/namespaces/instances/instances.test.ts index 5adf42db0d..b12d53e447 100644 --- a/tests/api-resources/aisearch/namespaces/instances/instances.test.ts +++ b/tests/api-resources/aisearch/namespaces/instances/instances.test.ts @@ -77,8 +77,11 @@ describe('resource instances', () => { source: 'all', }, parse_options: { - content_selector: [{ path: '**/blog/**', selector: 'article .post-body' }], - include_headers: { foo: 'string' }, + content_selector: [ + { path: '**/blog/**', selector: 'article div.post-body' }, + { path: '**/docs/**', selector: 'main' }, + ], + include_headers: { 'cache-control': 'no-cache, no-store' }, include_images: true, specific_sitemaps: ['https://example.com/sitemap.xml', 'https://example.com/blog-sitemap.xml'], use_browser_rendering: true, @@ -161,8 +164,11 @@ describe('resource instances', () => { source: 'all', }, parse_options: { - content_selector: [{ path: '**/blog/**', selector: 'article .post-body' }], - include_headers: { foo: 'string' }, + content_selector: [ + { path: '**/blog/**', selector: 'article div.post-body' }, + { path: '**/docs/**', selector: 'main' }, + ], + include_headers: { 'cache-control': 'no-cache, no-store' }, include_images: true, specific_sitemaps: ['https://example.com/sitemap.xml', 'https://example.com/blog-sitemap.xml'], use_browser_rendering: true, From 19cbc6a259d77bf8f4f3cb65f99cb9974b717b41 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 14:39:59 +0000 Subject: [PATCH 03/73] feat: feat(load_balancer_monitor_group): promote load_balancer_monitor_group config to main * feat(load_balancers): promote monitor group Stainless config to main Add monitor group references endpoint and set terraform resource name to load_balancer_monitor_group. Cherry-picked from staging. --- .stats.yml | 4 +- scripts/detect-breaking-changes | 3 +- src/resources/load-balancers/api.md | 24 +- src/resources/load-balancers/index.ts | 2 +- .../load-balancers/load-balancers.ts | 24 +- .../load-balancers/monitor-groups.ts | 435 +---------------- .../load-balancers/monitor-groups/index.ts | 19 + .../monitor-groups/monitor-groups.ts | 454 ++++++++++++++++++ .../monitor-groups/references.ts | 63 +++ .../monitor-groups.test.ts | 0 .../monitor-groups/references.test.ts | 33 ++ 11 files changed, 604 insertions(+), 457 deletions(-) create mode 100644 src/resources/load-balancers/monitor-groups/index.ts create mode 100644 src/resources/load-balancers/monitor-groups/monitor-groups.ts create mode 100644 src/resources/load-balancers/monitor-groups/references.ts rename tests/api-resources/load-balancers/{ => monitor-groups}/monitor-groups.test.ts (100%) create mode 100644 tests/api-resources/load-balancers/monitor-groups/references.test.ts diff --git a/.stats.yml b/.stats.yml index 3c642fb30b..0826ed7cbc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2204 +configured_endpoints: 2205 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 42dd4ac0ac3f5c00bbe80e26fed2fa51 -config_hash: 20574d7a53e0349a3337a121a46638d4 +config_hash: 8ff9a61d85e7bdc4cb1a445d27d8173e diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 3e4cc25513..0a0c791c75 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -47,7 +47,8 @@ TEST_PATHS=( tests/api-resources/load-balancers/monitors/monitors.test.ts tests/api-resources/load-balancers/monitors/previews.test.ts tests/api-resources/load-balancers/monitors/references.test.ts - tests/api-resources/load-balancers/monitor-groups.test.ts + tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts + tests/api-resources/load-balancers/monitor-groups/references.test.ts tests/api-resources/load-balancers/pools/pools.test.ts tests/api-resources/load-balancers/pools/health.test.ts tests/api-resources/load-balancers/pools/references.test.ts diff --git a/src/resources/load-balancers/api.md b/src/resources/load-balancers/api.md index 569455403a..2d91342b90 100644 --- a/src/resources/load-balancers/api.md +++ b/src/resources/load-balancers/api.md @@ -70,16 +70,26 @@ Methods: Types: -- MonitorGroup +- MonitorGroup Methods: -- client.loadBalancers.monitorGroups.create({ ...params }) -> MonitorGroup -- client.loadBalancers.monitorGroups.update(monitorGroupId, { ...params }) -> MonitorGroup -- client.loadBalancers.monitorGroups.list({ ...params }) -> MonitorGroupsSinglePage -- client.loadBalancers.monitorGroups.delete(monitorGroupId, { ...params }) -> MonitorGroup -- client.loadBalancers.monitorGroups.edit(monitorGroupId, { ...params }) -> MonitorGroup -- client.loadBalancers.monitorGroups.get(monitorGroupId, { ...params }) -> MonitorGroup +- client.loadBalancers.monitorGroups.create({ ...params }) -> MonitorGroup +- client.loadBalancers.monitorGroups.update(monitorGroupId, { ...params }) -> MonitorGroup +- client.loadBalancers.monitorGroups.list({ ...params }) -> MonitorGroupsSinglePage +- client.loadBalancers.monitorGroups.delete(monitorGroupId, { ...params }) -> MonitorGroup +- client.loadBalancers.monitorGroups.edit(monitorGroupId, { ...params }) -> MonitorGroup +- client.loadBalancers.monitorGroups.get(monitorGroupId, { ...params }) -> MonitorGroup + +### References + +Types: + +- ReferenceGetResponse + +Methods: + +- client.loadBalancers.monitorGroups.references.get(monitorGroupId, { ...params }) -> ReferenceGetResponsesSinglePage ## Pools diff --git a/src/resources/load-balancers/index.ts b/src/resources/load-balancers/index.ts index 8758b53ed9..8d36b0c223 100644 --- a/src/resources/load-balancers/index.ts +++ b/src/resources/load-balancers/index.ts @@ -11,7 +11,7 @@ export { type MonitorGroupDeleteParams, type MonitorGroupEditParams, type MonitorGroupGetParams, -} from './monitor-groups'; +} from './monitor-groups/index'; export { MonitorsSinglePage, Monitors, diff --git a/src/resources/load-balancers/load-balancers.ts b/src/resources/load-balancers/load-balancers.ts index 73f57b5759..525cdb2394 100644 --- a/src/resources/load-balancers/load-balancers.ts +++ b/src/resources/load-balancers/load-balancers.ts @@ -3,18 +3,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as LoadBalancersAPI from './load-balancers'; -import * as MonitorGroupsAPI from './monitor-groups'; -import { - MonitorGroup, - MonitorGroupCreateParams, - MonitorGroupDeleteParams, - MonitorGroupEditParams, - MonitorGroupGetParams, - MonitorGroupListParams, - MonitorGroupUpdateParams, - MonitorGroups, - MonitorGroupsSinglePage, -} from './monitor-groups'; import * as PreviewsAPI from './previews'; import { PreviewGetParams, PreviewGetResponse, Previews } from './previews'; import * as RegionsAPI from './regions'; @@ -26,6 +14,18 @@ import { SearchListResponsesV4PagePagination, Searches, } from './searches'; +import * as MonitorGroupsAPI from './monitor-groups/monitor-groups'; +import { + MonitorGroup, + MonitorGroupCreateParams, + MonitorGroupDeleteParams, + MonitorGroupEditParams, + MonitorGroupGetParams, + MonitorGroupListParams, + MonitorGroupUpdateParams, + MonitorGroups, + MonitorGroupsSinglePage, +} from './monitor-groups/monitor-groups'; import * as MonitorsAPI from './monitors/monitors'; import { Monitor, diff --git a/src/resources/load-balancers/monitor-groups.ts b/src/resources/load-balancers/monitor-groups.ts index c818642b0f..1c11056182 100644 --- a/src/resources/load-balancers/monitor-groups.ts +++ b/src/resources/load-balancers/monitor-groups.ts @@ -1,436 +1,3 @@ // 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 MonitorGroups extends APIResource { - /** - * Create a new monitor group. - * - * @example - * ```ts - * const monitorGroup = - * await client.loadBalancers.monitorGroups.create({ - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * id: 'id', - * description: 'Primary datacenter monitors', - * members: [ - * { - * enabled: true, - * monitor_id: 'monitor_id', - * monitoring_only: false, - * must_be_healthy: true, - * }, - * ], - * }); - * ``` - */ - create(params: MonitorGroupCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.post(`/accounts/${account_id}/load_balancers/monitor_groups`, { - body, - ...options, - }) as Core.APIPromise<{ result: MonitorGroup }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Modify a configured monitor group. - * - * @example - * ```ts - * const monitorGroup = - * await client.loadBalancers.monitorGroups.update( - * '17b5962d775c646f3f9725cbc7a53df4', - * { - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * id: 'id', - * description: 'Primary datacenter monitors', - * members: [ - * { - * enabled: true, - * monitor_id: 'monitor_id', - * monitoring_only: false, - * must_be_healthy: true, - * }, - * ], - * }, - * ); - * ``` - */ - update( - monitorGroupId: string, - params: MonitorGroupUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.put(`/accounts/${account_id}/load_balancers/monitor_groups/${monitorGroupId}`, { - body, - ...options, - }) as Core.APIPromise<{ result: MonitorGroup }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * List configured monitor groups. - * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const monitorGroup of client.loadBalancers.monitorGroups.list( - * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * )) { - * // ... - * } - * ``` - */ - list( - params: MonitorGroupListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { - const { account_id } = params; - return this._client.getAPIList( - `/accounts/${account_id}/load_balancers/monitor_groups`, - MonitorGroupsSinglePage, - options, - ); - } - - /** - * Delete a configured monitor group. - * - * @example - * ```ts - * const monitorGroup = - * await client.loadBalancers.monitorGroups.delete( - * '17b5962d775c646f3f9725cbc7a53df4', - * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * ); - * ``` - */ - delete( - monitorGroupId: string, - params: MonitorGroupDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/load_balancers/monitor_groups/${monitorGroupId}`, - options, - ) as Core.APIPromise<{ result: MonitorGroup }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Apply changes to an existing monitor group, overwriting the supplied properties. - * - * @example - * ```ts - * const monitorGroup = - * await client.loadBalancers.monitorGroups.edit( - * '17b5962d775c646f3f9725cbc7a53df4', - * { - * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * id: 'id', - * description: 'Primary datacenter monitors', - * members: [ - * { - * enabled: true, - * monitor_id: 'monitor_id', - * monitoring_only: false, - * must_be_healthy: true, - * }, - * ], - * }, - * ); - * ``` - */ - edit( - monitorGroupId: string, - params: MonitorGroupEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.patch(`/accounts/${account_id}/load_balancers/monitor_groups/${monitorGroupId}`, { - body, - ...options, - }) as Core.APIPromise<{ result: MonitorGroup }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetch a single configured monitor group. - * - * @example - * ```ts - * const monitorGroup = - * await client.loadBalancers.monitorGroups.get( - * '17b5962d775c646f3f9725cbc7a53df4', - * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * ); - * ``` - */ - get( - monitorGroupId: string, - params: MonitorGroupGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get( - `/accounts/${account_id}/load_balancers/monitor_groups/${monitorGroupId}`, - options, - ) as Core.APIPromise<{ result: MonitorGroup }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class MonitorGroupsSinglePage extends SinglePage {} - -export interface MonitorGroup { - /** - * The ID of the Monitor Group to use for checking the health of origins within - * this pool. - */ - id: string; - - /** - * A short description of the monitor group - */ - description: string; - - /** - * List of monitors in this group - */ - members: Array; - - /** - * The timestamp of when the monitor group was created - */ - created_at?: string; - - /** - * The timestamp of when the monitor group was last updated - */ - updated_at?: string; -} - -export namespace MonitorGroup { - export interface Member { - /** - * Whether this monitor is enabled in the group - */ - enabled: boolean; - - /** - * The ID of the Monitor to use for checking the health of origins within this - * pool. - */ - monitor_id: string; - - /** - * Whether this monitor is used for monitoring only (does not affect pool health) - */ - monitoring_only: boolean; - - /** - * Whether this monitor must be healthy for the pool to be considered healthy - */ - must_be_healthy: boolean; - - /** - * The timestamp of when the monitor was added to the group - */ - created_at?: string; - - /** - * The timestamp of when the monitor group member was last updated - */ - updated_at?: string; - } -} - -export interface MonitorGroupCreateParams { - /** - * Path param: Identifier. - */ - account_id: string; - - /** - * Body param: The ID of the Monitor Group to use for checking the health of - * origins within this pool. - */ - id: string; - - /** - * Body param: A short description of the monitor group - */ - description: string; - - /** - * Body param: List of monitors in this group - */ - members: Array; -} - -export namespace MonitorGroupCreateParams { - export interface Member { - /** - * Whether this monitor is enabled in the group - */ - enabled: boolean; - - /** - * The ID of the Monitor to use for checking the health of origins within this - * pool. - */ - monitor_id: string; - - /** - * Whether this monitor is used for monitoring only (does not affect pool health) - */ - monitoring_only: boolean; - - /** - * Whether this monitor must be healthy for the pool to be considered healthy - */ - must_be_healthy: boolean; - } -} - -export interface MonitorGroupUpdateParams { - /** - * Path param: Identifier. - */ - account_id: string; - - /** - * Body param: The ID of the Monitor Group to use for checking the health of - * origins within this pool. - */ - id: string; - - /** - * Body param: A short description of the monitor group - */ - description: string; - - /** - * Body param: List of monitors in this group - */ - members: Array; -} - -export namespace MonitorGroupUpdateParams { - export interface Member { - /** - * Whether this monitor is enabled in the group - */ - enabled: boolean; - - /** - * The ID of the Monitor to use for checking the health of origins within this - * pool. - */ - monitor_id: string; - - /** - * Whether this monitor is used for monitoring only (does not affect pool health) - */ - monitoring_only: boolean; - - /** - * Whether this monitor must be healthy for the pool to be considered healthy - */ - must_be_healthy: boolean; - } -} - -export interface MonitorGroupListParams { - /** - * Identifier. - */ - account_id: string; -} - -export interface MonitorGroupDeleteParams { - /** - * Identifier. - */ - account_id: string; -} - -export interface MonitorGroupEditParams { - /** - * Path param: Identifier. - */ - account_id: string; - - /** - * Body param: The ID of the Monitor Group to use for checking the health of - * origins within this pool. - */ - id: string; - - /** - * Body param: A short description of the monitor group - */ - description: string; - - /** - * Body param: List of monitors in this group - */ - members: Array; -} - -export namespace MonitorGroupEditParams { - export interface Member { - /** - * Whether this monitor is enabled in the group - */ - enabled: boolean; - - /** - * The ID of the Monitor to use for checking the health of origins within this - * pool. - */ - monitor_id: string; - - /** - * Whether this monitor is used for monitoring only (does not affect pool health) - */ - monitoring_only: boolean; - - /** - * Whether this monitor must be healthy for the pool to be considered healthy - */ - must_be_healthy: boolean; - } -} - -export interface MonitorGroupGetParams { - /** - * Identifier. - */ - account_id: string; -} - -MonitorGroups.MonitorGroupsSinglePage = MonitorGroupsSinglePage; - -export declare namespace MonitorGroups { - export { - type MonitorGroup as MonitorGroup, - MonitorGroupsSinglePage as MonitorGroupsSinglePage, - type MonitorGroupCreateParams as MonitorGroupCreateParams, - type MonitorGroupUpdateParams as MonitorGroupUpdateParams, - type MonitorGroupListParams as MonitorGroupListParams, - type MonitorGroupDeleteParams as MonitorGroupDeleteParams, - type MonitorGroupEditParams as MonitorGroupEditParams, - type MonitorGroupGetParams as MonitorGroupGetParams, - }; -} +export * from './monitor-groups/index'; diff --git a/src/resources/load-balancers/monitor-groups/index.ts b/src/resources/load-balancers/monitor-groups/index.ts new file mode 100644 index 0000000000..ff06afc659 --- /dev/null +++ b/src/resources/load-balancers/monitor-groups/index.ts @@ -0,0 +1,19 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + MonitorGroupsSinglePage, + MonitorGroups, + type MonitorGroup, + type MonitorGroupCreateParams, + type MonitorGroupUpdateParams, + type MonitorGroupListParams, + type MonitorGroupDeleteParams, + type MonitorGroupEditParams, + type MonitorGroupGetParams, +} from './monitor-groups'; +export { + ReferenceGetResponsesSinglePage, + References, + type ReferenceGetResponse, + type ReferenceGetParams, +} from './references'; diff --git a/src/resources/load-balancers/monitor-groups/monitor-groups.ts b/src/resources/load-balancers/monitor-groups/monitor-groups.ts new file mode 100644 index 0000000000..0c74989ebc --- /dev/null +++ b/src/resources/load-balancers/monitor-groups/monitor-groups.ts @@ -0,0 +1,454 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as ReferencesAPI from './references'; +import { + ReferenceGetParams, + ReferenceGetResponse, + ReferenceGetResponsesSinglePage, + References, +} from './references'; +import { SinglePage } from '../../../pagination'; + +export class MonitorGroups extends APIResource { + references: ReferencesAPI.References = new ReferencesAPI.References(this._client); + + /** + * Create a new monitor group. + * + * @example + * ```ts + * const monitorGroup = + * await client.loadBalancers.monitorGroups.create({ + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * id: 'id', + * description: 'Primary datacenter monitors', + * members: [ + * { + * enabled: true, + * monitor_id: 'monitor_id', + * monitoring_only: false, + * must_be_healthy: true, + * }, + * ], + * }); + * ``` + */ + create(params: MonitorGroupCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/load_balancers/monitor_groups`, { + body, + ...options, + }) as Core.APIPromise<{ result: MonitorGroup }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Modify a configured monitor group. + * + * @example + * ```ts + * const monitorGroup = + * await client.loadBalancers.monitorGroups.update( + * '17b5962d775c646f3f9725cbc7a53df4', + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * id: 'id', + * description: 'Primary datacenter monitors', + * members: [ + * { + * enabled: true, + * monitor_id: 'monitor_id', + * monitoring_only: false, + * must_be_healthy: true, + * }, + * ], + * }, + * ); + * ``` + */ + update( + monitorGroupId: string, + params: MonitorGroupUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/load_balancers/monitor_groups/${monitorGroupId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: MonitorGroup }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List configured monitor groups. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const monitorGroup of client.loadBalancers.monitorGroups.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: MonitorGroupListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/load_balancers/monitor_groups`, + MonitorGroupsSinglePage, + options, + ); + } + + /** + * Delete a configured monitor group. + * + * @example + * ```ts + * const monitorGroup = + * await client.loadBalancers.monitorGroups.delete( + * '17b5962d775c646f3f9725cbc7a53df4', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + monitorGroupId: string, + params: MonitorGroupDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/load_balancers/monitor_groups/${monitorGroupId}`, + options, + ) as Core.APIPromise<{ result: MonitorGroup }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Apply changes to an existing monitor group, overwriting the supplied properties. + * + * @example + * ```ts + * const monitorGroup = + * await client.loadBalancers.monitorGroups.edit( + * '17b5962d775c646f3f9725cbc7a53df4', + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * id: 'id', + * description: 'Primary datacenter monitors', + * members: [ + * { + * enabled: true, + * monitor_id: 'monitor_id', + * monitoring_only: false, + * must_be_healthy: true, + * }, + * ], + * }, + * ); + * ``` + */ + edit( + monitorGroupId: string, + params: MonitorGroupEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/load_balancers/monitor_groups/${monitorGroupId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: MonitorGroup }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Fetch a single configured monitor group. + * + * @example + * ```ts + * const monitorGroup = + * await client.loadBalancers.monitorGroups.get( + * '17b5962d775c646f3f9725cbc7a53df4', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + monitorGroupId: string, + params: MonitorGroupGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/load_balancers/monitor_groups/${monitorGroupId}`, + options, + ) as Core.APIPromise<{ result: MonitorGroup }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class MonitorGroupsSinglePage extends SinglePage {} + +export interface MonitorGroup { + /** + * The ID of the Monitor Group to use for checking the health of origins within + * this pool. + */ + id: string; + + /** + * A short description of the monitor group + */ + description: string; + + /** + * List of monitors in this group + */ + members: Array; + + /** + * The timestamp of when the monitor group was created + */ + created_at?: string; + + /** + * The timestamp of when the monitor group was last updated + */ + updated_at?: string; +} + +export namespace MonitorGroup { + export interface Member { + /** + * Whether this monitor is enabled in the group + */ + enabled: boolean; + + /** + * The ID of the Monitor to use for checking the health of origins within this + * pool. + */ + monitor_id: string; + + /** + * Whether this monitor is used for monitoring only (does not affect pool health) + */ + monitoring_only: boolean; + + /** + * Whether this monitor must be healthy for the pool to be considered healthy + */ + must_be_healthy: boolean; + + /** + * The timestamp of when the monitor was added to the group + */ + created_at?: string; + + /** + * The timestamp of when the monitor group member was last updated + */ + updated_at?: string; + } +} + +export interface MonitorGroupCreateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The ID of the Monitor Group to use for checking the health of + * origins within this pool. + */ + id: string; + + /** + * Body param: A short description of the monitor group + */ + description: string; + + /** + * Body param: List of monitors in this group + */ + members: Array; +} + +export namespace MonitorGroupCreateParams { + export interface Member { + /** + * Whether this monitor is enabled in the group + */ + enabled: boolean; + + /** + * The ID of the Monitor to use for checking the health of origins within this + * pool. + */ + monitor_id: string; + + /** + * Whether this monitor is used for monitoring only (does not affect pool health) + */ + monitoring_only: boolean; + + /** + * Whether this monitor must be healthy for the pool to be considered healthy + */ + must_be_healthy: boolean; + } +} + +export interface MonitorGroupUpdateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The ID of the Monitor Group to use for checking the health of + * origins within this pool. + */ + id: string; + + /** + * Body param: A short description of the monitor group + */ + description: string; + + /** + * Body param: List of monitors in this group + */ + members: Array; +} + +export namespace MonitorGroupUpdateParams { + export interface Member { + /** + * Whether this monitor is enabled in the group + */ + enabled: boolean; + + /** + * The ID of the Monitor to use for checking the health of origins within this + * pool. + */ + monitor_id: string; + + /** + * Whether this monitor is used for monitoring only (does not affect pool health) + */ + monitoring_only: boolean; + + /** + * Whether this monitor must be healthy for the pool to be considered healthy + */ + must_be_healthy: boolean; + } +} + +export interface MonitorGroupListParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface MonitorGroupDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface MonitorGroupEditParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The ID of the Monitor Group to use for checking the health of + * origins within this pool. + */ + id: string; + + /** + * Body param: A short description of the monitor group + */ + description: string; + + /** + * Body param: List of monitors in this group + */ + members: Array; +} + +export namespace MonitorGroupEditParams { + export interface Member { + /** + * Whether this monitor is enabled in the group + */ + enabled: boolean; + + /** + * The ID of the Monitor to use for checking the health of origins within this + * pool. + */ + monitor_id: string; + + /** + * Whether this monitor is used for monitoring only (does not affect pool health) + */ + monitoring_only: boolean; + + /** + * Whether this monitor must be healthy for the pool to be considered healthy + */ + must_be_healthy: boolean; + } +} + +export interface MonitorGroupGetParams { + /** + * Identifier. + */ + account_id: string; +} + +MonitorGroups.MonitorGroupsSinglePage = MonitorGroupsSinglePage; +MonitorGroups.References = References; +MonitorGroups.ReferenceGetResponsesSinglePage = ReferenceGetResponsesSinglePage; + +export declare namespace MonitorGroups { + export { + type MonitorGroup as MonitorGroup, + MonitorGroupsSinglePage as MonitorGroupsSinglePage, + type MonitorGroupCreateParams as MonitorGroupCreateParams, + type MonitorGroupUpdateParams as MonitorGroupUpdateParams, + type MonitorGroupListParams as MonitorGroupListParams, + type MonitorGroupDeleteParams as MonitorGroupDeleteParams, + type MonitorGroupEditParams as MonitorGroupEditParams, + type MonitorGroupGetParams as MonitorGroupGetParams, + }; + + export { + References as References, + type ReferenceGetResponse as ReferenceGetResponse, + ReferenceGetResponsesSinglePage as ReferenceGetResponsesSinglePage, + type ReferenceGetParams as ReferenceGetParams, + }; +} diff --git a/src/resources/load-balancers/monitor-groups/references.ts b/src/resources/load-balancers/monitor-groups/references.ts new file mode 100644 index 0000000000..ad711a7b60 --- /dev/null +++ b/src/resources/load-balancers/monitor-groups/references.ts @@ -0,0 +1,63 @@ +// 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 References extends APIResource { + /** + * Get the list of resources that reference the provided monitor group. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const referenceGetResponse of client.loadBalancers.monitorGroups.references.get( + * 'f1aba936b94213e5b8dca0c0dbf1f9cc', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + get( + monitorGroupId: string, + params: ReferenceGetParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/load_balancers/monitor_groups/${monitorGroupId}/references`, + ReferenceGetResponsesSinglePage, + options, + ); + } +} + +export class ReferenceGetResponsesSinglePage extends SinglePage {} + +export interface ReferenceGetResponse { + reference_type?: '*' | 'referral' | 'referrer'; + + resource_id?: string; + + resource_name?: string; + + resource_type?: string; +} + +export interface ReferenceGetParams { + /** + * Identifier. + */ + account_id: string; +} + +References.ReferenceGetResponsesSinglePage = ReferenceGetResponsesSinglePage; + +export declare namespace References { + export { + type ReferenceGetResponse as ReferenceGetResponse, + ReferenceGetResponsesSinglePage as ReferenceGetResponsesSinglePage, + type ReferenceGetParams as ReferenceGetParams, + }; +} diff --git a/tests/api-resources/load-balancers/monitor-groups.test.ts b/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts similarity index 100% rename from tests/api-resources/load-balancers/monitor-groups.test.ts rename to tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts diff --git a/tests/api-resources/load-balancers/monitor-groups/references.test.ts b/tests/api-resources/load-balancers/monitor-groups/references.test.ts new file mode 100644 index 0000000000..0d26b84c9d --- /dev/null +++ b/tests/api-resources/load-balancers/monitor-groups/references.test.ts @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource references', () => { + test('get: only required params', async () => { + const responsePromise = client.loadBalancers.monitorGroups.references.get( + 'f1aba936b94213e5b8dca0c0dbf1f9cc', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.loadBalancers.monitorGroups.references.get( + 'f1aba936b94213e5b8dca0c0dbf1f9cc', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); From de557495278405da2bdc668c3f4d147bae979d0f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 15:20:27 +0000 Subject: [PATCH 04/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 0826ed7cbc..e1e29097db 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2205 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 42dd4ac0ac3f5c00bbe80e26fed2fa51 -config_hash: 8ff9a61d85e7bdc4cb1a445d27d8173e +config_hash: 33ec2cdb453b26c2d3b3a8447bff4595 From ea27501d42b2943164a6e9e740c1bbd12ccdffe8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 16:22:33 +0000 Subject: [PATCH 05/73] feat: feat(cache): Update OPCR config to v2 endpoints (CACHE-13523) * feat(cache): Update OPCR config to v2 endpoints (CACHE-13523) Promote OPCR (origin public cloud region) Stainless config from staging to main: - v2 endpoints under /origin/cloud_regions (PUT-only, no POST), with upsert + ImportState support via id_path_param + id_property. - Deprecated v1 methods (/cache/origin_cloud_regions/*) retained as *_v1 with deprecated annotation; skipped for all SDK/Terraform targets so only the docs site consumes them. v1 was never published to SDKs/Terraform historically, and v1 endpoints remain functional during the deprecation period. - Resource model points to cache-rules_origin_cloud_region_v2_entry. Combines staging-branch commits 7e22620f (MR 762) and 1c1ece32 (MR 795). --- .stats.yml | 4 +- src/resources/cache/api.md | 21 +- src/resources/cache/cache.ts | 25 +- src/resources/cache/index.ts | 12 +- src/resources/cache/origin-cloud-regions.ts | 534 ++++++------------ .../cache/origin-cloud-regions.test.ts | 55 +- 6 files changed, 223 insertions(+), 428 deletions(-) diff --git a/.stats.yml b/.stats.yml index e1e29097db..0d7a1867ad 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2205 +configured_endpoints: 2204 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 42dd4ac0ac3f5c00bbe80e26fed2fa51 -config_hash: 33ec2cdb453b26c2d3b3a8447bff4595 +config_hash: 0c33107d28fc9d1d5726d8ac8459421a diff --git a/src/resources/cache/api.md b/src/resources/cache/api.md index e732450dc3..2887704bcc 100644 --- a/src/resources/cache/api.md +++ b/src/resources/cache/api.md @@ -74,22 +74,17 @@ Methods: Types: - OriginCloudRegion -- OriginCloudRegionCreateResponse -- OriginCloudRegionListResponse - OriginCloudRegionDeleteResponse - OriginCloudRegionBulkDeleteResponse -- OriginCloudRegionBulkEditResponse -- OriginCloudRegionEditResponse -- OriginCloudRegionGetResponse +- OriginCloudRegionBulkUpdateResponse - OriginCloudRegionSupportedRegionsResponse Methods: -- client.cache.originCloudRegions.create({ ...params }) -> OriginCloudRegionCreateResponse -- client.cache.originCloudRegions.list({ ...params }) -> OriginCloudRegionListResponse -- client.cache.originCloudRegions.delete(originIP, { ...params }) -> OriginCloudRegionDeleteResponse -- client.cache.originCloudRegions.bulkDelete({ ...params }) -> OriginCloudRegionBulkDeleteResponse -- client.cache.originCloudRegions.bulkEdit([ ...body ]) -> OriginCloudRegionBulkEditResponse -- client.cache.originCloudRegions.edit({ ...params }) -> OriginCloudRegionEditResponse -- client.cache.originCloudRegions.get(originIP, { ...params }) -> OriginCloudRegionGetResponse -- client.cache.originCloudRegions.supportedRegions({ ...params }) -> OriginCloudRegionSupportedRegionsResponse +- client.cache.originCloudRegions.update(originIP, { ...params }) -> OriginCloudRegion +- client.cache.originCloudRegions.list({ ...params }) -> OriginCloudRegionsV4PagePaginationArray +- client.cache.originCloudRegions.delete(originIP, { ...params }) -> OriginCloudRegionDeleteResponse +- client.cache.originCloudRegions.bulkDelete({ ...params }) -> OriginCloudRegionBulkDeleteResponse +- client.cache.originCloudRegions.bulkUpdate([ ...body ]) -> OriginCloudRegionBulkUpdateResponse +- client.cache.originCloudRegions.get(originIP, { ...params }) -> OriginCloudRegion +- client.cache.originCloudRegions.supportedRegions({ ...params }) -> OriginCloudRegionSupportedRegionsResponse diff --git a/src/resources/cache/cache.ts b/src/resources/cache/cache.ts index b88a2e31d5..78109bfc0b 100644 --- a/src/resources/cache/cache.ts +++ b/src/resources/cache/cache.ts @@ -22,21 +22,17 @@ import { OriginCloudRegion, OriginCloudRegionBulkDeleteParams, OriginCloudRegionBulkDeleteResponse, - OriginCloudRegionBulkEditParams, - OriginCloudRegionBulkEditResponse, - OriginCloudRegionCreateParams, - OriginCloudRegionCreateResponse, + OriginCloudRegionBulkUpdateParams, + OriginCloudRegionBulkUpdateResponse, OriginCloudRegionDeleteParams, OriginCloudRegionDeleteResponse, - OriginCloudRegionEditParams, - OriginCloudRegionEditResponse, OriginCloudRegionGetParams, - OriginCloudRegionGetResponse, OriginCloudRegionListParams, - OriginCloudRegionListResponse, OriginCloudRegionSupportedRegionsParams, OriginCloudRegionSupportedRegionsResponse, + OriginCloudRegionUpdateParams, OriginCloudRegions, + OriginCloudRegionsV4PagePaginationArray, } from './origin-cloud-regions'; import * as RegionalTieredCacheAPI from './regional-tiered-cache'; import { @@ -268,6 +264,7 @@ Cache.SmartTieredCache = SmartTieredCache; Cache.Variants = Variants; Cache.RegionalTieredCacheResource = RegionalTieredCacheResource; Cache.OriginCloudRegions = OriginCloudRegions; +Cache.OriginCloudRegionsV4PagePaginationArray = OriginCloudRegionsV4PagePaginationArray; export declare namespace Cache { export { type CachePurgeResponse as CachePurgeResponse, type CachePurgeParams as CachePurgeParams }; @@ -320,20 +317,16 @@ export declare namespace Cache { export { OriginCloudRegions as OriginCloudRegions, type OriginCloudRegion as OriginCloudRegion, - type OriginCloudRegionCreateResponse as OriginCloudRegionCreateResponse, - type OriginCloudRegionListResponse as OriginCloudRegionListResponse, type OriginCloudRegionDeleteResponse as OriginCloudRegionDeleteResponse, type OriginCloudRegionBulkDeleteResponse as OriginCloudRegionBulkDeleteResponse, - type OriginCloudRegionBulkEditResponse as OriginCloudRegionBulkEditResponse, - type OriginCloudRegionEditResponse as OriginCloudRegionEditResponse, - type OriginCloudRegionGetResponse as OriginCloudRegionGetResponse, + type OriginCloudRegionBulkUpdateResponse as OriginCloudRegionBulkUpdateResponse, type OriginCloudRegionSupportedRegionsResponse as OriginCloudRegionSupportedRegionsResponse, - type OriginCloudRegionCreateParams as OriginCloudRegionCreateParams, + OriginCloudRegionsV4PagePaginationArray as OriginCloudRegionsV4PagePaginationArray, + type OriginCloudRegionUpdateParams as OriginCloudRegionUpdateParams, type OriginCloudRegionListParams as OriginCloudRegionListParams, type OriginCloudRegionDeleteParams as OriginCloudRegionDeleteParams, type OriginCloudRegionBulkDeleteParams as OriginCloudRegionBulkDeleteParams, - type OriginCloudRegionBulkEditParams as OriginCloudRegionBulkEditParams, - type OriginCloudRegionEditParams as OriginCloudRegionEditParams, + type OriginCloudRegionBulkUpdateParams as OriginCloudRegionBulkUpdateParams, type OriginCloudRegionGetParams as OriginCloudRegionGetParams, type OriginCloudRegionSupportedRegionsParams as OriginCloudRegionSupportedRegionsParams, }; diff --git a/src/resources/cache/index.ts b/src/resources/cache/index.ts index 33310961fc..f10ef06193 100644 --- a/src/resources/cache/index.ts +++ b/src/resources/cache/index.ts @@ -16,22 +16,18 @@ export { type CacheReserveStatusParams, } from './cache-reserve'; export { + OriginCloudRegionsV4PagePaginationArray, OriginCloudRegions, type OriginCloudRegion, - type OriginCloudRegionCreateResponse, - type OriginCloudRegionListResponse, type OriginCloudRegionDeleteResponse, type OriginCloudRegionBulkDeleteResponse, - type OriginCloudRegionBulkEditResponse, - type OriginCloudRegionEditResponse, - type OriginCloudRegionGetResponse, + type OriginCloudRegionBulkUpdateResponse, type OriginCloudRegionSupportedRegionsResponse, - type OriginCloudRegionCreateParams, + type OriginCloudRegionUpdateParams, type OriginCloudRegionListParams, type OriginCloudRegionDeleteParams, type OriginCloudRegionBulkDeleteParams, - type OriginCloudRegionBulkEditParams, - type OriginCloudRegionEditParams, + type OriginCloudRegionBulkUpdateParams, type OriginCloudRegionGetParams, type OriginCloudRegionSupportedRegionsParams, } from './origin-cloud-regions'; diff --git a/src/resources/cache/origin-cloud-regions.ts b/src/resources/cache/origin-cloud-regions.ts index afa70055ab..284eb69404 100644 --- a/src/resources/cache/origin-cloud-regions.ts +++ b/src/resources/cache/origin-cloud-regions.ts @@ -2,71 +2,81 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class OriginCloudRegions extends APIResource { /** - * Adds a single IP-to-cloud-region mapping for the zone. The IP must be a valid - * IPv4 or IPv6 address and is normalized to canonical form before storage (RFC - * 5952 for IPv6). Returns 400 (code 1145) if a mapping for that IP already exists - * — use PATCH to update an existing entry. The vendor and region are validated - * against the list from - * `GET /zones/{zone_id}/cache/origin_cloud_regions/supported_regions`. + * Creates a new IP-to-cloud-region mapping or replaces the existing mapping for + * the specified IP. PUT is idempotent — calling it repeatedly with the same body + * produces the same result. The IP path parameter is normalized to canonical form + * (RFC 5952 for IPv6) before storage. The vendor and region are validated against + * the list from `GET /zones/{zone_id}/origin/cloud_regions/supported_regions`. + * Returns 400 if the `origin_ip` in the body does not match the URL path + * parameter. Returns 403 (code 1164) when the zone has reached the limit of 3,500 + * IP mappings. * * @example * ```ts * const originCloudRegion = - * await client.cache.originCloudRegions.create({ - * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - * ip: '192.0.2.1', - * region: 'us-east-1', - * vendor: 'aws', - * }); + * await client.cache.originCloudRegions.update( + * '192.0.2.1', + * { + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * origin_ip: '192.0.2.1', + * region: 'us-east-1', + * vendor: 'aws', + * }, + * ); * ``` */ - create( - params: OriginCloudRegionCreateParams, + update( + originIP: string, + params: OriginCloudRegionUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return ( - this._client.post(`/zones/${zone_id}/cache/origin_cloud_regions`, { + this._client.put(`/zones/${zone_id}/origin/cloud_regions/${originIP}`, { body, ...options, - }) as Core.APIPromise<{ result: OriginCloudRegionCreateResponse }> + }) as Core.APIPromise<{ result: OriginCloudRegion }> )._thenUnwrap((obj) => obj.result); } /** - * Returns all IP-to-cloud-region mappings configured for the zone. Each mapping - * tells Cloudflare which cloud vendor and region hosts the origin at that IP, - * enabling the edge to route via the nearest Tiered Cache upper-tier co-located - * with that cloud provider. Returns an empty array when no mappings exist. + * Returns all IP-to-cloud-region mappings configured for the zone with pagination + * support. Each mapping tells Cloudflare which cloud vendor and region hosts the + * origin at that IP, enabling the edge to route via the nearest Tiered Cache + * upper-tier co-located with that cloud provider. Returns an empty array when no + * mappings exist. * * @example * ```ts - * const originCloudRegions = - * await client.cache.originCloudRegions.list({ - * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - * }); + * // Automatically fetches more pages as needed. + * for await (const originCloudRegion of client.cache.originCloudRegions.list( + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } * ``` */ list( params: OriginCloudRegionListParams, options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id } = params; - return ( - this._client.get(`/zones/${zone_id}/cache/origin_cloud_regions`, options) as Core.APIPromise<{ - result: OriginCloudRegionListResponse; - }> - )._thenUnwrap((obj) => obj.result); + ): Core.PagePromise { + const { zone_id, ...query } = params; + return this._client.getAPIList( + `/zones/${zone_id}/origin/cloud_regions`, + OriginCloudRegionsV4PagePaginationArray, + { query, ...options }, + ); } /** * Removes the cloud region mapping for a single origin IP address. The IP path - * parameter is normalized before lookup. Returns the deleted entry on success. - * Returns 404 (code 1163) if no mapping exists for the specified IP. When the last - * mapping for the zone is removed the underlying rule record is also deleted. + * parameter is normalized before lookup. Returns the deleted IP on success. + * Returns 404 if no mapping exists for the specified IP. When the last mapping for + * the zone is removed the underlying rule record is also deleted. * * @example * ```ts @@ -84,10 +94,9 @@ export class OriginCloudRegions extends APIResource { ): Core.APIPromise { const { zone_id } = params; return ( - this._client.delete( - `/zones/${zone_id}/cache/origin_cloud_regions/${originIP}`, - options, - ) as Core.APIPromise<{ result: OriginCloudRegionDeleteResponse }> + this._client.delete(`/zones/${zone_id}/origin/cloud_regions/${originIP}`, options) as Core.APIPromise<{ + result: OriginCloudRegionDeleteResponse; + }> )._thenUnwrap((obj) => obj.result); } @@ -111,32 +120,34 @@ export class OriginCloudRegions extends APIResource { ): Core.APIPromise { const { zone_id } = params; return ( - this._client.delete(`/zones/${zone_id}/cache/origin_cloud_regions/batch`, options) as Core.APIPromise<{ + this._client.delete(`/zones/${zone_id}/origin/cloud_regions/batch`, options) as Core.APIPromise<{ result: OriginCloudRegionBulkDeleteResponse; }> )._thenUnwrap((obj) => obj.result); } /** - * Adds or updates up to 100 IP-to-cloud-region mappings in a single request. Each - * item is validated independently — valid items are applied and invalid items are - * returned in the `failed` array. The vendor and region for every item are - * validated against the list from - * `GET /zones/{zone_id}/cache/origin_cloud_regions/supported_regions`. + * Upserts up to 100 IP-to-cloud-region mappings in a single request. Items in the + * request body are created or replaced; mappings not included in the request body + * are preserved unchanged (this is a merge operation, not a full collection + * replacement). Each item is validated independently — valid items are applied and + * invalid items are returned in the `failed` array. The vendor and region for + * every item are validated against the list from + * `GET /zones/{zone_id}/origin/cloud_regions/supported_regions`. * * @example * ```ts * const response = - * await client.cache.originCloudRegions.bulkEdit({ + * await client.cache.originCloudRegions.bulkUpdate({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * body: [ * { - * ip: '192.0.2.1', + * origin_ip: '192.0.2.1', * region: 'us-east-1', * vendor: 'aws', * }, * { - * ip: '2001:db8::1', + * origin_ip: '2001:db8::1', * region: 'us-central1', * vendor: 'gcp', * }, @@ -144,55 +155,23 @@ export class OriginCloudRegions extends APIResource { * }); * ``` */ - bulkEdit( - params: OriginCloudRegionBulkEditParams, + bulkUpdate( + params: OriginCloudRegionBulkUpdateParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, body } = params; return ( - this._client.patch(`/zones/${zone_id}/cache/origin_cloud_regions/batch`, { + this._client.put(`/zones/${zone_id}/origin/cloud_regions/batch`, { body: body, ...options, - }) as Core.APIPromise<{ result: OriginCloudRegionBulkEditResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Adds or updates a single IP-to-cloud-region mapping for the zone. Unlike POST, - * this operation is idempotent — if a mapping for the IP already exists it is - * overwritten. Returns the complete updated list of all mappings for the zone. - * Returns 403 (code 1164) when the zone has reached the limit of 3,500 IP - * mappings. - * - * @example - * ```ts - * const response = await client.cache.originCloudRegions.edit( - * { - * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - * ip: '2001:db8::1', - * region: 'us-central1', - * vendor: 'gcp', - * }, - * ); - * ``` - */ - edit( - params: OriginCloudRegionEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id, ...body } = params; - return ( - this._client.patch(`/zones/${zone_id}/cache/origin_cloud_regions`, { - body, - ...options, - }) as Core.APIPromise<{ result: OriginCloudRegionEditResponse }> + }) as Core.APIPromise<{ result: OriginCloudRegionBulkUpdateResponse }> )._thenUnwrap((obj) => obj.result); } /** * Returns the cloud region mapping for a single origin IP address. The IP path - * parameter is normalized before lookup (RFC 5952 for IPv6). Returns 404 - * (code 1142) if the zone has no mappings or if the specified IP has no mapping. + * parameter is normalized before lookup (RFC 5952 for IPv6). Returns 404 if the + * zone has no mappings or if the specified IP has no mapping. * * @example * ```ts @@ -206,13 +185,12 @@ export class OriginCloudRegions extends APIResource { originIP: string, params: OriginCloudRegionGetParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id } = params; return ( - this._client.get( - `/zones/${zone_id}/cache/origin_cloud_regions/${originIP}`, - options, - ) as Core.APIPromise<{ result: OriginCloudRegionGetResponse }> + this._client.get(`/zones/${zone_id}/origin/cloud_regions/${originIP}`, options) as Core.APIPromise<{ + result: OriginCloudRegion; + }> )._thenUnwrap((obj) => obj.result); } @@ -237,21 +215,24 @@ export class OriginCloudRegions extends APIResource { const { zone_id } = params; return ( this._client.get( - `/zones/${zone_id}/cache/origin_cloud_regions/supported_regions`, + `/zones/${zone_id}/origin/cloud_regions/supported_regions`, options, ) as Core.APIPromise<{ result: OriginCloudRegionSupportedRegionsResponse }> )._thenUnwrap((obj) => obj.result); } } +export class OriginCloudRegionsV4PagePaginationArray extends V4PagePaginationArray {} + /** * A single origin IP-to-cloud-region mapping. */ export interface OriginCloudRegion { /** - * The origin IP address (IPv4 or IPv6, canonicalized). + * The origin IP address (IPv4 or IPv6). Normalized to canonical form (RFC 5952 for + * IPv6). */ - 'origin-ip': string; + origin_ip: string; /** * Cloud vendor region identifier. @@ -270,279 +251,155 @@ export interface OriginCloudRegion { } /** - * Response result for a single origin cloud region mapping. + * Response result for a delete operation. Identifies the deleted mapping. */ -export interface OriginCloudRegionCreateResponse { - id: 'origin_public_cloud_region'; - - /** - * Whether the setting can be modified by the current user. - */ - editable: boolean; - - /** - * A single origin IP-to-cloud-region mapping. - */ - value: OriginCloudRegion; - +export interface OriginCloudRegionDeleteResponse { /** - * Time the mapping was last modified. + * The origin IP address whose mapping was deleted. */ - modified_on?: string; + origin_ip: string; } /** - * Response result for a list of origin cloud region mappings. + * Response result for a batch origin cloud region operation. */ -export interface OriginCloudRegionListResponse { - id: 'origin_public_cloud_region'; - +export interface OriginCloudRegionBulkDeleteResponse { /** - * Whether the setting can be modified by the current user. + * Items that could not be applied, with error details. */ - editable: boolean; - - value: Array; + failed: Array; /** - * Time the mapping set was last modified. Null when no mappings exist. + * Items that were successfully applied. */ - modified_on?: string | null; + succeeded: Array; } -/** - * Response result for a single origin cloud region mapping. - */ -export interface OriginCloudRegionDeleteResponse { - id: 'origin_public_cloud_region'; - - /** - * Whether the setting can be modified by the current user. - */ - editable: boolean; - - /** - * A single origin IP-to-cloud-region mapping. - */ - value: OriginCloudRegion; - +export namespace OriginCloudRegionBulkDeleteResponse { /** - * Time the mapping was last modified. + * Result for a single item in a batch operation. */ - modified_on?: string; -} + export interface Failed { + /** + * The origin IP address for this item. + */ + origin_ip: string; -/** - * Response result for a batch origin cloud region operation. - */ -export interface OriginCloudRegionBulkDeleteResponse { - id: 'origin_public_cloud_region'; + /** + * Error message explaining why the item failed. Present only on failed items. + */ + error?: string; - /** - * Whether the setting can be modified by the current user. - */ - editable: boolean; + /** + * Cloud vendor region identifier. Present on succeeded items (the new value for + * upsert, the deleted value for delete). + */ + region?: string; - value: OriginCloudRegionBulkDeleteResponse.Value; + /** + * Cloud vendor identifier. Present on succeeded items (the new value for upsert, + * the deleted value for delete). + */ + vendor?: string; + } /** - * Time the mapping set was last modified. Null when no items were successfully - * applied. + * Result for a single item in a batch operation. */ - modified_on?: string | null; -} - -export namespace OriginCloudRegionBulkDeleteResponse { - export interface Value { + export interface Succeeded { /** - * Items that could not be applied, with error details. + * The origin IP address for this item. */ - failed: Array; + origin_ip: string; /** - * Items that were successfully applied. + * Error message explaining why the item failed. Present only on failed items. */ - succeeded: Array; - } + error?: string; - export namespace Value { /** - * Result for a single item in a batch operation. + * Cloud vendor region identifier. Present on succeeded items (the new value for + * upsert, the deleted value for delete). */ - export interface Failed { - /** - * The origin IP address for this item. - */ - 'origin-ip': string; - - /** - * Error message explaining why the item failed. Present only on failed items. - */ - error?: string; - - /** - * Cloud vendor region identifier. Present on succeeded items for patch operations. - */ - region?: string; - - /** - * Cloud vendor identifier. Present on succeeded items for patch operations. - */ - vendor?: string; - } + region?: string; /** - * Result for a single item in a batch operation. + * Cloud vendor identifier. Present on succeeded items (the new value for upsert, + * the deleted value for delete). */ - export interface Succeeded { - /** - * The origin IP address for this item. - */ - 'origin-ip': string; - - /** - * Error message explaining why the item failed. Present only on failed items. - */ - error?: string; - - /** - * Cloud vendor region identifier. Present on succeeded items for patch operations. - */ - region?: string; - - /** - * Cloud vendor identifier. Present on succeeded items for patch operations. - */ - vendor?: string; - } + vendor?: string; } } /** * Response result for a batch origin cloud region operation. */ -export interface OriginCloudRegionBulkEditResponse { - id: 'origin_public_cloud_region'; - +export interface OriginCloudRegionBulkUpdateResponse { /** - * Whether the setting can be modified by the current user. + * Items that could not be applied, with error details. */ - editable: boolean; - - value: OriginCloudRegionBulkEditResponse.Value; + failed: Array; /** - * Time the mapping set was last modified. Null when no items were successfully - * applied. + * Items that were successfully applied. */ - modified_on?: string | null; + succeeded: Array; } -export namespace OriginCloudRegionBulkEditResponse { - export interface Value { +export namespace OriginCloudRegionBulkUpdateResponse { + /** + * Result for a single item in a batch operation. + */ + export interface Failed { /** - * Items that could not be applied, with error details. + * The origin IP address for this item. */ - failed: Array; + origin_ip: string; /** - * Items that were successfully applied. + * Error message explaining why the item failed. Present only on failed items. */ - succeeded: Array; - } + error?: string; - export namespace Value { /** - * Result for a single item in a batch operation. + * Cloud vendor region identifier. Present on succeeded items (the new value for + * upsert, the deleted value for delete). */ - export interface Failed { - /** - * The origin IP address for this item. - */ - 'origin-ip': string; - - /** - * Error message explaining why the item failed. Present only on failed items. - */ - error?: string; - - /** - * Cloud vendor region identifier. Present on succeeded items for patch operations. - */ - region?: string; - - /** - * Cloud vendor identifier. Present on succeeded items for patch operations. - */ - vendor?: string; - } + region?: string; /** - * Result for a single item in a batch operation. + * Cloud vendor identifier. Present on succeeded items (the new value for upsert, + * the deleted value for delete). */ - export interface Succeeded { - /** - * The origin IP address for this item. - */ - 'origin-ip': string; - - /** - * Error message explaining why the item failed. Present only on failed items. - */ - error?: string; - - /** - * Cloud vendor region identifier. Present on succeeded items for patch operations. - */ - region?: string; - - /** - * Cloud vendor identifier. Present on succeeded items for patch operations. - */ - vendor?: string; - } + vendor?: string; } -} - -/** - * Response result for a list of origin cloud region mappings. - */ -export interface OriginCloudRegionEditResponse { - id: 'origin_public_cloud_region'; /** - * Whether the setting can be modified by the current user. + * Result for a single item in a batch operation. */ - editable: boolean; - - value: Array; - - /** - * Time the mapping set was last modified. Null when no mappings exist. - */ - modified_on?: string | null; -} - -/** - * Response result for a single origin cloud region mapping. - */ -export interface OriginCloudRegionGetResponse { - id: 'origin_public_cloud_region'; + export interface Succeeded { + /** + * The origin IP address for this item. + */ + origin_ip: string; - /** - * Whether the setting can be modified by the current user. - */ - editable: boolean; + /** + * Error message explaining why the item failed. Present only on failed items. + */ + error?: string; - /** - * A single origin IP-to-cloud-region mapping. - */ - value: OriginCloudRegion; + /** + * Cloud vendor region identifier. Present on succeeded items (the new value for + * upsert, the deleted value for delete). + */ + region?: string; - /** - * Time the mapping was last modified. - */ - modified_on?: string; + /** + * Cloud vendor identifier. Present on succeeded items (the new value for upsert, + * the deleted value for delete). + */ + vendor?: string; + } } /** @@ -582,17 +439,19 @@ export namespace OriginCloudRegionSupportedRegionsResponse { } } -export interface OriginCloudRegionCreateParams { +export interface OriginCloudRegionUpdateParams { /** * Path param: Identifier. */ zone_id: string; /** - * Body param: Origin IP address (IPv4 or IPv6). Normalized to canonical form - * before storage (RFC 5952 for IPv6). + * Body param: Origin IP address (IPv4 or IPv6). For the single PUT endpoint + * (`PUT /origin/cloud_regions/{origin_ip}`), this field must match the path + * parameter or the request will be rejected with a 400 error. For the batch PUT + * endpoint, this field identifies which mapping to upsert. */ - ip: string; + origin_ip: string; /** * Body param: Cloud vendor region identifier. Must be a valid region for the @@ -607,9 +466,9 @@ export interface OriginCloudRegionCreateParams { vendor: 'aws' | 'azure' | 'gcp' | 'oci'; } -export interface OriginCloudRegionListParams { +export interface OriginCloudRegionListParams extends V4PagePaginationArrayParams { /** - * Identifier. + * Path param: Identifier. */ zone_id: string; } @@ -628,7 +487,7 @@ export interface OriginCloudRegionBulkDeleteParams { zone_id: string; } -export interface OriginCloudRegionBulkEditParams { +export interface OriginCloudRegionBulkUpdateParams { /** * Path param: Identifier. */ @@ -637,19 +496,21 @@ export interface OriginCloudRegionBulkEditParams { /** * Body param */ - body: Array; + body: Array; } -export namespace OriginCloudRegionBulkEditParams { +export namespace OriginCloudRegionBulkUpdateParams { /** - * Request body for creating or updating an origin cloud region mapping. + * Request body for creating or replacing an origin cloud region mapping. */ export interface Body { /** - * Origin IP address (IPv4 or IPv6). Normalized to canonical form before storage - * (RFC 5952 for IPv6). + * Origin IP address (IPv4 or IPv6). For the single PUT endpoint + * (`PUT /origin/cloud_regions/{origin_ip}`), this field must match the path + * parameter or the request will be rejected with a 400 error. For the batch PUT + * endpoint, this field identifies which mapping to upsert. */ - ip: string; + origin_ip: string; /** * Cloud vendor region identifier. Must be a valid region for the specified vendor @@ -664,31 +525,6 @@ export namespace OriginCloudRegionBulkEditParams { } } -export interface OriginCloudRegionEditParams { - /** - * Path param: Identifier. - */ - zone_id: string; - - /** - * Body param: Origin IP address (IPv4 or IPv6). Normalized to canonical form - * before storage (RFC 5952 for IPv6). - */ - ip: string; - - /** - * Body param: Cloud vendor region identifier. Must be a valid region for the - * specified vendor as returned by the supported_regions endpoint. - */ - region: string; - - /** - * Body param: Cloud vendor hosting the origin. Must be one of the supported - * vendors. - */ - vendor: 'aws' | 'azure' | 'gcp' | 'oci'; -} - export interface OriginCloudRegionGetParams { /** * Identifier. @@ -703,23 +539,21 @@ export interface OriginCloudRegionSupportedRegionsParams { zone_id: string; } +OriginCloudRegions.OriginCloudRegionsV4PagePaginationArray = OriginCloudRegionsV4PagePaginationArray; + export declare namespace OriginCloudRegions { export { type OriginCloudRegion as OriginCloudRegion, - type OriginCloudRegionCreateResponse as OriginCloudRegionCreateResponse, - type OriginCloudRegionListResponse as OriginCloudRegionListResponse, type OriginCloudRegionDeleteResponse as OriginCloudRegionDeleteResponse, type OriginCloudRegionBulkDeleteResponse as OriginCloudRegionBulkDeleteResponse, - type OriginCloudRegionBulkEditResponse as OriginCloudRegionBulkEditResponse, - type OriginCloudRegionEditResponse as OriginCloudRegionEditResponse, - type OriginCloudRegionGetResponse as OriginCloudRegionGetResponse, + type OriginCloudRegionBulkUpdateResponse as OriginCloudRegionBulkUpdateResponse, type OriginCloudRegionSupportedRegionsResponse as OriginCloudRegionSupportedRegionsResponse, - type OriginCloudRegionCreateParams as OriginCloudRegionCreateParams, + OriginCloudRegionsV4PagePaginationArray as OriginCloudRegionsV4PagePaginationArray, + type OriginCloudRegionUpdateParams as OriginCloudRegionUpdateParams, type OriginCloudRegionListParams as OriginCloudRegionListParams, type OriginCloudRegionDeleteParams as OriginCloudRegionDeleteParams, type OriginCloudRegionBulkDeleteParams as OriginCloudRegionBulkDeleteParams, - type OriginCloudRegionBulkEditParams as OriginCloudRegionBulkEditParams, - type OriginCloudRegionEditParams as OriginCloudRegionEditParams, + type OriginCloudRegionBulkUpdateParams as OriginCloudRegionBulkUpdateParams, type OriginCloudRegionGetParams as OriginCloudRegionGetParams, type OriginCloudRegionSupportedRegionsParams as OriginCloudRegionSupportedRegionsParams, }; diff --git a/tests/api-resources/cache/origin-cloud-regions.test.ts b/tests/api-resources/cache/origin-cloud-regions.test.ts index b6fdffa650..4e9739877b 100644 --- a/tests/api-resources/cache/origin-cloud-regions.test.ts +++ b/tests/api-resources/cache/origin-cloud-regions.test.ts @@ -10,10 +10,10 @@ const client = new Cloudflare({ }); describe('resource originCloudRegions', () => { - test('create: only required params', async () => { - const responsePromise = client.cache.originCloudRegions.create({ + test('update: only required params', async () => { + const responsePromise = client.cache.originCloudRegions.update('192.0.2.1', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - ip: '192.0.2.1', + origin_ip: '192.0.2.1', region: 'us-east-1', vendor: 'aws', }); @@ -26,10 +26,10 @@ describe('resource originCloudRegions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { - const response = await client.cache.originCloudRegions.create({ + test('update: required and optional params', async () => { + const response = await client.cache.originCloudRegions.update('192.0.2.1', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - ip: '192.0.2.1', + origin_ip: '192.0.2.1', region: 'us-east-1', vendor: 'aws', }); @@ -51,6 +51,8 @@ describe('resource originCloudRegions', () => { test('list: required and optional params', async () => { const response = await client.cache.originCloudRegions.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + page: 1, + per_page: 1, }); }); @@ -92,17 +94,17 @@ describe('resource originCloudRegions', () => { }); }); - test('bulkEdit: only required params', async () => { - const responsePromise = client.cache.originCloudRegions.bulkEdit({ + test('bulkUpdate: only required params', async () => { + const responsePromise = client.cache.originCloudRegions.bulkUpdate({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [ { - ip: '192.0.2.1', + origin_ip: '192.0.2.1', region: 'us-east-1', vendor: 'aws', }, { - ip: '2001:db8::1', + origin_ip: '2001:db8::1', region: 'us-central1', vendor: 'gcp', }, @@ -117,17 +119,17 @@ describe('resource originCloudRegions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('bulkEdit: required and optional params', async () => { - const response = await client.cache.originCloudRegions.bulkEdit({ + test('bulkUpdate: required and optional params', async () => { + const response = await client.cache.originCloudRegions.bulkUpdate({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [ { - ip: '192.0.2.1', + origin_ip: '192.0.2.1', region: 'us-east-1', vendor: 'aws', }, { - ip: '2001:db8::1', + origin_ip: '2001:db8::1', region: 'us-central1', vendor: 'gcp', }, @@ -135,31 +137,6 @@ describe('resource originCloudRegions', () => { }); }); - test('edit: only required params', async () => { - const responsePromise = client.cache.originCloudRegions.edit({ - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - ip: '2001:db8::1', - region: 'us-central1', - vendor: 'gcp', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('edit: required and optional params', async () => { - const response = await client.cache.originCloudRegions.edit({ - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - ip: '2001:db8::1', - region: 'us-central1', - vendor: 'gcp', - }); - }); - test('get: only required params', async () => { const responsePromise = client.cache.originCloudRegions.get('192.0.2.1', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', From 2704fcdfc250a227d8bc17406f1289d4a54e43b5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 16:30:26 +0000 Subject: [PATCH 06/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/resource-sharing/resource-sharing.ts | 8 ++++++++ .../resource-sharing/resource-sharing.test.ts | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 0d7a1867ad..95721e9a13 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2204 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 42dd4ac0ac3f5c00bbe80e26fed2fa51 +openapi_spec_hash: 1cb07cbc59f51be4843f63ea4357d7f2 config_hash: 0c33107d28fc9d1d5726d8ac8459421a diff --git a/src/resources/resource-sharing/resource-sharing.ts b/src/resources/resource-sharing/resource-sharing.ts index f6691eadcf..54d64a6227 100644 --- a/src/resources/resource-sharing/resource-sharing.ts +++ b/src/resources/resource-sharing/resource-sharing.ts @@ -938,6 +938,14 @@ export interface ResourceSharingListParams extends V4PagePaginationArrayParams { */ status?: 'active' | 'deleting' | 'deleted'; + /** + * Query param: Filter shares by tag. Each value is either `key=value` (matches + * shares whose tags contain that key/value pair) or `key` alone (matches shares + * that have any value for that key). May be repeated; multiple `tag` parameters + * are ANDed together. Maximum 20 `tag` parameters per request. + */ + tag?: Array; + /** * Query param: Filter shares by target_type. */ diff --git a/tests/api-resources/resource-sharing/resource-sharing.test.ts b/tests/api-resources/resource-sharing/resource-sharing.test.ts index f295e59b82..79d0cc8d72 100644 --- a/tests/api-resources/resource-sharing/resource-sharing.test.ts +++ b/tests/api-resources/resource-sharing/resource-sharing.test.ts @@ -98,6 +98,7 @@ describe('resource resourceSharing', () => { per_page: 20, resource_types: ['custom-ruleset'], status: 'active', + tag: ['env=production'], target_type: 'account', }); }); From a25246e8d3e6dc4d2fef99efbe0ecb3a84a15165 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 17:08:48 +0000 Subject: [PATCH 07/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/user/user.ts | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 95721e9a13..c8c80a20fe 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2204 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 1cb07cbc59f51be4843f63ea4357d7f2 +openapi_spec_hash: 43b3282cc17b94e7729c724d6a3c67ae config_hash: 0c33107d28fc9d1d5726d8ac8459421a diff --git a/src/resources/user/user.ts b/src/resources/user/user.ts index 836bf78b22..cc3e67bba2 100644 --- a/src/resources/user/user.ts +++ b/src/resources/user/user.ts @@ -76,7 +76,12 @@ export interface UserEditResponse { /** * Identifier of the user. */ - id?: string; + id: string; + + /** + * Current email address of the user. + */ + email: string; /** * Lists the betas that the user is participating in. @@ -147,7 +152,12 @@ export interface UserGetResponse { /** * Identifier of the user. */ - id?: string; + id: string; + + /** + * Current email address of the user. + */ + email: string; /** * Lists the betas that the user is participating in. From dfc4b172fd218a4a85acf8218fec12ad6cca6711 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 21:21:32 +0000 Subject: [PATCH 08/73] feat: feat(cache): add create (POST) method for smart_tiered_cache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(cache): add create (POST) method for smart_tiered_cache Add the missing create method to smart_tiered_cache subresource. The POST endpoint for tiered_cache_smart_topology_enable was already in the api-gateway but missing from the Stainless config. Removes the internal-only endpoints (cache_limit_rate, cache_reserve_jurisdiction, class_of_service) from the original APIX-592 MR — these have no api-gateway routes and are not customer-facing. Closes CACHE-13445 --- .stats.yml | 4 +- src/resources/cache/api.md | 2 + src/resources/cache/cache.ts | 4 ++ src/resources/cache/index.ts | 2 + src/resources/cache/smart-tiered-cache.ts | 66 +++++++++++++++++++ .../cache/smart-tiered-cache.test.ts | 21 ++++++ 6 files changed, 97 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c8c80a20fe..5be486d5dd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2204 +configured_endpoints: 2205 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 43b3282cc17b94e7729c724d6a3c67ae -config_hash: 0c33107d28fc9d1d5726d8ac8459421a +config_hash: 25d6458459b0af390a57abd94fb34218 diff --git a/src/resources/cache/api.md b/src/resources/cache/api.md index 2887704bcc..14e19f79a7 100644 --- a/src/resources/cache/api.md +++ b/src/resources/cache/api.md @@ -31,12 +31,14 @@ Methods: Types: +- SmartTieredCacheCreateResponse - SmartTieredCacheDeleteResponse - SmartTieredCacheEditResponse - SmartTieredCacheGetResponse Methods: +- client.cache.smartTieredCache.create({ ...params }) -> SmartTieredCacheCreateResponse - client.cache.smartTieredCache.delete({ ...params }) -> SmartTieredCacheDeleteResponse - client.cache.smartTieredCache.edit({ ...params }) -> SmartTieredCacheEditResponse - client.cache.smartTieredCache.get({ ...params }) -> SmartTieredCacheGetResponse diff --git a/src/resources/cache/cache.ts b/src/resources/cache/cache.ts index 78109bfc0b..9b81afbac2 100644 --- a/src/resources/cache/cache.ts +++ b/src/resources/cache/cache.ts @@ -46,6 +46,8 @@ import { import * as SmartTieredCacheAPI from './smart-tiered-cache'; import { SmartTieredCache, + SmartTieredCacheCreateParams, + SmartTieredCacheCreateResponse, SmartTieredCacheDeleteParams, SmartTieredCacheDeleteResponse, SmartTieredCacheEditParams, @@ -286,9 +288,11 @@ export declare namespace Cache { export { SmartTieredCache as SmartTieredCache, + type SmartTieredCacheCreateResponse as SmartTieredCacheCreateResponse, type SmartTieredCacheDeleteResponse as SmartTieredCacheDeleteResponse, type SmartTieredCacheEditResponse as SmartTieredCacheEditResponse, type SmartTieredCacheGetResponse as SmartTieredCacheGetResponse, + type SmartTieredCacheCreateParams as SmartTieredCacheCreateParams, type SmartTieredCacheDeleteParams as SmartTieredCacheDeleteParams, type SmartTieredCacheEditParams as SmartTieredCacheEditParams, type SmartTieredCacheGetParams as SmartTieredCacheGetParams, diff --git a/src/resources/cache/index.ts b/src/resources/cache/index.ts index f10ef06193..adb610c246 100644 --- a/src/resources/cache/index.ts +++ b/src/resources/cache/index.ts @@ -41,9 +41,11 @@ export { } from './regional-tiered-cache'; export { SmartTieredCache, + type SmartTieredCacheCreateResponse, type SmartTieredCacheDeleteResponse, type SmartTieredCacheEditResponse, type SmartTieredCacheGetResponse, + type SmartTieredCacheCreateParams, type SmartTieredCacheDeleteParams, type SmartTieredCacheEditParams, type SmartTieredCacheGetParams, diff --git a/src/resources/cache/smart-tiered-cache.ts b/src/resources/cache/smart-tiered-cache.ts index 0acc9f466a..b445aaad66 100644 --- a/src/resources/cache/smart-tiered-cache.ts +++ b/src/resources/cache/smart-tiered-cache.ts @@ -4,6 +4,36 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; export class SmartTieredCache extends APIResource { + /** + * 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. + * + * @example + * ```ts + * const smartTieredCache = + * await client.cache.smartTieredCache.create({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * value: 'on', + * }); + * ``` + */ + create( + params: SmartTieredCacheCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/cache/tiered_cache_smart_topology_enable`, { + body, + ...options, + }) as Core.APIPromise<{ result: SmartTieredCacheCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + /** * 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 @@ -92,6 +122,28 @@ export class SmartTieredCache extends APIResource { } } +export interface SmartTieredCacheCreateResponse { + /** + * The identifier of the caching setting. + */ + id: 'tiered_cache_smart_topology_enable'; + + /** + * Whether the setting is editable. + */ + editable: boolean; + + /** + * Value of the Smart Tiered Cache zone setting. + */ + value: 'on' | 'off'; + + /** + * Last time this setting was modified. + */ + modified_on?: string | null; +} + export interface SmartTieredCacheDeleteResponse { /** * The identifier of the caching setting. @@ -153,6 +205,18 @@ export interface SmartTieredCacheGetResponse { modified_on?: string | null; } +export interface SmartTieredCacheCreateParams { + /** + * Path param: Identifier. + */ + zone_id: string; + + /** + * Body param: Enable or disable the Smart Tiered Cache. + */ + value: 'on' | 'off'; +} + export interface SmartTieredCacheDeleteParams { /** * Identifier. @@ -181,9 +245,11 @@ export interface SmartTieredCacheGetParams { export declare namespace SmartTieredCache { export { + type SmartTieredCacheCreateResponse as SmartTieredCacheCreateResponse, type SmartTieredCacheDeleteResponse as SmartTieredCacheDeleteResponse, type SmartTieredCacheEditResponse as SmartTieredCacheEditResponse, type SmartTieredCacheGetResponse as SmartTieredCacheGetResponse, + type SmartTieredCacheCreateParams as SmartTieredCacheCreateParams, type SmartTieredCacheDeleteParams as SmartTieredCacheDeleteParams, type SmartTieredCacheEditParams as SmartTieredCacheEditParams, type SmartTieredCacheGetParams as SmartTieredCacheGetParams, diff --git a/tests/api-resources/cache/smart-tiered-cache.test.ts b/tests/api-resources/cache/smart-tiered-cache.test.ts index b1409dc28a..df25a0d0cd 100644 --- a/tests/api-resources/cache/smart-tiered-cache.test.ts +++ b/tests/api-resources/cache/smart-tiered-cache.test.ts @@ -10,6 +10,27 @@ const client = new Cloudflare({ }); describe('resource smartTieredCache', () => { + test('create: only required params', async () => { + const responsePromise = client.cache.smartTieredCache.create({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + value: 'on', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.cache.smartTieredCache.create({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + value: 'on', + }); + }); + test('delete: only required params', async () => { const responsePromise = client.cache.smartTieredCache.delete({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', From 4dc290b7251ae7101d5b3306436dd43ad6666a7b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 21:31:25 +0000 Subject: [PATCH 09/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 5be486d5dd..f58eeaf15c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2205 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 43b3282cc17b94e7729c724d6a3c67ae -config_hash: 25d6458459b0af390a57abd94fb34218 +config_hash: 738e0c7378ea7821d530b044c332db9e From 987ce04936267bb3df4d4fc03c26a101339cb190 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 21:39:29 +0000 Subject: [PATCH 10/73] feat: feat(radar): add BGP RPKI ROAs timeseries and BGP IPs top ASes endpoints * feat(radar): add BGP RPKI ROAs timeseries and BGP IPs top ASes endpoints - Add /radar/bgp/rpki/roas/timeseries - Add /radar/bgp/ips/top/ases RADAR-7051 --- .stats.yml | 4 +- scripts/detect-breaking-changes | 4 +- src/resources/radar/api.md | 24 +- src/resources/radar/bgp/bgp.ts | 4 +- src/resources/radar/bgp/index.ts | 2 +- src/resources/radar/bgp/ips.ts | 286 +---------------- src/resources/radar/bgp/ips/index.ts | 4 + src/resources/radar/bgp/ips/ips.ts | 295 ++++++++++++++++++ src/resources/radar/bgp/ips/top.ts | 84 +++++ src/resources/radar/bgp/rpki/index.ts | 1 + src/resources/radar/bgp/rpki/roas.ts | 120 +++++++ src/resources/radar/bgp/rpki/rpki.ts | 10 + .../radar/bgp/{ => ips}/ips.test.ts | 0 tests/api-resources/radar/bgp/ips/top.test.ts | 46 +++ .../api-resources/radar/bgp/rpki/roas.test.ts | 48 +++ 15 files changed, 639 insertions(+), 293 deletions(-) create mode 100644 src/resources/radar/bgp/ips/index.ts create mode 100644 src/resources/radar/bgp/ips/ips.ts create mode 100644 src/resources/radar/bgp/ips/top.ts create mode 100644 src/resources/radar/bgp/rpki/roas.ts rename tests/api-resources/radar/bgp/{ => ips}/ips.test.ts (100%) create mode 100644 tests/api-resources/radar/bgp/ips/top.test.ts create mode 100644 tests/api-resources/radar/bgp/rpki/roas.test.ts diff --git a/.stats.yml b/.stats.yml index f58eeaf15c..abff5e52b7 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2205 +configured_endpoints: 2207 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 43b3282cc17b94e7729c724d6a3c67ae -config_hash: 738e0c7378ea7821d530b044c332db9e +config_hash: 82bd9683d33d942855962bb7dc595067 diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 0a0c791c75..2c9955e3e1 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -627,9 +627,11 @@ TEST_PATHS=( tests/api-resources/radar/bgp/hijacks/hijacks.test.ts tests/api-resources/radar/bgp/hijacks/events.test.ts tests/api-resources/radar/bgp/routes.test.ts - tests/api-resources/radar/bgp/ips.test.ts + tests/api-resources/radar/bgp/ips/ips.test.ts + tests/api-resources/radar/bgp/ips/top.test.ts tests/api-resources/radar/bgp/rpki/rpki.test.ts tests/api-resources/radar/bgp/rpki/aspa.test.ts + tests/api-resources/radar/bgp/rpki/roas.test.ts tests/api-resources/radar/bots/bots.test.ts tests/api-resources/radar/bots/web-crawlers.test.ts tests/api-resources/radar/datasets.test.ts diff --git a/src/resources/radar/api.md b/src/resources/radar/api.md index 45c83dd511..495cf7521d 100644 --- a/src/resources/radar/api.md +++ b/src/resources/radar/api.md @@ -250,11 +250,21 @@ Methods: Types: -- IPTimeseriesResponse +- IPTimeseriesResponse Methods: -- client.radar.bgp.ips.timeseries({ ...params }) -> IPTimeseriesResponse +- client.radar.bgp.ips.timeseries({ ...params }) -> IPTimeseriesResponse + +#### Top + +Types: + +- TopAsesResponse + +Methods: + +- client.radar.bgp.ips.top.ases({ ...params }) -> TopAsesResponse ### RPKI @@ -272,6 +282,16 @@ Methods: - client.radar.bgp.rpki.aspa.snapshot({ ...params }) -> ASPASnapshotResponse - client.radar.bgp.rpki.aspa.timeseries({ ...params }) -> ASPATimeseriesResponse +#### Roas + +Types: + +- RoaTimeseriesResponse + +Methods: + +- client.radar.bgp.rpki.roas.timeseries({ ...params }) -> RoaTimeseriesResponse + ## Bots Types: diff --git a/src/resources/radar/bgp/bgp.ts b/src/resources/radar/bgp/bgp.ts index 4166d818fb..63edf9133f 100644 --- a/src/resources/radar/bgp/bgp.ts +++ b/src/resources/radar/bgp/bgp.ts @@ -3,8 +3,6 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; -import * as IPsAPI from './ips'; -import { IPTimeseriesParams, IPTimeseriesResponse, IPs } from './ips'; import * as RoutesAPI from './routes'; import { RouteAsesParams, @@ -21,6 +19,8 @@ import { } from './routes'; import * as HijacksAPI from './hijacks/hijacks'; import { Hijacks } from './hijacks/hijacks'; +import * as IPsAPI from './ips/ips'; +import { IPTimeseriesParams, IPTimeseriesResponse, IPs } from './ips/ips'; import * as LeaksAPI from './leaks/leaks'; import { Leaks } from './leaks/leaks'; import * as RPKIAPI from './rpki/rpki'; diff --git a/src/resources/radar/bgp/index.ts b/src/resources/radar/bgp/index.ts index ba86e6033a..e958cefdc0 100644 --- a/src/resources/radar/bgp/index.ts +++ b/src/resources/radar/bgp/index.ts @@ -2,7 +2,7 @@ export { BGP, type BGPTimeseriesResponse, type BGPTimeseriesParams } from './bgp'; export { Hijacks } from './hijacks/index'; -export { IPs, type IPTimeseriesResponse, type IPTimeseriesParams } from './ips'; +export { IPs, type IPTimeseriesResponse, type IPTimeseriesParams } from './ips/index'; export { Leaks } from './leaks/index'; export { RPKI } from './rpki/index'; export { diff --git a/src/resources/radar/bgp/ips.ts b/src/resources/radar/bgp/ips.ts index 9146957338..33d0c49764 100644 --- a/src/resources/radar/bgp/ips.ts +++ b/src/resources/radar/bgp/ips.ts @@ -1,287 +1,3 @@ // 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 IPs extends APIResource { - /** - * Retrieves time series data for the announced IP space count, represented as the - * number of IPv4 /24s and IPv6 /48s, for a given ASN. - * - * @example - * ```ts - * const response = await client.radar.bgp.ips.timeseries(); - * ``` - */ - timeseries( - query?: IPTimeseriesParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - timeseries(options?: Core.RequestOptions): Core.APIPromise; - timeseries( - query: IPTimeseriesParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.timeseries({}, query); - } - return ( - this._client.get('/radar/bgp/ips/timeseries', { query, ...options }) as Core.APIPromise<{ - result: IPTimeseriesResponse; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export interface IPTimeseriesResponse { - /** - * Metadata for the results. - */ - meta: IPTimeseriesResponse.Meta; - - serie_0: IPTimeseriesResponse.Serie0; -} - -export namespace IPTimeseriesResponse { - /** - * Metadata for the results. - */ - export interface Meta { - /** - * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). - * Refer to - * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). - */ - aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; - - confidenceInfo: Meta.ConfidenceInfo; - - dateRange: Array; - - /** - * Timestamp of the last dataset update. - */ - lastUpdated: string; - - /** - * Normalization method applied to the results. Refer to - * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). - */ - normalization: - | 'PERCENTAGE' - | 'MIN0_MAX' - | 'MIN_MAX' - | 'RAW_VALUES' - | 'PERCENTAGE_CHANGE' - | 'ROLLING_AVERAGE' - | 'OVERLAPPED_PERCENTAGE' - | 'RATIO'; - - /** - * Measurement units for the results. - */ - units: Array; - - delay?: Meta.Delay; - } - - export namespace Meta { - export interface ConfidenceInfo { - annotations: Array; - - /** - * Provides an indication of how much confidence Cloudflare has in the data. - */ - level: number; - } - - export namespace ConfidenceInfo { - /** - * Annotation associated with the result (e.g. outage or other type of event). - */ - export interface Annotation { - /** - * Data source for annotations. - */ - dataSource: - | 'ALL' - | 'AI_BOTS' - | 'AI_GATEWAY' - | 'BGP' - | 'BOTS' - | 'CONNECTION_ANOMALY' - | 'CT' - | 'DNS' - | 'DNS_MAGNITUDE' - | 'DNS_AS112' - | 'DOS' - | 'EMAIL_ROUTING' - | 'EMAIL_SECURITY' - | 'FW' - | 'FW_PG' - | 'HTTP' - | 'HTTP_CONTROL' - | 'HTTP_CRAWLER_REFERER' - | 'HTTP_ORIGINS' - | 'IQI' - | 'LEAKED_CREDENTIALS' - | 'NET' - | 'ROBOTS_TXT' - | 'SPEED' - | 'WORKERS_AI'; - - description: string; - - endDate: string; - - /** - * Event type for annotations. - */ - eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; - - /** - * Whether event is a single point in time or a time range. - */ - isInstantaneous: boolean; - - linkedUrl: string; - - startDate: string; - } - } - - export interface DateRange { - /** - * Adjusted end of date range. - */ - endTime: string; - - /** - * Adjusted start of date range. - */ - startTime: string; - } - - export interface Unit { - name: string; - - value: string; - } - - export interface Delay { - asn_data: Delay.ASNData; - - country_data: Delay.CountryData; - - healthy: boolean; - - nowTs: number; - } - - export namespace Delay { - export interface ASNData { - delaySecs: number; - - delayStr: string; - - healthy: boolean; - - latest: ASNData.Latest; - } - - export namespace ASNData { - export interface Latest { - entries_count: number; - - path: string; - - timestamp: number; - } - } - - export interface CountryData { - delaySecs: number; - - delayStr: string; - - healthy: boolean; - - latest: CountryData.Latest; - } - - export namespace CountryData { - export interface Latest { - count: number; - - timestamp: number; - } - } - } - } - - export interface Serie0 { - ipv4: Array; - - ipv6: Array; - - timestamps: Array; - } -} - -export interface IPTimeseriesParams { - /** - * Filters results by Autonomous System. Specify one or more Autonomous System - * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from - * results. For example, `-174, 3356` excludes results from AS174, but includes - * results from AS3356. - */ - asn?: Array; - - /** - * End of the date range (inclusive). - */ - dateEnd?: Array; - - /** - * Filters results by date range. 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; - - /** - * Start of the date range. - */ - dateStart?: Array; - - /** - * Format in which results will be returned. - */ - format?: 'JSON' | 'CSV'; - - /** - * Includes data delay meta information. - */ - includeDelay?: boolean; - - /** - * Filters results by IP version (Ipv4 vs. IPv6). - */ - ipVersion?: Array<'IPv4' | 'IPv6'>; - - /** - * Filters results by location. Specify a comma-separated list of alpha-2 location - * codes. - */ - location?: Array; - - /** - * Array of names used to label the series in the response. - */ - name?: Array; -} - -export declare namespace IPs { - export { type IPTimeseriesResponse as IPTimeseriesResponse, type IPTimeseriesParams as IPTimeseriesParams }; -} +export * from './ips/index'; diff --git a/src/resources/radar/bgp/ips/index.ts b/src/resources/radar/bgp/ips/index.ts new file mode 100644 index 0000000000..b8ca47dbc8 --- /dev/null +++ b/src/resources/radar/bgp/ips/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { IPs, type IPTimeseriesResponse, type IPTimeseriesParams } from './ips'; +export { Top, type TopAsesResponse, type TopAsesParams } from './top'; diff --git a/src/resources/radar/bgp/ips/ips.ts b/src/resources/radar/bgp/ips/ips.ts new file mode 100644 index 0000000000..954d5a4b4b --- /dev/null +++ b/src/resources/radar/bgp/ips/ips.ts @@ -0,0 +1,295 @@ +// 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 TopAPI from './top'; +import { Top, TopAsesParams, TopAsesResponse } from './top'; + +export class IPs extends APIResource { + top: TopAPI.Top = new TopAPI.Top(this._client); + + /** + * Retrieves time series data for the announced IP space count, represented as the + * number of IPv4 /24s and IPv6 /48s, for a given ASN. + * + * @example + * ```ts + * const response = await client.radar.bgp.ips.timeseries(); + * ``` + */ + timeseries( + query?: IPTimeseriesParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseries(options?: Core.RequestOptions): Core.APIPromise; + timeseries( + query: IPTimeseriesParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseries({}, query); + } + return ( + this._client.get('/radar/bgp/ips/timeseries', { query, ...options }) as Core.APIPromise<{ + result: IPTimeseriesResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface IPTimeseriesResponse { + /** + * Metadata for the results. + */ + meta: IPTimeseriesResponse.Meta; + + serie_0: IPTimeseriesResponse.Serie0; +} + +export namespace IPTimeseriesResponse { + /** + * Metadata for the results. + */ + export interface Meta { + /** + * Aggregation interval of the results (e.g., in 15 minutes or 1 hour intervals). + * Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval: 'FIFTEEN_MINUTES' | 'ONE_HOUR' | 'ONE_DAY' | 'ONE_WEEK' | 'ONE_MONTH'; + + confidenceInfo: Meta.ConfidenceInfo; + + dateRange: Array; + + /** + * Timestamp of the last dataset update. + */ + lastUpdated: string; + + /** + * Normalization method applied to the results. Refer to + * [Normalization methods](https://developers.cloudflare.com/radar/concepts/normalization/). + */ + normalization: + | 'PERCENTAGE' + | 'MIN0_MAX' + | 'MIN_MAX' + | 'RAW_VALUES' + | 'PERCENTAGE_CHANGE' + | 'ROLLING_AVERAGE' + | 'OVERLAPPED_PERCENTAGE' + | 'RATIO'; + + /** + * Measurement units for the results. + */ + units: Array; + + delay?: Meta.Delay; + } + + export namespace Meta { + export interface ConfidenceInfo { + annotations: Array; + + /** + * Provides an indication of how much confidence Cloudflare has in the data. + */ + level: number; + } + + export namespace ConfidenceInfo { + /** + * Annotation associated with the result (e.g. outage or other type of event). + */ + export interface Annotation { + /** + * Data source for annotations. + */ + dataSource: + | 'ALL' + | 'AI_BOTS' + | 'AI_GATEWAY' + | 'BGP' + | 'BOTS' + | 'CONNECTION_ANOMALY' + | 'CT' + | 'DNS' + | 'DNS_MAGNITUDE' + | 'DNS_AS112' + | 'DOS' + | 'EMAIL_ROUTING' + | 'EMAIL_SECURITY' + | 'FW' + | 'FW_PG' + | 'HTTP' + | 'HTTP_CONTROL' + | 'HTTP_CRAWLER_REFERER' + | 'HTTP_ORIGINS' + | 'IQI' + | 'LEAKED_CREDENTIALS' + | 'NET' + | 'ROBOTS_TXT' + | 'SPEED' + | 'WORKERS_AI'; + + description: string; + + endDate: string; + + /** + * Event type for annotations. + */ + eventType: 'EVENT' | 'GENERAL' | 'OUTAGE' | 'PARTIAL_PROJECTION' | 'PIPELINE' | 'TRAFFIC_ANOMALY'; + + /** + * Whether event is a single point in time or a time range. + */ + isInstantaneous: boolean; + + linkedUrl: string; + + startDate: string; + } + } + + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface Unit { + name: string; + + value: string; + } + + export interface Delay { + asn_data: Delay.ASNData; + + country_data: Delay.CountryData; + + healthy: boolean; + + nowTs: number; + } + + export namespace Delay { + export interface ASNData { + delaySecs: number; + + delayStr: string; + + healthy: boolean; + + latest: ASNData.Latest; + } + + export namespace ASNData { + export interface Latest { + entries_count: number; + + path: string; + + timestamp: number; + } + } + + export interface CountryData { + delaySecs: number; + + delayStr: string; + + healthy: boolean; + + latest: CountryData.Latest; + } + + export namespace CountryData { + export interface Latest { + count: number; + + timestamp: number; + } + } + } + } + + export interface Serie0 { + ipv4: Array; + + ipv6: Array; + + timestamps: Array; + } +} + +export interface IPTimeseriesParams { + /** + * Filters results by Autonomous System. Specify one or more Autonomous System + * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from + * results. For example, `-174, 3356` excludes results from AS174, but includes + * results from AS3356. + */ + asn?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * Filters results by date range. 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; + + /** + * Start of the date range. + */ + dateStart?: Array; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Includes data delay meta information. + */ + includeDelay?: boolean; + + /** + * Filters results by IP version (Ipv4 vs. IPv6). + */ + ipVersion?: Array<'IPv4' | 'IPv6'>; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 location + * codes. + */ + location?: Array; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; +} + +IPs.Top = Top; + +export declare namespace IPs { + export { type IPTimeseriesResponse as IPTimeseriesResponse, type IPTimeseriesParams as IPTimeseriesParams }; + + export { Top as Top, type TopAsesResponse as TopAsesResponse, type TopAsesParams as TopAsesParams }; +} diff --git a/src/resources/radar/bgp/ips/top.ts b/src/resources/radar/bgp/ips/top.ts new file mode 100644 index 0000000000..8c8df3ae44 --- /dev/null +++ b/src/resources/radar/bgp/ips/top.ts @@ -0,0 +1,84 @@ +// 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 Top extends APIResource { + /** + * Returns the top-N autonomous systems by announced IP space at the nearest 8-hour + * RIB boundary at or before the requested date. The snapped boundary is returned + * as `anchor_ts`. + * + * @example + * ```ts + * const response = await client.radar.bgp.ips.top.ases(); + * ``` + */ + ases(query?: TopAsesParams, options?: Core.RequestOptions): Core.APIPromise; + ases(options?: Core.RequestOptions): Core.APIPromise; + ases( + query: TopAsesParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.ases({}, query); + } + return ( + this._client.get('/radar/bgp/ips/top/ases', { query, ...options }) as Core.APIPromise<{ + result: TopAsesResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface TopAsesResponse { + anchorTs: string; + + asns: Array; + + country: string | null; + + metric: string; +} + +export namespace TopAsesResponse { + export interface ASN { + asn: number; + + v4_24s: number; + + v6_48s: number; + } +} + +export interface TopAsesParams { + /** + * Optional ISO 3166-1 alpha-2 country filter. Omit for global top-N. + */ + country?: string; + + /** + * Filters results by the specified datetime (ISO 8601). + */ + date?: string; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Limits the number of objects returned in the response. + */ + limit?: number; + + /** + * Ranking metric: IPv4 /24 count or IPv6 /48 count. + */ + metric?: 'v4_24s' | 'v6_48s'; +} + +export declare namespace Top { + export { type TopAsesResponse as TopAsesResponse, type TopAsesParams as TopAsesParams }; +} diff --git a/src/resources/radar/bgp/rpki/index.ts b/src/resources/radar/bgp/rpki/index.ts index 342fcc7277..51480f3d22 100644 --- a/src/resources/radar/bgp/rpki/index.ts +++ b/src/resources/radar/bgp/rpki/index.ts @@ -10,3 +10,4 @@ export { type ASPATimeseriesParams, } from './aspa'; export { RPKI } from './rpki'; +export { Roas, type RoaTimeseriesResponse, type RoaTimeseriesParams } from './roas'; diff --git a/src/resources/radar/bgp/rpki/roas.ts b/src/resources/radar/bgp/rpki/roas.ts new file mode 100644 index 0000000000..634c00377c --- /dev/null +++ b/src/resources/radar/bgp/rpki/roas.ts @@ -0,0 +1,120 @@ +// 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 Roas extends APIResource { + /** + * Retrieves RPKI ROA (Route Origin Authorization) validation ratios over time. + * Returns the selected metric as a time series. Supports filtering by ASN or + * location (country code) — multiple values of the same filter type produce one + * series per value. If no ASN or location is specified, returns the global + * aggregate. + * + * @example + * ```ts + * const response = + * await client.radar.bgp.rpki.roas.timeseries(); + * ``` + */ + timeseries( + query?: RoaTimeseriesParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseries(options?: Core.RequestOptions): Core.APIPromise; + timeseries( + query: RoaTimeseriesParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseries({}, query); + } + return ( + this._client.get('/radar/bgp/rpki/roas/timeseries', { query, ...options }) as Core.APIPromise<{ + result: RoaTimeseriesResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface RoaTimeseriesResponse { + meta: RoaTimeseriesResponse.Meta; + + serie_0: RoaTimeseriesResponse.Serie0; +} + +export namespace RoaTimeseriesResponse { + export interface Meta { + /** + * Timestamp of the underlying data. + */ + dataTime: string; + + /** + * Timestamp when the query was executed. + */ + queryTime: string; + } + + export interface Serie0 { + timestamps: Array; + + values: Array; + } +} + +export interface RoaTimeseriesParams { + /** + * Filters results by Autonomous System Number. Specify one or more ASNs. Multiple + * values generate one series per ASN. + */ + asn?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: string; + + /** + * Start of the date range (inclusive). + */ + dateStart?: string; + + /** + * Format in which results will be returned. + */ + format?: 'JSON' | 'CSV'; + + /** + * Filters results by location. Specify a comma-separated list of alpha-2 location + * codes. + */ + location?: Array; + + /** + * Which RPKI ROA validation metric to return. validPfxsRatio = ratio of RPKI-valid + * prefixes (IPv4+IPv6 combined). validPfxsV4Ratio / validPfxsV6Ratio = same, split + * by IP version. validIpsRatio = ratio of RPKI-valid address space (IPv4 /24s + + * IPv6 /48s). validIpsV4Ratio / validIpsV6Ratio = same, split by IP version. + */ + metric?: + | 'validPfxsRatio' + | 'validPfxsV4Ratio' + | 'validPfxsV6Ratio' + | 'validIpsRatio' + | 'validIpsV4Ratio' + | 'validIpsV6Ratio'; + + /** + * Array of names used to label the series in the response. + */ + name?: Array; +} + +export declare namespace Roas { + export { + type RoaTimeseriesResponse as RoaTimeseriesResponse, + type RoaTimeseriesParams as RoaTimeseriesParams, + }; +} diff --git a/src/resources/radar/bgp/rpki/rpki.ts b/src/resources/radar/bgp/rpki/rpki.ts index e5f7f9c4e0..f9680107b5 100644 --- a/src/resources/radar/bgp/rpki/rpki.ts +++ b/src/resources/radar/bgp/rpki/rpki.ts @@ -11,12 +11,16 @@ import { ASPATimeseriesParams, ASPATimeseriesResponse, } from './aspa'; +import * as RoasAPI from './roas'; +import { RoaTimeseriesParams, RoaTimeseriesResponse, Roas } from './roas'; export class RPKI extends APIResource { aspa: ASPAAPI.ASPA = new ASPAAPI.ASPA(this._client); + roas: RoasAPI.Roas = new RoasAPI.Roas(this._client); } RPKI.ASPA = ASPA; +RPKI.Roas = Roas; export declare namespace RPKI { export { @@ -28,4 +32,10 @@ export declare namespace RPKI { type ASPASnapshotParams as ASPASnapshotParams, type ASPATimeseriesParams as ASPATimeseriesParams, }; + + export { + Roas as Roas, + type RoaTimeseriesResponse as RoaTimeseriesResponse, + type RoaTimeseriesParams as RoaTimeseriesParams, + }; } diff --git a/tests/api-resources/radar/bgp/ips.test.ts b/tests/api-resources/radar/bgp/ips/ips.test.ts similarity index 100% rename from tests/api-resources/radar/bgp/ips.test.ts rename to tests/api-resources/radar/bgp/ips/ips.test.ts diff --git a/tests/api-resources/radar/bgp/ips/top.test.ts b/tests/api-resources/radar/bgp/ips/top.test.ts new file mode 100644 index 0000000000..f7394d63d4 --- /dev/null +++ b/tests/api-resources/radar/bgp/ips/top.test.ts @@ -0,0 +1,46 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource top', () => { + test('ases', async () => { + const responsePromise = client.radar.bgp.ips.top.ases(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('ases: request options instead of params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect(client.radar.bgp.ips.top.ases({ path: '/_stainless_unknown_path' })).rejects.toThrow( + Cloudflare.NotFoundError, + ); + }); + + test('ases: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.radar.bgp.ips.top.ases( + { + country: 'US', + date: '2024-09-19T00:00:00Z', + format: 'JSON', + limit: 5, + metric: 'v4_24s', + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Cloudflare.NotFoundError); + }); +}); diff --git a/tests/api-resources/radar/bgp/rpki/roas.test.ts b/tests/api-resources/radar/bgp/rpki/roas.test.ts new file mode 100644 index 0000000000..70fb0b43e7 --- /dev/null +++ b/tests/api-resources/radar/bgp/rpki/roas.test.ts @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource roas', () => { + test('timeseries', async () => { + const responsePromise = client.radar.bgp.rpki.roas.timeseries(); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('timeseries: request options instead of params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect(client.radar.bgp.rpki.roas.timeseries({ path: '/_stainless_unknown_path' })).rejects.toThrow( + Cloudflare.NotFoundError, + ); + }); + + test('timeseries: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.radar.bgp.rpki.roas.timeseries( + { + asn: ['string'], + dateEnd: '2023-09-01T11:41:33.782Z', + dateStart: '2023-09-01T11:41:33.782Z', + format: 'JSON', + location: ['string'], + metric: 'validPfxsRatio', + name: ['main_series'], + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Cloudflare.NotFoundError); + }); +}); From 887ca8c3ce39302a3a41ce91f57e20c3674acc96 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 21:44:55 +0000 Subject: [PATCH 11/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index abff5e52b7..cc241adb91 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2207 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 43b3282cc17b94e7729c724d6a3c67ae -config_hash: 82bd9683d33d942855962bb7dc595067 +config_hash: e84ce27865a87048dfceb774cac9c0fd From 956d874b30a5c45372f1e0835fcc66f5cbba537d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 23:37:48 +0000 Subject: [PATCH 12/73] chore(api): update composite API spec --- .stats.yml | 2 +- .../monitor-groups/monitor-groups.ts | 25 ++----------------- .../resource-sharing/resource-sharing.ts | 19 +++++++++----- src/resources/resource-sharing/resources.ts | 21 ++++++++++------ .../monitor-groups/monitor-groups.test.ts | 6 ----- 5 files changed, 30 insertions(+), 43 deletions(-) diff --git a/.stats.yml b/.stats.yml index cc241adb91..49516dea71 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2207 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 43b3282cc17b94e7729c724d6a3c67ae +openapi_spec_hash: 512888090352626a0937b97e77f93c6c config_hash: e84ce27865a87048dfceb774cac9c0fd diff --git a/src/resources/load-balancers/monitor-groups/monitor-groups.ts b/src/resources/load-balancers/monitor-groups/monitor-groups.ts index 0c74989ebc..79117bf5b3 100644 --- a/src/resources/load-balancers/monitor-groups/monitor-groups.ts +++ b/src/resources/load-balancers/monitor-groups/monitor-groups.ts @@ -22,7 +22,6 @@ export class MonitorGroups extends APIResource { * const monitorGroup = * await client.loadBalancers.monitorGroups.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * id: 'id', * description: 'Primary datacenter monitors', * members: [ * { @@ -55,7 +54,6 @@ export class MonitorGroups extends APIResource { * '17b5962d775c646f3f9725cbc7a53df4', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * id: 'id', * description: 'Primary datacenter monitors', * members: [ * { @@ -144,7 +142,6 @@ export class MonitorGroups extends APIResource { * '17b5962d775c646f3f9725cbc7a53df4', * { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', - * id: 'id', * description: 'Primary datacenter monitors', * members: [ * { @@ -221,12 +218,12 @@ export interface MonitorGroup { /** * The timestamp of when the monitor group was created */ - created_at?: string; + created_on?: string; /** * The timestamp of when the monitor group was last updated */ - updated_at?: string; + modified_on?: string; } export namespace MonitorGroup { @@ -270,12 +267,6 @@ export interface MonitorGroupCreateParams { */ account_id: string; - /** - * Body param: The ID of the Monitor Group to use for checking the health of - * origins within this pool. - */ - id: string; - /** * Body param: A short description of the monitor group */ @@ -318,12 +309,6 @@ export interface MonitorGroupUpdateParams { */ account_id: string; - /** - * Body param: The ID of the Monitor Group to use for checking the health of - * origins within this pool. - */ - id: string; - /** * Body param: A short description of the monitor group */ @@ -380,12 +365,6 @@ export interface MonitorGroupEditParams { */ account_id: string; - /** - * Body param: The ID of the Monitor Group to use for checking the health of - * origins within this pool. - */ - id: string; - /** * Body param: A short description of the monitor group */ diff --git a/src/resources/resource-sharing/resource-sharing.ts b/src/resources/resource-sharing/resource-sharing.ts index 54d64a6227..419f3b97b5 100644 --- a/src/resources/resource-sharing/resource-sharing.ts +++ b/src/resources/resource-sharing/resource-sharing.ts @@ -291,7 +291,8 @@ export namespace ResourceSharingCreateResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -418,7 +419,8 @@ export namespace ResourceSharingUpdateResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -545,7 +547,8 @@ export namespace ResourceSharingListResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -672,7 +675,8 @@ export namespace ResourceSharingDeleteResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -799,7 +803,8 @@ export namespace ResourceSharingGetResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -875,7 +880,8 @@ export namespace ResourceSharingCreateParams { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; } } @@ -931,6 +937,7 @@ export interface ResourceSharingListParams extends V4PagePaginationArrayParams { | 'gateway-destination-ip' | 'gateway-block-page-settings' | 'gateway-extended-email-matching' + | 'idp-federation-grant' >; /** diff --git a/src/resources/resource-sharing/resources.ts b/src/resources/resource-sharing/resources.ts index 8ad7ee265e..22b54abff7 100644 --- a/src/resources/resource-sharing/resources.ts +++ b/src/resources/resource-sharing/resources.ts @@ -195,7 +195,8 @@ export interface ResourceCreateResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -247,7 +248,8 @@ export interface ResourceUpdateResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -299,7 +301,8 @@ export interface ResourceListResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -351,7 +354,8 @@ export interface ResourceDeleteResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -403,7 +407,8 @@ export interface ResourceGetResponse { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Resource Version. @@ -445,7 +450,8 @@ export interface ResourceCreateParams { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; } export interface ResourceUpdateParams { @@ -474,7 +480,8 @@ export interface ResourceListParams extends V4PagePaginationArrayParams { | 'gateway-policy' | 'gateway-destination-ip' | 'gateway-block-page-settings' - | 'gateway-extended-email-matching'; + | 'gateway-extended-email-matching' + | 'idp-federation-grant'; /** * Query param: Filter share resources by status. diff --git a/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts b/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts index f987edb7db..80a375dd05 100644 --- a/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts +++ b/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts @@ -13,7 +13,6 @@ describe('resource monitorGroups', () => { test('create: only required params', async () => { const responsePromise = client.loadBalancers.monitorGroups.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', - id: 'id', description: 'Primary datacenter monitors', members: [ { @@ -36,7 +35,6 @@ describe('resource monitorGroups', () => { test('create: required and optional params', async () => { const response = await client.loadBalancers.monitorGroups.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', - id: 'id', description: 'Primary datacenter monitors', members: [ { @@ -52,7 +50,6 @@ describe('resource monitorGroups', () => { test('update: only required params', async () => { const responsePromise = client.loadBalancers.monitorGroups.update('17b5962d775c646f3f9725cbc7a53df4', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', - id: 'id', description: 'Primary datacenter monitors', members: [ { @@ -75,7 +72,6 @@ describe('resource monitorGroups', () => { test('update: required and optional params', async () => { const response = await client.loadBalancers.monitorGroups.update('17b5962d775c646f3f9725cbc7a53df4', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', - id: 'id', description: 'Primary datacenter monitors', members: [ { @@ -129,7 +125,6 @@ describe('resource monitorGroups', () => { test('edit: only required params', async () => { const responsePromise = client.loadBalancers.monitorGroups.edit('17b5962d775c646f3f9725cbc7a53df4', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', - id: 'id', description: 'Primary datacenter monitors', members: [ { @@ -152,7 +147,6 @@ describe('resource monitorGroups', () => { test('edit: required and optional params', async () => { const response = await client.loadBalancers.monitorGroups.edit('17b5962d775c646f3f9725cbc7a53df4', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', - id: 'id', description: 'Primary datacenter monitors', members: [ { From 1360ad8f734fe8a082dcc0437005c461a8ecb7fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 14:53:12 +0000 Subject: [PATCH 13/73] chore(api): update composite API spec --- .stats.yml | 2 +- .../threat-events/threat-events.ts | 2 +- src/resources/url-scanner/scans.ts | 58 +++++++++++++++++++ .../resource-library/applications.ts | 28 ++++++++- .../resource-library/applications.test.ts | 1 + 5 files changed, 87 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 49516dea71..bcc369c880 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2207 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 512888090352626a0937b97e77f93c6c +openapi_spec_hash: 080c9cae915329f859d49062622da2f7 config_hash: e84ce27865a87048dfceb774cac9c0fd diff --git a/src/resources/cloudforce-one/threat-events/threat-events.ts b/src/resources/cloudforce-one/threat-events/threat-events.ts index 7ac5d28d50..6a66aaa727 100644 --- a/src/resources/cloudforce-one/threat-events/threat-events.ts +++ b/src/resources/cloudforce-one/threat-events/threat-events.ts @@ -638,7 +638,7 @@ export interface ThreatEventListParams { /** * Query param */ - format?: 'json' | 'stix2'; + format?: 'json' | 'stix2' | 'taxii'; /** * Query param diff --git a/src/resources/url-scanner/scans.ts b/src/resources/url-scanner/scans.ts index 73337a0ba4..71ab0f4f45 100644 --- a/src/resources/url-scanner/scans.ts +++ b/src/resources/url-scanner/scans.ts @@ -1058,6 +1058,8 @@ export namespace ScanGetResponse { ap2: Commerce.Ap2; + mpp: Commerce.Mpp; + ucp: Commerce.Ucp; x402: Commerce.X402; @@ -1176,6 +1178,62 @@ export namespace ScanGetResponse { } } + export interface Mpp { + status: string; + + details?: unknown; + + durationMs?: number; + + evidence?: Array; + + message?: string; + } + + export namespace Mpp { + export interface Evidence { + action: string; + + label: string; + + finding?: Evidence.Finding; + + request?: Evidence.Request; + + response?: Evidence.Response; + } + + export namespace Evidence { + export interface Finding { + outcome: string; + + summary: string; + } + + export interface Request { + method: string; + + url: string; + + headers?: unknown; + } + + export interface Response { + status: number; + + statusText: string; + + bodyPreview?: string; + + bodySize?: number; + + headers?: unknown; + + redirectedTo?: string; + } + } + } + export interface Ucp { status: string; diff --git a/src/resources/zero-trust/resource-library/applications.ts b/src/resources/zero-trust/resource-library/applications.ts index 54bde713a9..896a0109c4 100644 --- a/src/resources/zero-trust/resource-library/applications.ts +++ b/src/resources/zero-trust/resource-library/applications.ts @@ -125,6 +125,11 @@ export interface ApplicationListResponse { */ support_domains: Array; + /** + * Cloudflare products that support this application. + */ + supported: Array<'GATEWAY' | 'ACCESS' | 'CASB'>; + /** * Returns the application update time. */ @@ -212,6 +217,11 @@ export interface ApplicationGetResponse { */ support_domains: Array; + /** + * Cloudflare products that support this application. + */ + supported: Array<'GATEWAY' | 'ACCESS' | 'CASB'>; + /** * Returns the application update time. */ @@ -251,7 +261,13 @@ export interface ApplicationListParams { * - ip_subnet: Filter by IP subnet using CIDR containment — returns applications * where any stored subnet contains the search value (e.g., ip_subnet:10.0.1.5/32 * matches apps with 10.0.0.0/16) - * - intel_id: Filter by Intel API ID (e.g., intel_id:498). . + * - intel_id: Filter by Intel API ID (e.g., intel_id:498). also supports multiple + * values (e.g., intel_id:498,1001) + * - category_id: Filter by category ID (e.g., + * category_id:37f8ec03-8766-49d4-9a15-369b044c842c). + * - category_name: Filter by category name (e.g., category_name:HR). + * - supported: Filter by supported Cloudflare product (e.g., supported:ACCESS). + * Values: GATEWAY, ACCESS, CASB. . */ filter?: string; @@ -266,9 +282,17 @@ export interface ApplicationListParams { offset?: number; /** - * Query param: Order by result by field name and order (e.g., name:asc). + * Query param: Order results by field name and direction (e.g., name:asc). Ignored + * when search is provided; results are ranked by relevance instead. */ order_by?: string; + + /** + * Query param: Fuzzy search across application name and hostnames. Results are + * ranked by relevance. Must be between 2 and 200 characters. Can be combined with + * filter parameters. + */ + search?: string; } export interface ApplicationGetParams { diff --git a/tests/api-resources/zero-trust/resource-library/applications.test.ts b/tests/api-resources/zero-trust/resource-library/applications.test.ts index fed1d750ea..4c761b8dd6 100644 --- a/tests/api-resources/zero-trust/resource-library/applications.test.ts +++ b/tests/api-resources/zero-trust/resource-library/applications.test.ts @@ -30,6 +30,7 @@ describe('resource applications', () => { limit: 0, offset: 0, order_by: 'order_by', + search: 'xx', }); }); From b38db1f70792ba59fb98a2d8ac37cda7ebf367d0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 16:14:25 +0000 Subject: [PATCH 14/73] feat: feat(ai_gateway): add billing endpoints for credit balance, usage, invoices,... * feat(ai_gateway): add billing endpoints for credit balance, usage, invoices, topup, and spending limits --- .stats.yml | 4 +- scripts/detect-breaking-changes | 4 + src/resources/ai-gateway/ai-gateway.ts | 26 ++ src/resources/ai-gateway/api.md | 56 +++ src/resources/ai-gateway/billing.ts | 3 + src/resources/ai-gateway/billing/billing.ts | 363 ++++++++++++++++++ src/resources/ai-gateway/billing/index.ts | 29 ++ .../ai-gateway/billing/spending-limit.ts | 148 +++++++ src/resources/ai-gateway/billing/topup.ts | 3 + .../ai-gateway/billing/topup/config.ts | 133 +++++++ .../ai-gateway/billing/topup/index.ts | 18 + .../ai-gateway/billing/topup/topup.ts | 139 +++++++ src/resources/ai-gateway/index.ts | 11 + .../ai-gateway/billing/billing.test.ts | 80 ++++ .../ai-gateway/billing/spending-limit.test.ts | 67 ++++ .../ai-gateway/billing/topup/config.test.ts | 65 ++++ .../ai-gateway/billing/topup/topup.test.ts | 48 +++ 17 files changed, 1195 insertions(+), 2 deletions(-) create mode 100644 src/resources/ai-gateway/billing.ts create mode 100644 src/resources/ai-gateway/billing/billing.ts create mode 100644 src/resources/ai-gateway/billing/index.ts create mode 100644 src/resources/ai-gateway/billing/spending-limit.ts create mode 100644 src/resources/ai-gateway/billing/topup.ts create mode 100644 src/resources/ai-gateway/billing/topup/config.ts create mode 100644 src/resources/ai-gateway/billing/topup/index.ts create mode 100644 src/resources/ai-gateway/billing/topup/topup.ts create mode 100644 tests/api-resources/ai-gateway/billing/billing.test.ts create mode 100644 tests/api-resources/ai-gateway/billing/spending-limit.test.ts create mode 100644 tests/api-resources/ai-gateway/billing/topup/config.test.ts create mode 100644 tests/api-resources/ai-gateway/billing/topup/topup.test.ts diff --git a/.stats.yml b/.stats.yml index bcc369c880..fa4557fd0c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2207 +configured_endpoints: 2219 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 080c9cae915329f859d49062622da2f7 -config_hash: e84ce27865a87048dfceb774cac9c0fd +config_hash: f450f135e11cc00980b6c05811e4988d diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 2c9955e3e1..5629104c4f 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -783,6 +783,10 @@ TEST_PATHS=( tests/api-resources/ai-gateway/dynamic-routing.test.ts tests/api-resources/ai-gateway/provider-configs.test.ts tests/api-resources/ai-gateway/urls.test.ts + tests/api-resources/ai-gateway/billing/billing.test.ts + tests/api-resources/ai-gateway/billing/topup/topup.test.ts + tests/api-resources/ai-gateway/billing/topup/config.test.ts + tests/api-resources/ai-gateway/billing/spending-limit.test.ts tests/api-resources/iam/iam.test.ts tests/api-resources/iam/permission-groups.test.ts tests/api-resources/iam/resource-groups.test.ts diff --git a/src/resources/ai-gateway/ai-gateway.ts b/src/resources/ai-gateway/ai-gateway.ts index bc2f4ab4b9..1f67180455 100644 --- a/src/resources/ai-gateway/ai-gateway.ts +++ b/src/resources/ai-gateway/ai-gateway.ts @@ -89,6 +89,18 @@ import { } from './provider-configs'; import * as URLsAPI from './urls'; import { URLGetParams, URLGetResponse, URLs } from './urls'; +import * as BillingAPI from './billing/billing'; +import { + Billing, + BillingCreditBalanceParams, + BillingCreditBalanceResponse, + BillingInvoiceHistoryParams, + BillingInvoiceHistoryResponse, + BillingInvoicePreviewParams, + BillingInvoicePreviewResponse, + BillingUsageHistoryParams, + BillingUsageHistoryResponse, +} from './billing/billing'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class AIGateway extends APIResource { @@ -99,6 +111,7 @@ export class AIGateway extends APIResource { dynamicRouting: DynamicRoutingAPI.DynamicRouting = new DynamicRoutingAPI.DynamicRouting(this._client); providerConfigs: ProviderConfigsAPI.ProviderConfigs = new ProviderConfigsAPI.ProviderConfigs(this._client); urls: URLsAPI.URLs = new URLsAPI.URLs(this._client); + billing: BillingAPI.Billing = new BillingAPI.Billing(this._client); /** * Creates a new AI Gateway. @@ -1112,6 +1125,7 @@ AIGateway.DynamicRouting = DynamicRouting; AIGateway.ProviderConfigs = ProviderConfigs; AIGateway.ProviderConfigListResponsesV4PagePaginationArray = ProviderConfigListResponsesV4PagePaginationArray; AIGateway.URLs = URLs; +AIGateway.Billing = Billing; export declare namespace AIGateway { export { @@ -1214,4 +1228,16 @@ export declare namespace AIGateway { }; export { URLs as URLs, type URLGetResponse as URLGetResponse, type URLGetParams as URLGetParams }; + + export { + Billing as Billing, + type BillingCreditBalanceResponse as BillingCreditBalanceResponse, + type BillingInvoiceHistoryResponse as BillingInvoiceHistoryResponse, + type BillingInvoicePreviewResponse as BillingInvoicePreviewResponse, + type BillingUsageHistoryResponse as BillingUsageHistoryResponse, + type BillingCreditBalanceParams as BillingCreditBalanceParams, + type BillingInvoiceHistoryParams as BillingInvoiceHistoryParams, + type BillingInvoicePreviewParams as BillingInvoicePreviewParams, + type BillingUsageHistoryParams as BillingUsageHistoryParams, + }; } diff --git a/src/resources/ai-gateway/api.md b/src/resources/ai-gateway/api.md index 34a65839e3..a437e6c8d9 100644 --- a/src/resources/ai-gateway/api.md +++ b/src/resources/ai-gateway/api.md @@ -129,3 +129,59 @@ Types: Methods: - client.aiGateway.urls.get(gatewayId, provider, { ...params }) -> URLGetResponse + +## Billing + +Types: + +- BillingCreditBalanceResponse +- BillingInvoiceHistoryResponse +- BillingInvoicePreviewResponse +- BillingUsageHistoryResponse + +Methods: + +- client.aiGateway.billing.creditBalance({ ...params }) -> BillingCreditBalanceResponse +- client.aiGateway.billing.invoiceHistory({ ...params }) -> BillingInvoiceHistoryResponse +- client.aiGateway.billing.invoicePreview({ ...params }) -> BillingInvoicePreviewResponse +- client.aiGateway.billing.usageHistory({ ...params }) -> BillingUsageHistoryResponse + +### Topup + +Types: + +- TopupCreateResponse +- TopupStatusResponse + +Methods: + +- client.aiGateway.billing.topup.create({ ...params }) -> TopupCreateResponse +- client.aiGateway.billing.topup.status({ ...params }) -> TopupStatusResponse + +#### Config + +Types: + +- ConfigCreateResponse +- ConfigDeleteResponse +- ConfigGetResponse + +Methods: + +- client.aiGateway.billing.topup.config.create({ ...params }) -> ConfigCreateResponse +- client.aiGateway.billing.topup.config.delete({ ...params }) -> ConfigDeleteResponse +- client.aiGateway.billing.topup.config.get({ ...params }) -> ConfigGetResponse + +### SpendingLimit + +Types: + +- SpendingLimitCreateResponse +- SpendingLimitDeleteResponse +- SpendingLimitGetResponse + +Methods: + +- client.aiGateway.billing.spendingLimit.create({ ...params }) -> SpendingLimitCreateResponse +- client.aiGateway.billing.spendingLimit.delete({ ...params }) -> SpendingLimitDeleteResponse +- client.aiGateway.billing.spendingLimit.get({ ...params }) -> SpendingLimitGetResponse diff --git a/src/resources/ai-gateway/billing.ts b/src/resources/ai-gateway/billing.ts new file mode 100644 index 0000000000..565ff303e6 --- /dev/null +++ b/src/resources/ai-gateway/billing.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './billing/index'; diff --git a/src/resources/ai-gateway/billing/billing.ts b/src/resources/ai-gateway/billing/billing.ts new file mode 100644 index 0000000000..94fe30b4bd --- /dev/null +++ b/src/resources/ai-gateway/billing/billing.ts @@ -0,0 +1,363 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import * as SpendingLimitAPI from './spending-limit'; +import { + SpendingLimit, + SpendingLimitCreateParams, + SpendingLimitCreateResponse, + SpendingLimitDeleteParams, + SpendingLimitDeleteResponse, + SpendingLimitGetParams, + SpendingLimitGetResponse, +} from './spending-limit'; +import * as TopupAPI from './topup/topup'; +import { + Topup, + TopupCreateParams, + TopupCreateResponse, + TopupStatusParams, + TopupStatusResponse, +} from './topup/topup'; + +export class Billing extends APIResource { + topup: TopupAPI.Topup = new TopupAPI.Topup(this._client); + spendingLimit: SpendingLimitAPI.SpendingLimit = new SpendingLimitAPI.SpendingLimit(this._client); + + /** + * Retrieve the current credit balance, payment method info, and top-up + * configuration. + * + * @example + * ```ts + * const response = + * await client.aiGateway.billing.creditBalance({ + * account_id: 'account_id', + * }); + * ``` + */ + creditBalance( + params: BillingCreditBalanceParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-gateway/billing/credit-balance`, + options, + ) as Core.APIPromise<{ result: BillingCreditBalanceResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve a list of past invoices with pagination, optionally filtered by type. + * + * @example + * ```ts + * const response = + * await client.aiGateway.billing.invoiceHistory({ + * account_id: 'account_id', + * }); + * ``` + */ + invoiceHistory( + params: BillingInvoiceHistoryParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/ai-gateway/billing/invoice-history`, { + query, + ...options, + }) as Core.APIPromise<{ result: BillingInvoiceHistoryResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve a preview of the upcoming invoice including line items and tax. + * + * @example + * ```ts + * const response = + * await client.aiGateway.billing.invoicePreview({ + * account_id: 'account_id', + * }); + * ``` + */ + invoicePreview( + params: BillingInvoicePreviewParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-gateway/billing/invoice-preview`, + options, + ) as Core.APIPromise<{ result: BillingInvoicePreviewResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve aggregated usage meter event summaries for the given time range. + * + * @example + * ```ts + * const response = + * await client.aiGateway.billing.usageHistory({ + * account_id: 'account_id', + * value_grouping_window: 'day', + * }); + * ``` + */ + usageHistory( + params: BillingUsageHistoryParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/ai-gateway/billing/usage-history`, { + query, + ...options, + }) as Core.APIPromise<{ result: BillingUsageHistoryResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface BillingCreditBalanceResponse { + balance: number; + + has_default_payment_method: boolean; + + payment_method: BillingCreditBalanceResponse.PaymentMethod | null; + + topup_config: BillingCreditBalanceResponse.TopupConfig; + + first_topup_success?: boolean; +} + +export namespace BillingCreditBalanceResponse { + export interface PaymentMethod { + brand?: string; + + last4?: string; + } + + export interface TopupConfig { + amount: number | null; + + disabledReason: string | null; + + error: string | null; + + lastFailedAt: number | null; + + threshold: number | null; + } +} + +export interface BillingInvoiceHistoryResponse { + invoices: Array; + + pagination: BillingInvoiceHistoryResponse.Pagination; +} + +export namespace BillingInvoiceHistoryResponse { + export interface Invoice { + amount_due: number; + + amount_paid: number; + + amount_remaining: number; + + currency: string; + + id?: string | null; + + attempt_count?: number; + + attempted?: boolean; + + auto_advance?: boolean | null; + + created?: number; + + created_by?: string; + + description?: string | null; + + invoice_origin?: string; + + invoice_pdf?: string | null; + + status?: string | null; + } + + export interface Pagination { + has_more: boolean; + + page: number; + + per_page: number; + + total_count: number; + } +} + +export interface BillingInvoicePreviewResponse { + id: string; + + amount_due: number; + + amount_paid: number; + + amount_remaining: number; + + currency: string; + + invoice_lines: Array; + + period_end: number; + + period_start: number; + + status: 'draft' | 'open' | 'paid' | 'uncollectible' | 'void'; +} + +export namespace BillingInvoicePreviewResponse { + export interface InvoiceLine { + amount: number; + + currency: string; + + description: string | null; + + period: InvoiceLine.Period; + + pricing: InvoiceLine.Pricing; + + quantity: number; + + pretax_credit_amounts?: Array; + } + + export namespace InvoiceLine { + export interface Period { + end: number; + + start: number; + } + + export interface Pricing { + unit_amount_decimal: string | null; + } + + export interface PretaxCreditAmount { + amount: number; + + type: string; + + credit_balance_transaction?: string | null; + + discount?: string | null; + } + } +} + +export interface BillingUsageHistoryResponse { + history: Array; +} + +export namespace BillingUsageHistoryResponse { + export interface History { + id: string; + + aggregated_value: number; + + end_time: number; + + start_time: number; + } +} + +export interface BillingCreditBalanceParams { + /** + * Cloudflare account ID. + */ + account_id: string; +} + +export interface BillingInvoiceHistoryParams { + /** + * Path param: Cloudflare account ID. + */ + account_id: string; + + /** + * Query param: Filter invoice type: auto, manual, or all. + */ + type?: 'auto' | 'all' | 'manual'; +} + +export interface BillingInvoicePreviewParams { + /** + * Cloudflare account ID. + */ + account_id: string; +} + +export interface BillingUsageHistoryParams { + /** + * Path param: Cloudflare account ID. + */ + account_id: string; + + /** + * Query param: Grouping window for usage data. + */ + value_grouping_window: 'day' | 'hour'; + + /** + * Query param: End time (Unix timestamp). + */ + end_time?: number | null; + + /** + * Query param: Start time (Unix timestamp). + */ + start_time?: number | null; +} + +Billing.Topup = Topup; +Billing.SpendingLimit = SpendingLimit; + +export declare namespace Billing { + export { + type BillingCreditBalanceResponse as BillingCreditBalanceResponse, + type BillingInvoiceHistoryResponse as BillingInvoiceHistoryResponse, + type BillingInvoicePreviewResponse as BillingInvoicePreviewResponse, + type BillingUsageHistoryResponse as BillingUsageHistoryResponse, + type BillingCreditBalanceParams as BillingCreditBalanceParams, + type BillingInvoiceHistoryParams as BillingInvoiceHistoryParams, + type BillingInvoicePreviewParams as BillingInvoicePreviewParams, + type BillingUsageHistoryParams as BillingUsageHistoryParams, + }; + + export { + Topup as Topup, + type TopupCreateResponse as TopupCreateResponse, + type TopupStatusResponse as TopupStatusResponse, + type TopupCreateParams as TopupCreateParams, + type TopupStatusParams as TopupStatusParams, + }; + + export { + SpendingLimit as SpendingLimit, + type SpendingLimitCreateResponse as SpendingLimitCreateResponse, + type SpendingLimitDeleteResponse as SpendingLimitDeleteResponse, + type SpendingLimitGetResponse as SpendingLimitGetResponse, + type SpendingLimitCreateParams as SpendingLimitCreateParams, + type SpendingLimitDeleteParams as SpendingLimitDeleteParams, + type SpendingLimitGetParams as SpendingLimitGetParams, + }; +} diff --git a/src/resources/ai-gateway/billing/index.ts b/src/resources/ai-gateway/billing/index.ts new file mode 100644 index 0000000000..35277abff0 --- /dev/null +++ b/src/resources/ai-gateway/billing/index.ts @@ -0,0 +1,29 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Billing, + type BillingCreditBalanceResponse, + type BillingInvoiceHistoryResponse, + type BillingInvoicePreviewResponse, + type BillingUsageHistoryResponse, + type BillingCreditBalanceParams, + type BillingInvoiceHistoryParams, + type BillingInvoicePreviewParams, + type BillingUsageHistoryParams, +} from './billing'; +export { + SpendingLimit, + type SpendingLimitCreateResponse, + type SpendingLimitDeleteResponse, + type SpendingLimitGetResponse, + type SpendingLimitCreateParams, + type SpendingLimitDeleteParams, + type SpendingLimitGetParams, +} from './spending-limit'; +export { + Topup, + type TopupCreateResponse, + type TopupStatusResponse, + type TopupCreateParams, + type TopupStatusParams, +} from './topup/index'; diff --git a/src/resources/ai-gateway/billing/spending-limit.ts b/src/resources/ai-gateway/billing/spending-limit.ts new file mode 100644 index 0000000000..f1c03f56ee --- /dev/null +++ b/src/resources/ai-gateway/billing/spending-limit.ts @@ -0,0 +1,148 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; + +export class SpendingLimit extends APIResource { + /** + * Configure a spending limit with amount, strategy, and duration. + * + * @example + * ```ts + * const spendingLimit = + * await client.aiGateway.billing.spendingLimit.create({ + * account_id: 'account_id', + * amount: 10000, + * duration: 'monthly', + * strategy: 'fixed', + * }); + * ``` + */ + create( + params: SpendingLimitCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai-gateway/billing/spending-limit`, { + body, + ...options, + }) as Core.APIPromise<{ result: SpendingLimitCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Remove the spending limit for the account. + * + * @example + * ```ts + * const spendingLimit = + * await client.aiGateway.billing.spendingLimit.delete({ + * account_id: 'account_id', + * }); + * ``` + */ + delete( + params: SpendingLimitDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/ai-gateway/billing/spending-limit`, + options, + ) as Core.APIPromise<{ result: SpendingLimitDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve the current spending limit configuration for the account. + * + * @example + * ```ts + * const spendingLimit = + * await client.aiGateway.billing.spendingLimit.get({ + * account_id: 'account_id', + * }); + * ``` + */ + get( + params: SpendingLimitGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-gateway/billing/spending-limit`, + options, + ) as Core.APIPromise<{ result: SpendingLimitGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export type SpendingLimitCreateResponse = unknown; + +export type SpendingLimitDeleteResponse = unknown; + +export interface SpendingLimitGetResponse { + config: SpendingLimitGetResponse.Config; + + enabled: boolean; +} + +export namespace SpendingLimitGetResponse { + export interface Config { + amount: number | null; + + duration: string | null; + + strategy: string | null; + } +} + +export interface SpendingLimitCreateParams { + /** + * Path param: Cloudflare account ID. + */ + account_id: string; + + /** + * Body param: Spending limit amount in cents (min 100). + */ + amount: number; + + /** + * Body param: Spending limit duration. + */ + duration: 'daily' | 'weekly' | 'monthly'; + + /** + * Body param: Spending limit strategy. + */ + strategy: 'fixed' | 'sliding'; +} + +export interface SpendingLimitDeleteParams { + /** + * Cloudflare account ID. + */ + account_id: string; +} + +export interface SpendingLimitGetParams { + /** + * Cloudflare account ID. + */ + account_id: string; +} + +export declare namespace SpendingLimit { + export { + type SpendingLimitCreateResponse as SpendingLimitCreateResponse, + type SpendingLimitDeleteResponse as SpendingLimitDeleteResponse, + type SpendingLimitGetResponse as SpendingLimitGetResponse, + type SpendingLimitCreateParams as SpendingLimitCreateParams, + type SpendingLimitDeleteParams as SpendingLimitDeleteParams, + type SpendingLimitGetParams as SpendingLimitGetParams, + }; +} diff --git a/src/resources/ai-gateway/billing/topup.ts b/src/resources/ai-gateway/billing/topup.ts new file mode 100644 index 0000000000..fc403a44d5 --- /dev/null +++ b/src/resources/ai-gateway/billing/topup.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './topup/index'; diff --git a/src/resources/ai-gateway/billing/topup/config.ts b/src/resources/ai-gateway/billing/topup/config.ts new file mode 100644 index 0000000000..15b63f76fc --- /dev/null +++ b/src/resources/ai-gateway/billing/topup/config.ts @@ -0,0 +1,133 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; + +export class Config extends APIResource { + /** + * Configure auto top-up with a balance threshold and top-up amount. + * + * @example + * ```ts + * const config = + * await client.aiGateway.billing.topup.config.create({ + * account_id: 'account_id', + * amount: 5000, + * threshold: 500, + * }); + * ``` + */ + create(params: ConfigCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai-gateway/billing/topup/config`, { + body, + ...options, + }) as Core.APIPromise<{ result: ConfigCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Remove the auto top-up configuration for the account. + * + * @example + * ```ts + * const config = + * await client.aiGateway.billing.topup.config.delete({ + * account_id: 'account_id', + * }); + * ``` + */ + delete(params: ConfigDeleteParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/ai-gateway/billing/topup/config`, + options, + ) as Core.APIPromise<{ result: ConfigDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieve the current auto top-up threshold, amount, and any error state. + * + * @example + * ```ts + * const config = + * await client.aiGateway.billing.topup.config.get({ + * account_id: 'account_id', + * }); + * ``` + */ + get(params: ConfigGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/ai-gateway/billing/topup/config`, + options, + ) as Core.APIPromise<{ result: ConfigGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ConfigCreateResponse { + amount: number; + + threshold: number; +} + +export type ConfigDeleteResponse = unknown; + +export interface ConfigGetResponse { + amount: number | null; + + disabledReason: string | null; + + error: string | null; + + lastFailedAt: number | null; + + threshold: number | null; +} + +export interface ConfigCreateParams { + /** + * Path param: Cloudflare account ID. + */ + account_id: string; + + /** + * Body param: Auto top-up amount in cents (min 1000). + */ + amount: number; + + /** + * Body param: Balance threshold in cents that triggers auto top-up (min 500). + */ + threshold: number; +} + +export interface ConfigDeleteParams { + /** + * Cloudflare account ID. + */ + account_id: string; +} + +export interface ConfigGetParams { + /** + * Cloudflare account ID. + */ + account_id: string; +} + +export declare namespace Config { + export { + type ConfigCreateResponse as ConfigCreateResponse, + type ConfigDeleteResponse as ConfigDeleteResponse, + type ConfigGetResponse as ConfigGetResponse, + type ConfigCreateParams as ConfigCreateParams, + type ConfigDeleteParams as ConfigDeleteParams, + type ConfigGetParams as ConfigGetParams, + }; +} diff --git a/src/resources/ai-gateway/billing/topup/index.ts b/src/resources/ai-gateway/billing/topup/index.ts new file mode 100644 index 0000000000..cb58e9d912 --- /dev/null +++ b/src/resources/ai-gateway/billing/topup/index.ts @@ -0,0 +1,18 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Config, + type ConfigCreateResponse, + type ConfigDeleteResponse, + type ConfigGetResponse, + type ConfigCreateParams, + type ConfigDeleteParams, + type ConfigGetParams, +} from './config'; +export { + Topup, + type TopupCreateResponse, + type TopupStatusResponse, + type TopupCreateParams, + type TopupStatusParams, +} from './topup'; diff --git a/src/resources/ai-gateway/billing/topup/topup.ts b/src/resources/ai-gateway/billing/topup/topup.ts new file mode 100644 index 0000000000..0df4d022ae --- /dev/null +++ b/src/resources/ai-gateway/billing/topup/topup.ts @@ -0,0 +1,139 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; +import * as ConfigAPI from './config'; +import { + Config, + ConfigCreateParams, + ConfigCreateResponse, + ConfigDeleteParams, + ConfigDeleteResponse, + ConfigGetParams, + ConfigGetResponse, +} from './config'; + +export class Topup extends APIResource { + config: ConfigAPI.Config = new ConfigAPI.Config(this._client); + + /** + * Create a credit top-up via Stripe PaymentIntent for the given account. + * + * @example + * ```ts + * const topup = await client.aiGateway.billing.topup.create({ + * account_id: 'account_id', + * amount: 5000, + * }); + * ``` + */ + create(params: TopupCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai-gateway/billing/topup`, { + body, + ...options, + }) as Core.APIPromise<{ result: TopupCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get the payment processing status of a top-up by its invoice ID. + * + * @example + * ```ts + * const response = + * await client.aiGateway.billing.topup.status({ + * account_id: 'account_id', + * payment_intent_id: 'in_1abc', + * }); + * ``` + */ + status(params: TopupStatusParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/ai-gateway/billing/topup/status`, { + body, + ...options, + }) as Core.APIPromise<{ result: TopupStatusResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface TopupCreateResponse { + /** + * Stripe PaymentIntent client secret. + */ + client_secret: string | null; + + /** + * Whether the user was already onboarded. + */ + onboarding: boolean; + + /** + * Stripe invoice ID. + */ + payment_intent_id: string; + + /** + * Card brand (visa, mastercard, etc.). + */ + brand?: string; + + /** + * Last 4 digits of card. + */ + last4?: string; +} + +export interface TopupStatusResponse { + payment_intent_id: string; + + status: 'completed' | 'pending'; +} + +export interface TopupCreateParams { + /** + * Path param: Cloudflare account ID. + */ + account_id: string; + + /** + * Body param: Top-up amount in cents (min 1000). + */ + amount: number; +} + +export interface TopupStatusParams { + /** + * Path param: Cloudflare account ID. + */ + account_id: string; + + /** + * Body param: Stripe invoice ID to check status for. + */ + payment_intent_id: string; +} + +Topup.Config = Config; + +export declare namespace Topup { + export { + type TopupCreateResponse as TopupCreateResponse, + type TopupStatusResponse as TopupStatusResponse, + type TopupCreateParams as TopupCreateParams, + type TopupStatusParams as TopupStatusParams, + }; + + export { + Config as Config, + type ConfigCreateResponse as ConfigCreateResponse, + type ConfigDeleteResponse as ConfigDeleteResponse, + type ConfigGetResponse as ConfigGetResponse, + type ConfigCreateParams as ConfigCreateParams, + type ConfigDeleteParams as ConfigDeleteParams, + type ConfigGetParams as ConfigGetParams, + }; +} diff --git a/src/resources/ai-gateway/index.ts b/src/resources/ai-gateway/index.ts index 682de9f76b..7b9a3f9995 100644 --- a/src/resources/ai-gateway/index.ts +++ b/src/resources/ai-gateway/index.ts @@ -1,6 +1,17 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { AIGateway } from './ai-gateway'; +export { + Billing, + type BillingCreditBalanceResponse, + type BillingInvoiceHistoryResponse, + type BillingInvoicePreviewResponse, + type BillingUsageHistoryResponse, + type BillingCreditBalanceParams, + type BillingInvoiceHistoryParams, + type BillingInvoicePreviewParams, + type BillingUsageHistoryParams, +} from './billing/index'; export { DatasetListResponsesV4PagePaginationArray, Datasets, diff --git a/tests/api-resources/ai-gateway/billing/billing.test.ts b/tests/api-resources/ai-gateway/billing/billing.test.ts new file mode 100644 index 0000000000..07fa0bfc25 --- /dev/null +++ b/tests/api-resources/ai-gateway/billing/billing.test.ts @@ -0,0 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource billing', () => { + test('creditBalance: only required params', async () => { + const responsePromise = client.aiGateway.billing.creditBalance({ account_id: 'account_id' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('creditBalance: required and optional params', async () => { + const response = await client.aiGateway.billing.creditBalance({ account_id: 'account_id' }); + }); + + test('invoiceHistory: only required params', async () => { + const responsePromise = client.aiGateway.billing.invoiceHistory({ account_id: 'account_id' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('invoiceHistory: required and optional params', async () => { + const response = await client.aiGateway.billing.invoiceHistory({ account_id: 'account_id', type: 'all' }); + }); + + test('invoicePreview: only required params', async () => { + const responsePromise = client.aiGateway.billing.invoicePreview({ account_id: 'account_id' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('invoicePreview: required and optional params', async () => { + const response = await client.aiGateway.billing.invoicePreview({ account_id: 'account_id' }); + }); + + test('usageHistory: only required params', async () => { + const responsePromise = client.aiGateway.billing.usageHistory({ + account_id: 'account_id', + value_grouping_window: 'day', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('usageHistory: required and optional params', async () => { + const response = await client.aiGateway.billing.usageHistory({ + account_id: 'account_id', + value_grouping_window: 'day', + end_time: 1700086400, + start_time: 1700000000, + }); + }); +}); diff --git a/tests/api-resources/ai-gateway/billing/spending-limit.test.ts b/tests/api-resources/ai-gateway/billing/spending-limit.test.ts new file mode 100644 index 0000000000..378a04725f --- /dev/null +++ b/tests/api-resources/ai-gateway/billing/spending-limit.test.ts @@ -0,0 +1,67 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource spendingLimit', () => { + test('create: only required params', async () => { + const responsePromise = client.aiGateway.billing.spendingLimit.create({ + account_id: 'account_id', + amount: 10000, + duration: 'monthly', + strategy: 'fixed', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.aiGateway.billing.spendingLimit.create({ + account_id: 'account_id', + amount: 10000, + duration: 'monthly', + strategy: 'fixed', + }); + }); + + test('delete: only required params', async () => { + const responsePromise = client.aiGateway.billing.spendingLimit.delete({ account_id: 'account_id' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.aiGateway.billing.spendingLimit.delete({ account_id: 'account_id' }); + }); + + test('get: only required params', async () => { + const responsePromise = client.aiGateway.billing.spendingLimit.get({ account_id: 'account_id' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.aiGateway.billing.spendingLimit.get({ account_id: 'account_id' }); + }); +}); diff --git a/tests/api-resources/ai-gateway/billing/topup/config.test.ts b/tests/api-resources/ai-gateway/billing/topup/config.test.ts new file mode 100644 index 0000000000..10f62c6ac2 --- /dev/null +++ b/tests/api-resources/ai-gateway/billing/topup/config.test.ts @@ -0,0 +1,65 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource config', () => { + test('create: only required params', async () => { + const responsePromise = client.aiGateway.billing.topup.config.create({ + account_id: 'account_id', + amount: 5000, + threshold: 500, + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.aiGateway.billing.topup.config.create({ + account_id: 'account_id', + amount: 5000, + threshold: 500, + }); + }); + + test('delete: only required params', async () => { + const responsePromise = client.aiGateway.billing.topup.config.delete({ account_id: 'account_id' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.aiGateway.billing.topup.config.delete({ account_id: 'account_id' }); + }); + + test('get: only required params', async () => { + const responsePromise = client.aiGateway.billing.topup.config.get({ account_id: 'account_id' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.aiGateway.billing.topup.config.get({ account_id: 'account_id' }); + }); +}); diff --git a/tests/api-resources/ai-gateway/billing/topup/topup.test.ts b/tests/api-resources/ai-gateway/billing/topup/topup.test.ts new file mode 100644 index 0000000000..612c2098a3 --- /dev/null +++ b/tests/api-resources/ai-gateway/billing/topup/topup.test.ts @@ -0,0 +1,48 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource topup', () => { + test('create: only required params', async () => { + const responsePromise = client.aiGateway.billing.topup.create({ account_id: 'account_id', amount: 5000 }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.aiGateway.billing.topup.create({ account_id: 'account_id', amount: 5000 }); + }); + + test('status: only required params', async () => { + const responsePromise = client.aiGateway.billing.topup.status({ + account_id: 'account_id', + payment_intent_id: 'in_1abc', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('status: required and optional params', async () => { + const response = await client.aiGateway.billing.topup.status({ + account_id: 'account_id', + payment_intent_id: 'in_1abc', + }); + }); +}); From c18247ec0effa88fa783cff44f9d3b59287eddde Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 16:50:45 +0000 Subject: [PATCH 15/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index fa4557fd0c..ab8c807038 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2219 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 080c9cae915329f859d49062622da2f7 +openapi_spec_hash: bffae552c9187ab2f14f0c87039bdbab config_hash: f450f135e11cc00980b6c05811e4988d From 93bfc18c442817691c065d3e106b037ca8fcd829 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 21:01:40 +0000 Subject: [PATCH 16/73] feat: chore: skip failing Go SDK tests for ai_gateway, cache, load_balancers * chore: skip failing Go SDK tests for ai_gateway, cache, load_balancers --- .stats.yml | 2 +- tests/api-resources/ai-gateway/billing/billing.test.ts | 6 ++++-- tests/api-resources/cache/origin-cloud-regions.test.ts | 6 ++++-- .../load-balancers/monitor-groups/monitor-groups.test.ts | 6 ++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index ab8c807038..b887ef69c8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2219 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: bffae552c9187ab2f14f0c87039bdbab -config_hash: f450f135e11cc00980b6c05811e4988d +config_hash: f6fa3a155508fae2904b264233641e02 diff --git a/tests/api-resources/ai-gateway/billing/billing.test.ts b/tests/api-resources/ai-gateway/billing/billing.test.ts index 07fa0bfc25..28994b39a0 100644 --- a/tests/api-resources/ai-gateway/billing/billing.test.ts +++ b/tests/api-resources/ai-gateway/billing/billing.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource billing', () => { - test('creditBalance: only required params', async () => { + // HTTP 404 error from prism -- route not in spec + test.skip('creditBalance: only required params', async () => { const responsePromise = client.aiGateway.billing.creditBalance({ account_id: 'account_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -21,7 +22,8 @@ describe('resource billing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('creditBalance: required and optional params', async () => { + // HTTP 404 error from prism -- route not in spec + test.skip('creditBalance: required and optional params', async () => { const response = await client.aiGateway.billing.creditBalance({ account_id: 'account_id' }); }); diff --git a/tests/api-resources/cache/origin-cloud-regions.test.ts b/tests/api-resources/cache/origin-cloud-regions.test.ts index 4e9739877b..4bf496f305 100644 --- a/tests/api-resources/cache/origin-cloud-regions.test.ts +++ b/tests/api-resources/cache/origin-cloud-regions.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource originCloudRegions', () => { - test('update: only required params', async () => { + // HTTP 404 error from prism -- route not in spec + test.skip('update: only required params', async () => { const responsePromise = client.cache.originCloudRegions.update('192.0.2.1', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', origin_ip: '192.0.2.1', @@ -26,7 +27,8 @@ describe('resource originCloudRegions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: required and optional params', async () => { + // HTTP 404 error from prism -- route not in spec + test.skip('update: required and optional params', async () => { const response = await client.cache.originCloudRegions.update('192.0.2.1', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', origin_ip: '192.0.2.1', diff --git a/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts b/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts index 80a375dd05..1f1924e1cf 100644 --- a/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts +++ b/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource monitorGroups', () => { - test('create: only required params', async () => { + // HTTP 422 error from prism + test.skip('create: only required params', async () => { const responsePromise = client.loadBalancers.monitorGroups.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', description: 'Primary datacenter monitors', @@ -32,7 +33,8 @@ describe('resource monitorGroups', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { + // HTTP 422 error from prism + test.skip('create: required and optional params', async () => { const response = await client.loadBalancers.monitorGroups.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', description: 'Primary datacenter monitors', From 2e419b487230f2d5decfb497ff0d8050a972e800 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 21:30:53 +0000 Subject: [PATCH 17/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/ai-gateway/billing/billing.ts | 4 ++-- tests/api-resources/ai-gateway/billing/billing.test.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index b887ef69c8..ac1f553526 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2219 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: bffae552c9187ab2f14f0c87039bdbab +openapi_spec_hash: 478ddecc51ea529014a89e20699fad90 config_hash: f6fa3a155508fae2904b264233641e02 diff --git a/src/resources/ai-gateway/billing/billing.ts b/src/resources/ai-gateway/billing/billing.ts index 94fe30b4bd..c8da558ee7 100644 --- a/src/resources/ai-gateway/billing/billing.ts +++ b/src/resources/ai-gateway/billing/billing.ts @@ -318,12 +318,12 @@ export interface BillingUsageHistoryParams { value_grouping_window: 'day' | 'hour'; /** - * Query param: End time (Unix timestamp). + * Query param: End time as Unix timestamp in milliseconds. */ end_time?: number | null; /** - * Query param: Start time (Unix timestamp). + * Query param: Start time as Unix timestamp in milliseconds. */ start_time?: number | null; } diff --git a/tests/api-resources/ai-gateway/billing/billing.test.ts b/tests/api-resources/ai-gateway/billing/billing.test.ts index 28994b39a0..6c1a9283d7 100644 --- a/tests/api-resources/ai-gateway/billing/billing.test.ts +++ b/tests/api-resources/ai-gateway/billing/billing.test.ts @@ -75,8 +75,8 @@ describe('resource billing', () => { const response = await client.aiGateway.billing.usageHistory({ account_id: 'account_id', value_grouping_window: 'day', - end_time: 1700086400, - start_time: 1700000000, + end_time: 1700086400000, + start_time: 1700000000000, }); }); }); From 194ff00ebdae48a74047678cec93c323d99c260c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 6 May 2026 21:35:51 +0000 Subject: [PATCH 18/73] chore(api): update composite API spec --- .stats.yml | 4 +- src/resources/cache/api.md | 2 + src/resources/cache/cache.ts | 145 +++++++++++++++++++++++- tests/api-resources/cache/cache.test.ts | 20 ++++ 4 files changed, 166 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index ac1f553526..02b1113a4b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2219 +configured_endpoints: 2220 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 478ddecc51ea529014a89e20699fad90 +openapi_spec_hash: 5f7d8a96b953cef8677dacffc249761d config_hash: f6fa3a155508fae2904b264233641e02 diff --git a/src/resources/cache/api.md b/src/resources/cache/api.md index 14e19f79a7..a6caf9ba23 100644 --- a/src/resources/cache/api.md +++ b/src/resources/cache/api.md @@ -3,10 +3,12 @@ Types: - CachePurgeResponse +- CachePurgeEnvironmentResponse Methods: - client.cache.purge({ ...params }) -> CachePurgeResponse | null +- client.cache.purgeEnvironment(environmentId, { ...params }) -> CachePurgeEnvironmentResponse | null ## CacheReserve diff --git a/src/resources/cache/cache.ts b/src/resources/cache/cache.ts index 9b81afbac2..4e9ece1acf 100644 --- a/src/resources/cache/cache.ts +++ b/src/resources/cache/cache.ts @@ -111,7 +111,7 @@ export class Cache extends APIResource { * Single file purge example with url and header pairs: * * ``` - * {"files": [{url: "http://www.example.com/cat_picture.jpg", headers: { "CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN" }}, {url: "http://www.example.com/dog_picture.jpg", headers: { "CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US" }}]} + * {"files": [{"url": "http://www.example.com/cat_picture.jpg", "headers": {"CF-IPCountry": "US", "CF-Device-Type": "desktop", "Accept-Language": "zh-CN"}}, {"url": "http://www.example.com/dog_picture.jpg", "headers": {"CF-IPCountry": "EU", "CF-Device-Type": "mobile", "Accept-Language": "en-US"}}]} * ``` * * ### Purge Cached Content by Tag, Host or Prefix @@ -139,7 +139,7 @@ export class Cache extends APIResource { * * ### Availability and limits * - * please refer to + * Please refer to * [purge cache availability and limits documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits). * * @example @@ -157,12 +157,48 @@ export class Cache extends APIResource { }> )._thenUnwrap((obj) => obj.result); } + + /** + * Purge cached content scoped to a specific environment. Supports the same purge + * types as the zone-level endpoint (purge everything, by URL, by tag, host, or + * prefix). + * + * ### Availability and limits + * + * Please refer to + * [purge cache availability and limits documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/#availability-and-limits). + * + * @example + * ```ts + * const response = await client.cache.purgeEnvironment( + * '023e105f4ecef8ad9ca31a8372d0c353', + * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + purgeEnvironment( + environmentId: string, + params: CachePurgeEnvironmentParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.post(`/zones/${zone_id}/environments/${environmentId}/purge_cache`, { + body, + ...options, + }) as Core.APIPromise<{ result: CachePurgeEnvironmentResponse | null }> + )._thenUnwrap((obj) => obj.result); + } } export interface CachePurgeResponse { id: string; } +export interface CachePurgeEnvironmentResponse { + id: string; +} + export type CachePurgeParams = | CachePurgeParams.CachePurgeFlexPurgeByTags | CachePurgeParams.CachePurgeFlexPurgeByHostnames @@ -261,6 +297,104 @@ export declare namespace CachePurgeParams { } } +export type CachePurgeEnvironmentParams = + | CachePurgeEnvironmentParams.CachePurgeFlexPurgeByTags + | CachePurgeEnvironmentParams.CachePurgeFlexPurgeByHostnames + | CachePurgeEnvironmentParams.CachePurgeFlexPurgeByPrefixes + | CachePurgeEnvironmentParams.CachePurgeEverything + | CachePurgeEnvironmentParams.CachePurgeSingleFile + | CachePurgeEnvironmentParams.CachePurgeSingleFileWithURLAndHeaders; + +export declare namespace CachePurgeEnvironmentParams { + export interface CachePurgeFlexPurgeByTags { + /** + * Path param + */ + zone_id: string; + + /** + * Body param: For more information on cache tags and purging by tags, please refer + * to + * [purge by cache-tags documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-tags/). + */ + tags?: Array; + } + + export interface CachePurgeFlexPurgeByHostnames { + /** + * Path param + */ + zone_id: string; + + /** + * Body param: For more information purging by hostnames, please refer to + * [purge by hostname documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-hostname/). + */ + hosts?: Array; + } + + export interface CachePurgeFlexPurgeByPrefixes { + /** + * Path param + */ + zone_id: string; + + /** + * Body param: For more information on purging by prefixes, please refer to + * [purge by prefix documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge_by_prefix/). + */ + prefixes?: Array; + } + + export interface CachePurgeEverything { + /** + * Path param + */ + zone_id: string; + + /** + * Body param: For more information, please refer to + * [purge everything documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-everything/). + */ + purge_everything?: boolean; + } + + export interface CachePurgeSingleFile { + /** + * Path param + */ + zone_id: string; + + /** + * Body param: For more information on purging files, please refer to + * [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). + */ + files?: Array; + } + + export interface CachePurgeSingleFileWithURLAndHeaders { + /** + * Path param + */ + zone_id: string; + + /** + * Body param: For more information on purging files with URL and headers, please + * refer to + * [purge by single-file documentation page](https://developers.cloudflare.com/cache/how-to/purge-cache/purge-by-single-file/). + */ + files?: Array; + } + + export namespace CachePurgeSingleFileWithURLAndHeaders { + export interface File { + headers?: { [key: string]: string }; + + url?: string; + } + } +} + Cache.CacheReserveResource = CacheReserveResource; Cache.SmartTieredCache = SmartTieredCache; Cache.Variants = Variants; @@ -269,7 +403,12 @@ Cache.OriginCloudRegions = OriginCloudRegions; Cache.OriginCloudRegionsV4PagePaginationArray = OriginCloudRegionsV4PagePaginationArray; export declare namespace Cache { - export { type CachePurgeResponse as CachePurgeResponse, type CachePurgeParams as CachePurgeParams }; + export { + type CachePurgeResponse as CachePurgeResponse, + type CachePurgeEnvironmentResponse as CachePurgeEnvironmentResponse, + type CachePurgeParams as CachePurgeParams, + type CachePurgeEnvironmentParams as CachePurgeEnvironmentParams, + }; export { CacheReserveResource as CacheReserveResource, diff --git a/tests/api-resources/cache/cache.test.ts b/tests/api-resources/cache/cache.test.ts index 5604143ce9..3ae5283a29 100644 --- a/tests/api-resources/cache/cache.test.ts +++ b/tests/api-resources/cache/cache.test.ts @@ -27,4 +27,24 @@ describe('resource cache', () => { tags: ['a-cache-tag', 'another-cache-tag'], }); }); + + test('purgeEnvironment: only required params', async () => { + const responsePromise = client.cache.purgeEnvironment('023e105f4ecef8ad9ca31a8372d0c353', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('purgeEnvironment: required and optional params', async () => { + const response = await client.cache.purgeEnvironment('023e105f4ecef8ad9ca31a8372d0c353', { + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + tags: ['a-cache-tag', 'another-cache-tag'], + }); + }); }); From e54749dc53a0e61c28b0a4d2c5ddf7ff17affb02 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 13:25:17 +0000 Subject: [PATCH 19/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/radar/quality/iqi.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 02b1113a4b..f5a1c43751 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2220 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 5f7d8a96b953cef8677dacffc249761d +openapi_spec_hash: 9a73d6e19fbf993950d4705e65c8e5f6 config_hash: f6fa3a155508fae2904b264233641e02 diff --git a/src/resources/radar/quality/iqi.ts b/src/resources/radar/quality/iqi.ts index 1b6a968a5f..81a2f281af 100644 --- a/src/resources/radar/quality/iqi.ts +++ b/src/resources/radar/quality/iqi.ts @@ -318,13 +318,9 @@ export namespace IQITimeseriesGroupsResponse { } export interface Serie0 { - p25: Array; - - p50: Array; - - p75: Array; - timestamps: Array; + + [k: string]: Array | Array | undefined; } } From 8749cd9e52fd74867d6ed1e73109c4f6e2b1a777 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 15:47:11 +0000 Subject: [PATCH 20/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f5a1c43751..e117106b2f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2220 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 9a73d6e19fbf993950d4705e65c8e5f6 +openapi_spec_hash: 133defba7d0d08dc80ddcbbd587e0291 config_hash: f6fa3a155508fae2904b264233641e02 From 8ba9fb2e4e7ed08d118ae4593e52ab9d1cb940f6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 16:27:26 +0000 Subject: [PATCH 21/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index e117106b2f..f063e47afa 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2220 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 133defba7d0d08dc80ddcbbd587e0291 +openapi_spec_hash: e53e5e8a8b0247835b06484b4382e0c4 config_hash: f6fa3a155508fae2904b264233641e02 From a37e928d86087d6b7373aa2f6a9f175b88f1b2aa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 7 May 2026 17:03:18 +0000 Subject: [PATCH 22/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f063e47afa..c46ee1d4e2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2220 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: e53e5e8a8b0247835b06484b4382e0c4 -config_hash: f6fa3a155508fae2904b264233641e02 +config_hash: cef856e42543e49d9b09cb9eac20dc9e From 804b8d2b79fb5836e15fe1a2d35cfb518830ca7a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 11 May 2026 06:08:39 +0000 Subject: [PATCH 23/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/ai-gateway/ai-gateway.ts | 423 ++++++++++++++++++ .../zero-trust/devices/fleet-status.ts | 5 + .../zero-trust/dex/fleet-status/devices.ts | 5 + .../zero-trust/dlp/entries/custom.ts | 103 +++-- .../zero-trust/dlp/entries/entries.ts | 121 +++-- .../zero-trust/dlp/entries/integration.ts | 103 +++-- .../zero-trust/dlp/entries/predefined.ts | 103 +++-- .../zero-trust/dlp/profiles/custom.ts | 36 ++ .../zero-trust/dlp/profiles/predefined.ts | 18 + .../zero-trust/dlp/profiles/profiles.ts | 90 ++++ .../ai-gateway/ai-gateway.test.ts | 36 +- 12 files changed, 943 insertions(+), 102 deletions(-) diff --git a/.stats.yml b/.stats.yml index c46ee1d4e2..5164ab07e1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2220 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: e53e5e8a8b0247835b06484b4382e0c4 +openapi_spec_hash: 20525f5883d4d78be797dee296df1442 config_hash: cef856e42543e49d9b09cb9eac20dc9e diff --git a/src/resources/ai-gateway/ai-gateway.ts b/src/resources/ai-gateway/ai-gateway.ts index 1f67180455..31ec1cc2c9 100644 --- a/src/resources/ai-gateway/ai-gateway.ts +++ b/src/resources/ai-gateway/ai-gateway.ts @@ -273,6 +273,8 @@ export interface AIGatewayCreateResponse { dlp?: AIGatewayCreateResponse.UnionMember0 | AIGatewayCreateResponse.UnionMember1; + guardrails?: AIGatewayCreateResponse.Guardrails | null; + is_default?: boolean; log_management?: number | null; @@ -344,6 +346,74 @@ export namespace AIGatewayCreateResponse { } } + export interface Guardrails { + prompt: Guardrails.Prompt; + + response: Guardrails.Response; + } + + export namespace Guardrails { + export interface Prompt { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + + export interface Response { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + } + export interface Otel { authorization: string; @@ -391,6 +461,8 @@ export interface AIGatewayUpdateResponse { dlp?: AIGatewayUpdateResponse.UnionMember0 | AIGatewayUpdateResponse.UnionMember1; + guardrails?: AIGatewayUpdateResponse.Guardrails | null; + is_default?: boolean; log_management?: number | null; @@ -462,6 +534,74 @@ export namespace AIGatewayUpdateResponse { } } + export interface Guardrails { + prompt: Guardrails.Prompt; + + response: Guardrails.Response; + } + + export namespace Guardrails { + export interface Prompt { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + + export interface Response { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + } + export interface Otel { authorization: string; @@ -509,6 +649,8 @@ export interface AIGatewayListResponse { dlp?: AIGatewayListResponse.UnionMember0 | AIGatewayListResponse.UnionMember1; + guardrails?: AIGatewayListResponse.Guardrails | null; + is_default?: boolean; log_management?: number | null; @@ -580,6 +722,74 @@ export namespace AIGatewayListResponse { } } + export interface Guardrails { + prompt: Guardrails.Prompt; + + response: Guardrails.Response; + } + + export namespace Guardrails { + export interface Prompt { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + + export interface Response { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + } + export interface Otel { authorization: string; @@ -627,6 +837,8 @@ export interface AIGatewayDeleteResponse { dlp?: AIGatewayDeleteResponse.UnionMember0 | AIGatewayDeleteResponse.UnionMember1; + guardrails?: AIGatewayDeleteResponse.Guardrails | null; + is_default?: boolean; log_management?: number | null; @@ -698,6 +910,74 @@ export namespace AIGatewayDeleteResponse { } } + export interface Guardrails { + prompt: Guardrails.Prompt; + + response: Guardrails.Response; + } + + export namespace Guardrails { + export interface Prompt { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + + export interface Response { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + } + export interface Otel { authorization: string; @@ -745,6 +1025,8 @@ export interface AIGatewayGetResponse { dlp?: AIGatewayGetResponse.UnionMember0 | AIGatewayGetResponse.UnionMember1; + guardrails?: AIGatewayGetResponse.Guardrails | null; + is_default?: boolean; log_management?: number | null; @@ -816,6 +1098,74 @@ export namespace AIGatewayGetResponse { } } + export interface Guardrails { + prompt: Guardrails.Prompt; + + response: Guardrails.Response; + } + + export namespace Guardrails { + export interface Prompt { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + + export interface Response { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + } + export interface Otel { authorization: string; @@ -973,6 +1323,11 @@ export interface AIGatewayUpdateParams { */ dlp?: AIGatewayUpdateParams.UnionMember0 | AIGatewayUpdateParams.UnionMember1; + /** + * Body param + */ + guardrails?: AIGatewayUpdateParams.Guardrails | null; + /** * Body param */ @@ -1069,6 +1424,74 @@ export namespace AIGatewayUpdateParams { } } + export interface Guardrails { + prompt: Guardrails.Prompt; + + response: Guardrails.Response; + } + + export namespace Guardrails { + export interface Prompt { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + + export interface Response { + P1?: 'FLAG' | 'BLOCK'; + + S1?: 'FLAG' | 'BLOCK'; + + S10?: 'FLAG' | 'BLOCK'; + + S11?: 'FLAG' | 'BLOCK'; + + S12?: 'FLAG' | 'BLOCK'; + + S13?: 'FLAG' | 'BLOCK'; + + S2?: 'FLAG' | 'BLOCK'; + + S3?: 'FLAG' | 'BLOCK'; + + S4?: 'FLAG' | 'BLOCK'; + + S5?: 'FLAG' | 'BLOCK'; + + S6?: 'FLAG' | 'BLOCK'; + + S7?: 'FLAG' | 'BLOCK'; + + S8?: 'FLAG' | 'BLOCK'; + + S9?: 'FLAG' | 'BLOCK'; + } + } + export interface Otel { authorization: string; diff --git a/src/resources/zero-trust/devices/fleet-status.ts b/src/resources/zero-trust/devices/fleet-status.ts index efc676cc04..9da3d09bfe 100644 --- a/src/resources/zero-trust/devices/fleet-status.ts +++ b/src/resources/zero-trust/devices/fleet-status.ts @@ -92,6 +92,11 @@ export interface FleetStatusGetResponse { */ deviceName?: string; + /** + * @deprecated Use `registrationId` instead. + */ + deviceRegistration?: string | null; + diskReadBps?: number | null; diskUsagePct?: number | null; diff --git a/src/resources/zero-trust/dex/fleet-status/devices.ts b/src/resources/zero-trust/dex/fleet-status/devices.ts index ad81ea9c5e..53aae83850 100644 --- a/src/resources/zero-trust/dex/fleet-status/devices.ts +++ b/src/resources/zero-trust/dex/fleet-status/devices.ts @@ -98,6 +98,11 @@ export interface DeviceListResponse { */ deviceName?: string; + /** + * @deprecated Use `registrationId` instead. + */ + deviceRegistration?: string | null; + diskReadBps?: number | null; diskUsagePct?: number | null; diff --git a/src/resources/zero-trust/dlp/entries/custom.ts b/src/resources/zero-trust/dlp/entries/custom.ts index 212d218bd0..7765d3fb45 100644 --- a/src/resources/zero-trust/dlp/entries/custom.ts +++ b/src/resources/zero-trust/dlp/entries/custom.ts @@ -192,7 +192,8 @@ export type CustomListResponse = | CustomListResponse.UnionMember2 | CustomListResponse.UnionMember3 | CustomListResponse.UnionMember4 - | CustomListResponse.UnionMember5; + | CustomListResponse.UnionMember5 + | CustomListResponse.UnionMember6; export namespace CustomListResponse { export interface UnionMember0 { @@ -226,7 +227,26 @@ export namespace CustomListResponse { export interface UnionMember1 { id: string; - confidence: UnionMember1.Confidence; + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + + upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; + } + + export interface UnionMember2 { + id: string; + + confidence: UnionMember2.Confidence; enabled: boolean; @@ -244,10 +264,10 @@ export namespace CustomListResponse { /** * A Predefined AI prompt classification topic entry. */ - variant?: UnionMember1.UnionMember0 | UnionMember1.UnionMember1; + variant?: UnionMember2.UnionMember0 | UnionMember2.UnionMember1; } - export namespace UnionMember1 { + export namespace UnionMember2 { export interface Confidence { /** * Indicates whether this entry has AI remote service validation. @@ -289,7 +309,7 @@ export namespace CustomListResponse { } } - export interface UnionMember2 { + export interface UnionMember3 { id: string; created_at: string; @@ -307,7 +327,7 @@ export namespace CustomListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember3 { + export interface UnionMember4 { id: string; /** @@ -331,7 +351,7 @@ export namespace CustomListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember4 { + export interface UnionMember5 { id: string; created_at: string; @@ -347,7 +367,7 @@ export namespace CustomListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember5 { + export interface UnionMember6 { id: string; created_at: string; @@ -376,7 +396,8 @@ export type CustomGetResponse = | CustomGetResponse.UnionMember2 | CustomGetResponse.UnionMember3 | CustomGetResponse.UnionMember4 - | CustomGetResponse.UnionMember5; + | CustomGetResponse.UnionMember5 + | CustomGetResponse.UnionMember6; export namespace CustomGetResponse { export interface UnionMember0 { @@ -423,7 +444,39 @@ export namespace CustomGetResponse { export interface UnionMember1 { id: string; - confidence: UnionMember1.Confidence; + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + + profiles?: Array; + + upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; + } + + export namespace UnionMember1 { + /** + * Computed entry field for a profile that an entry is shared into. + */ + export interface Profile { + id: string; + + name: string; + } + } + + export interface UnionMember2 { + id: string; + + confidence: UnionMember2.Confidence; enabled: boolean; @@ -436,17 +489,17 @@ export namespace CustomGetResponse { */ profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; /** * A Predefined AI prompt classification topic entry. */ - variant?: UnionMember1.UnionMember0 | UnionMember1.UnionMember1; + variant?: UnionMember2.UnionMember0 | UnionMember2.UnionMember1; } - export namespace UnionMember1 { + export namespace UnionMember2 { export interface Confidence { /** * Indicates whether this entry has AI remote service validation. @@ -497,7 +550,7 @@ export namespace CustomGetResponse { } } - export interface UnionMember2 { + export interface UnionMember3 { id: string; created_at: string; @@ -512,12 +565,12 @@ export namespace CustomGetResponse { profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember2 { + export namespace UnionMember3 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -528,7 +581,7 @@ export namespace CustomGetResponse { } } - export interface UnionMember3 { + export interface UnionMember4 { id: string; /** @@ -549,12 +602,12 @@ export namespace CustomGetResponse { updated_at: string; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember3 { + export namespace UnionMember4 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -565,7 +618,7 @@ export namespace CustomGetResponse { } } - export interface UnionMember4 { + export interface UnionMember5 { id: string; created_at: string; @@ -578,12 +631,12 @@ export namespace CustomGetResponse { updated_at: string; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember4 { + export namespace UnionMember5 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -594,7 +647,7 @@ export namespace CustomGetResponse { } } - export interface UnionMember5 { + export interface UnionMember6 { id: string; created_at: string; @@ -611,12 +664,12 @@ export namespace CustomGetResponse { profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember5 { + export namespace UnionMember6 { /** * Computed entry field for a profile that an entry is shared into. */ diff --git a/src/resources/zero-trust/dlp/entries/entries.ts b/src/resources/zero-trust/dlp/entries/entries.ts index e20ee525e9..47853f011d 100644 --- a/src/resources/zero-trust/dlp/entries/entries.ts +++ b/src/resources/zero-trust/dlp/entries/entries.ts @@ -209,6 +209,7 @@ export interface EntryCreateResponse { export type EntryUpdateResponse = | EntryUpdateResponse.CustomEntry + | EntryUpdateResponse.CustomPromptTopicEntry | EntryUpdateResponse.PredefinedEntry | EntryUpdateResponse.IntegrationEntry | EntryUpdateResponse.ExactDataEntry @@ -242,6 +243,23 @@ export namespace EntryUpdateResponse { profile_id?: string | null; } + export interface CustomPromptTopicEntry { + id: string; + + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + } + export interface PredefinedEntry { id: string; @@ -383,7 +401,8 @@ export type EntryListResponse = | EntryListResponse.UnionMember2 | EntryListResponse.UnionMember3 | EntryListResponse.UnionMember4 - | EntryListResponse.UnionMember5; + | EntryListResponse.UnionMember5 + | EntryListResponse.UnionMember6; export namespace EntryListResponse { export interface UnionMember0 { @@ -417,7 +436,26 @@ export namespace EntryListResponse { export interface UnionMember1 { id: string; - confidence: UnionMember1.Confidence; + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + + upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; + } + + export interface UnionMember2 { + id: string; + + confidence: UnionMember2.Confidence; enabled: boolean; @@ -435,10 +473,10 @@ export namespace EntryListResponse { /** * A Predefined AI prompt classification topic entry. */ - variant?: UnionMember1.UnionMember0 | UnionMember1.UnionMember1; + variant?: UnionMember2.UnionMember0 | UnionMember2.UnionMember1; } - export namespace UnionMember1 { + export namespace UnionMember2 { export interface Confidence { /** * Indicates whether this entry has AI remote service validation. @@ -480,7 +518,7 @@ export namespace EntryListResponse { } } - export interface UnionMember2 { + export interface UnionMember3 { id: string; created_at: string; @@ -498,7 +536,7 @@ export namespace EntryListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember3 { + export interface UnionMember4 { id: string; /** @@ -522,7 +560,7 @@ export namespace EntryListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember4 { + export interface UnionMember5 { id: string; created_at: string; @@ -538,7 +576,7 @@ export namespace EntryListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember5 { + export interface UnionMember6 { id: string; created_at: string; @@ -567,7 +605,8 @@ export type EntryGetResponse = | EntryGetResponse.UnionMember2 | EntryGetResponse.UnionMember3 | EntryGetResponse.UnionMember4 - | EntryGetResponse.UnionMember5; + | EntryGetResponse.UnionMember5 + | EntryGetResponse.UnionMember6; export namespace EntryGetResponse { export interface UnionMember0 { @@ -614,7 +653,39 @@ export namespace EntryGetResponse { export interface UnionMember1 { id: string; - confidence: UnionMember1.Confidence; + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + + profiles?: Array; + + upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; + } + + export namespace UnionMember1 { + /** + * Computed entry field for a profile that an entry is shared into. + */ + export interface Profile { + id: string; + + name: string; + } + } + + export interface UnionMember2 { + id: string; + + confidence: UnionMember2.Confidence; enabled: boolean; @@ -627,17 +698,17 @@ export namespace EntryGetResponse { */ profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; /** * A Predefined AI prompt classification topic entry. */ - variant?: UnionMember1.UnionMember0 | UnionMember1.UnionMember1; + variant?: UnionMember2.UnionMember0 | UnionMember2.UnionMember1; } - export namespace UnionMember1 { + export namespace UnionMember2 { export interface Confidence { /** * Indicates whether this entry has AI remote service validation. @@ -688,7 +759,7 @@ export namespace EntryGetResponse { } } - export interface UnionMember2 { + export interface UnionMember3 { id: string; created_at: string; @@ -703,12 +774,12 @@ export namespace EntryGetResponse { profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember2 { + export namespace UnionMember3 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -719,7 +790,7 @@ export namespace EntryGetResponse { } } - export interface UnionMember3 { + export interface UnionMember4 { id: string; /** @@ -740,12 +811,12 @@ export namespace EntryGetResponse { updated_at: string; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember3 { + export namespace UnionMember4 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -756,7 +827,7 @@ export namespace EntryGetResponse { } } - export interface UnionMember4 { + export interface UnionMember5 { id: string; created_at: string; @@ -769,12 +840,12 @@ export namespace EntryGetResponse { updated_at: string; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember4 { + export namespace UnionMember5 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -785,7 +856,7 @@ export namespace EntryGetResponse { } } - export interface UnionMember5 { + export interface UnionMember6 { id: string; created_at: string; @@ -802,12 +873,12 @@ export namespace EntryGetResponse { profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember5 { + export namespace UnionMember6 { /** * Computed entry field for a profile that an entry is shared into. */ diff --git a/src/resources/zero-trust/dlp/entries/integration.ts b/src/resources/zero-trust/dlp/entries/integration.ts index 60ab3773b5..fe76a4b724 100644 --- a/src/resources/zero-trust/dlp/entries/integration.ts +++ b/src/resources/zero-trust/dlp/entries/integration.ts @@ -173,7 +173,8 @@ export type IntegrationListResponse = | IntegrationListResponse.UnionMember2 | IntegrationListResponse.UnionMember3 | IntegrationListResponse.UnionMember4 - | IntegrationListResponse.UnionMember5; + | IntegrationListResponse.UnionMember5 + | IntegrationListResponse.UnionMember6; export namespace IntegrationListResponse { export interface UnionMember0 { @@ -207,7 +208,26 @@ export namespace IntegrationListResponse { export interface UnionMember1 { id: string; - confidence: UnionMember1.Confidence; + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + + upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; + } + + export interface UnionMember2 { + id: string; + + confidence: UnionMember2.Confidence; enabled: boolean; @@ -225,10 +245,10 @@ export namespace IntegrationListResponse { /** * A Predefined AI prompt classification topic entry. */ - variant?: UnionMember1.UnionMember0 | UnionMember1.UnionMember1; + variant?: UnionMember2.UnionMember0 | UnionMember2.UnionMember1; } - export namespace UnionMember1 { + export namespace UnionMember2 { export interface Confidence { /** * Indicates whether this entry has AI remote service validation. @@ -270,7 +290,7 @@ export namespace IntegrationListResponse { } } - export interface UnionMember2 { + export interface UnionMember3 { id: string; created_at: string; @@ -288,7 +308,7 @@ export namespace IntegrationListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember3 { + export interface UnionMember4 { id: string; /** @@ -312,7 +332,7 @@ export namespace IntegrationListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember4 { + export interface UnionMember5 { id: string; created_at: string; @@ -328,7 +348,7 @@ export namespace IntegrationListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember5 { + export interface UnionMember6 { id: string; created_at: string; @@ -357,7 +377,8 @@ export type IntegrationGetResponse = | IntegrationGetResponse.UnionMember2 | IntegrationGetResponse.UnionMember3 | IntegrationGetResponse.UnionMember4 - | IntegrationGetResponse.UnionMember5; + | IntegrationGetResponse.UnionMember5 + | IntegrationGetResponse.UnionMember6; export namespace IntegrationGetResponse { export interface UnionMember0 { @@ -404,7 +425,39 @@ export namespace IntegrationGetResponse { export interface UnionMember1 { id: string; - confidence: UnionMember1.Confidence; + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + + profiles?: Array; + + upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; + } + + export namespace UnionMember1 { + /** + * Computed entry field for a profile that an entry is shared into. + */ + export interface Profile { + id: string; + + name: string; + } + } + + export interface UnionMember2 { + id: string; + + confidence: UnionMember2.Confidence; enabled: boolean; @@ -417,17 +470,17 @@ export namespace IntegrationGetResponse { */ profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; /** * A Predefined AI prompt classification topic entry. */ - variant?: UnionMember1.UnionMember0 | UnionMember1.UnionMember1; + variant?: UnionMember2.UnionMember0 | UnionMember2.UnionMember1; } - export namespace UnionMember1 { + export namespace UnionMember2 { export interface Confidence { /** * Indicates whether this entry has AI remote service validation. @@ -478,7 +531,7 @@ export namespace IntegrationGetResponse { } } - export interface UnionMember2 { + export interface UnionMember3 { id: string; created_at: string; @@ -493,12 +546,12 @@ export namespace IntegrationGetResponse { profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember2 { + export namespace UnionMember3 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -509,7 +562,7 @@ export namespace IntegrationGetResponse { } } - export interface UnionMember3 { + export interface UnionMember4 { id: string; /** @@ -530,12 +583,12 @@ export namespace IntegrationGetResponse { updated_at: string; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember3 { + export namespace UnionMember4 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -546,7 +599,7 @@ export namespace IntegrationGetResponse { } } - export interface UnionMember4 { + export interface UnionMember5 { id: string; created_at: string; @@ -559,12 +612,12 @@ export namespace IntegrationGetResponse { updated_at: string; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember4 { + export namespace UnionMember5 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -575,7 +628,7 @@ export namespace IntegrationGetResponse { } } - export interface UnionMember5 { + export interface UnionMember6 { id: string; created_at: string; @@ -592,12 +645,12 @@ export namespace IntegrationGetResponse { profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember5 { + export namespace UnionMember6 { /** * Computed entry field for a profile that an entry is shared into. */ diff --git a/src/resources/zero-trust/dlp/entries/predefined.ts b/src/resources/zero-trust/dlp/entries/predefined.ts index 3f47812d9e..ac1c380aeb 100644 --- a/src/resources/zero-trust/dlp/entries/predefined.ts +++ b/src/resources/zero-trust/dlp/entries/predefined.ts @@ -269,7 +269,8 @@ export type PredefinedListResponse = | PredefinedListResponse.UnionMember2 | PredefinedListResponse.UnionMember3 | PredefinedListResponse.UnionMember4 - | PredefinedListResponse.UnionMember5; + | PredefinedListResponse.UnionMember5 + | PredefinedListResponse.UnionMember6; export namespace PredefinedListResponse { export interface UnionMember0 { @@ -303,7 +304,26 @@ export namespace PredefinedListResponse { export interface UnionMember1 { id: string; - confidence: UnionMember1.Confidence; + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + + upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; + } + + export interface UnionMember2 { + id: string; + + confidence: UnionMember2.Confidence; enabled: boolean; @@ -321,10 +341,10 @@ export namespace PredefinedListResponse { /** * A Predefined AI prompt classification topic entry. */ - variant?: UnionMember1.UnionMember0 | UnionMember1.UnionMember1; + variant?: UnionMember2.UnionMember0 | UnionMember2.UnionMember1; } - export namespace UnionMember1 { + export namespace UnionMember2 { export interface Confidence { /** * Indicates whether this entry has AI remote service validation. @@ -366,7 +386,7 @@ export namespace PredefinedListResponse { } } - export interface UnionMember2 { + export interface UnionMember3 { id: string; created_at: string; @@ -384,7 +404,7 @@ export namespace PredefinedListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember3 { + export interface UnionMember4 { id: string; /** @@ -408,7 +428,7 @@ export namespace PredefinedListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember4 { + export interface UnionMember5 { id: string; created_at: string; @@ -424,7 +444,7 @@ export namespace PredefinedListResponse { upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export interface UnionMember5 { + export interface UnionMember6 { id: string; created_at: string; @@ -453,7 +473,8 @@ export type PredefinedGetResponse = | PredefinedGetResponse.UnionMember2 | PredefinedGetResponse.UnionMember3 | PredefinedGetResponse.UnionMember4 - | PredefinedGetResponse.UnionMember5; + | PredefinedGetResponse.UnionMember5 + | PredefinedGetResponse.UnionMember6; export namespace PredefinedGetResponse { export interface UnionMember0 { @@ -500,7 +521,39 @@ export namespace PredefinedGetResponse { export interface UnionMember1 { id: string; - confidence: UnionMember1.Confidence; + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + + profiles?: Array; + + upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; + } + + export namespace UnionMember1 { + /** + * Computed entry field for a profile that an entry is shared into. + */ + export interface Profile { + id: string; + + name: string; + } + } + + export interface UnionMember2 { + id: string; + + confidence: UnionMember2.Confidence; enabled: boolean; @@ -513,17 +566,17 @@ export namespace PredefinedGetResponse { */ profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; /** * A Predefined AI prompt classification topic entry. */ - variant?: UnionMember1.UnionMember0 | UnionMember1.UnionMember1; + variant?: UnionMember2.UnionMember0 | UnionMember2.UnionMember1; } - export namespace UnionMember1 { + export namespace UnionMember2 { export interface Confidence { /** * Indicates whether this entry has AI remote service validation. @@ -574,7 +627,7 @@ export namespace PredefinedGetResponse { } } - export interface UnionMember2 { + export interface UnionMember3 { id: string; created_at: string; @@ -589,12 +642,12 @@ export namespace PredefinedGetResponse { profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember2 { + export namespace UnionMember3 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -605,7 +658,7 @@ export namespace PredefinedGetResponse { } } - export interface UnionMember3 { + export interface UnionMember4 { id: string; /** @@ -626,12 +679,12 @@ export namespace PredefinedGetResponse { updated_at: string; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember3 { + export namespace UnionMember4 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -642,7 +695,7 @@ export namespace PredefinedGetResponse { } } - export interface UnionMember4 { + export interface UnionMember5 { id: string; created_at: string; @@ -655,12 +708,12 @@ export namespace PredefinedGetResponse { updated_at: string; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember4 { + export namespace UnionMember5 { /** * Computed entry field for a profile that an entry is shared into. */ @@ -671,7 +724,7 @@ export namespace PredefinedGetResponse { } } - export interface UnionMember5 { + export interface UnionMember6 { id: string; created_at: string; @@ -688,12 +741,12 @@ export namespace PredefinedGetResponse { profile_id?: string | null; - profiles?: Array; + profiles?: Array; upload_status?: 'empty' | 'uploading' | 'pending' | 'processing' | 'failed' | 'complete'; } - export namespace UnionMember5 { + export namespace UnionMember6 { /** * Computed entry field for a profile that an entry is shared into. */ diff --git a/src/resources/zero-trust/dlp/profiles/custom.ts b/src/resources/zero-trust/dlp/profiles/custom.ts index 90e6e03825..5ee6f6a121 100644 --- a/src/resources/zero-trust/dlp/profiles/custom.ts +++ b/src/resources/zero-trust/dlp/profiles/custom.ts @@ -165,6 +165,7 @@ export interface CustomProfile { */ entries?: Array< | CustomProfile.CustomEntry + | CustomProfile.CustomPromptTopicEntry | CustomProfile.PredefinedEntry | CustomProfile.IntegrationEntry | CustomProfile.ExactDataEntry @@ -179,6 +180,7 @@ export interface CustomProfile { shared_entries?: Array< | CustomProfile.CustomEntry + | CustomProfile.CustomPromptTopicEntry | CustomProfile.PredefinedEntry | CustomProfile.IntegrationEntry | CustomProfile.ExactDataEntry @@ -214,6 +216,23 @@ export namespace CustomProfile { profile_id?: string | null; } + export interface CustomPromptTopicEntry { + id: string; + + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + } + export interface PredefinedEntry { id: string; @@ -383,6 +402,23 @@ export namespace CustomProfile { profile_id?: string | null; } + export interface CustomPromptTopicEntry { + id: string; + + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + } + export interface PredefinedEntry { id: string; diff --git a/src/resources/zero-trust/dlp/profiles/predefined.ts b/src/resources/zero-trust/dlp/profiles/predefined.ts index 5d89fd871d..01f70838ce 100644 --- a/src/resources/zero-trust/dlp/profiles/predefined.ts +++ b/src/resources/zero-trust/dlp/profiles/predefined.ts @@ -109,6 +109,7 @@ export interface PredefinedProfile { */ entries: Array< | PredefinedProfile.CustomEntry + | PredefinedProfile.CustomPromptTopicEntry | PredefinedProfile.PredefinedEntry | PredefinedProfile.IntegrationEntry | PredefinedProfile.ExactDataEntry @@ -158,6 +159,23 @@ export namespace PredefinedProfile { profile_id?: string | null; } + export interface CustomPromptTopicEntry { + id: string; + + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + } + export interface PredefinedEntry { id: string; diff --git a/src/resources/zero-trust/dlp/profiles/profiles.ts b/src/resources/zero-trust/dlp/profiles/profiles.ts index 94d8da86f8..7f10f17bfe 100644 --- a/src/resources/zero-trust/dlp/profiles/profiles.ts +++ b/src/resources/zero-trust/dlp/profiles/profiles.ts @@ -173,6 +173,7 @@ export namespace Profile { */ entries?: Array< | CustomProfile.CustomEntry + | CustomProfile.CustomPromptTopicEntry | CustomProfile.PredefinedEntry | CustomProfile.IntegrationEntry | CustomProfile.ExactDataEntry @@ -187,6 +188,7 @@ export namespace Profile { shared_entries?: Array< | CustomProfile.CustomEntry + | CustomProfile.CustomPromptTopicEntry | CustomProfile.PredefinedEntry | CustomProfile.IntegrationEntry | CustomProfile.ExactDataEntry @@ -222,6 +224,23 @@ export namespace Profile { profile_id?: string | null; } + export interface CustomPromptTopicEntry { + id: string; + + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + } + export interface PredefinedEntry { id: string; @@ -391,6 +410,23 @@ export namespace Profile { profile_id?: string | null; } + export interface CustomPromptTopicEntry { + id: string; + + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + } + export interface PredefinedEntry { id: string; @@ -539,6 +575,7 @@ export namespace Profile { */ entries: Array< | PredefinedProfile.CustomEntry + | PredefinedProfile.CustomPromptTopicEntry | PredefinedProfile.PredefinedEntry | PredefinedProfile.IntegrationEntry | PredefinedProfile.ExactDataEntry @@ -598,6 +635,23 @@ export namespace Profile { profile_id?: string | null; } + export interface CustomPromptTopicEntry { + id: string; + + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + } + export interface PredefinedEntry { id: string; @@ -743,6 +797,7 @@ export namespace Profile { */ entries: Array< | IntegrationProfile.CustomEntry + | IntegrationProfile.CustomPromptTopicEntry | IntegrationProfile.PredefinedEntry | IntegrationProfile.IntegrationEntry | IntegrationProfile.ExactDataEntry @@ -754,6 +809,7 @@ export namespace Profile { shared_entries: Array< | IntegrationProfile.CustomEntry + | IntegrationProfile.CustomPromptTopicEntry | IntegrationProfile.PredefinedEntry | IntegrationProfile.IntegrationEntry | IntegrationProfile.ExactDataEntry @@ -798,6 +854,23 @@ export namespace Profile { profile_id?: string | null; } + export interface CustomPromptTopicEntry { + id: string; + + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + } + export interface PredefinedEntry { id: string; @@ -958,6 +1031,23 @@ export namespace Profile { profile_id?: string | null; } + export interface CustomPromptTopicEntry { + id: string; + + created_at: string; + + /** + * @deprecated + */ + enabled: boolean; + + name: string; + + type: 'custom_prompt_topic'; + + updated_at: string; + } + export interface PredefinedEntry { id: string; diff --git a/tests/api-resources/ai-gateway/ai-gateway.test.ts b/tests/api-resources/ai-gateway/ai-gateway.test.ts index 1428ae341f..5f98fba07e 100644 --- a/tests/api-resources/ai-gateway/ai-gateway.test.ts +++ b/tests/api-resources/ai-gateway/ai-gateway.test.ts @@ -84,6 +84,40 @@ describe('resource aiGateway', () => { enabled: true, profiles: ['string'], }, + guardrails: { + prompt: { + P1: 'FLAG', + S1: 'FLAG', + S10: 'FLAG', + S11: 'FLAG', + S12: 'FLAG', + S13: 'FLAG', + S2: 'FLAG', + S3: 'FLAG', + S4: 'FLAG', + S5: 'FLAG', + S6: 'FLAG', + S7: 'FLAG', + S8: 'FLAG', + S9: 'FLAG', + }, + response: { + P1: 'FLAG', + S1: 'FLAG', + S10: 'FLAG', + S11: 'FLAG', + S12: 'FLAG', + S13: 'FLAG', + S2: 'FLAG', + S3: 'FLAG', + S4: 'FLAG', + S5: 'FLAG', + S6: 'FLAG', + S7: 'FLAG', + S8: 'FLAG', + S9: 'FLAG', + }, + }, log_management: 10000, log_management_strategy: 'STOP_INSERTING', logpush: true, @@ -92,7 +126,7 @@ describe('resource aiGateway', () => { { authorization: 'authorization', headers: { foo: 'string' }, - url: 'url', + url: 'https://example.com', content_type: 'json', }, ], From acb87c71f1128ce0f59ab5e9bda15bf9176bb12a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 00:30:31 +0000 Subject: [PATCH 24/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/acm/custom-trust-store.ts | 15 +++++---- src/resources/ai-gateway/dynamic-routing.ts | 32 +++++++++++++++++-- src/resources/d1/d1.ts | 6 ++-- src/resources/d1/database/database.ts | 19 +++++++++++ .../ai-gateway/dynamic-routing.test.ts | 2 ++ .../d1/database/database.test.ts | 1 + 7 files changed, 65 insertions(+), 12 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5164ab07e1..4aa3d32323 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2220 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 20525f5883d4d78be797dee296df1442 +openapi_spec_hash: 0a99f50e35e07f6bf24899f6cb02ca0f config_hash: cef856e42543e49d9b09cb9eac20dc9e diff --git a/src/resources/acm/custom-trust-store.ts b/src/resources/acm/custom-trust-store.ts index 7cfdd7d0b5..1e25285e0b 100644 --- a/src/resources/acm/custom-trust-store.ts +++ b/src/resources/acm/custom-trust-store.ts @@ -6,7 +6,8 @@ import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../p export class CustomTrustStore extends APIResource { /** - * Add Custom Origin Trust Store for a Zone. + * Upload a root CA certificate to the Custom Origin Trust Store for a Zone. Only + * root CA certificates are accepted. * * @example * ```ts @@ -56,7 +57,7 @@ export class CustomTrustStore extends APIResource { } /** - * Removes a CA certificate from the custom origin trust store. Origins using + * Removes a root CA certificate from the custom origin trust store. Origins using * certificates signed by this CA will no longer be trusted. * * @example @@ -83,8 +84,8 @@ export class CustomTrustStore extends APIResource { } /** - * Retrieves details about a specific certificate in the custom origin trust store, - * including expiration and subject information. + * Retrieves details about a specific root CA certificate in the custom origin + * trust store, including expiration and subject information. * * @example * ```ts @@ -119,7 +120,8 @@ export interface CustomTrustStore { id: string; /** - * The zone's SSL certificate or certificate and the intermediate(s). + * The root CA certificate in PEM format. Only root CA certificates are accepted; + * intermediate and leaf certificates are not supported. */ certificate: string; @@ -168,7 +170,8 @@ export interface CustomTrustStoreCreateParams { zone_id: string; /** - * Body param: The zone's SSL certificate or certificate and the intermediate(s). + * Body param: The root CA certificate in PEM format. Only root CA certificates are + * accepted; intermediate and leaf certificates are not supported. */ certificate: string; } diff --git a/src/resources/ai-gateway/dynamic-routing.ts b/src/resources/ai-gateway/dynamic-routing.ts index 7210e4c948..fb67ddba09 100644 --- a/src/resources/ai-gateway/dynamic-routing.ts +++ b/src/resources/ai-gateway/dynamic-routing.ts @@ -82,8 +82,11 @@ export class DynamicRouting extends APIResource { params: DynamicRoutingListParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; - return this._client.get(`/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/routes`, options); + const { account_id, ...query } = params; + return this._client.get(`/accounts/${account_id}/ai-gateway/gateways/${gatewayId}/routes`, { + query, + ...options, + }); } /** @@ -491,6 +494,8 @@ export namespace DynamicRoutingCreateResponse { data: string; version_id: string; + + is_valid?: boolean; } } @@ -701,6 +706,8 @@ export namespace DynamicRoutingUpdateResponse { data: string; version_id: string; + + is_valid?: boolean; } } } @@ -925,6 +932,8 @@ export namespace DynamicRoutingListResponse { data: string; version_id: string; + + is_valid?: boolean; } } } @@ -1665,6 +1674,8 @@ export namespace DynamicRoutingGetResponse { data: string; version_id: string; + + is_valid?: boolean; } } @@ -1693,6 +1704,8 @@ export interface DynamicRoutingGetVersionResponse { name: string; version_id: string; + + is_valid?: boolean; } export namespace DynamicRoutingGetVersionResponse { @@ -1911,6 +1924,8 @@ export namespace DynamicRoutingListVersionsResponse { data: string; version_id: string; + + is_valid?: boolean; } } } @@ -2110,7 +2125,20 @@ export interface DynamicRoutingUpdateParams { } export interface DynamicRoutingListParams { + /** + * Path param + */ account_id: string; + + /** + * Query param: Page number + */ + page?: number; + + /** + * Query param: Number of routes per page + */ + per_page?: number; } export interface DynamicRoutingDeleteParams { diff --git a/src/resources/d1/d1.ts b/src/resources/d1/d1.ts index 46a2524e02..4a51c559a8 100644 --- a/src/resources/d1/d1.ts +++ b/src/resources/d1/d1.ts @@ -75,9 +75,9 @@ export namespace D1 { */ export interface ReadReplication { /** - * The read replication mode for the database. Use 'auto' to create replicas and - * allow D1 automatically place them around the world, or 'disabled' to not use any - * database replicas (it can take a few hours for all replicas to be deleted). + * The read replication mode for the database. Mode 'auto' denotes that D1 creates + * replicas and automatically places them around the world. Mode 'disabled' denotes + * that no database replicas are used. */ mode: 'auto' | 'disabled'; } diff --git a/src/resources/d1/database/database.ts b/src/resources/d1/database/database.ts index 01936a7754..ed96fea209 100644 --- a/src/resources/d1/database/database.ts +++ b/src/resources/d1/database/database.ts @@ -701,6 +701,25 @@ export interface DatabaseCreateParams { * user. */ primary_location_hint?: 'wnam' | 'enam' | 'weur' | 'eeur' | 'apac' | 'oc'; + + /** + * Body param: Configuration for D1 read replication. + */ + read_replication?: DatabaseCreateParams.ReadReplication; +} + +export namespace DatabaseCreateParams { + /** + * Configuration for D1 read replication. + */ + export interface ReadReplication { + /** + * The read replication mode for the database. Use 'auto' to create replicas and + * allow D1 automatically place them around the world, or 'disabled' to not use any + * database replicas (it can take a few hours for all replicas to be deleted). + */ + mode: 'auto' | 'disabled'; + } } export interface DatabaseUpdateParams { diff --git a/tests/api-resources/ai-gateway/dynamic-routing.test.ts b/tests/api-resources/ai-gateway/dynamic-routing.test.ts index df2b90b5d8..547924b213 100644 --- a/tests/api-resources/ai-gateway/dynamic-routing.test.ts +++ b/tests/api-resources/ai-gateway/dynamic-routing.test.ts @@ -82,6 +82,8 @@ describe('resource dynamicRouting', () => { test('list: required and optional params', async () => { const response = await client.aiGateway.dynamicRouting.list('54442216', { account_id: '0d37909e38d3e99c29fa2cd343ac421a', + page: 1, + per_page: 20, }); }); diff --git a/tests/api-resources/d1/database/database.test.ts b/tests/api-resources/d1/database/database.test.ts index 979c4446c3..c7dea1b432 100644 --- a/tests/api-resources/d1/database/database.test.ts +++ b/tests/api-resources/d1/database/database.test.ts @@ -30,6 +30,7 @@ describe('resource database', () => { name: 'my-database', jurisdiction: 'eu', primary_location_hint: 'wnam', + read_replication: { mode: 'auto' }, }); }); From 1a0e7d63c513ea7a77fafe8be565266be1d3f202 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 15:45:37 +0000 Subject: [PATCH 25/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 4aa3d32323..9ab2b4c63b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2220 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 0a99f50e35e07f6bf24899f6cb02ca0f +openapi_spec_hash: 4388fdee095ceb19ba22da605f7a4fe2 config_hash: cef856e42543e49d9b09cb9eac20dc9e From 163d258b6278a359d1d5d379b20db8c620b90663 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 17:01:55 +0000 Subject: [PATCH 26/73] feat: feat: WAD-244 Onboard AI Security for Apps api * feat: WAD-244 Onboard AI Security for Apps api --- .stats.yml | 4 +- api.md | 2 + scripts/detect-breaking-changes | 2 + src/index.ts | 5 + src/resources/ai-security.ts | 3 + src/resources/ai-security/ai-security.ts | 117 ++++++++++++++ src/resources/ai-security/api.md | 23 +++ src/resources/ai-security/custom-topics.ts | 143 ++++++++++++++++++ src/resources/ai-security/index.ts | 10 ++ src/resources/index.ts | 1 + .../ai-security/ai-security.test.ts | 45 ++++++ .../ai-security/custom-topics.test.ts | 51 +++++++ 12 files changed, 404 insertions(+), 2 deletions(-) create mode 100644 src/resources/ai-security.ts create mode 100644 src/resources/ai-security/ai-security.ts create mode 100644 src/resources/ai-security/api.md create mode 100644 src/resources/ai-security/custom-topics.ts create mode 100644 src/resources/ai-security/index.ts create mode 100644 tests/api-resources/ai-security/ai-security.test.ts create mode 100644 tests/api-resources/ai-security/custom-topics.test.ts diff --git a/.stats.yml b/.stats.yml index 9ab2b4c63b..83f29fc05d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2220 +configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 4388fdee095ceb19ba22da605f7a4fe2 -config_hash: cef856e42543e49d9b09cb9eac20dc9e +config_hash: f442d2e2e1199d087c1cd3441cd62b77 diff --git a/api.md b/api.md index 6e073fdc99..dffd6a3c44 100644 --- a/api.md +++ b/api.md @@ -219,6 +219,8 @@ Types: # [ContentScanning](src/resources/content-scanning/api.md) +# [AISecurity](src/resources/ai-security/api.md) + # [AbuseReports](src/resources/abuse-reports/api.md) # [AI](src/resources/ai/api.md) diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 5629104c4f..f3ab109852 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -818,6 +818,8 @@ TEST_PATHS=( tests/api-resources/content-scanning/content-scanning.test.ts tests/api-resources/content-scanning/payloads.test.ts tests/api-resources/content-scanning/settings.test.ts + tests/api-resources/ai-security/ai-security.test.ts + tests/api-resources/ai-security/custom-topics.test.ts tests/api-resources/abuse-reports/abuse-reports.test.ts tests/api-resources/abuse-reports/mitigations.test.ts tests/api-resources/ai/ai.test.ts diff --git a/src/index.ts b/src/index.ts index 9abff20913..e8558e34ce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -25,6 +25,7 @@ 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 { AISecurity } from './resources/ai-security/ai-security'; import { AI } from './resources/ai/ai'; import { AISearch } from './resources/aisearch/aisearch'; import { Alerting } from './resources/alerting/alerting'; @@ -372,6 +373,7 @@ export class Cloudflare extends Core.APIClient { resourceTagging: API.ResourceTagging = new API.ResourceTagging(this); leakedCredentialChecks: API.LeakedCredentialChecks = new API.LeakedCredentialChecks(this); contentScanning: API.ContentScanning = new API.ContentScanning(this); + aiSecurity: API.AISecurity = new API.AISecurity(this); abuseReports: API.AbuseReports = new API.AbuseReports(this); ai: API.AI = new API.AI(this); aiSearch: API.AISearch = new API.AISearch(this); @@ -620,6 +622,7 @@ Cloudflare.ResourceSharing = ResourceSharing; Cloudflare.ResourceTagging = ResourceTagging; Cloudflare.LeakedCredentialChecks = LeakedCredentialChecks; Cloudflare.ContentScanning = ContentScanning; +Cloudflare.AISecurity = AISecurity; Cloudflare.AbuseReports = AbuseReports; Cloudflare.AI = AI; Cloudflare.AISearch = AISearch; @@ -859,6 +862,8 @@ export declare namespace Cloudflare { export { ContentScanning as ContentScanning }; + export { AISecurity as AISecurity }; + export { AbuseReports as AbuseReports }; export { AI as AI }; diff --git a/src/resources/ai-security.ts b/src/resources/ai-security.ts new file mode 100644 index 0000000000..fc541887d2 --- /dev/null +++ b/src/resources/ai-security.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './ai-security/index'; diff --git a/src/resources/ai-security/ai-security.ts b/src/resources/ai-security/ai-security.ts new file mode 100644 index 0000000000..4645991853 --- /dev/null +++ b/src/resources/ai-security/ai-security.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 * as CustomTopicsAPI from './custom-topics'; +import { + CustomTopicGetParams, + CustomTopicGetResponse, + CustomTopicUpdateParams, + CustomTopicUpdateResponse, + CustomTopics, +} from './custom-topics'; + +export class AISecurity extends APIResource { + customTopics: CustomTopicsAPI.CustomTopics = new CustomTopicsAPI.CustomTopics(this._client); + + /** + * Enable or disable AI Security for Apps for a zone. + * + * Changes can take up to a minute to propagate to the zone. + * + * @example + * ```ts + * const aiSecurity = await client.aiSecurity.update({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * }); + * ``` + */ + update( + params: AISecurityUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.put(`/zones/${zone_id}/ai-security/settings`, { body, ...options }) as Core.APIPromise<{ + result: AISecurityUpdateResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get whether AI Security for Apps is enabled or disabled for a zone. + * + * @example + * ```ts + * const aiSecurity = await client.aiSecurity.get({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * }); + * ``` + */ + get(params: AISecurityGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/ai-security/settings`, options) as Core.APIPromise<{ + result: AISecurityGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * AI Security for Apps enablement status for a zone. + */ +export interface AISecurityUpdateResponse { + /** + * Whether AI Security for Apps is enabled on the zone. + */ + enabled?: boolean; +} + +/** + * AI Security for Apps enablement status for a zone. + */ +export interface AISecurityGetResponse { + /** + * Whether AI Security for Apps is enabled on the zone. + */ + enabled?: boolean; +} + +export interface AISecurityUpdateParams { + /** + * Path param: Defines the zone. + */ + zone_id: string; + + /** + * Body param: Whether AI Security for Apps is enabled on the zone. + */ + enabled?: boolean; +} + +export interface AISecurityGetParams { + /** + * Defines the zone. + */ + zone_id: string; +} + +AISecurity.CustomTopics = CustomTopics; + +export declare namespace AISecurity { + export { + type AISecurityUpdateResponse as AISecurityUpdateResponse, + type AISecurityGetResponse as AISecurityGetResponse, + type AISecurityUpdateParams as AISecurityUpdateParams, + type AISecurityGetParams as AISecurityGetParams, + }; + + export { + CustomTopics as CustomTopics, + type CustomTopicUpdateResponse as CustomTopicUpdateResponse, + type CustomTopicGetResponse as CustomTopicGetResponse, + type CustomTopicUpdateParams as CustomTopicUpdateParams, + type CustomTopicGetParams as CustomTopicGetParams, + }; +} diff --git a/src/resources/ai-security/api.md b/src/resources/ai-security/api.md new file mode 100644 index 0000000000..d75b74efd6 --- /dev/null +++ b/src/resources/ai-security/api.md @@ -0,0 +1,23 @@ +# AISecurity + +Types: + +- AISecurityUpdateResponse +- AISecurityGetResponse + +Methods: + +- client.aiSecurity.update({ ...params }) -> AISecurityUpdateResponse +- client.aiSecurity.get({ ...params }) -> AISecurityGetResponse + +## CustomTopics + +Types: + +- CustomTopicUpdateResponse +- CustomTopicGetResponse + +Methods: + +- client.aiSecurity.customTopics.update({ ...params }) -> CustomTopicUpdateResponse +- client.aiSecurity.customTopics.get({ ...params }) -> CustomTopicGetResponse diff --git a/src/resources/ai-security/custom-topics.ts b/src/resources/ai-security/custom-topics.ts new file mode 100644 index 0000000000..217a4c317c --- /dev/null +++ b/src/resources/ai-security/custom-topics.ts @@ -0,0 +1,143 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; + +export class CustomTopics extends APIResource { + /** + * Set the AI Security for Apps custom topic categories for a zone. + * + * A maximum of 20 custom topics can be configured per zone. Each topic label must + * be 2–20 characters using only lowercase letters (a–z), digits (0–9), and + * hyphens. Each topic description must be 2–50 printable ASCII characters. + * + * Changes can take up to a minute to propagate to the zone. + * + * @example + * ```ts + * const customTopic = + * await client.aiSecurity.customTopics.update({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * }); + * ``` + */ + update( + params: CustomTopicUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { zone_id, ...body } = params; + return ( + this._client.put(`/zones/${zone_id}/ai-security/custom-topics`, { + body, + ...options, + }) as Core.APIPromise<{ result: CustomTopicUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get the AI Security for Apps custom topic categories for a zone. + * + * @example + * ```ts + * const customTopic = + * await client.aiSecurity.customTopics.get({ + * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + * }); + * ``` + */ + get(params: CustomTopicGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/ai-security/custom-topics`, options) as Core.APIPromise<{ + result: CustomTopicGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface CustomTopicUpdateResponse { + /** + * Custom topic categories for AI Security for Apps content detection. + */ + topics?: Array; +} + +export namespace CustomTopicUpdateResponse { + export interface Topic { + /** + * Unique label identifier. Must contain only lowercase letters (a–z), digits + * (0–9), and hyphens. + */ + label: string; + + /** + * Description of the topic category. Must contain only printable ASCII characters. + */ + topic: string; + } +} + +export interface CustomTopicGetResponse { + /** + * Custom topic categories for AI Security for Apps content detection. + */ + topics?: Array; +} + +export namespace CustomTopicGetResponse { + export interface Topic { + /** + * Unique label identifier. Must contain only lowercase letters (a–z), digits + * (0–9), and hyphens. + */ + label: string; + + /** + * Description of the topic category. Must contain only printable ASCII characters. + */ + topic: string; + } +} + +export interface CustomTopicUpdateParams { + /** + * Path param: Defines the zone. + */ + zone_id: string; + + /** + * Body param: Custom topic categories for AI Security for Apps content detection. + */ + topics?: Array; +} + +export namespace CustomTopicUpdateParams { + export interface Topic { + /** + * Unique label identifier. Must contain only lowercase letters (a–z), digits + * (0–9), and hyphens. + */ + label: string; + + /** + * Description of the topic category. Must contain only printable ASCII characters. + */ + topic: string; + } +} + +export interface CustomTopicGetParams { + /** + * Defines the zone. + */ + zone_id: string; +} + +export declare namespace CustomTopics { + export { + type CustomTopicUpdateResponse as CustomTopicUpdateResponse, + type CustomTopicGetResponse as CustomTopicGetResponse, + type CustomTopicUpdateParams as CustomTopicUpdateParams, + type CustomTopicGetParams as CustomTopicGetParams, + }; +} diff --git a/src/resources/ai-security/index.ts b/src/resources/ai-security/index.ts new file mode 100644 index 0000000000..fe24586666 --- /dev/null +++ b/src/resources/ai-security/index.ts @@ -0,0 +1,10 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { AISecurity } from './ai-security'; +export { + CustomTopics, + type CustomTopicUpdateResponse, + type CustomTopicGetResponse, + type CustomTopicUpdateParams, + type CustomTopicGetParams, +} from './custom-topics'; diff --git a/src/resources/index.ts b/src/resources/index.ts index a16db5c29e..7235c2e0a8 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -5,6 +5,7 @@ export { ACM } from './acm/acm'; export { AI } from './ai/ai'; export { AIGateway } from './ai-gateway/ai-gateway'; export { AISearch } from './aisearch/aisearch'; +export { AISecurity } from './ai-security/ai-security'; export { APIGateway } from './api-gateway/api-gateway'; export { AbuseReports } from './abuse-reports/abuse-reports'; export { Accounts } from './accounts/accounts'; diff --git a/tests/api-resources/ai-security/ai-security.test.ts b/tests/api-resources/ai-security/ai-security.test.ts new file mode 100644 index 0000000000..f9730ae514 --- /dev/null +++ b/tests/api-resources/ai-security/ai-security.test.ts @@ -0,0 +1,45 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource aiSecurity', () => { + test('update: only required params', async () => { + const responsePromise = client.aiSecurity.update({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('update: required and optional params', async () => { + const response = await client.aiSecurity.update({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + enabled: true, + }); + }); + + test('get: only required params', async () => { + const responsePromise = client.aiSecurity.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.aiSecurity.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + }); +}); diff --git a/tests/api-resources/ai-security/custom-topics.test.ts b/tests/api-resources/ai-security/custom-topics.test.ts new file mode 100644 index 0000000000..e0c97ce2e6 --- /dev/null +++ b/tests/api-resources/ai-security/custom-topics.test.ts @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource customTopics', () => { + test('update: only required params', async () => { + const responsePromise = client.aiSecurity.customTopics.update({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('update: required and optional params', async () => { + const response = await client.aiSecurity.customTopics.update({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + topics: [{ label: 'credit-cards', topic: 'credit card numbers' }], + }); + }); + + test('get: only required params', async () => { + const responsePromise = client.aiSecurity.customTopics.get({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.aiSecurity.customTopics.get({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); From 59e61484ca95777fae21e515cd14282fbc20990f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 19:11:19 +0000 Subject: [PATCH 27/73] feat: chore: skip 25 failing TypeScript SDK tests from prism * chore: skip failing tests from CI run 25749791655 Skip 25 failing test methods from cloudflare-typescript PR #2753 (staging-next sync). Failures are prism mock server errors, not real SDK bugs. Breakdown by HTTP status: - 22 methods: HTTP 404 (route not in prism spec) - 2 methods: HTTP 422 (load_balancers.monitor_groups) - 1 method: HTTP 405 (cache.smart_tiered_cache.create) Resources affected: - ai_gateway.billing (3 methods + 8 in subresources) - ai_security (2 methods + 2 in custom_topics) - cache (1 method + 7 in origin_cloud_regions + 1 in smart_tiered_cache) - load_balancers.monitor_groups (2 methods) CI run: https://github.com/cloudflare/cloudflare-typescript/actions/runs/25749791655 --- .stats.yml | 2 +- .../ai-gateway/billing/billing.test.ts | 18 ++++++---- .../ai-gateway/billing/spending-limit.test.ts | 18 ++++++---- .../ai-gateway/billing/topup/config.test.ts | 18 ++++++---- .../ai-gateway/billing/topup/topup.test.ts | 12 ++++--- .../ai-security/ai-security.test.ts | 12 ++++--- .../ai-security/custom-topics.test.ts | 12 ++++--- tests/api-resources/cache/cache.test.ts | 6 ++-- .../cache/origin-cloud-regions.test.ts | 36 ++++++++++++------- .../cache/smart-tiered-cache.test.ts | 6 ++-- .../monitor-groups/monitor-groups.test.ts | 12 ++++--- 11 files changed, 101 insertions(+), 51 deletions(-) diff --git a/.stats.yml b/.stats.yml index 83f29fc05d..9cc1aaaa8b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 4388fdee095ceb19ba22da605f7a4fe2 -config_hash: f442d2e2e1199d087c1cd3441cd62b77 +config_hash: a0d2c4abe971a3caafcc4324d98d7106 diff --git a/tests/api-resources/ai-gateway/billing/billing.test.ts b/tests/api-resources/ai-gateway/billing/billing.test.ts index 6c1a9283d7..e02557ecf3 100644 --- a/tests/api-resources/ai-gateway/billing/billing.test.ts +++ b/tests/api-resources/ai-gateway/billing/billing.test.ts @@ -27,7 +27,8 @@ describe('resource billing', () => { const response = await client.aiGateway.billing.creditBalance({ account_id: 'account_id' }); }); - test('invoiceHistory: only required params', async () => { + // HTTP 404 error from prism + test.skip('invoiceHistory: only required params', async () => { const responsePromise = client.aiGateway.billing.invoiceHistory({ account_id: 'account_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -38,11 +39,13 @@ describe('resource billing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('invoiceHistory: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('invoiceHistory: required and optional params', async () => { const response = await client.aiGateway.billing.invoiceHistory({ account_id: 'account_id', type: 'all' }); }); - test('invoicePreview: only required params', async () => { + // HTTP 404 error from prism + test.skip('invoicePreview: only required params', async () => { const responsePromise = client.aiGateway.billing.invoicePreview({ account_id: 'account_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -53,11 +56,13 @@ describe('resource billing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('invoicePreview: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('invoicePreview: required and optional params', async () => { const response = await client.aiGateway.billing.invoicePreview({ account_id: 'account_id' }); }); - test('usageHistory: only required params', async () => { + // HTTP 404 error from prism + test.skip('usageHistory: only required params', async () => { const responsePromise = client.aiGateway.billing.usageHistory({ account_id: 'account_id', value_grouping_window: 'day', @@ -71,7 +76,8 @@ describe('resource billing', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('usageHistory: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('usageHistory: required and optional params', async () => { const response = await client.aiGateway.billing.usageHistory({ account_id: 'account_id', value_grouping_window: 'day', diff --git a/tests/api-resources/ai-gateway/billing/spending-limit.test.ts b/tests/api-resources/ai-gateway/billing/spending-limit.test.ts index 378a04725f..e14d29f9a4 100644 --- a/tests/api-resources/ai-gateway/billing/spending-limit.test.ts +++ b/tests/api-resources/ai-gateway/billing/spending-limit.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource spendingLimit', () => { - test('create: only required params', async () => { + // HTTP 404 error from prism + test.skip('create: only required params', async () => { const responsePromise = client.aiGateway.billing.spendingLimit.create({ account_id: 'account_id', amount: 10000, @@ -26,7 +27,8 @@ describe('resource spendingLimit', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('create: required and optional params', async () => { const response = await client.aiGateway.billing.spendingLimit.create({ account_id: 'account_id', amount: 10000, @@ -35,7 +37,8 @@ describe('resource spendingLimit', () => { }); }); - test('delete: only required params', async () => { + // HTTP 404 error from prism + test.skip('delete: only required params', async () => { const responsePromise = client.aiGateway.billing.spendingLimit.delete({ account_id: 'account_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -46,11 +49,13 @@ describe('resource spendingLimit', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('delete: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('delete: required and optional params', async () => { const response = await client.aiGateway.billing.spendingLimit.delete({ account_id: 'account_id' }); }); - test('get: only required params', async () => { + // HTTP 404 error from prism + test.skip('get: only required params', async () => { const responsePromise = client.aiGateway.billing.spendingLimit.get({ account_id: 'account_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -61,7 +66,8 @@ describe('resource spendingLimit', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('get: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('get: required and optional params', async () => { const response = await client.aiGateway.billing.spendingLimit.get({ account_id: 'account_id' }); }); }); diff --git a/tests/api-resources/ai-gateway/billing/topup/config.test.ts b/tests/api-resources/ai-gateway/billing/topup/config.test.ts index 10f62c6ac2..3578dd3094 100644 --- a/tests/api-resources/ai-gateway/billing/topup/config.test.ts +++ b/tests/api-resources/ai-gateway/billing/topup/config.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource config', () => { - test('create: only required params', async () => { + // HTTP 404 error from prism + test.skip('create: only required params', async () => { const responsePromise = client.aiGateway.billing.topup.config.create({ account_id: 'account_id', amount: 5000, @@ -25,7 +26,8 @@ describe('resource config', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('create: required and optional params', async () => { const response = await client.aiGateway.billing.topup.config.create({ account_id: 'account_id', amount: 5000, @@ -33,7 +35,8 @@ describe('resource config', () => { }); }); - test('delete: only required params', async () => { + // HTTP 404 error from prism + test.skip('delete: only required params', async () => { const responsePromise = client.aiGateway.billing.topup.config.delete({ account_id: 'account_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -44,11 +47,13 @@ describe('resource config', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('delete: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('delete: required and optional params', async () => { const response = await client.aiGateway.billing.topup.config.delete({ account_id: 'account_id' }); }); - test('get: only required params', async () => { + // HTTP 404 error from prism + test.skip('get: only required params', async () => { const responsePromise = client.aiGateway.billing.topup.config.get({ account_id: 'account_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -59,7 +64,8 @@ describe('resource config', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('get: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('get: required and optional params', async () => { const response = await client.aiGateway.billing.topup.config.get({ account_id: 'account_id' }); }); }); diff --git a/tests/api-resources/ai-gateway/billing/topup/topup.test.ts b/tests/api-resources/ai-gateway/billing/topup/topup.test.ts index 612c2098a3..8412810300 100644 --- a/tests/api-resources/ai-gateway/billing/topup/topup.test.ts +++ b/tests/api-resources/ai-gateway/billing/topup/topup.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource topup', () => { - test('create: only required params', async () => { + // HTTP 404 error from prism + test.skip('create: only required params', async () => { const responsePromise = client.aiGateway.billing.topup.create({ account_id: 'account_id', amount: 5000 }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -21,11 +22,13 @@ describe('resource topup', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('create: required and optional params', async () => { const response = await client.aiGateway.billing.topup.create({ account_id: 'account_id', amount: 5000 }); }); - test('status: only required params', async () => { + // HTTP 404 error from prism + test.skip('status: only required params', async () => { const responsePromise = client.aiGateway.billing.topup.status({ account_id: 'account_id', payment_intent_id: 'in_1abc', @@ -39,7 +42,8 @@ describe('resource topup', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('status: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('status: required and optional params', async () => { const response = await client.aiGateway.billing.topup.status({ account_id: 'account_id', payment_intent_id: 'in_1abc', diff --git a/tests/api-resources/ai-security/ai-security.test.ts b/tests/api-resources/ai-security/ai-security.test.ts index f9730ae514..dedfbf4adf 100644 --- a/tests/api-resources/ai-security/ai-security.test.ts +++ b/tests/api-resources/ai-security/ai-security.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource aiSecurity', () => { - test('update: only required params', async () => { + // HTTP 404 error from prism + test.skip('update: only required params', async () => { const responsePromise = client.aiSecurity.update({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -21,14 +22,16 @@ describe('resource aiSecurity', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('update: required and optional params', async () => { const response = await client.aiSecurity.update({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', enabled: true, }); }); - test('get: only required params', async () => { + // HTTP 404 error from prism + test.skip('get: only required params', async () => { const responsePromise = client.aiSecurity.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -39,7 +42,8 @@ describe('resource aiSecurity', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('get: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('get: required and optional params', async () => { const response = await client.aiSecurity.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); }); }); diff --git a/tests/api-resources/ai-security/custom-topics.test.ts b/tests/api-resources/ai-security/custom-topics.test.ts index e0c97ce2e6..18fb39c00c 100644 --- a/tests/api-resources/ai-security/custom-topics.test.ts +++ b/tests/api-resources/ai-security/custom-topics.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource customTopics', () => { - test('update: only required params', async () => { + // HTTP 404 error from prism + test.skip('update: only required params', async () => { const responsePromise = client.aiSecurity.customTopics.update({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -23,14 +24,16 @@ describe('resource customTopics', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('update: required and optional params', async () => { const response = await client.aiSecurity.customTopics.update({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', topics: [{ label: 'credit-cards', topic: 'credit card numbers' }], }); }); - test('get: only required params', async () => { + // HTTP 404 error from prism + test.skip('get: only required params', async () => { const responsePromise = client.aiSecurity.customTopics.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -43,7 +46,8 @@ describe('resource customTopics', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('get: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('get: required and optional params', async () => { const response = await client.aiSecurity.customTopics.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); diff --git a/tests/api-resources/cache/cache.test.ts b/tests/api-resources/cache/cache.test.ts index 3ae5283a29..894a545938 100644 --- a/tests/api-resources/cache/cache.test.ts +++ b/tests/api-resources/cache/cache.test.ts @@ -28,7 +28,8 @@ describe('resource cache', () => { }); }); - test('purgeEnvironment: only required params', async () => { + // HTTP 404 error from prism + test.skip('purgeEnvironment: only required params', async () => { const responsePromise = client.cache.purgeEnvironment('023e105f4ecef8ad9ca31a8372d0c353', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -41,7 +42,8 @@ describe('resource cache', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('purgeEnvironment: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('purgeEnvironment: required and optional params', async () => { const response = await client.cache.purgeEnvironment('023e105f4ecef8ad9ca31a8372d0c353', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', tags: ['a-cache-tag', 'another-cache-tag'], diff --git a/tests/api-resources/cache/origin-cloud-regions.test.ts b/tests/api-resources/cache/origin-cloud-regions.test.ts index 4bf496f305..3123b24639 100644 --- a/tests/api-resources/cache/origin-cloud-regions.test.ts +++ b/tests/api-resources/cache/origin-cloud-regions.test.ts @@ -37,7 +37,8 @@ describe('resource originCloudRegions', () => { }); }); - test('list: only required params', async () => { + // HTTP 404 error from prism + test.skip('list: only required params', async () => { const responsePromise = client.cache.originCloudRegions.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -50,7 +51,8 @@ describe('resource originCloudRegions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('list: required and optional params', async () => { const response = await client.cache.originCloudRegions.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', page: 1, @@ -58,7 +60,8 @@ describe('resource originCloudRegions', () => { }); }); - test('delete: only required params', async () => { + // HTTP 404 error from prism + test.skip('delete: only required params', async () => { const responsePromise = client.cache.originCloudRegions.delete('192.0.2.1', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -71,13 +74,15 @@ describe('resource originCloudRegions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('delete: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('delete: required and optional params', async () => { const response = await client.cache.originCloudRegions.delete('192.0.2.1', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); - test('bulkDelete: only required params', async () => { + // HTTP 404 error from prism + test.skip('bulkDelete: only required params', async () => { const responsePromise = client.cache.originCloudRegions.bulkDelete({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -90,13 +95,15 @@ describe('resource originCloudRegions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('bulkDelete: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('bulkDelete: required and optional params', async () => { const response = await client.cache.originCloudRegions.bulkDelete({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); - test('bulkUpdate: only required params', async () => { + // HTTP 404 error from prism + test.skip('bulkUpdate: only required params', async () => { const responsePromise = client.cache.originCloudRegions.bulkUpdate({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [ @@ -121,7 +128,8 @@ describe('resource originCloudRegions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('bulkUpdate: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('bulkUpdate: required and optional params', async () => { const response = await client.cache.originCloudRegions.bulkUpdate({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', body: [ @@ -139,7 +147,8 @@ describe('resource originCloudRegions', () => { }); }); - test('get: only required params', async () => { + // HTTP 404 error from prism + test.skip('get: only required params', async () => { const responsePromise = client.cache.originCloudRegions.get('192.0.2.1', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -152,13 +161,15 @@ describe('resource originCloudRegions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('get: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('get: required and optional params', async () => { const response = await client.cache.originCloudRegions.get('192.0.2.1', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); - test('supportedRegions: only required params', async () => { + // HTTP 404 error from prism + test.skip('supportedRegions: only required params', async () => { const responsePromise = client.cache.originCloudRegions.supportedRegions({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -171,7 +182,8 @@ describe('resource originCloudRegions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('supportedRegions: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('supportedRegions: required and optional params', async () => { const response = await client.cache.originCloudRegions.supportedRegions({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); diff --git a/tests/api-resources/cache/smart-tiered-cache.test.ts b/tests/api-resources/cache/smart-tiered-cache.test.ts index df25a0d0cd..9df7852687 100644 --- a/tests/api-resources/cache/smart-tiered-cache.test.ts +++ b/tests/api-resources/cache/smart-tiered-cache.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource smartTieredCache', () => { - test('create: only required params', async () => { + // HTTP 405 error from prism + test.skip('create: only required params', async () => { const responsePromise = client.cache.smartTieredCache.create({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', value: 'on', @@ -24,7 +25,8 @@ describe('resource smartTieredCache', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { + // HTTP 405 error from prism + test.skip('create: required and optional params', async () => { const response = await client.cache.smartTieredCache.create({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', value: 'on', diff --git a/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts b/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts index 1f1924e1cf..a5143a5b86 100644 --- a/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts +++ b/tests/api-resources/load-balancers/monitor-groups/monitor-groups.test.ts @@ -49,7 +49,8 @@ describe('resource monitorGroups', () => { }); }); - test('update: only required params', async () => { + // HTTP 422 error from prism + test.skip('update: only required params', async () => { const responsePromise = client.loadBalancers.monitorGroups.update('17b5962d775c646f3f9725cbc7a53df4', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', description: 'Primary datacenter monitors', @@ -71,7 +72,8 @@ describe('resource monitorGroups', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: required and optional params', async () => { + // HTTP 422 error from prism + test.skip('update: required and optional params', async () => { const response = await client.loadBalancers.monitorGroups.update('17b5962d775c646f3f9725cbc7a53df4', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', description: 'Primary datacenter monitors', @@ -124,7 +126,8 @@ describe('resource monitorGroups', () => { }); }); - test('edit: only required params', async () => { + // HTTP 422 error from prism + test.skip('edit: only required params', async () => { const responsePromise = client.loadBalancers.monitorGroups.edit('17b5962d775c646f3f9725cbc7a53df4', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', description: 'Primary datacenter monitors', @@ -146,7 +149,8 @@ describe('resource monitorGroups', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('edit: required and optional params', async () => { + // HTTP 422 error from prism + test.skip('edit: required and optional params', async () => { const response = await client.loadBalancers.monitorGroups.edit('17b5962d775c646f3f9725cbc7a53df4', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', description: 'Primary datacenter monitors', From 3dca94b6455843ffc6024407bf0f63dd5d6c1aad Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 20:01:20 +0000 Subject: [PATCH 28/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/intel/miscategorizations.ts | 5 ++++ src/resources/secrets-store/stores/stores.ts | 24 +++++++++++++------ .../secrets-store/stores/stores.test.ts | 1 + 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9cc1aaaa8b..826cf4085b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 4388fdee095ceb19ba22da605f7a4fe2 +openapi_spec_hash: 922a016dedd59fe69b5fd850d9a9f836 config_hash: a0d2c4abe971a3caafcc4324d98d7106 diff --git a/src/resources/intel/miscategorizations.ts b/src/resources/intel/miscategorizations.ts index a5a11f290a..dc1326b90f 100644 --- a/src/resources/intel/miscategorizations.ts +++ b/src/resources/intel/miscategorizations.ts @@ -7,6 +7,11 @@ export class Miscategorizations extends APIResource { /** * Allows you to submit requests to change a domain’s category. * + * Requests that include category `169` (New Domains) or category `177` (Newly + * Seen) in any of `content_adds`, `content_removes`, `security_adds`, or + * `security_removes` will be rejected with a `400 Bad Request`. These categories + * are automatically managed and fall off 30 days after they are applied. + * * @example * ```ts * const miscategorization = diff --git a/src/resources/secrets-store/stores/stores.ts b/src/resources/secrets-store/stores/stores.ts index 23f07fc98a..8bee25ccec 100644 --- a/src/resources/secrets-store/stores/stores.ts +++ b/src/resources/secrets-store/stores/stores.ts @@ -74,7 +74,10 @@ export class Stores extends APIResource { } /** - * Deletes a single store + * Deletes a single store. By default, a store that still contains secrets cannot + * be deleted and returns HTTP 409 (Conflict) with the "store_not_empty" error. + * Pass `force=true` to cascade-delete all secrets in the store. Empty stores are + * always deleted regardless of the force parameter. * * @example * ```ts @@ -89,12 +92,12 @@ export class Stores extends APIResource { params: StoreDeleteParams, options?: Core.RequestOptions, ): Core.APIPromise { - const { account_id } = params; + const { account_id, force } = params; return ( - this._client.delete( - `/accounts/${account_id}/secrets_store/stores/${storeId}`, - options, - ) as Core.APIPromise<{ result: StoreDeleteResponse | null }> + this._client.delete(`/accounts/${account_id}/secrets_store/stores/${storeId}`, { + query: { force }, + ...options, + }) as Core.APIPromise<{ result: StoreDeleteResponse | null }> )._thenUnwrap((obj) => obj.result); } } @@ -191,9 +194,16 @@ export interface StoreListParams extends V4PagePaginationArrayParams { export interface StoreDeleteParams { /** - * Account Identifier + * Path param: Account Identifier */ account_id: string; + + /** + * Query param: When true, cascade-deletes all secrets in the store before deleting + * the store itself. Required when deleting a non-empty store. Without this + * parameter, attempting to delete a non-empty store returns 409. + */ + force?: boolean; } Stores.StoreListResponsesV4PagePaginationArray = StoreListResponsesV4PagePaginationArray; diff --git a/tests/api-resources/secrets-store/stores/stores.test.ts b/tests/api-resources/secrets-store/stores/stores.test.ts index 7df24abfb7..4ff2b6cf41 100644 --- a/tests/api-resources/secrets-store/stores/stores.test.ts +++ b/tests/api-resources/secrets-store/stores/stores.test.ts @@ -76,6 +76,7 @@ describe('resource stores', () => { test.skip('delete: required and optional params', async () => { const response = await client.secretsStore.stores.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '985e105f4ecef8ad9ca31a8372d0c353', + force: true, }); }); }); From dfd53c3cb44c6b4aa1bfea44a0bf44178c0dbb94 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 12 May 2026 20:31:48 +0000 Subject: [PATCH 29/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 826cf4085b..8700bb2567 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 922a016dedd59fe69b5fd850d9a9f836 +openapi_spec_hash: 31da2976a230d6a4056b11bbe236f35b config_hash: a0d2c4abe971a3caafcc4324d98d7106 From a596de7cc7c64c7fa9887b52bed97550b392b369 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 05:19:47 +0000 Subject: [PATCH 30/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 8700bb2567..8176f38ea0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 31da2976a230d6a4056b11bbe236f35b +openapi_spec_hash: 62e8e24872538e8d6c6ea10982bfd9e1 config_hash: a0d2c4abe971a3caafcc4324d98d7106 From 3adae730d57d6f240efacf2c96d3cbde4d010e9a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 09:47:45 +0000 Subject: [PATCH 31/73] chore(api): update composite API spec --- .stats.yml | 2 +- .../email-security/investigate/investigate.ts | 17 +++++++++ src/resources/radar/http/http.ts | 24 +++++++++++++ src/resources/radar/post-quantum/tls.ts | 35 +++++++++++++++++-- .../investigate/investigate.test.ts | 1 + tests/api-resources/radar/http/http.test.ts | 3 ++ 6 files changed, 78 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 8176f38ea0..39b21058ad 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 62e8e24872538e8d6c6ea10982bfd9e1 +openapi_spec_hash: 688a10f8bad37046ecc77a00e6e358c4 config_hash: a0d2c4abe971a3caafcc4324d98d7106 diff --git a/src/resources/email-security/investigate/investigate.ts b/src/resources/email-security/investigate/investigate.ts index 09d47af3ae..ed8cf1df14 100644 --- a/src/resources/email-security/investigate/investigate.ts +++ b/src/resources/email-security/investigate/investigate.ts @@ -205,6 +205,10 @@ export interface InvestigateListResponse { sent_date?: string | null; + smtp_helo_server_ip?: string | null; + + smtp_previous_hop_ip?: string | null; + subject?: string | null; threat_categories?: Array | null; @@ -214,6 +218,8 @@ export interface InvestigateListResponse { to_name?: Array | null; validation?: InvestigateListResponse.Validation; + + x_originating_ip?: string | null; } export namespace InvestigateListResponse { @@ -459,6 +465,10 @@ export interface InvestigateGetResponse { sent_date?: string | null; + smtp_helo_server_ip?: string | null; + + smtp_previous_hop_ip?: string | null; + subject?: string | null; threat_categories?: Array | null; @@ -468,6 +478,8 @@ export interface InvestigateGetResponse { to_name?: Array | null; validation?: InvestigateGetResponse.Validation; + + x_originating_ip?: string | null; } export namespace InvestigateGetResponse { @@ -626,6 +638,11 @@ export interface InvestigateListParams extends V4PagePaginationArrayParams { */ cursor?: string; + /** + * Query param: Delivery status to filter by. + */ + delivery_status?: 'delivered' | 'moved' | 'quarantined' | 'rejected' | 'deferred' | 'bounced' | 'queued'; + /** * Query param: Whether to include only detections in search results. */ diff --git a/src/resources/radar/http/http.ts b/src/resources/radar/http/http.ts index 5ccf97d03e..b37a5a2eb9 100644 --- a/src/resources/radar/http/http.ts +++ b/src/resources/radar/http/http.ts @@ -80,6 +80,7 @@ export class HTTP extends APIResource { summaryV2( dimension: | 'ADM1' + | 'API_TRAFFIC' | 'AS' | 'BOT_CLASS' | 'BROWSER' @@ -98,6 +99,7 @@ export class HTTP extends APIResource { summaryV2( dimension: | 'ADM1' + | 'API_TRAFFIC' | 'AS' | 'BOT_CLASS' | 'BROWSER' @@ -115,6 +117,7 @@ export class HTTP extends APIResource { summaryV2( dimension: | 'ADM1' + | 'API_TRAFFIC' | 'AS' | 'BOT_CLASS' | 'BROWSER' @@ -180,6 +183,7 @@ export class HTTP extends APIResource { timeseriesGroupsV2( dimension: | 'ADM1' + | 'API_TRAFFIC' | 'AS' | 'BOT_CLASS' | 'BROWSER' @@ -198,6 +202,7 @@ export class HTTP extends APIResource { timeseriesGroupsV2( dimension: | 'ADM1' + | 'API_TRAFFIC' | 'AS' | 'BOT_CLASS' | 'BROWSER' @@ -215,6 +220,7 @@ export class HTTP extends APIResource { timeseriesGroupsV2( dimension: | 'ADM1' + | 'API_TRAFFIC' | 'AS' | 'BOT_CLASS' | 'BROWSER' @@ -656,6 +662,12 @@ export namespace HTTPTimeseriesGroupsV2Response { } export interface HTTPSummaryV2Params { + /** + * Filters results by API traffic classification. API traffic is identified by JSON + * or XML response content types on dynamic (non-cacheable) HTTP requests. + */ + apiTraffic?: Array<'API' | 'NON_API'>; + /** * Filters results by Autonomous System. Specify one or more Autonomous System * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from @@ -765,6 +777,12 @@ export interface HTTPTimeseriesParams { */ aggInterval?: '15m' | '1h' | '1d' | '1w'; + /** + * Filters results by API traffic classification. API traffic is identified by JSON + * or XML response content types on dynamic (non-cacheable) HTTP requests. + */ + apiTraffic?: Array<'API' | 'NON_API'>; + /** * Filters results by Autonomous System. Specify one or more Autonomous System * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from @@ -878,6 +896,12 @@ export interface HTTPTimeseriesGroupsV2Params { */ aggInterval?: '15m' | '1h' | '1d' | '1w'; + /** + * Filters results by API traffic classification. API traffic is identified by JSON + * or XML response content types on dynamic (non-cacheable) HTTP requests. + */ + apiTraffic?: Array<'API' | 'NON_API'>; + /** * Filters results by Autonomous System. Specify one or more Autonomous System * Numbers (ASNs) as a comma-separated list. Prefix with `-` to exclude ASNs from diff --git a/src/resources/radar/post-quantum/tls.ts b/src/resources/radar/post-quantum/tls.ts index aef3d864d1..20917a665a 100644 --- a/src/resources/radar/post-quantum/tls.ts +++ b/src/resources/radar/post-quantum/tls.ts @@ -6,8 +6,9 @@ import * as Core from '../../../core'; export class TLS extends APIResource { /** * Tests whether a hostname or IP address supports Post-Quantum (PQ) TLS key - * exchange. Returns information about the negotiated key exchange algorithm and - * whether it uses PQ cryptography. + * exchange. Returns information about the negotiated key exchange algorithm, + * whether it uses PQ cryptography, and any detected TLS implementation bugs (Split + * ClientHello, HRR failure, etc.). * * @example * ```ts @@ -26,6 +27,8 @@ export class TLS extends APIResource { } export interface TLSSupportResponse { + bugs: TLSSupportResponse.Bugs; + /** * The host that was tested */ @@ -42,11 +45,37 @@ export interface TLSSupportResponse { kexName: string; /** - * Whether the negotiated key exchange uses Post-Quantum cryptography + * Whether the negotiated key exchange uses Post-Quantum cryptography (specifically + * X25519MLKEM768) */ pq: boolean; } +export namespace TLSSupportResponse { + export interface Bugs { + /** + * Server sends a HelloRetryRequest but fails to complete the handshake after the + * client sends the second ClientHello. Often caused by non-compliant TLS 1.3 + * implementations on shared hosting providers. + */ + hrrFailure: boolean; + + /** + * Server rejects fragmented ClientHello caused by large PQ keyshare, but accepts + * classical (non-PQ) handshakes. Typically caused by middleboxes or firewalls that + * cannot reassemble split TLS ClientHello messages. + */ + splitClientHello: boolean; + + /** + * Server cannot handle an unknown key exchange algorithm in the ClientHello + * keyshare extension. Compliant servers should respond with HelloRetryRequest for + * a supported algorithm. + */ + unknownKeyshare: boolean; + } +} + export interface TLSSupportParams { /** * Hostname or IP address to test for Post-Quantum TLS support, optionally with diff --git a/tests/api-resources/email-security/investigate/investigate.test.ts b/tests/api-resources/email-security/investigate/investigate.test.ts index 24c5646ef5..f650dcfe6e 100644 --- a/tests/api-resources/email-security/investigate/investigate.test.ts +++ b/tests/api-resources/email-security/investigate/investigate.test.ts @@ -29,6 +29,7 @@ describe('resource investigate', () => { action_log: true, alert_id: 'alert_id', cursor: 'cursor', + delivery_status: 'delivered', detections_only: true, domain: 'domain', end: '2019-12-27T18:11:19.117Z', diff --git a/tests/api-resources/radar/http/http.test.ts b/tests/api-resources/radar/http/http.test.ts index 13d952c38f..473eb3fcdf 100644 --- a/tests/api-resources/radar/http/http.test.ts +++ b/tests/api-resources/radar/http/http.test.ts @@ -34,6 +34,7 @@ describe('resource http', () => { client.radar.http.summaryV2( 'ADM1', { + apiTraffic: ['API'], asn: ['string'], botClass: ['LIKELY_AUTOMATED'], continent: ['string'], @@ -81,6 +82,7 @@ describe('resource http', () => { client.radar.http.timeseries( { aggInterval: '1h', + apiTraffic: ['API'], asn: ['string'], botClass: ['LIKELY_AUTOMATED'], browserFamily: ['CHROME'], @@ -130,6 +132,7 @@ describe('resource http', () => { 'ADM1', { aggInterval: '1h', + apiTraffic: ['API'], asn: ['string'], botClass: ['LIKELY_AUTOMATED'], continent: ['string'], From 25e45974ccc809287049fca0b29b010e688f296f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 13:28:52 +0000 Subject: [PATCH 32/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/zones/custom-nameservers.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 39b21058ad..5e4d31a550 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 688a10f8bad37046ecc77a00e6e358c4 +openapi_spec_hash: af35fe9ff5829ddee2028232a1ffd265 config_hash: a0d2c4abe971a3caafcc4324d98d7106 diff --git a/src/resources/zones/custom-nameservers.ts b/src/resources/zones/custom-nameservers.ts index d5374a1553..31308d3f5d 100644 --- a/src/resources/zones/custom-nameservers.ts +++ b/src/resources/zones/custom-nameservers.ts @@ -132,6 +132,11 @@ export namespace CustomNameserverGetResponse { * Total results available without any search parameters. */ total_count?: number; + + /** + * The number of total pages in the entire result set. + */ + total_pages?: number; } } From cb2663a44b28ab489f68c5bdeae92b4253a37b11 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 17:07:35 +0000 Subject: [PATCH 33/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 5e4d31a550..7fa5a14b3e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: af35fe9ff5829ddee2028232a1ffd265 +openapi_spec_hash: 318e54e5c7666a55fb803495fa7e383c config_hash: a0d2c4abe971a3caafcc4324d98d7106 From 3797a3c733106dff819b73d8651efad5271aa996 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 22:13:51 +0000 Subject: [PATCH 34/73] chore(api): update composite API spec --- .stats.yml | 2 +- .../intel/indicator-feeds/indicator-feeds.ts | 11 +++++++++++ src/resources/workflows/instances/instances.ts | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 7fa5a14b3e..97dbd7d9c4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 318e54e5c7666a55fb803495fa7e383c +openapi_spec_hash: 275833b1cb003b3174b6e01526ccb7a6 config_hash: a0d2c4abe971a3caafcc4324d98d7106 diff --git a/src/resources/intel/indicator-feeds/indicator-feeds.ts b/src/resources/intel/indicator-feeds/indicator-feeds.ts index 58cd580a2f..67d152fbd4 100644 --- a/src/resources/intel/indicator-feeds/indicator-feeds.ts +++ b/src/resources/intel/indicator-feeds/indicator-feeds.ts @@ -317,6 +317,17 @@ export interface IndicatorFeedGetResponse { */ last_upload_summary?: IndicatorFeedGetResponse.LastUploadSummary; + /** + * Human-readable error message describing why the latest upload failed. Populated + * only when `latest_upload_status` is `Error`. Returns one of a small fixed set of + * category-level messages (invalid domain / IP / URL entries, malformed row or + * header, invalid valid_until timestamp, etc.) or the generic `Upload failed` for + * unknown or infrastructure-level errors. Never echoes raw error text from the + * underlying loader. Intel accounts receive the verbatim loader/API error text + * (including specific offending values) instead of these category-level messages. + */ + latest_upload_error?: string; + /** * Status of the latest snapshot uploaded */ diff --git a/src/resources/workflows/instances/instances.ts b/src/resources/workflows/instances/instances.ts index 44f7e01077..0400bfb87c 100644 --- a/src/resources/workflows/instances/instances.ts +++ b/src/resources/workflows/instances/instances.ts @@ -236,6 +236,12 @@ export namespace InstanceGetResponse { * Specifies the timeout duration. */ timeout: string | number; + + /** + * When set to 'output', step output is redacted from log and step output + * responses. + */ + sensitive?: 'output'; } export namespace Config { From a9b4a69db45f0f7e171d29a53badfb8a1ab71ad0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 22:54:28 +0000 Subject: [PATCH 35/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 97dbd7d9c4..8ef767b791 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 275833b1cb003b3174b6e01526ccb7a6 +openapi_spec_hash: c6b6ec233d76f292d7cafd65a7a5c330 config_hash: a0d2c4abe971a3caafcc4324d98d7106 From cf32841d013936da4d976d331d86c4bfe81ee5c7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 10:41:47 +0000 Subject: [PATCH 36/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 8ef767b791..b83714b276 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2224 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: c6b6ec233d76f292d7cafd65a7a5c330 +openapi_spec_hash: 381c372ce0663f3bff73aeff4c918b2c config_hash: a0d2c4abe971a3caafcc4324d98d7106 From 99c8dfceaa4d740aad8940a62987ae188b060477 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 14:06:47 +0000 Subject: [PATCH 37/73] chore(api): update composite API spec --- .stats.yml | 4 +- src/resources/api-gateway/api.md | 2 - .../api-gateway/discovery/discovery.ts | 4 -- src/resources/api-gateway/discovery/index.ts | 2 - .../api-gateway/discovery/operations.ts | 54 ------------------- .../api-gateway/discovery/operations.test.ts | 21 -------- 6 files changed, 2 insertions(+), 85 deletions(-) diff --git a/.stats.yml b/.stats.yml index b83714b276..d984d6119a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2224 +configured_endpoints: 2223 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 381c372ce0663f3bff73aeff4c918b2c +openapi_spec_hash: 75233fc92a536588b23158e9a3d0ed90 config_hash: a0d2c4abe971a3caafcc4324d98d7106 diff --git a/src/resources/api-gateway/api.md b/src/resources/api-gateway/api.md index ff702913f6..a0bb15556e 100644 --- a/src/resources/api-gateway/api.md +++ b/src/resources/api-gateway/api.md @@ -27,13 +27,11 @@ 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 ## Labels diff --git a/src/resources/api-gateway/discovery/discovery.ts b/src/resources/api-gateway/discovery/discovery.ts index dc9185efdb..207bb9724b 100644 --- a/src/resources/api-gateway/discovery/discovery.ts +++ b/src/resources/api-gateway/discovery/discovery.ts @@ -6,8 +6,6 @@ import * as OperationsAPI from './operations'; import { OperationBulkEditParams, OperationBulkEditResponse, - OperationEditParams, - OperationEditResponse, OperationListParams, Operations, } from './operations'; @@ -129,9 +127,7 @@ export declare namespace Discovery { 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 a2a9fd29a6..43c900321b 100644 --- a/src/resources/api-gateway/discovery/index.ts +++ b/src/resources/api-gateway/discovery/index.ts @@ -10,8 +10,6 @@ export { 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 f7b4a5fd74..f8802bbaf0 100644 --- a/src/resources/api-gateway/discovery/operations.ts +++ b/src/resources/api-gateway/discovery/operations.ts @@ -59,32 +59,6 @@ export class Operations extends APIResource { }) as Core.APIPromise<{ result: OperationBulkEditResponse }> )._thenUnwrap((obj) => obj.result); } - - /** - * Update the `state` on a discovered operation - * - * @example - * ```ts - * const response = - * await client.apiGateway.discovery.operations.edit( - * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * ); - * ``` - */ - edit( - operationId: string, - params: OperationEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id, ...body } = params; - return ( - this._client.patch(`/zones/${zone_id}/api_gateway/discovery/operations/${operationId}`, { - body, - ...options, - }) as Core.APIPromise<{ result: OperationEditResponse }> - )._thenUnwrap((obj) => obj.result); - } } export type OperationBulkEditResponse = { [key: string]: OperationBulkEditResponse.item }; @@ -104,17 +78,6 @@ export namespace OperationBulkEditResponse { } } -export interface OperationEditResponse { - /** - * State of operation in API Discovery - * - * - `review` - Operation is not saved into API Shield Endpoint Management - * - `saved` - Operation is saved into API Shield Endpoint Management - * - `ignored` - Operation is marked as ignored - */ - state?: 'review' | 'saved' | 'ignored'; -} - export interface OperationListParams extends V4PagePaginationArrayParams { /** * Path param: Identifier. @@ -202,28 +165,11 @@ export namespace OperationBulkEditParams { } } -export interface OperationEditParams { - /** - * Path param: Identifier. - */ - zone_id: string; - - /** - * Body param: Mark state of operation in API Discovery - * - * - `review` - Mark operation as for review - * - `ignored` - Mark operation as ignored - */ - state?: 'review' | 'ignored'; -} - 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, }; } diff --git a/tests/api-resources/api-gateway/discovery/operations.test.ts b/tests/api-resources/api-gateway/discovery/operations.test.ts index f1de475ff3..2c591aed66 100644 --- a/tests/api-resources/api-gateway/discovery/operations.test.ts +++ b/tests/api-resources/api-gateway/discovery/operations.test.ts @@ -65,25 +65,4 @@ describe('resource operations', () => { }, }); }); - - test('edit: only required params', async () => { - const responsePromise = client.apiGateway.discovery.operations.edit( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - ); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('edit: required and optional params', async () => { - const response = await client.apiGateway.discovery.operations.edit( - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', state: 'review' }, - ); - }); }); From 5513ec7b2e9b298dc6ee5a89ab2538447e8690bf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 14:13:31 +0000 Subject: [PATCH 38/73] feat: feat(api): add advanced_tcp_protection endpoint mappings * feat(api): add advanced_tcp_protection endpoint mappings for APIX-639 --- .stats.yml | 4 +- api.md | 2 + scripts/detect-breaking-changes | 17 + src/index.ts | 5 + src/resources/ddos-protection.ts | 3 + .../advanced-tcp-protection.ts | 3 + .../advanced-tcp-protection.ts | 93 +++++ .../advanced-tcp-protection/allowlist.ts | 3 + .../allowlist/allowlist.ts | 277 +++++++++++++ .../allowlist/index.ts | 21 + .../allowlist/items.ts | 233 +++++++++++ .../advanced-tcp-protection/index.ts | 35 ++ .../advanced-tcp-protection/prefixes.ts | 3 + .../advanced-tcp-protection/prefixes/index.ts | 24 ++ .../advanced-tcp-protection/prefixes/items.ts | 233 +++++++++++ .../prefixes/prefixes.ts | 377 ++++++++++++++++++ .../advanced-tcp-protection/status.ts | 87 ++++ .../advanced-tcp-protection/syn-protection.ts | 3 + .../syn-protection/filters.ts | 3 + .../syn-protection/filters/filters.ts | 266 ++++++++++++ .../syn-protection/filters/index.ts | 21 + .../syn-protection/filters/items.ts | 224 +++++++++++ .../syn-protection/index.ts | 23 ++ .../syn-protection/rules.ts | 3 + .../syn-protection/rules/index.ts | 21 + .../syn-protection/rules/items.ts | 287 +++++++++++++ .../syn-protection/rules/rules.ts | 337 ++++++++++++++++ .../syn-protection/syn-protection.ts | 59 +++ .../tcp-flow-protection.ts | 3 + .../tcp-flow-protection/filters.ts | 3 + .../tcp-flow-protection/filters/filters.ts | 266 ++++++++++++ .../tcp-flow-protection/filters/index.ts | 21 + .../tcp-flow-protection/filters/items.ts | 224 +++++++++++ .../tcp-flow-protection/index.ts | 23 ++ .../tcp-flow-protection/rules.ts | 3 + .../tcp-flow-protection/rules/index.ts | 21 + .../tcp-flow-protection/rules/items.ts | 271 +++++++++++++ .../tcp-flow-protection/rules/rules.ts | 320 +++++++++++++++ .../tcp-flow-protection.ts | 59 +++ src/resources/ddos-protection/api.md | 189 +++++++++ .../ddos-protection/ddos-protection.ts | 16 + src/resources/ddos-protection/index.ts | 4 + src/resources/index.ts | 1 + .../allowlist/allowlist.test.ts | 79 ++++ .../allowlist/items.test.ts | 79 ++++ .../prefixes/items.test.ts | 79 ++++ .../prefixes/prefixes.test.ts | 112 ++++++ .../advanced-tcp-protection/status.test.ts | 52 +++ .../syn-protection/filters/filters.test.ts | 78 ++++ .../syn-protection/filters/items.test.ts | 79 ++++ .../syn-protection/rules/items.test.ts | 81 ++++ .../syn-protection/rules/rules.test.ts | 84 ++++ .../filters/filters.test.ts | 78 ++++ .../tcp-flow-protection/filters/items.test.ts | 80 ++++ .../tcp-flow-protection/rules/items.test.ts | 80 ++++ .../tcp-flow-protection/rules/rules.test.ts | 83 ++++ 56 files changed, 5133 insertions(+), 2 deletions(-) create mode 100644 src/resources/ddos-protection.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/advanced-tcp-protection.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/allowlist.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/allowlist/allowlist.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/allowlist/index.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/allowlist/items.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/index.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/prefixes.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/prefixes/index.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/prefixes/items.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/prefixes/prefixes.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/status.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/filters.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/index.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/items.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/index.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/index.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/items.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/rules.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/syn-protection/syn-protection.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/filters.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/index.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/items.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/index.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/index.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/items.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/rules.ts create mode 100644 src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/tcp-flow-protection.ts create mode 100644 src/resources/ddos-protection/api.md create mode 100644 src/resources/ddos-protection/ddos-protection.ts create mode 100644 src/resources/ddos-protection/index.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/allowlist.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/items.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/items.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/prefixes.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/status.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/filters.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/items.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/items.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/rules.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/filters.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/items.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/items.test.ts create mode 100644 tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/rules.test.ts diff --git a/.stats.yml b/.stats.yml index d984d6119a..d6a4984cd6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2223 +configured_endpoints: 2262 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 75233fc92a536588b23158e9a3d0ed90 -config_hash: a0d2c4abe971a3caafcc4324d98d7106 +config_hash: 554d1342364a8f4cc148dba5d7d8c997 diff --git a/api.md b/api.md index dffd6a3c44..5bfb9e5cad 100644 --- a/api.md +++ b/api.md @@ -129,6 +129,8 @@ Types: # [MagicTransit](src/resources/magic-transit/api.md) +# [DDoSProtection](src/resources/ddos-protection/api.md) + # [MagicNetworkMonitoring](src/resources/magic-network-monitoring/api.md) # [MagicCloudNetworking](src/resources/magic-cloud-networking/api.md) diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index f3ab109852..fab3dc6204 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -337,6 +337,23 @@ TEST_PATHS=( tests/api-resources/magic-transit/pcaps/pcaps.test.ts tests/api-resources/magic-transit/pcaps/ownership.test.ts tests/api-resources/magic-transit/pcaps/download.test.ts + tests/api-resources/ddos-protection/ddos-protection.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/advanced-tcp-protection.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/allowlist.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/items.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/prefixes.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/items.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/syn-protection.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/filters.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/items.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/rules.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/items.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/tcp-flow-protection.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/filters.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/items.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/rules.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/items.test.ts + tests/api-resources/ddos-protection/advanced-tcp-protection/status.test.ts tests/api-resources/magic-network-monitoring/magic-network-monitoring.test.ts tests/api-resources/magic-network-monitoring/vpc-flows/vpc-flows.test.ts tests/api-resources/magic-network-monitoring/vpc-flows/tokens.test.ts diff --git a/src/index.ts b/src/index.ts index e8558e34ce..8e74e9dde1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -51,6 +51,7 @@ import { CustomNameservers } from './resources/custom-nameservers/custom-nameser import { CustomPages } from './resources/custom-pages/custom-pages'; import { D1Resource } from './resources/d1/d1'; import { DCVDelegation } from './resources/dcv-delegation/dcv-delegation'; +import { DDoSProtection } from './resources/ddos-protection/ddos-protection'; import { Diagnostics } from './resources/diagnostics/diagnostics'; import { DNSFirewall } from './resources/dns-firewall/dns-firewall'; import { DNS } from './resources/dns/dns'; @@ -328,6 +329,7 @@ export class Cloudflare extends Core.APIClient { images: API.Images = new API.Images(this); intel: API.Intel = new API.Intel(this); magicTransit: API.MagicTransit = new API.MagicTransit(this); + DDoSProtection: API.DDoSProtection = new API.DDoSProtection(this); magicNetworkMonitoring: API.MagicNetworkMonitoring = new API.MagicNetworkMonitoring(this); magicCloudNetworking: API.MagicCloudNetworking = new API.MagicCloudNetworking(this); networkInterconnects: API.NetworkInterconnects = new API.NetworkInterconnects(this); @@ -577,6 +579,7 @@ Cloudflare.Diagnostics = Diagnostics; Cloudflare.Images = Images; Cloudflare.Intel = Intel; Cloudflare.MagicTransit = MagicTransit; +Cloudflare.DDoSProtection = DDoSProtection; Cloudflare.MagicNetworkMonitoring = MagicNetworkMonitoring; Cloudflare.MagicCloudNetworking = MagicCloudNetworking; Cloudflare.NetworkInterconnects = NetworkInterconnects; @@ -772,6 +775,8 @@ export declare namespace Cloudflare { export { MagicTransit as MagicTransit }; + export { DDoSProtection as DDoSProtection }; + export { MagicNetworkMonitoring as MagicNetworkMonitoring }; export { MagicCloudNetworking as MagicCloudNetworking }; diff --git a/src/resources/ddos-protection.ts b/src/resources/ddos-protection.ts new file mode 100644 index 0000000000..294ab1e017 --- /dev/null +++ b/src/resources/ddos-protection.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './ddos-protection/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection.ts b/src/resources/ddos-protection/advanced-tcp-protection.ts new file mode 100644 index 0000000000..6a0445e3a1 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './advanced-tcp-protection/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/advanced-tcp-protection.ts b/src/resources/ddos-protection/advanced-tcp-protection/advanced-tcp-protection.ts new file mode 100644 index 0000000000..01e9b16e88 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/advanced-tcp-protection.ts @@ -0,0 +1,93 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as StatusAPI from './status'; +import { Status, StatusEditParams, StatusEditResponse, StatusGetParams, StatusGetResponse } from './status'; +import * as AllowlistAPI from './allowlist/allowlist'; +import { + Allowlist, + AllowlistBulkDeleteParams, + AllowlistBulkDeleteResponse, + AllowlistCreateParams, + AllowlistCreateResponse, + AllowlistListParams, + AllowlistListResponse, + AllowlistListResponsesV4PagePaginationArray, +} from './allowlist/allowlist'; +import * as PrefixesAPI from './prefixes/prefixes'; +import { + PrefixBulkCreateParams, + PrefixBulkCreateResponse, + PrefixBulkCreateResponsesSinglePage, + PrefixBulkDeleteParams, + PrefixBulkDeleteResponse, + PrefixCreateParams, + PrefixCreateResponse, + PrefixListParams, + PrefixListResponse, + PrefixListResponsesV4PagePaginationArray, + Prefixes, +} from './prefixes/prefixes'; +import * as SynProtectionAPI from './syn-protection/syn-protection'; +import { SynProtection } from './syn-protection/syn-protection'; +import * as TCPFlowProtectionAPI from './tcp-flow-protection/tcp-flow-protection'; +import { TCPFlowProtection } from './tcp-flow-protection/tcp-flow-protection'; + +export class AdvancedTCPProtection extends APIResource { + allowlist: AllowlistAPI.Allowlist = new AllowlistAPI.Allowlist(this._client); + prefixes: PrefixesAPI.Prefixes = new PrefixesAPI.Prefixes(this._client); + synProtection: SynProtectionAPI.SynProtection = new SynProtectionAPI.SynProtection(this._client); + tcpFlowProtection: TCPFlowProtectionAPI.TCPFlowProtection = new TCPFlowProtectionAPI.TCPFlowProtection( + this._client, + ); + status: StatusAPI.Status = new StatusAPI.Status(this._client); +} + +AdvancedTCPProtection.Allowlist = Allowlist; +AdvancedTCPProtection.AllowlistListResponsesV4PagePaginationArray = + AllowlistListResponsesV4PagePaginationArray; +AdvancedTCPProtection.Prefixes = Prefixes; +AdvancedTCPProtection.PrefixListResponsesV4PagePaginationArray = PrefixListResponsesV4PagePaginationArray; +AdvancedTCPProtection.PrefixBulkCreateResponsesSinglePage = PrefixBulkCreateResponsesSinglePage; +AdvancedTCPProtection.SynProtection = SynProtection; +AdvancedTCPProtection.TCPFlowProtection = TCPFlowProtection; +AdvancedTCPProtection.Status = Status; + +export declare namespace AdvancedTCPProtection { + export { + Allowlist as Allowlist, + type AllowlistCreateResponse as AllowlistCreateResponse, + type AllowlistListResponse as AllowlistListResponse, + type AllowlistBulkDeleteResponse as AllowlistBulkDeleteResponse, + AllowlistListResponsesV4PagePaginationArray as AllowlistListResponsesV4PagePaginationArray, + type AllowlistCreateParams as AllowlistCreateParams, + type AllowlistListParams as AllowlistListParams, + type AllowlistBulkDeleteParams as AllowlistBulkDeleteParams, + }; + + export { + Prefixes as Prefixes, + type PrefixCreateResponse as PrefixCreateResponse, + type PrefixListResponse as PrefixListResponse, + type PrefixBulkCreateResponse as PrefixBulkCreateResponse, + type PrefixBulkDeleteResponse as PrefixBulkDeleteResponse, + PrefixListResponsesV4PagePaginationArray as PrefixListResponsesV4PagePaginationArray, + PrefixBulkCreateResponsesSinglePage as PrefixBulkCreateResponsesSinglePage, + type PrefixCreateParams as PrefixCreateParams, + type PrefixListParams as PrefixListParams, + type PrefixBulkCreateParams as PrefixBulkCreateParams, + type PrefixBulkDeleteParams as PrefixBulkDeleteParams, + }; + + export { SynProtection as SynProtection }; + + export { TCPFlowProtection as TCPFlowProtection }; + + export { + Status as Status, + type StatusEditResponse as StatusEditResponse, + type StatusGetResponse as StatusGetResponse, + type StatusEditParams as StatusEditParams, + type StatusGetParams as StatusGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/allowlist.ts b/src/resources/ddos-protection/advanced-tcp-protection/allowlist.ts new file mode 100644 index 0000000000..f62e4081ef --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/allowlist.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './allowlist/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/allowlist/allowlist.ts b/src/resources/ddos-protection/advanced-tcp-protection/allowlist/allowlist.ts new file mode 100644 index 0000000000..0358755ddb --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/allowlist/allowlist.ts @@ -0,0 +1,277 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; +import * as ItemsAPI from './items'; +import { + ItemDeleteParams, + ItemDeleteResponse, + ItemEditParams, + ItemEditResponse, + ItemGetParams, + ItemGetResponse, + Items, +} from './items'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../pagination'; + +export class Allowlist extends APIResource { + items: ItemsAPI.Items = new ItemsAPI.Items(this._client); + + /** + * Create an allowlist prefix for an account. + * + * @example + * ```ts + * const allowlist = + * await client.DDoSProtection.advancedTCPProtection.allowlist.create( + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * comment: 'comment', + * enabled: true, + * prefix: 'prefix', + * }, + * ); + * ``` + */ + create( + params: AllowlistCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/magic/advanced_tcp_protection/configs/allowlist`, { + body, + ...options, + }) as Core.APIPromise<{ result: AllowlistCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List all allowlist prefixes for an account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const allowlistListResponse of client.DDoSProtection.advancedTCPProtection.allowlist.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: AllowlistListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/allowlist`, + AllowlistListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete all allowlist prefixes for an account. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.allowlist.bulkDelete( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + bulkDelete( + params: AllowlistBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/allowlist`, + options, + ); + } +} + +export class AllowlistListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface AllowlistCreateResponse { + /** + * The unique ID of the allowlist prefix. + */ + id: string; + + /** + * An optional comment describing the allowlist prefix. + */ + comment: string; + + /** + * The creation timestamp of the allowlist prefix. + */ + created_on: string; + + /** + * Whether to enable the allowlist prefix into effect. Defaults to false. + */ + enabled: boolean; + + /** + * The last modification timestamp of the allowlist prefix. + */ + modified_on: string; + + /** + * The allowlist prefix in CIDR format. + */ + prefix: string; +} + +export interface AllowlistListResponse { + /** + * The unique ID of the allowlist prefix. + */ + id: string; + + /** + * An optional comment describing the allowlist prefix. + */ + comment: string; + + /** + * The creation timestamp of the allowlist prefix. + */ + created_on: string; + + /** + * Whether to enable the allowlist prefix into effect. Defaults to false. + */ + enabled: boolean; + + /** + * The last modification timestamp of the allowlist prefix. + */ + modified_on: string; + + /** + * The allowlist prefix in CIDR format. + */ + prefix: string; +} + +export interface AllowlistBulkDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace AllowlistBulkDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface AllowlistCreateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: An comment describing the allowlist prefix. + */ + comment: string; + + /** + * Body param: Whether to enable the allowlist prefix into effect. + */ + enabled: boolean; + + /** + * Body param: The allowlist prefix to add in CIDR format. + */ + prefix: string; +} + +export interface AllowlistListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Query param: The direction of ordering (ASC or DESC). Defaults to 'ASC'. + */ + direction?: string; + + /** + * Query param: The field to order by. Defaults to 'prefix'. + */ + order?: string; +} + +export interface AllowlistBulkDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +Allowlist.AllowlistListResponsesV4PagePaginationArray = AllowlistListResponsesV4PagePaginationArray; +Allowlist.Items = Items; + +export declare namespace Allowlist { + export { + type AllowlistCreateResponse as AllowlistCreateResponse, + type AllowlistListResponse as AllowlistListResponse, + type AllowlistBulkDeleteResponse as AllowlistBulkDeleteResponse, + AllowlistListResponsesV4PagePaginationArray as AllowlistListResponsesV4PagePaginationArray, + type AllowlistCreateParams as AllowlistCreateParams, + type AllowlistListParams as AllowlistListParams, + type AllowlistBulkDeleteParams as AllowlistBulkDeleteParams, + }; + + export { + Items as Items, + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/allowlist/index.ts b/src/resources/ddos-protection/advanced-tcp-protection/allowlist/index.ts new file mode 100644 index 0000000000..45f1e1f951 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/allowlist/index.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + AllowlistListResponsesV4PagePaginationArray, + Allowlist, + type AllowlistCreateResponse, + type AllowlistListResponse, + type AllowlistBulkDeleteResponse, + type AllowlistCreateParams, + type AllowlistListParams, + type AllowlistBulkDeleteParams, +} from './allowlist'; +export { + Items, + type ItemDeleteResponse, + type ItemEditResponse, + type ItemGetResponse, + type ItemDeleteParams, + type ItemEditParams, + type ItemGetParams, +} from './items'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/allowlist/items.ts b/src/resources/ddos-protection/advanced-tcp-protection/allowlist/items.ts new file mode 100644 index 0000000000..e6665a694e --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/allowlist/items.ts @@ -0,0 +1,233 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; + +export class Items extends APIResource { + /** + * Delete the allowlist prefix for an account given a UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.allowlist.items.delete( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + prefixId: string, + params: ItemDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/allowlist/${prefixId}`, + options, + ); + } + + /** + * Update an allowlist prefix specified by the given UUID. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.allowlist.items.edit( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + edit( + prefixId: string, + params: ItemEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/allowlist/${prefixId}`, + { body, ...options }, + ) as Core.APIPromise<{ result: ItemEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get an allowlist prefix specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.allowlist.items.get( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + prefixId: string, + params: ItemGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/allowlist/${prefixId}`, + options, + ) as Core.APIPromise<{ result: ItemGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ItemDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace ItemDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface ItemEditResponse { + /** + * The unique ID of the allowlist prefix. + */ + id: string; + + /** + * An optional comment describing the allowlist prefix. + */ + comment: string; + + /** + * The creation timestamp of the allowlist prefix. + */ + created_on: string; + + /** + * Whether to enable the allowlist prefix into effect. Defaults to false. + */ + enabled: boolean; + + /** + * The last modification timestamp of the allowlist prefix. + */ + modified_on: string; + + /** + * The allowlist prefix in CIDR format. + */ + prefix: string; +} + +export interface ItemGetResponse { + /** + * The unique ID of the allowlist prefix. + */ + id: string; + + /** + * An optional comment describing the allowlist prefix. + */ + comment: string; + + /** + * The creation timestamp of the allowlist prefix. + */ + created_on: string; + + /** + * Whether to enable the allowlist prefix into effect. Defaults to false. + */ + enabled: boolean; + + /** + * The last modification timestamp of the allowlist prefix. + */ + modified_on: string; + + /** + * The allowlist prefix in CIDR format. + */ + prefix: string; +} + +export interface ItemDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface ItemEditParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: A comment describing the allowlist prefix. Optional. + */ + comment?: string; + + /** + * Body param: Whether to enable the allowlist prefix into effect. Optional. + */ + enabled?: boolean; +} + +export interface ItemGetParams { + /** + * Identifier. + */ + account_id: string; +} + +export declare namespace Items { + export { + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/index.ts b/src/resources/ddos-protection/advanced-tcp-protection/index.ts new file mode 100644 index 0000000000..29af64875f --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/index.ts @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { AdvancedTCPProtection } from './advanced-tcp-protection'; +export { + AllowlistListResponsesV4PagePaginationArray, + Allowlist, + type AllowlistCreateResponse, + type AllowlistListResponse, + type AllowlistBulkDeleteResponse, + type AllowlistCreateParams, + type AllowlistListParams, + type AllowlistBulkDeleteParams, +} from './allowlist/index'; +export { + PrefixListResponsesV4PagePaginationArray, + PrefixBulkCreateResponsesSinglePage, + Prefixes, + type PrefixCreateResponse, + type PrefixListResponse, + type PrefixBulkCreateResponse, + type PrefixBulkDeleteResponse, + type PrefixCreateParams, + type PrefixListParams, + type PrefixBulkCreateParams, + type PrefixBulkDeleteParams, +} from './prefixes/index'; +export { + Status, + type StatusEditResponse, + type StatusGetResponse, + type StatusEditParams, + type StatusGetParams, +} from './status'; +export { SynProtection } from './syn-protection/index'; +export { TCPFlowProtection } from './tcp-flow-protection/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/prefixes.ts b/src/resources/ddos-protection/advanced-tcp-protection/prefixes.ts new file mode 100644 index 0000000000..68828b7e91 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/prefixes.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './prefixes/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/prefixes/index.ts b/src/resources/ddos-protection/advanced-tcp-protection/prefixes/index.ts new file mode 100644 index 0000000000..203cdf872a --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/prefixes/index.ts @@ -0,0 +1,24 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Items, + type ItemDeleteResponse, + type ItemEditResponse, + type ItemGetResponse, + type ItemDeleteParams, + type ItemEditParams, + type ItemGetParams, +} from './items'; +export { + PrefixListResponsesV4PagePaginationArray, + PrefixBulkCreateResponsesSinglePage, + Prefixes, + type PrefixCreateResponse, + type PrefixListResponse, + type PrefixBulkCreateResponse, + type PrefixBulkDeleteResponse, + type PrefixCreateParams, + type PrefixListParams, + type PrefixBulkCreateParams, + type PrefixBulkDeleteParams, +} from './prefixes'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/prefixes/items.ts b/src/resources/ddos-protection/advanced-tcp-protection/prefixes/items.ts new file mode 100644 index 0000000000..ccab2800e1 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/prefixes/items.ts @@ -0,0 +1,233 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; + +export class Items extends APIResource { + /** + * Delete the prefix for an account given a UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.prefixes.items.delete( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + prefixId: string, + params: ItemDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/prefixes/${prefixId}`, + options, + ); + } + + /** + * Update a prefix specified by the given UUID. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.prefixes.items.edit( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + edit( + prefixId: string, + params: ItemEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/prefixes/${prefixId}`, + { body, ...options }, + ) as Core.APIPromise<{ result: ItemEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a prefix specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.prefixes.items.get( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + prefixId: string, + params: ItemGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/prefixes/${prefixId}`, + options, + ) as Core.APIPromise<{ result: ItemGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ItemDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace ItemDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface ItemEditResponse { + /** + * The unique ID of the prefix. + */ + id: string; + + /** + * A comment describing the prefix. + */ + comment: string; + + /** + * The creation timestamp of the prefix. + */ + created_on: string; + + /** + * Whether to exclude the prefix from protection. + */ + excluded: boolean; + + /** + * The last modification timestamp of the prefix. + */ + modified_on: string; + + /** + * The prefix in CIDR format. + */ + prefix: string; +} + +export interface ItemGetResponse { + /** + * The unique ID of the prefix. + */ + id: string; + + /** + * A comment describing the prefix. + */ + comment: string; + + /** + * The creation timestamp of the prefix. + */ + created_on: string; + + /** + * Whether to exclude the prefix from protection. + */ + excluded: boolean; + + /** + * The last modification timestamp of the prefix. + */ + modified_on: string; + + /** + * The prefix in CIDR format. + */ + prefix: string; +} + +export interface ItemDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface ItemEditParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: A new comment for the prefix. Optional. + */ + comment?: string; + + /** + * Body param: Whether to exclude the prefix from protection. Optional. + */ + excluded?: boolean; +} + +export interface ItemGetParams { + /** + * Identifier. + */ + account_id: string; +} + +export declare namespace Items { + export { + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/prefixes/prefixes.ts b/src/resources/ddos-protection/advanced-tcp-protection/prefixes/prefixes.ts new file mode 100644 index 0000000000..ab79619a45 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/prefixes/prefixes.ts @@ -0,0 +1,377 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as Core from '../../../../core'; +import * as ItemsAPI from './items'; +import { + ItemDeleteParams, + ItemDeleteResponse, + ItemEditParams, + ItemEditResponse, + ItemGetParams, + ItemGetResponse, + Items, +} from './items'; +import { SinglePage, V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../pagination'; + +export class Prefixes extends APIResource { + items: ItemsAPI.Items = new ItemsAPI.Items(this._client); + + /** + * Create a prefix for an account. + * + * @example + * ```ts + * const prefix = + * await client.DDoSProtection.advancedTCPProtection.prefixes.create( + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * comment: 'comment', + * excluded: true, + * prefix: '192.0.2.0/24', + * }, + * ); + * ``` + */ + create(params: PrefixCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/magic/advanced_tcp_protection/configs/prefixes`, { + body, + ...options, + }) as Core.APIPromise<{ result: PrefixCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List all prefixes for an account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const prefixListResponse of client.DDoSProtection.advancedTCPProtection.prefixes.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: PrefixListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/prefixes`, + PrefixListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Create multiple prefixes for an account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const prefixBulkCreateResponse of client.DDoSProtection.advancedTCPProtection.prefixes.bulkCreate( + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * body: [ + * { + * comment: 'comment', + * excluded: true, + * prefix: '192.0.2.0/24', + * }, + * ], + * }, + * )) { + * // ... + * } + * ``` + */ + bulkCreate( + params: PrefixBulkCreateParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, body } = params; + return this._client.getAPIList( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/prefixes/bulk`, + PrefixBulkCreateResponsesSinglePage, + { body: body, method: 'post', ...options }, + ); + } + + /** + * Delete all prefixes for an account. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.prefixes.bulkDelete( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + bulkDelete( + params: PrefixBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/prefixes`, + options, + ); + } +} + +export class PrefixListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export class PrefixBulkCreateResponsesSinglePage extends SinglePage {} + +export interface PrefixCreateResponse { + /** + * The unique ID of the prefix. + */ + id: string; + + /** + * A comment describing the prefix. + */ + comment: string; + + /** + * The creation timestamp of the prefix. + */ + created_on: string; + + /** + * Whether to exclude the prefix from protection. + */ + excluded: boolean; + + /** + * The last modification timestamp of the prefix. + */ + modified_on: string; + + /** + * The prefix in CIDR format. + */ + prefix: string; +} + +export interface PrefixListResponse { + /** + * The unique ID of the prefix. + */ + id: string; + + /** + * A comment describing the prefix. + */ + comment: string; + + /** + * The creation timestamp of the prefix. + */ + created_on: string; + + /** + * Whether to exclude the prefix from protection. + */ + excluded: boolean; + + /** + * The last modification timestamp of the prefix. + */ + modified_on: string; + + /** + * The prefix in CIDR format. + */ + prefix: string; +} + +export interface PrefixBulkCreateResponse { + /** + * The unique ID of the prefix. + */ + id: string; + + /** + * A comment describing the prefix. + */ + comment: string; + + /** + * The creation timestamp of the prefix. + */ + created_on: string; + + /** + * Whether to exclude the prefix from protection. + */ + excluded: boolean; + + /** + * The last modification timestamp of the prefix. + */ + modified_on: string; + + /** + * The prefix in CIDR format. + */ + prefix: string; +} + +export interface PrefixBulkDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace PrefixBulkDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface PrefixCreateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: A comment describing the prefix. + */ + comment: string; + + /** + * Body param: Whether to exclude the prefix from protection. + */ + excluded: boolean; + + /** + * Body param: The prefix to add in CIDR format. + */ + prefix: string; +} + +export interface PrefixListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Query param: The direction of ordering (ASC or DESC). Defaults to 'ASC'. + */ + direction?: string; + + /** + * Query param: The field to order by. Defaults to 'prefix'. + */ + order?: string; +} + +export interface PrefixBulkCreateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param + */ + body: Array; +} + +export namespace PrefixBulkCreateParams { + export interface Body { + /** + * A comment describing the prefix. + */ + comment: string; + + /** + * Whether to exclude the prefix from protection. + */ + excluded: boolean; + + /** + * The prefix to add in CIDR format. + */ + prefix: string; + } +} + +export interface PrefixBulkDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +Prefixes.PrefixListResponsesV4PagePaginationArray = PrefixListResponsesV4PagePaginationArray; +Prefixes.PrefixBulkCreateResponsesSinglePage = PrefixBulkCreateResponsesSinglePage; +Prefixes.Items = Items; + +export declare namespace Prefixes { + export { + type PrefixCreateResponse as PrefixCreateResponse, + type PrefixListResponse as PrefixListResponse, + type PrefixBulkCreateResponse as PrefixBulkCreateResponse, + type PrefixBulkDeleteResponse as PrefixBulkDeleteResponse, + PrefixListResponsesV4PagePaginationArray as PrefixListResponsesV4PagePaginationArray, + PrefixBulkCreateResponsesSinglePage as PrefixBulkCreateResponsesSinglePage, + type PrefixCreateParams as PrefixCreateParams, + type PrefixListParams as PrefixListParams, + type PrefixBulkCreateParams as PrefixBulkCreateParams, + type PrefixBulkDeleteParams as PrefixBulkDeleteParams, + }; + + export { + Items as Items, + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/status.ts b/src/resources/ddos-protection/advanced-tcp-protection/status.ts new file mode 100644 index 0000000000..b77001bba5 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/status.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 Status extends APIResource { + /** + * Update the protection status of the account. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.status.edit( + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * enabled: true, + * }, + * ); + * ``` + */ + edit(params: StatusEditParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_protection_status`, + { body, ...options }, + ) as Core.APIPromise<{ result: StatusEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get the protection status of the account. + * + * @example + * ```ts + * const status = + * await client.DDoSProtection.advancedTCPProtection.status.get( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get(params: StatusGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_protection_status`, + options, + ) as Core.APIPromise<{ result: StatusGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface StatusEditResponse { + enabled: boolean; +} + +export interface StatusGetResponse { + enabled: boolean; +} + +export interface StatusEditParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: Enables or disables protection. + */ + enabled: boolean; +} + +export interface StatusGetParams { + /** + * Identifier. + */ + account_id: string; +} + +export declare namespace Status { + export { + type StatusEditResponse as StatusEditResponse, + type StatusGetResponse as StatusGetResponse, + type StatusEditParams as StatusEditParams, + type StatusGetParams as StatusGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection.ts new file mode 100644 index 0000000000..854a17a299 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './syn-protection/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters.ts new file mode 100644 index 0000000000..27c1404188 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './filters/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/filters.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/filters.ts new file mode 100644 index 0000000000..f1466697f3 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/filters.ts @@ -0,0 +1,266 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; +import * as ItemsAPI from './items'; +import { + ItemDeleteParams, + ItemDeleteResponse, + ItemEditParams, + ItemEditResponse, + ItemGetParams, + ItemGetResponse, + Items, +} from './items'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../../pagination'; + +export class Filters extends APIResource { + items: ItemsAPI.Items = new ItemsAPI.Items(this._client); + + /** + * Create a SYN Protection filter for an account. + * + * @example + * ```ts + * const filter = + * await client.DDoSProtection.advancedTCPProtection.synProtection.filters.create( + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * expression: + * 'ip.dst in { 192.0.2.0/24 198.51.100.0/24 } and tcp.srcport in { 80 443 10000..65535 }', + * mode: 'mode', + * }, + * ); + * ``` + */ + create(params: FilterCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters`, + { body, ...options }, + ) as Core.APIPromise<{ result: FilterCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List all SYN Protection filters for an account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const filterListResponse of client.DDoSProtection.advancedTCPProtection.synProtection.filters.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: FilterListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters`, + FilterListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete all SYN Protection filters for an account. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.synProtection.filters.bulkDelete( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + bulkDelete( + params: FilterBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters`, + options, + ); + } +} + +export class FilterListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface FilterCreateResponse { + /** + * The unique ID of the expression filter. + */ + id: string; + + /** + * The creation timestamp of the expression filter. + */ + created_on: string; + + /** + * The filter expression. + */ + expression: string; + + /** + * The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the expression filter. + */ + modified_on: string; +} + +export interface FilterListResponse { + /** + * The unique ID of the expression filter. + */ + id: string; + + /** + * The creation timestamp of the expression filter. + */ + created_on: string; + + /** + * The filter expression. + */ + expression: string; + + /** + * The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the expression filter. + */ + modified_on: string; +} + +export interface FilterBulkDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace FilterBulkDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface FilterCreateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The filter expression. + */ + expression: string; + + /** + * Body param: The filter's mode. Must be one of 'enabled', 'disabled', + * 'monitoring'. + */ + mode: string; +} + +export interface FilterListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Query param: The direction of ordering (ASC or DESC). Defaults to 'ASC'. + */ + direction?: string; + + /** + * Query param: The mode of the filters to get. Optional. Valid values: 'enabled', + * 'disabled', 'monitoring'. + */ + mode?: string; + + /** + * Query param: The field to order by. Defaults to 'prefix'. + */ + order?: string; +} + +export interface FilterBulkDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +Filters.FilterListResponsesV4PagePaginationArray = FilterListResponsesV4PagePaginationArray; +Filters.Items = Items; + +export declare namespace Filters { + export { + type FilterCreateResponse as FilterCreateResponse, + type FilterListResponse as FilterListResponse, + type FilterBulkDeleteResponse as FilterBulkDeleteResponse, + FilterListResponsesV4PagePaginationArray as FilterListResponsesV4PagePaginationArray, + type FilterCreateParams as FilterCreateParams, + type FilterListParams as FilterListParams, + type FilterBulkDeleteParams as FilterBulkDeleteParams, + }; + + export { + Items as Items, + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/index.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/index.ts new file mode 100644 index 0000000000..38cc9322f0 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/index.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + FilterListResponsesV4PagePaginationArray, + Filters, + type FilterCreateResponse, + type FilterListResponse, + type FilterBulkDeleteResponse, + type FilterCreateParams, + type FilterListParams, + type FilterBulkDeleteParams, +} from './filters'; +export { + Items, + type ItemDeleteResponse, + type ItemEditResponse, + type ItemGetResponse, + type ItemDeleteParams, + type ItemEditParams, + type ItemGetParams, +} from './items'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/items.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/items.ts new file mode 100644 index 0000000000..dc0c23d382 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/items.ts @@ -0,0 +1,224 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; + +export class Items extends APIResource { + /** + * Delete a SYN Protection filter specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.delete( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + filterId: string, + params: ItemDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters/${filterId}`, + options, + ); + } + + /** + * Update a SYN Protection filter specified by the given UUID. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.edit( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + edit( + filterId: string, + params: ItemEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters/${filterId}`, + { body, ...options }, + ) as Core.APIPromise<{ result: ItemEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a SYN Protection filter specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.get( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + filterId: string, + params: ItemGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/filters/${filterId}`, + options, + ) as Core.APIPromise<{ result: ItemGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ItemDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace ItemDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface ItemEditResponse { + /** + * The unique ID of the expression filter. + */ + id: string; + + /** + * The creation timestamp of the expression filter. + */ + created_on: string; + + /** + * The filter expression. + */ + expression: string; + + /** + * The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the expression filter. + */ + modified_on: string; +} + +export interface ItemGetResponse { + /** + * The unique ID of the expression filter. + */ + id: string; + + /** + * The creation timestamp of the expression filter. + */ + created_on: string; + + /** + * The filter expression. + */ + expression: string; + + /** + * The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the expression filter. + */ + modified_on: string; +} + +export interface ItemDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface ItemEditParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The new filter expression. Optional. + */ + expression?: string; + + /** + * Body param: The new mode for the filter. Optional. Must be one of 'enabled', + * 'disabled', 'monitoring'. + */ + mode?: string; +} + +export interface ItemGetParams { + /** + * Identifier. + */ + account_id: string; +} + +export declare namespace Items { + export { + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/index.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/index.ts new file mode 100644 index 0000000000..c21f6c8ed1 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/index.ts @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + FilterListResponsesV4PagePaginationArray, + Filters, + type FilterCreateResponse, + type FilterListResponse, + type FilterBulkDeleteResponse, + type FilterCreateParams, + type FilterListParams, + type FilterBulkDeleteParams, +} from './filters/index'; +export { + RuleListResponsesV4PagePaginationArray, + Rules, + type RuleCreateResponse, + type RuleListResponse, + type RuleBulkDeleteResponse, + type RuleCreateParams, + type RuleListParams, + type RuleBulkDeleteParams, +} from './rules/index'; +export { SynProtection } from './syn-protection'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules.ts new file mode 100644 index 0000000000..073142c337 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './rules/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/index.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/index.ts new file mode 100644 index 0000000000..52f332b1ed --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/index.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Items, + type ItemDeleteResponse, + type ItemEditResponse, + type ItemGetResponse, + type ItemDeleteParams, + type ItemEditParams, + type ItemGetParams, +} from './items'; +export { + RuleListResponsesV4PagePaginationArray, + Rules, + type RuleCreateResponse, + type RuleListResponse, + type RuleBulkDeleteResponse, + type RuleCreateParams, + type RuleListParams, + type RuleBulkDeleteParams, +} from './rules'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/items.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/items.ts new file mode 100644 index 0000000000..47ee26a1a6 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/items.ts @@ -0,0 +1,287 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; + +export class Items extends APIResource { + /** + * Delete a SYN Protection rule specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.delete( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + ruleId: string, + params: ItemDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules/${ruleId}`, + options, + ); + } + + /** + * Update a SYN Protection rule specified by the given UUID. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.edit( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + edit( + ruleId: string, + params: ItemEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules/${ruleId}`, + { body, ...options }, + ) as Core.APIPromise<{ result: ItemEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a SYN Protection rule specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.get( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + ruleId: string, + params: ItemGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules/${ruleId}`, + options, + ) as Core.APIPromise<{ result: ItemGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ItemDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace ItemDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface ItemEditResponse { + /** + * The unique ID of the SYN Protection rule. + */ + id: string; + + /** + * The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * The creation timestamp of the SYN Protection rule. + */ + created_on: string; + + /** + * The type of mitigation for SYN Protection. Must be one of 'challenge' or + * 'retransmit'. + */ + mitigation_type: string; + + /** + * The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the SYN Protection rule. + */ + modified_on: string; + + /** + * The name of the SYN Protection rule. Value is relative to the 'scope' setting. + * For 'global' scope, name should be 'global'. For either the 'region' or + * 'datacenter' scope, name should be the actual name of the region or datacenter, + * e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * The scope for the SYN Protection rule. Must be one of 'global', 'region', or + * 'datacenter'. + */ + scope: string; +} + +export interface ItemGetResponse { + /** + * The unique ID of the SYN Protection rule. + */ + id: string; + + /** + * The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * The creation timestamp of the SYN Protection rule. + */ + created_on: string; + + /** + * The type of mitigation for SYN Protection. Must be one of 'challenge' or + * 'retransmit'. + */ + mitigation_type: string; + + /** + * The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the SYN Protection rule. + */ + modified_on: string; + + /** + * The name of the SYN Protection rule. Value is relative to the 'scope' setting. + * For 'global' scope, name should be 'global'. For either the 'region' or + * 'datacenter' scope, name should be the actual name of the region or datacenter, + * e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * The scope for the SYN Protection rule. Must be one of 'global', 'region', or + * 'datacenter'. + */ + scope: string; +} + +export interface ItemDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface ItemEditParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The new burst sensitivity. Optional. Must be one of 'low', 'medium', + * 'high'. + */ + burst_sensitivity?: string; + + /** + * Body param: The new mitigation type. Optional. Must be one of 'challenge' or + * 'retransmit'. + */ + mitigation_type?: string; + + /** + * Body param: The new mode for SYN Protection. Optional. Must be one of 'enabled', + * 'disabled', 'monitoring'. + */ + mode?: string; + + /** + * Body param: The new rate sensitivity. Optional. Must be one of 'low', 'medium', + * 'high'. + */ + rate_sensitivity?: string; +} + +export interface ItemGetParams { + /** + * Identifier. + */ + account_id: string; +} + +export declare namespace Items { + export { + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/rules.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/rules.ts new file mode 100644 index 0000000000..c3ab1e8b5e --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/rules.ts @@ -0,0 +1,337 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; +import * as ItemsAPI from './items'; +import { + ItemDeleteParams, + ItemDeleteResponse, + ItemEditParams, + ItemEditResponse, + ItemGetParams, + ItemGetResponse, + Items, +} from './items'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../../pagination'; + +export class Rules extends APIResource { + items: ItemsAPI.Items = new ItemsAPI.Items(this._client); + + /** + * Create a SYN Protection rule for an account. + * + * @example + * ```ts + * const rule = + * await client.DDoSProtection.advancedTCPProtection.synProtection.rules.create( + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * burst_sensitivity: 'burst_sensitivity', + * mode: 'mode', + * name: 'name', + * rate_sensitivity: 'rate_sensitivity', + * scope: 'scope', + * }, + * ); + * ``` + */ + create(params: RuleCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules`, + { body, ...options }, + ) as Core.APIPromise<{ result: RuleCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List all SYN Protection rules for an account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const ruleListResponse of client.DDoSProtection.advancedTCPProtection.synProtection.rules.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: RuleListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules`, + RuleListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete all SYN Protection rules for an account. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.synProtection.rules.bulkDelete( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + bulkDelete( + params: RuleBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/syn_protection/rules`, + options, + ); + } +} + +export class RuleListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface RuleCreateResponse { + /** + * The unique ID of the SYN Protection rule. + */ + id: string; + + /** + * The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * The creation timestamp of the SYN Protection rule. + */ + created_on: string; + + /** + * The type of mitigation for SYN Protection. Must be one of 'challenge' or + * 'retransmit'. + */ + mitigation_type: string; + + /** + * The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the SYN Protection rule. + */ + modified_on: string; + + /** + * The name of the SYN Protection rule. Value is relative to the 'scope' setting. + * For 'global' scope, name should be 'global'. For either the 'region' or + * 'datacenter' scope, name should be the actual name of the region or datacenter, + * e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * The scope for the SYN Protection rule. Must be one of 'global', 'region', or + * 'datacenter'. + */ + scope: string; +} + +export interface RuleListResponse { + /** + * The unique ID of the SYN Protection rule. + */ + id: string; + + /** + * The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * The creation timestamp of the SYN Protection rule. + */ + created_on: string; + + /** + * The type of mitigation for SYN Protection. Must be one of 'challenge' or + * 'retransmit'. + */ + mitigation_type: string; + + /** + * The mode for SYN Protection. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the SYN Protection rule. + */ + modified_on: string; + + /** + * The name of the SYN Protection rule. Value is relative to the 'scope' setting. + * For 'global' scope, name should be 'global'. For either the 'region' or + * 'datacenter' scope, name should be the actual name of the region or datacenter, + * e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * The scope for the SYN Protection rule. Must be one of 'global', 'region', or + * 'datacenter'. + */ + scope: string; +} + +export interface RuleBulkDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace RuleBulkDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface RuleCreateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * Body param: The mode for SYN Protection. Must be one of 'enabled', 'disabled', + * 'monitoring'. + */ + mode: string; + + /** + * Body param: The name of the SYN Protection rule. Value is relative to the + * 'scope' setting. For 'global' scope, name should be 'global'. For either the + * 'region' or 'datacenter' scope, name should be the actual name of the region or + * datacenter, e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * Body param: The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * Body param: The scope for the SYN Protection rule. Must be one of 'global', + * 'region', or 'datacenter'. + */ + scope: string; + + /** + * Body param: The type of mitigation. Must be one of 'challenge' or 'retransmit'. + * Optional. Defaults to 'challenge'. + */ + mitigation_type?: string; +} + +export interface RuleListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Query param: The direction of ordering (ASC or DESC). Defaults to 'ASC'. + */ + direction?: string; + + /** + * Query param: The field to order by. Defaults to 'prefix'. + */ + order?: string; +} + +export interface RuleBulkDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +Rules.RuleListResponsesV4PagePaginationArray = RuleListResponsesV4PagePaginationArray; +Rules.Items = Items; + +export declare namespace Rules { + export { + type RuleCreateResponse as RuleCreateResponse, + type RuleListResponse as RuleListResponse, + type RuleBulkDeleteResponse as RuleBulkDeleteResponse, + RuleListResponsesV4PagePaginationArray as RuleListResponsesV4PagePaginationArray, + type RuleCreateParams as RuleCreateParams, + type RuleListParams as RuleListParams, + type RuleBulkDeleteParams as RuleBulkDeleteParams, + }; + + export { + Items as Items, + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/syn-protection.ts b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/syn-protection.ts new file mode 100644 index 0000000000..fba74ffe78 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/syn-protection/syn-protection.ts @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as FiltersAPI from './filters/filters'; +import { + FilterBulkDeleteParams, + FilterBulkDeleteResponse, + FilterCreateParams, + FilterCreateResponse, + FilterListParams, + FilterListResponse, + FilterListResponsesV4PagePaginationArray, + Filters, +} from './filters/filters'; +import * as RulesAPI from './rules/rules'; +import { + RuleBulkDeleteParams, + RuleBulkDeleteResponse, + RuleCreateParams, + RuleCreateResponse, + RuleListParams, + RuleListResponse, + RuleListResponsesV4PagePaginationArray, + Rules, +} from './rules/rules'; + +export class SynProtection extends APIResource { + filters: FiltersAPI.Filters = new FiltersAPI.Filters(this._client); + rules: RulesAPI.Rules = new RulesAPI.Rules(this._client); +} + +SynProtection.Filters = Filters; +SynProtection.FilterListResponsesV4PagePaginationArray = FilterListResponsesV4PagePaginationArray; +SynProtection.Rules = Rules; +SynProtection.RuleListResponsesV4PagePaginationArray = RuleListResponsesV4PagePaginationArray; + +export declare namespace SynProtection { + export { + Filters as Filters, + type FilterCreateResponse as FilterCreateResponse, + type FilterListResponse as FilterListResponse, + type FilterBulkDeleteResponse as FilterBulkDeleteResponse, + FilterListResponsesV4PagePaginationArray as FilterListResponsesV4PagePaginationArray, + type FilterCreateParams as FilterCreateParams, + type FilterListParams as FilterListParams, + type FilterBulkDeleteParams as FilterBulkDeleteParams, + }; + + export { + Rules as Rules, + type RuleCreateResponse as RuleCreateResponse, + type RuleListResponse as RuleListResponse, + type RuleBulkDeleteResponse as RuleBulkDeleteResponse, + RuleListResponsesV4PagePaginationArray as RuleListResponsesV4PagePaginationArray, + type RuleCreateParams as RuleCreateParams, + type RuleListParams as RuleListParams, + type RuleBulkDeleteParams as RuleBulkDeleteParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection.ts new file mode 100644 index 0000000000..501a003689 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './tcp-flow-protection/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters.ts new file mode 100644 index 0000000000..27c1404188 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './filters/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/filters.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/filters.ts new file mode 100644 index 0000000000..e5c4af8a87 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/filters.ts @@ -0,0 +1,266 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; +import * as ItemsAPI from './items'; +import { + ItemDeleteParams, + ItemDeleteResponse, + ItemEditParams, + ItemEditResponse, + ItemGetParams, + ItemGetResponse, + Items, +} from './items'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../../pagination'; + +export class Filters extends APIResource { + items: ItemsAPI.Items = new ItemsAPI.Items(this._client); + + /** + * Create a TCP Flow Protection filter for an account. + * + * @example + * ```ts + * const filter = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.create( + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * expression: + * 'ip.dst in { 192.0.2.0/24 198.51.100.0/24 } and tcp.srcport in { 80 443 10000..65535 }', + * mode: 'mode', + * }, + * ); + * ``` + */ + create(params: FilterCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`, + { body, ...options }, + ) as Core.APIPromise<{ result: FilterCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List all TCP Flow Protection filters for an account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const filterListResponse of client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: FilterListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`, + FilterListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete all TCP Flow Protection filters for an account. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.bulkDelete( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + bulkDelete( + params: FilterBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters`, + options, + ); + } +} + +export class FilterListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface FilterCreateResponse { + /** + * The unique ID of the expression filter. + */ + id: string; + + /** + * The creation timestamp of the expression filter. + */ + created_on: string; + + /** + * The filter expression. + */ + expression: string; + + /** + * The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the expression filter. + */ + modified_on: string; +} + +export interface FilterListResponse { + /** + * The unique ID of the expression filter. + */ + id: string; + + /** + * The creation timestamp of the expression filter. + */ + created_on: string; + + /** + * The filter expression. + */ + expression: string; + + /** + * The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the expression filter. + */ + modified_on: string; +} + +export interface FilterBulkDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace FilterBulkDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface FilterCreateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The filter expression. + */ + expression: string; + + /** + * Body param: The filter's mode. Must be one of 'enabled', 'disabled', + * 'monitoring'. + */ + mode: string; +} + +export interface FilterListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Query param: The direction of ordering (ASC or DESC). Defaults to 'ASC'. + */ + direction?: string; + + /** + * Query param: The mode of the filters to get. Optional. Valid values: 'enabled', + * 'disabled', 'monitoring'. + */ + mode?: string; + + /** + * Query param: The field to order by. Defaults to 'prefix'. + */ + order?: string; +} + +export interface FilterBulkDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +Filters.FilterListResponsesV4PagePaginationArray = FilterListResponsesV4PagePaginationArray; +Filters.Items = Items; + +export declare namespace Filters { + export { + type FilterCreateResponse as FilterCreateResponse, + type FilterListResponse as FilterListResponse, + type FilterBulkDeleteResponse as FilterBulkDeleteResponse, + FilterListResponsesV4PagePaginationArray as FilterListResponsesV4PagePaginationArray, + type FilterCreateParams as FilterCreateParams, + type FilterListParams as FilterListParams, + type FilterBulkDeleteParams as FilterBulkDeleteParams, + }; + + export { + Items as Items, + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/index.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/index.ts new file mode 100644 index 0000000000..38cc9322f0 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/index.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + FilterListResponsesV4PagePaginationArray, + Filters, + type FilterCreateResponse, + type FilterListResponse, + type FilterBulkDeleteResponse, + type FilterCreateParams, + type FilterListParams, + type FilterBulkDeleteParams, +} from './filters'; +export { + Items, + type ItemDeleteResponse, + type ItemEditResponse, + type ItemGetResponse, + type ItemDeleteParams, + type ItemEditParams, + type ItemGetParams, +} from './items'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/items.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/items.ts new file mode 100644 index 0000000000..01c8d7fa6b --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/items.ts @@ -0,0 +1,224 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; + +export class Items extends APIResource { + /** + * Delete a TCP Flow Protection filter specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.delete( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + filterId: string, + params: ItemDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${filterId}`, + options, + ); + } + + /** + * Update a TCP Flow Protection filter specified by the given UUID. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.edit( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + edit( + filterId: string, + params: ItemEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${filterId}`, + { body, ...options }, + ) as Core.APIPromise<{ result: ItemEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a TCP Flow Protection filter specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.get( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + filterId: string, + params: ItemGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/filters/${filterId}`, + options, + ) as Core.APIPromise<{ result: ItemGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ItemDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace ItemDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface ItemEditResponse { + /** + * The unique ID of the expression filter. + */ + id: string; + + /** + * The creation timestamp of the expression filter. + */ + created_on: string; + + /** + * The filter expression. + */ + expression: string; + + /** + * The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the expression filter. + */ + modified_on: string; +} + +export interface ItemGetResponse { + /** + * The unique ID of the expression filter. + */ + id: string; + + /** + * The creation timestamp of the expression filter. + */ + created_on: string; + + /** + * The filter expression. + */ + expression: string; + + /** + * The filter's mode. Must be one of 'enabled', 'disabled', 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the expression filter. + */ + modified_on: string; +} + +export interface ItemDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface ItemEditParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The new filter expression. Optional. + */ + expression?: string; + + /** + * Body param: The new mode for the filter. Optional. Must be one of 'enabled', + * 'disabled', 'monitoring'. + */ + mode?: string; +} + +export interface ItemGetParams { + /** + * Identifier. + */ + account_id: string; +} + +export declare namespace Items { + export { + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/index.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/index.ts new file mode 100644 index 0000000000..4a53bc818f --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/index.ts @@ -0,0 +1,23 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + FilterListResponsesV4PagePaginationArray, + Filters, + type FilterCreateResponse, + type FilterListResponse, + type FilterBulkDeleteResponse, + type FilterCreateParams, + type FilterListParams, + type FilterBulkDeleteParams, +} from './filters/index'; +export { + RuleListResponsesV4PagePaginationArray, + Rules, + type RuleCreateResponse, + type RuleListResponse, + type RuleBulkDeleteResponse, + type RuleCreateParams, + type RuleListParams, + type RuleBulkDeleteParams, +} from './rules/index'; +export { TCPFlowProtection } from './tcp-flow-protection'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules.ts new file mode 100644 index 0000000000..073142c337 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './rules/index'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/index.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/index.ts new file mode 100644 index 0000000000..52f332b1ed --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/index.ts @@ -0,0 +1,21 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + Items, + type ItemDeleteResponse, + type ItemEditResponse, + type ItemGetResponse, + type ItemDeleteParams, + type ItemEditParams, + type ItemGetParams, +} from './items'; +export { + RuleListResponsesV4PagePaginationArray, + Rules, + type RuleCreateResponse, + type RuleListResponse, + type RuleBulkDeleteResponse, + type RuleCreateParams, + type RuleListParams, + type RuleBulkDeleteParams, +} from './rules'; diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/items.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/items.ts new file mode 100644 index 0000000000..3e532b9641 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/items.ts @@ -0,0 +1,271 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; + +export class Items extends APIResource { + /** + * Delete a TCP Flow Protection rule specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.delete( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + ruleId: string, + params: ItemDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${ruleId}`, + options, + ); + } + + /** + * Update a TCP Flow Protection rule specified by the given UUID. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.edit( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + edit( + ruleId: string, + params: ItemEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${ruleId}`, + { body, ...options }, + ) as Core.APIPromise<{ result: ItemEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a TCP Flow Protection rule specified by the given UUID. + * + * @example + * ```ts + * const item = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.get( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + ruleId: string, + params: ItemGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules/${ruleId}`, + options, + ) as Core.APIPromise<{ result: ItemGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ItemDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace ItemDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface ItemEditResponse { + /** + * The unique ID of the TCP Flow Protection rule. + */ + id: string; + + /** + * The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * The creation timestamp of the TCP Flow Protection rule. + */ + created_on: string; + + /** + * The mode for TCP Flow Protection. Must be one of 'enabled', 'disabled', + * 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the TCP Flow Protection rule. + */ + modified_on: string; + + /** + * The name of the TCP Flow Protection rule. Value is relative to the 'scope' + * setting. For 'global' scope, name should be 'global'. For either the 'region' or + * 'datacenter' scope, name should be the actual name of the region or datacenter, + * e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * The scope for the TCP Flow Protection rule. Must be one of 'global', 'region', + * or 'datacenter'. + */ + scope: string; +} + +export interface ItemGetResponse { + /** + * The unique ID of the TCP Flow Protection rule. + */ + id: string; + + /** + * The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * The creation timestamp of the TCP Flow Protection rule. + */ + created_on: string; + + /** + * The mode for TCP Flow Protection. Must be one of 'enabled', 'disabled', + * 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the TCP Flow Protection rule. + */ + modified_on: string; + + /** + * The name of the TCP Flow Protection rule. Value is relative to the 'scope' + * setting. For 'global' scope, name should be 'global'. For either the 'region' or + * 'datacenter' scope, name should be the actual name of the region or datacenter, + * e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * The scope for the TCP Flow Protection rule. Must be one of 'global', 'region', + * or 'datacenter'. + */ + scope: string; +} + +export interface ItemDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface ItemEditParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The new burst sensitivity. Optional. Must be one of 'low', 'medium', + * 'high'. + */ + burst_sensitivity?: string; + + /** + * Body param: The new mode for TCP Flow Protection. Optional. Must be one of + * 'enabled', 'disabled', 'monitoring'. + */ + mode?: string; + + /** + * Body param: The new rate sensitivity. Optional. Must be one of 'low', 'medium', + * 'high'. + */ + rate_sensitivity?: string; +} + +export interface ItemGetParams { + /** + * Identifier. + */ + account_id: string; +} + +export declare namespace Items { + export { + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/rules.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/rules.ts new file mode 100644 index 0000000000..96ba281da0 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/rules.ts @@ -0,0 +1,320 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../../resource'; +import * as Core from '../../../../../core'; +import * as ItemsAPI from './items'; +import { + ItemDeleteParams, + ItemDeleteResponse, + ItemEditParams, + ItemEditResponse, + ItemGetParams, + ItemGetResponse, + Items, +} from './items'; +import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../../pagination'; + +export class Rules extends APIResource { + items: ItemsAPI.Items = new ItemsAPI.Items(this._client); + + /** + * Create a TCP Flow Protection rule for an account. + * + * @example + * ```ts + * const rule = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.create( + * { + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * burst_sensitivity: 'burst_sensitivity', + * mode: 'mode', + * name: 'name', + * rate_sensitivity: 'rate_sensitivity', + * scope: 'scope', + * }, + * ); + * ``` + */ + create(params: RuleCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`, + { body, ...options }, + ) as Core.APIPromise<{ result: RuleCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List all TCP Flow Protection rules for an account. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const ruleListResponse of client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: RuleListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`, + RuleListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Delete all TCP Flow Protection rules for an account. + * + * @example + * ```ts + * const response = + * await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.bulkDelete( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + bulkDelete( + params: RuleBulkDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/magic/advanced_tcp_protection/configs/tcp_flow_protection/rules`, + options, + ); + } +} + +export class RuleListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface RuleCreateResponse { + /** + * The unique ID of the TCP Flow Protection rule. + */ + id: string; + + /** + * The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * The creation timestamp of the TCP Flow Protection rule. + */ + created_on: string; + + /** + * The mode for TCP Flow Protection. Must be one of 'enabled', 'disabled', + * 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the TCP Flow Protection rule. + */ + modified_on: string; + + /** + * The name of the TCP Flow Protection rule. Value is relative to the 'scope' + * setting. For 'global' scope, name should be 'global'. For either the 'region' or + * 'datacenter' scope, name should be the actual name of the region or datacenter, + * e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * The scope for the TCP Flow Protection rule. Must be one of 'global', 'region', + * or 'datacenter'. + */ + scope: string; +} + +export interface RuleListResponse { + /** + * The unique ID of the TCP Flow Protection rule. + */ + id: string; + + /** + * The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * The creation timestamp of the TCP Flow Protection rule. + */ + created_on: string; + + /** + * The mode for TCP Flow Protection. Must be one of 'enabled', 'disabled', + * 'monitoring'. + */ + mode: string; + + /** + * The last modification timestamp of the TCP Flow Protection rule. + */ + modified_on: string; + + /** + * The name of the TCP Flow Protection rule. Value is relative to the 'scope' + * setting. For 'global' scope, name should be 'global'. For either the 'region' or + * 'datacenter' scope, name should be the actual name of the region or datacenter, + * e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * The scope for the TCP Flow Protection rule. Must be one of 'global', 'region', + * or 'datacenter'. + */ + scope: string; +} + +export interface RuleBulkDeleteResponse { + errors: Array; + + messages: Array; + + /** + * Whether the API call was successful. + */ + success: true; +} + +export namespace RuleBulkDeleteResponse { + export interface Error { + code: number; + + message: string; + + documentation_url?: string; + + source?: Error.Source; + } + + export namespace Error { + export interface Source { + pointer?: string; + } + } + + export interface Message { + code: number; + + message: string; + + documentation_url?: string; + + source?: Message.Source; + } + + export namespace Message { + export interface Source { + pointer?: string; + } + } +} + +export interface RuleCreateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: The burst sensitivity. Must be one of 'low', 'medium', 'high'. + */ + burst_sensitivity: string; + + /** + * Body param: The mode for the TCP Flow Protection. Must be one of 'enabled', + * 'disabled', 'monitoring'. + */ + mode: string; + + /** + * Body param: The name of the TCP Flow Protection rule. Value is relative to the + * 'scope' setting. For 'global' scope, name should be 'global'. For either the + * 'region' or 'datacenter' scope, name should be the actual name of the region or + * datacenter, e.g., 'wnam' or 'lax'. + */ + name: string; + + /** + * Body param: The rate sensitivity. Must be one of 'low', 'medium', 'high'. + */ + rate_sensitivity: string; + + /** + * Body param: The scope for the TCP Flow Protection rule. + */ + scope: string; +} + +export interface RuleListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Query param: The direction of ordering (ASC or DESC). Defaults to 'ASC'. + */ + direction?: string; + + /** + * Query param: The field to order by. Defaults to 'prefix'. + */ + order?: string; +} + +export interface RuleBulkDeleteParams { + /** + * Identifier. + */ + account_id: string; +} + +Rules.RuleListResponsesV4PagePaginationArray = RuleListResponsesV4PagePaginationArray; +Rules.Items = Items; + +export declare namespace Rules { + export { + type RuleCreateResponse as RuleCreateResponse, + type RuleListResponse as RuleListResponse, + type RuleBulkDeleteResponse as RuleBulkDeleteResponse, + RuleListResponsesV4PagePaginationArray as RuleListResponsesV4PagePaginationArray, + type RuleCreateParams as RuleCreateParams, + type RuleListParams as RuleListParams, + type RuleBulkDeleteParams as RuleBulkDeleteParams, + }; + + export { + Items as Items, + type ItemDeleteResponse as ItemDeleteResponse, + type ItemEditResponse as ItemEditResponse, + type ItemGetResponse as ItemGetResponse, + type ItemDeleteParams as ItemDeleteParams, + type ItemEditParams as ItemEditParams, + type ItemGetParams as ItemGetParams, + }; +} diff --git a/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/tcp-flow-protection.ts b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/tcp-flow-protection.ts new file mode 100644 index 0000000000..b66f2fd6d8 --- /dev/null +++ b/src/resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/tcp-flow-protection.ts @@ -0,0 +1,59 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../../resource'; +import * as FiltersAPI from './filters/filters'; +import { + FilterBulkDeleteParams, + FilterBulkDeleteResponse, + FilterCreateParams, + FilterCreateResponse, + FilterListParams, + FilterListResponse, + FilterListResponsesV4PagePaginationArray, + Filters, +} from './filters/filters'; +import * as RulesAPI from './rules/rules'; +import { + RuleBulkDeleteParams, + RuleBulkDeleteResponse, + RuleCreateParams, + RuleCreateResponse, + RuleListParams, + RuleListResponse, + RuleListResponsesV4PagePaginationArray, + Rules, +} from './rules/rules'; + +export class TCPFlowProtection extends APIResource { + filters: FiltersAPI.Filters = new FiltersAPI.Filters(this._client); + rules: RulesAPI.Rules = new RulesAPI.Rules(this._client); +} + +TCPFlowProtection.Filters = Filters; +TCPFlowProtection.FilterListResponsesV4PagePaginationArray = FilterListResponsesV4PagePaginationArray; +TCPFlowProtection.Rules = Rules; +TCPFlowProtection.RuleListResponsesV4PagePaginationArray = RuleListResponsesV4PagePaginationArray; + +export declare namespace TCPFlowProtection { + export { + Filters as Filters, + type FilterCreateResponse as FilterCreateResponse, + type FilterListResponse as FilterListResponse, + type FilterBulkDeleteResponse as FilterBulkDeleteResponse, + FilterListResponsesV4PagePaginationArray as FilterListResponsesV4PagePaginationArray, + type FilterCreateParams as FilterCreateParams, + type FilterListParams as FilterListParams, + type FilterBulkDeleteParams as FilterBulkDeleteParams, + }; + + export { + Rules as Rules, + type RuleCreateResponse as RuleCreateResponse, + type RuleListResponse as RuleListResponse, + type RuleBulkDeleteResponse as RuleBulkDeleteResponse, + RuleListResponsesV4PagePaginationArray as RuleListResponsesV4PagePaginationArray, + type RuleCreateParams as RuleCreateParams, + type RuleListParams as RuleListParams, + type RuleBulkDeleteParams as RuleBulkDeleteParams, + }; +} diff --git a/src/resources/ddos-protection/api.md b/src/resources/ddos-protection/api.md new file mode 100644 index 0000000000..ca0c6e974d --- /dev/null +++ b/src/resources/ddos-protection/api.md @@ -0,0 +1,189 @@ +# DDoSProtection + +## AdvancedTCPProtection + +### Allowlist + +Types: + +- AllowlistCreateResponse +- AllowlistListResponse +- AllowlistBulkDeleteResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.allowlist.create({ ...params }) -> AllowlistCreateResponse +- client.DDoSProtection.advancedTCPProtection.allowlist.list({ ...params }) -> AllowlistListResponsesV4PagePaginationArray +- client.DDoSProtection.advancedTCPProtection.allowlist.bulkDelete({ ...params }) -> AllowlistBulkDeleteResponse + +#### Items + +Types: + +- ItemDeleteResponse +- ItemEditResponse +- ItemGetResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.allowlist.items.delete(prefixId, { ...params }) -> ItemDeleteResponse +- client.DDoSProtection.advancedTCPProtection.allowlist.items.edit(prefixId, { ...params }) -> ItemEditResponse +- client.DDoSProtection.advancedTCPProtection.allowlist.items.get(prefixId, { ...params }) -> ItemGetResponse + +### Prefixes + +Types: + +- PrefixCreateResponse +- PrefixListResponse +- PrefixBulkCreateResponse +- PrefixBulkDeleteResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.prefixes.create({ ...params }) -> PrefixCreateResponse +- client.DDoSProtection.advancedTCPProtection.prefixes.list({ ...params }) -> PrefixListResponsesV4PagePaginationArray +- client.DDoSProtection.advancedTCPProtection.prefixes.bulkCreate([ ...body ]) -> PrefixBulkCreateResponsesSinglePage +- client.DDoSProtection.advancedTCPProtection.prefixes.bulkDelete({ ...params }) -> PrefixBulkDeleteResponse + +#### Items + +Types: + +- ItemDeleteResponse +- ItemEditResponse +- ItemGetResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.prefixes.items.delete(prefixId, { ...params }) -> ItemDeleteResponse +- client.DDoSProtection.advancedTCPProtection.prefixes.items.edit(prefixId, { ...params }) -> ItemEditResponse +- client.DDoSProtection.advancedTCPProtection.prefixes.items.get(prefixId, { ...params }) -> ItemGetResponse + +### SynProtection + +#### Filters + +Types: + +- FilterCreateResponse +- FilterListResponse +- FilterBulkDeleteResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.synProtection.filters.create({ ...params }) -> FilterCreateResponse +- client.DDoSProtection.advancedTCPProtection.synProtection.filters.list({ ...params }) -> FilterListResponsesV4PagePaginationArray +- client.DDoSProtection.advancedTCPProtection.synProtection.filters.bulkDelete({ ...params }) -> FilterBulkDeleteResponse + +##### Items + +Types: + +- ItemDeleteResponse +- ItemEditResponse +- ItemGetResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.delete(filterId, { ...params }) -> ItemDeleteResponse +- client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.edit(filterId, { ...params }) -> ItemEditResponse +- client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.get(filterId, { ...params }) -> ItemGetResponse + +#### Rules + +Types: + +- RuleCreateResponse +- RuleListResponse +- RuleBulkDeleteResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.synProtection.rules.create({ ...params }) -> RuleCreateResponse +- client.DDoSProtection.advancedTCPProtection.synProtection.rules.list({ ...params }) -> RuleListResponsesV4PagePaginationArray +- client.DDoSProtection.advancedTCPProtection.synProtection.rules.bulkDelete({ ...params }) -> RuleBulkDeleteResponse + +##### Items + +Types: + +- ItemDeleteResponse +- ItemEditResponse +- ItemGetResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.delete(ruleId, { ...params }) -> ItemDeleteResponse +- client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.edit(ruleId, { ...params }) -> ItemEditResponse +- client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.get(ruleId, { ...params }) -> ItemGetResponse + +### TCPFlowProtection + +#### Filters + +Types: + +- FilterCreateResponse +- FilterListResponse +- FilterBulkDeleteResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.create({ ...params }) -> FilterCreateResponse +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.list({ ...params }) -> FilterListResponsesV4PagePaginationArray +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.bulkDelete({ ...params }) -> FilterBulkDeleteResponse + +##### Items + +Types: + +- ItemDeleteResponse +- ItemEditResponse +- ItemGetResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.delete(filterId, { ...params }) -> ItemDeleteResponse +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.edit(filterId, { ...params }) -> ItemEditResponse +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.get(filterId, { ...params }) -> ItemGetResponse + +#### Rules + +Types: + +- RuleCreateResponse +- RuleListResponse +- RuleBulkDeleteResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.create({ ...params }) -> RuleCreateResponse +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.list({ ...params }) -> RuleListResponsesV4PagePaginationArray +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.bulkDelete({ ...params }) -> RuleBulkDeleteResponse + +##### Items + +Types: + +- ItemDeleteResponse +- ItemEditResponse +- ItemGetResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.delete(ruleId, { ...params }) -> ItemDeleteResponse +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.edit(ruleId, { ...params }) -> ItemEditResponse +- client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.get(ruleId, { ...params }) -> ItemGetResponse + +### Status + +Types: + +- StatusEditResponse +- StatusGetResponse + +Methods: + +- client.DDoSProtection.advancedTCPProtection.status.edit({ ...params }) -> StatusEditResponse +- client.DDoSProtection.advancedTCPProtection.status.get({ ...params }) -> StatusGetResponse diff --git a/src/resources/ddos-protection/ddos-protection.ts b/src/resources/ddos-protection/ddos-protection.ts new file mode 100644 index 0000000000..b1ef60d780 --- /dev/null +++ b/src/resources/ddos-protection/ddos-protection.ts @@ -0,0 +1,16 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as AdvancedTCPProtectionAPI from './advanced-tcp-protection/advanced-tcp-protection'; +import { AdvancedTCPProtection } from './advanced-tcp-protection/advanced-tcp-protection'; + +export class DDoSProtection extends APIResource { + advancedTCPProtection: AdvancedTCPProtectionAPI.AdvancedTCPProtection = + new AdvancedTCPProtectionAPI.AdvancedTCPProtection(this._client); +} + +DDoSProtection.AdvancedTCPProtection = AdvancedTCPProtection; + +export declare namespace DDoSProtection { + export { AdvancedTCPProtection as AdvancedTCPProtection }; +} diff --git a/src/resources/ddos-protection/index.ts b/src/resources/ddos-protection/index.ts new file mode 100644 index 0000000000..7d1bae1539 --- /dev/null +++ b/src/resources/ddos-protection/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { AdvancedTCPProtection } from './advanced-tcp-protection/index'; +export { DDoSProtection } from './ddos-protection'; diff --git a/src/resources/index.ts b/src/resources/index.ts index 7235c2e0a8..a217543e3c 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -32,6 +32,7 @@ export { CustomNameservers } from './custom-nameservers'; export { CustomPages } from './custom-pages/custom-pages'; export { D1Resource } from './d1/d1'; export { DCVDelegation } from './dcv-delegation'; +export { DDoSProtection } from './ddos-protection/ddos-protection'; export { DNS } from './dns/dns'; export { DNSFirewall } from './dns-firewall/dns-firewall'; export { Diagnostics } from './diagnostics/diagnostics'; diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/allowlist.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/allowlist.test.ts new file mode 100644 index 0000000000..201e685562 --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/allowlist.test.ts @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource allowlist', () => { + test('create: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.allowlist.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + comment: 'comment', + enabled: true, + prefix: 'prefix', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.allowlist.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + comment: 'comment', + enabled: true, + prefix: 'prefix', + }); + }); + + test('list: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.allowlist.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.allowlist.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + direction: 'direction', + order: 'order', + page: 0, + per_page: 0, + }); + }); + + test('bulkDelete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.allowlist.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('bulkDelete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.allowlist.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/items.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/items.test.ts new file mode 100644 index 0000000000..db8046452a --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/allowlist/items.test.ts @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource items', () => { + test('delete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.allowlist.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.allowlist.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); + + test('edit: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.allowlist.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.allowlist.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + comment: 'comment', + enabled: true, + }, + ); + }); + + test('get: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.allowlist.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.allowlist.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/items.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/items.test.ts new file mode 100644 index 0000000000..849123def1 --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/items.test.ts @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource items', () => { + test('delete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.prefixes.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.prefixes.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); + + test('edit: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.prefixes.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.prefixes.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + comment: 'comment', + excluded: true, + }, + ); + }); + + test('get: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.prefixes.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.prefixes.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/prefixes.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/prefixes.test.ts new file mode 100644 index 0000000000..daeb1ebb59 --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/prefixes/prefixes.test.ts @@ -0,0 +1,112 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource prefixes', () => { + test('create: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.prefixes.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + comment: 'comment', + excluded: true, + prefix: '192.0.2.0/24', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.prefixes.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + comment: 'comment', + excluded: true, + prefix: '192.0.2.0/24', + }); + }); + + test('list: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.prefixes.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.prefixes.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + direction: 'direction', + order: 'order', + page: 0, + per_page: 0, + }); + }); + + test('bulkCreate: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.prefixes.bulkCreate({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + body: [ + { + comment: 'comment', + excluded: true, + prefix: '192.0.2.0/24', + }, + ], + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('bulkCreate: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.prefixes.bulkCreate({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + body: [ + { + comment: 'comment', + excluded: true, + prefix: '192.0.2.0/24', + }, + ], + }); + }); + + test('bulkDelete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.prefixes.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('bulkDelete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.prefixes.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/status.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/status.test.ts new file mode 100644 index 0000000000..0d14410e12 --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/status.test.ts @@ -0,0 +1,52 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource status', () => { + test('edit: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.status.edit({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + enabled: true, + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.status.edit({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + enabled: true, + }); + }); + + test('get: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.status.get({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.status.get({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/filters.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/filters.test.ts new file mode 100644 index 0000000000..d6a8137c78 --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/filters.test.ts @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource filters', () => { + test('create: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.filters.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + expression: 'ip.dst in { 192.0.2.0/24 198.51.100.0/24 } and tcp.srcport in { 80 443 10000..65535 }', + mode: 'mode', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.filters.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + expression: 'ip.dst in { 192.0.2.0/24 198.51.100.0/24 } and tcp.srcport in { 80 443 10000..65535 }', + mode: 'mode', + }); + }); + + test('list: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.filters.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.filters.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + direction: 'direction', + mode: 'mode', + order: 'order', + page: 0, + per_page: 0, + }); + }); + + test('bulkDelete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.filters.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('bulkDelete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.filters.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/items.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/items.test.ts new file mode 100644 index 0000000000..7e3118f87e --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/filters/items.test.ts @@ -0,0 +1,79 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource items', () => { + test('delete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); + + test('edit: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + expression: 'ip.dst in { 192.0.2.0/24 198.51.100.0/24 } and tcp.srcport in { 80 443 10000..65535 }', + mode: 'mode', + }, + ); + }); + + test('get: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.filters.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/items.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/items.test.ts new file mode 100644 index 0000000000..caa6612d52 --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/items.test.ts @@ -0,0 +1,81 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource items', () => { + test('delete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); + + test('edit: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + burst_sensitivity: 'burst_sensitivity', + mitigation_type: 'mitigation_type', + mode: 'mode', + rate_sensitivity: 'rate_sensitivity', + }, + ); + }); + + test('get: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.rules.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/rules.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/rules.test.ts new file mode 100644 index 0000000000..5e66bd0ec7 --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/syn-protection/rules/rules.test.ts @@ -0,0 +1,84 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource rules', () => { + test('create: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.rules.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + burst_sensitivity: 'burst_sensitivity', + mode: 'mode', + name: 'name', + rate_sensitivity: 'rate_sensitivity', + scope: 'scope', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.rules.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + burst_sensitivity: 'burst_sensitivity', + mode: 'mode', + name: 'name', + rate_sensitivity: 'rate_sensitivity', + scope: 'scope', + mitigation_type: 'mitigation_type', + }); + }); + + test('list: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.rules.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.rules.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + direction: 'direction', + order: 'order', + page: 0, + per_page: 0, + }); + }); + + test('bulkDelete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.synProtection.rules.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('bulkDelete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.synProtection.rules.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/filters.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/filters.test.ts new file mode 100644 index 0000000000..79fa02cc7a --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/filters.test.ts @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource filters', () => { + test('create: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + expression: 'ip.dst in { 192.0.2.0/24 198.51.100.0/24 } and tcp.srcport in { 80 443 10000..65535 }', + mode: 'mode', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + expression: 'ip.dst in { 192.0.2.0/24 198.51.100.0/24 } and tcp.srcport in { 80 443 10000..65535 }', + mode: 'mode', + }); + }); + + test('list: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + direction: 'direction', + mode: 'mode', + order: 'order', + page: 0, + per_page: 0, + }); + }); + + test('bulkDelete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('bulkDelete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/items.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/items.test.ts new file mode 100644 index 0000000000..c5df50758c --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/filters/items.test.ts @@ -0,0 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource items', () => { + test('delete: only required params', async () => { + const responsePromise = + client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); + + test('edit: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + expression: 'ip.dst in { 192.0.2.0/24 198.51.100.0/24 } and tcp.srcport in { 80 443 10000..65535 }', + mode: 'mode', + }, + ); + }); + + test('get: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.filters.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/items.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/items.test.ts new file mode 100644 index 0000000000..a36d50757f --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/items.test.ts @@ -0,0 +1,80 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource items', () => { + test('delete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.delete( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); + + test('edit: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.edit( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + burst_sensitivity: 'burst_sensitivity', + mode: 'mode', + rate_sensitivity: 'rate_sensitivity', + }, + ); + }); + + test('get: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.items.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/rules.test.ts b/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/rules.test.ts new file mode 100644 index 0000000000..e20ab35975 --- /dev/null +++ b/tests/api-resources/ddos-protection/advanced-tcp-protection/tcp-flow-protection/rules/rules.test.ts @@ -0,0 +1,83 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource rules', () => { + test('create: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + burst_sensitivity: 'burst_sensitivity', + mode: 'mode', + name: 'name', + rate_sensitivity: 'rate_sensitivity', + scope: 'scope', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.create({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + burst_sensitivity: 'burst_sensitivity', + mode: 'mode', + name: 'name', + rate_sensitivity: 'rate_sensitivity', + scope: 'scope', + }); + }); + + test('list: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + direction: 'direction', + order: 'order', + page: 0, + per_page: 0, + }); + }); + + test('bulkDelete: only required params', async () => { + const responsePromise = client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('bulkDelete: required and optional params', async () => { + const response = await client.DDoSProtection.advancedTCPProtection.tcpFlowProtection.rules.bulkDelete({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); From 74cc7b2fd0e6bd53585da8ffdcbca62158ef8753 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 19:16:16 +0000 Subject: [PATCH 39/73] feat: feat(config): AUTH-8373 Make SAML certificate endpoints available in public docs * feat(config): AUTH-8373 Make SAML certificate endpoints available in public docs --- .stats.yml | 2 +- src/resources/zero-trust/access/access.ts | 8 ++++++++ src/resources/zero-trust/access/index.ts | 1 + src/resources/zero-trust/access/saml-certificates.ts | 5 +++++ src/resources/zero-trust/api.md | 4 ++++ .../zero-trust/identity-providers/identity-providers.ts | 6 ++++++ src/resources/zero-trust/identity-providers/index.ts | 1 + .../zero-trust/identity-providers/saml-certificate.ts | 5 +++++ 8 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/resources/zero-trust/access/saml-certificates.ts create mode 100644 src/resources/zero-trust/identity-providers/saml-certificate.ts diff --git a/.stats.yml b/.stats.yml index d6a4984cd6..de7e00976b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2262 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 75233fc92a536588b23158e9a3d0ed90 -config_hash: 554d1342364a8f4cc148dba5d7d8c997 +config_hash: 72738e61b53c6035f289a2387346a9cc diff --git a/src/resources/zero-trust/access/access.ts b/src/resources/zero-trust/access/access.ts index f6364bb7b2..6d109f562b 100644 --- a/src/resources/zero-trust/access/access.ts +++ b/src/resources/zero-trust/access/access.ts @@ -80,6 +80,8 @@ import { PolicyUpdateParams, PolicyUpdateResponse, } from './policies'; +import * as SAMLCertificatesAPI from './saml-certificates'; +import { SAMLCertificates } from './saml-certificates'; import * as ServiceTokensAPI from './service-tokens'; import { ServiceToken, @@ -182,6 +184,9 @@ import { export class Access extends APIResource { aiControls: AIControlsAPI.AIControls = new AIControlsAPI.AIControls(this._client); gatewayCA: GatewayCAAPI.GatewayCA = new GatewayCAAPI.GatewayCA(this._client); + samlCertificates: SAMLCertificatesAPI.SAMLCertificates = new SAMLCertificatesAPI.SAMLCertificates( + this._client, + ); infrastructure: InfrastructureAPI.Infrastructure = new InfrastructureAPI.Infrastructure(this._client); applications: ApplicationsAPI.Applications = new ApplicationsAPI.Applications(this._client); certificates: CertificatesAPI.Certificates = new CertificatesAPI.Certificates(this._client); @@ -199,6 +204,7 @@ export class Access extends APIResource { Access.AIControls = AIControls; Access.GatewayCA = GatewayCA; Access.GatewayCAListResponsesSinglePage = GatewayCAListResponsesSinglePage; +Access.SAMLCertificates = SAMLCertificates; Access.Infrastructure = Infrastructure; Access.Applications = Applications; Access.ApplicationListResponsesV4PagePaginationArray = ApplicationListResponsesV4PagePaginationArray; @@ -235,6 +241,8 @@ export declare namespace Access { type GatewayCADeleteParams as GatewayCADeleteParams, }; + export { SAMLCertificates as SAMLCertificates }; + export { Infrastructure as Infrastructure }; export { diff --git a/src/resources/zero-trust/access/index.ts b/src/resources/zero-trust/access/index.ts index 13a0ebe9d9..5d4fa03e4a 100644 --- a/src/resources/zero-trust/access/index.ts +++ b/src/resources/zero-trust/access/index.ts @@ -125,6 +125,7 @@ export { type PolicyDeleteParams, type PolicyGetParams, } from './policies'; +export { SAMLCertificates } from './saml-certificates'; export { ServiceTokensV4PagePaginationArray, ServiceTokens, diff --git a/src/resources/zero-trust/access/saml-certificates.ts b/src/resources/zero-trust/access/saml-certificates.ts new file mode 100644 index 0000000000..3a28195961 --- /dev/null +++ b/src/resources/zero-trust/access/saml-certificates.ts @@ -0,0 +1,5 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; + +export class SAMLCertificates extends APIResource {} diff --git a/src/resources/zero-trust/api.md b/src/resources/zero-trust/api.md index 495a10ec2a..d2a2edf5c9 100644 --- a/src/resources/zero-trust/api.md +++ b/src/resources/zero-trust/api.md @@ -344,6 +344,8 @@ Methods: - client.zeroTrust.identityProviders.scim.users.list(identityProviderId, { ...params }) -> AccessUsersV4PagePaginationArray +### SAMLCertificate + ## Organizations Types: @@ -439,6 +441,8 @@ Methods: - client.zeroTrust.access.gatewayCA.list({ ...params }) -> GatewayCAListResponsesSinglePage - client.zeroTrust.access.gatewayCA.delete(certificateId, { ...params }) -> GatewayCADeleteResponse +### SAMLCertificates + ### Infrastructure #### Targets diff --git a/src/resources/zero-trust/identity-providers/identity-providers.ts b/src/resources/zero-trust/identity-providers/identity-providers.ts index b2ee02a43d..97a4f35ed7 100644 --- a/src/resources/zero-trust/identity-providers/identity-providers.ts +++ b/src/resources/zero-trust/identity-providers/identity-providers.ts @@ -4,6 +4,8 @@ import { APIResource } from '../../../resource'; import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; import * as IdentityProvidersAPI from './identity-providers'; +import * as SAMLCertificateAPI from './saml-certificate'; +import { SAMLCertificate } from './saml-certificate'; import * as SCIMAPI from './scim/scim'; import { SCIM } from './scim/scim'; import { CloudflareError } from '../../../error'; @@ -11,6 +13,7 @@ import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../. export class IdentityProviders extends APIResource { scim: SCIMAPI.SCIM = new SCIMAPI.SCIM(this._client); + samlCertificate: SAMLCertificateAPI.SAMLCertificate = new SAMLCertificateAPI.SAMLCertificate(this._client); /** * Adds a new identity provider to Access. @@ -4736,6 +4739,7 @@ export interface IdentityProviderGetParams { IdentityProviders.IdentityProviderListResponsesV4PagePaginationArray = IdentityProviderListResponsesV4PagePaginationArray; IdentityProviders.SCIM = SCIM; +IdentityProviders.SAMLCertificate = SAMLCertificate; export declare namespace IdentityProviders { export { @@ -4755,4 +4759,6 @@ export declare namespace IdentityProviders { }; export { SCIM as SCIM }; + + export { SAMLCertificate as SAMLCertificate }; } diff --git a/src/resources/zero-trust/identity-providers/index.ts b/src/resources/zero-trust/identity-providers/index.ts index a254a5fb78..07584aa8b0 100644 --- a/src/resources/zero-trust/identity-providers/index.ts +++ b/src/resources/zero-trust/identity-providers/index.ts @@ -16,4 +16,5 @@ export { type IdentityProviderDeleteParams, type IdentityProviderGetParams, } from './identity-providers'; +export { SAMLCertificate } from './saml-certificate'; export { SCIM } from './scim/index'; diff --git a/src/resources/zero-trust/identity-providers/saml-certificate.ts b/src/resources/zero-trust/identity-providers/saml-certificate.ts new file mode 100644 index 0000000000..2f9b5b8a24 --- /dev/null +++ b/src/resources/zero-trust/identity-providers/saml-certificate.ts @@ -0,0 +1,5 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; + +export class SAMLCertificate extends APIResource {} From ed21fb2ddf7c9c907791efbdfb8998eed442c520 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 14 May 2026 21:21:18 +0000 Subject: [PATCH 40/73] chore(api): update composite API spec --- .stats.yml | 4 +- scripts/detect-breaking-changes | 2 + src/resources/zero-trust/access/access.ts | 25 +- src/resources/zero-trust/access/index.ts | 12 +- .../zero-trust/access/saml-certificates.ts | 340 ++- src/resources/zero-trust/api.md | 21 + .../zero-trust/devices/posture/posture.ts | 12 + .../identity-providers/identity-providers.ts | 2466 ++++++++++++++++- .../zero-trust/identity-providers/index.ts | 6 +- .../identity-providers/saml-certificate.ts | 116 +- .../access/saml-certificates.test.ts | 83 + .../identity-providers.test.ts | 2 + .../saml-certificate.test.ts | 33 + 13 files changed, 3102 insertions(+), 20 deletions(-) create mode 100644 tests/api-resources/zero-trust/access/saml-certificates.test.ts create mode 100644 tests/api-resources/zero-trust/identity-providers/saml-certificate.test.ts diff --git a/.stats.yml b/.stats.yml index de7e00976b..33d5094bde 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2262 +configured_endpoints: 2267 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 75233fc92a536588b23158e9a3d0ed90 +openapi_spec_hash: 07c8355a3bde9e448309ec2c008254bf config_hash: 72738e61b53c6035f289a2387346a9cc diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index fab3dc6204..4185e876dd 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -483,6 +483,7 @@ TEST_PATHS=( tests/api-resources/zero-trust/identity-providers/scim/scim.test.ts tests/api-resources/zero-trust/identity-providers/scim/groups.test.ts tests/api-resources/zero-trust/identity-providers/scim/users.test.ts + tests/api-resources/zero-trust/identity-providers/saml-certificate.test.ts tests/api-resources/zero-trust/organizations/organizations.test.ts tests/api-resources/zero-trust/organizations/doh.test.ts tests/api-resources/zero-trust/seats.test.ts @@ -492,6 +493,7 @@ TEST_PATHS=( tests/api-resources/zero-trust/access/ai-controls/mcp/portals.test.ts tests/api-resources/zero-trust/access/ai-controls/mcp/servers.test.ts tests/api-resources/zero-trust/access/gateway-ca.test.ts + tests/api-resources/zero-trust/access/saml-certificates.test.ts tests/api-resources/zero-trust/access/infrastructure/infrastructure.test.ts tests/api-resources/zero-trust/access/infrastructure/targets.test.ts tests/api-resources/zero-trust/access/applications/applications.test.ts diff --git a/src/resources/zero-trust/access/access.ts b/src/resources/zero-trust/access/access.ts index 6d109f562b..a7e9049fe3 100644 --- a/src/resources/zero-trust/access/access.ts +++ b/src/resources/zero-trust/access/access.ts @@ -81,7 +81,17 @@ import { PolicyUpdateResponse, } from './policies'; import * as SAMLCertificatesAPI from './saml-certificates'; -import { SAMLCertificates } from './saml-certificates'; +import { + SAMLCertificateGetParams, + SAMLCertificateGetPemParams, + SAMLCertificateGetResponse, + SAMLCertificateListParams, + SAMLCertificateListResponse, + SAMLCertificateListResponsesV4PagePaginationArray, + SAMLCertificateRotateParams, + SAMLCertificateRotateResponse, + SAMLCertificates, +} from './saml-certificates'; import * as ServiceTokensAPI from './service-tokens'; import { ServiceToken, @@ -205,6 +215,7 @@ Access.AIControls = AIControls; Access.GatewayCA = GatewayCA; Access.GatewayCAListResponsesSinglePage = GatewayCAListResponsesSinglePage; Access.SAMLCertificates = SAMLCertificates; +Access.SAMLCertificateListResponsesV4PagePaginationArray = SAMLCertificateListResponsesV4PagePaginationArray; Access.Infrastructure = Infrastructure; Access.Applications = Applications; Access.ApplicationListResponsesV4PagePaginationArray = ApplicationListResponsesV4PagePaginationArray; @@ -241,7 +252,17 @@ export declare namespace Access { type GatewayCADeleteParams as GatewayCADeleteParams, }; - export { SAMLCertificates as SAMLCertificates }; + export { + SAMLCertificates as SAMLCertificates, + type SAMLCertificateListResponse as SAMLCertificateListResponse, + type SAMLCertificateGetResponse as SAMLCertificateGetResponse, + type SAMLCertificateRotateResponse as SAMLCertificateRotateResponse, + SAMLCertificateListResponsesV4PagePaginationArray as SAMLCertificateListResponsesV4PagePaginationArray, + type SAMLCertificateListParams as SAMLCertificateListParams, + type SAMLCertificateGetParams as SAMLCertificateGetParams, + type SAMLCertificateGetPemParams as SAMLCertificateGetPemParams, + type SAMLCertificateRotateParams as SAMLCertificateRotateParams, + }; export { Infrastructure as Infrastructure }; diff --git a/src/resources/zero-trust/access/index.ts b/src/resources/zero-trust/access/index.ts index 5d4fa03e4a..6b7fbd80d5 100644 --- a/src/resources/zero-trust/access/index.ts +++ b/src/resources/zero-trust/access/index.ts @@ -125,7 +125,17 @@ export { type PolicyDeleteParams, type PolicyGetParams, } from './policies'; -export { SAMLCertificates } from './saml-certificates'; +export { + SAMLCertificateListResponsesV4PagePaginationArray, + SAMLCertificates, + type SAMLCertificateListResponse, + type SAMLCertificateGetResponse, + type SAMLCertificateRotateResponse, + type SAMLCertificateListParams, + type SAMLCertificateGetParams, + type SAMLCertificateGetPemParams, + type SAMLCertificateRotateParams, +} from './saml-certificates'; export { ServiceTokensV4PagePaginationArray, ServiceTokens, diff --git a/src/resources/zero-trust/access/saml-certificates.ts b/src/resources/zero-trust/access/saml-certificates.ts index 3a28195961..5b2615f771 100644 --- a/src/resources/zero-trust/access/saml-certificates.ts +++ b/src/resources/zero-trust/access/saml-certificates.ts @@ -1,5 +1,343 @@ // 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'; +import { type Response } from '../../../_shims/index'; -export class SAMLCertificates extends APIResource {} +export class SAMLCertificates extends APIResource { + /** + * Returns a paginated list of the organization's SAML encryption certificate sets. + * Each certificate set includes the current and (if present) previous + * certificates. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const samlCertificateListResponse of client.zeroTrust.access.samlCertificates.list( + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: SAMLCertificateListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/access/saml_certificates`, + SAMLCertificateListResponsesV4PagePaginationArray, + { query, ...options }, + ); + } + + /** + * Retrieves a specific SAML encryption certificate set by its UID, including both + * current and previous certificates if available. + * + * @example + * ```ts + * const samlCertificate = + * await client.zeroTrust.access.samlCertificates.get( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + samlCERTSetId: string, + params: SAMLCertificateGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/access/saml_certificates/${samlCERTSetId}`, + options, + ) as Core.APIPromise<{ result: SAMLCertificateGetResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Downloads the current SAML encryption certificate's public key in PEM format for + * the specified certificate set. This endpoint is useful for providing the + * certificate to Identity Providers for SAML assertion encryption configuration. + * + * @example + * ```ts + * const response = + * await client.zeroTrust.access.samlCertificates.getPem( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * + * const content = await response.blob(); + * console.log(content); + * ``` + */ + getPem( + samlCERTSetId: string, + params: SAMLCertificateGetPemParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.get(`/accounts/${account_id}/access/saml_certificates/${samlCERTSetId}/pem`, { + ...options, + headers: { Accept: 'application/x-pem-file', ...options?.headers }, + __binaryResponse: true, + }); + } + + /** + * Rotates the SAML encryption certificates within the specified certificate set. + * This generates a new certificate and moves the current certificate to the + * previous slot. If a previous certificate exists, it will be deactivated and + * removed. + * + * This endpoint ensures zero-downtime rotation by maintaining both current and + * previous certificates during the transition period, allowing IdPs time to update + * their configurations. Automated rotation happens 30 days before a current + * certificate's expiration. + * + * @example + * ```ts + * const response = + * await client.zeroTrust.access.samlCertificates.rotate( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + rotate( + samlCERTSetId: string, + params: SAMLCertificateRotateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.post( + `/accounts/${account_id}/access/saml_certificates/${samlCERTSetId}/rotate`, + options, + ) as Core.APIPromise<{ result: SAMLCertificateRotateResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class SAMLCertificateListResponsesV4PagePaginationArray extends V4PagePaginationArray {} + +export interface SAMLCertificateListResponse { + /** + * When the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * When the certificate set was last updated + */ + updated_at: string; + + /** + * The current active certificate + */ + current_certificate?: SAMLCertificateListResponse.CurrentCertificate; + + /** + * The previous certificate (maintained during rotation period). May be null when + * no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; +} + +export namespace SAMLCertificateListResponse { + /** + * The current active certificate + */ + export interface CurrentCertificate { + /** + * Indicates whether the certificate can be used for IdP configuration. + */ + is_current: boolean; + + /** + * Certificate expiration date + */ + not_after: string; + + /** + * The public certificate in PEM format + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } +} + +export interface SAMLCertificateGetResponse { + /** + * When the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * When the certificate set was last updated + */ + updated_at: string; + + /** + * The current active certificate + */ + current_certificate?: SAMLCertificateGetResponse.CurrentCertificate; + + /** + * The previous certificate (maintained during rotation period). May be null when + * no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; +} + +export namespace SAMLCertificateGetResponse { + /** + * The current active certificate + */ + export interface CurrentCertificate { + /** + * Indicates whether the certificate can be used for IdP configuration. + */ + is_current: boolean; + + /** + * Certificate expiration date + */ + not_after: string; + + /** + * The public certificate in PEM format + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } +} + +export interface SAMLCertificateRotateResponse { + /** + * When the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * When the certificate set was last updated + */ + updated_at: string; + + /** + * The current active certificate + */ + current_certificate?: SAMLCertificateRotateResponse.CurrentCertificate; + + /** + * The previous certificate (maintained during rotation period). May be null when + * no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; +} + +export namespace SAMLCertificateRotateResponse { + /** + * The current active certificate + */ + export interface CurrentCertificate { + /** + * Indicates whether the certificate can be used for IdP configuration. + */ + is_current: boolean; + + /** + * Certificate expiration date + */ + not_after: string; + + /** + * The public certificate in PEM format + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } +} + +export interface SAMLCertificateListParams extends V4PagePaginationArrayParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Query param: Filter by SAML certificate set UID. Accepts a comma-separated list + * of UIDs. + */ + id?: string; +} + +export interface SAMLCertificateGetParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface SAMLCertificateGetPemParams { + /** + * Identifier. + */ + account_id: string; +} + +export interface SAMLCertificateRotateParams { + /** + * Identifier. + */ + account_id: string; +} + +SAMLCertificates.SAMLCertificateListResponsesV4PagePaginationArray = + SAMLCertificateListResponsesV4PagePaginationArray; + +export declare namespace SAMLCertificates { + export { + type SAMLCertificateListResponse as SAMLCertificateListResponse, + type SAMLCertificateGetResponse as SAMLCertificateGetResponse, + type SAMLCertificateRotateResponse as SAMLCertificateRotateResponse, + SAMLCertificateListResponsesV4PagePaginationArray as SAMLCertificateListResponsesV4PagePaginationArray, + type SAMLCertificateListParams as SAMLCertificateListParams, + type SAMLCertificateGetParams as SAMLCertificateGetParams, + type SAMLCertificateGetPemParams as SAMLCertificateGetPemParams, + type SAMLCertificateRotateParams as SAMLCertificateRotateParams, + }; +} diff --git a/src/resources/zero-trust/api.md b/src/resources/zero-trust/api.md index d2a2edf5c9..51b142f951 100644 --- a/src/resources/zero-trust/api.md +++ b/src/resources/zero-trust/api.md @@ -346,6 +346,14 @@ Methods: ### SAMLCertificate +Types: + +- SAMLCertificateCreateResponse + +Methods: + +- client.zeroTrust.identityProviders.samlCertificate.create(identityProviderId, { ...params }) -> SAMLCertificateCreateResponse + ## Organizations Types: @@ -443,6 +451,19 @@ Methods: ### SAMLCertificates +Types: + +- SAMLCertificateListResponse +- SAMLCertificateGetResponse +- SAMLCertificateRotateResponse + +Methods: + +- client.zeroTrust.access.samlCertificates.list({ ...params }) -> SAMLCertificateListResponsesV4PagePaginationArray +- client.zeroTrust.access.samlCertificates.get(samlCERTSetId, { ...params }) -> SAMLCertificateGetResponse +- client.zeroTrust.access.samlCertificates.getPem(samlCERTSetId, { ...params }) -> Response +- client.zeroTrust.access.samlCertificates.rotate(samlCERTSetId, { ...params }) -> SAMLCertificateRotateResponse + ### Infrastructure #### Targets diff --git a/src/resources/zero-trust/devices/posture/posture.ts b/src/resources/zero-trust/devices/posture/posture.ts index 62f840d8b0..851b9c35e4 100644 --- a/src/resources/zero-trust/devices/posture/posture.ts +++ b/src/resources/zero-trust/devices/posture/posture.ts @@ -811,6 +811,12 @@ export interface KolideInput { */ connection_id: string; + /** + * The set of Kolide device authentication states that pass the posture check. + * Device must match one of the specified states. + */ + auth_state?: Array<'Good' | 'Notified' | 'Will Block' | 'Blocked'>; + /** * Count Operator. */ @@ -828,6 +834,12 @@ export interface KolideInputParam { */ connection_id: string; + /** + * The set of Kolide device authentication states that pass the posture check. + * Device must match one of the specified states. + */ + auth_state?: Array<'Good' | 'Notified' | 'Will Block' | 'Blocked'>; + /** * Count Operator. */ diff --git a/src/resources/zero-trust/identity-providers/identity-providers.ts b/src/resources/zero-trust/identity-providers/identity-providers.ts index 97a4f35ed7..33253718a6 100644 --- a/src/resources/zero-trust/identity-providers/identity-providers.ts +++ b/src/resources/zero-trust/identity-providers/identity-providers.ts @@ -5,7 +5,11 @@ import { isRequestOptions } from '../../../core'; import * as Core from '../../../core'; import * as IdentityProvidersAPI from './identity-providers'; import * as SAMLCertificateAPI from './saml-certificate'; -import { SAMLCertificate } from './saml-certificate'; +import { + SAMLCertificate, + SAMLCertificateCreateParams, + SAMLCertificateCreateResponse, +} from './saml-certificate'; import * as SCIMAPI from './scim/scim'; import { SCIM } from './scim/scim'; import { CloudflareError } from '../../../error'; @@ -289,6 +293,21 @@ export interface AzureAD { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AzureAD.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -350,6 +369,68 @@ export namespace AzureAD { */ support_groups?: boolean; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AzureADParam { @@ -372,6 +453,14 @@ export interface AzureADParam { */ type: IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -501,6 +590,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessCentrify.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -545,6 +649,68 @@ export namespace IdentityProvider { */ email_claim_name?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessFacebook { @@ -572,6 +738,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessFacebook.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -579,6 +760,70 @@ export namespace IdentityProvider { scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; } + export namespace AccessFacebook { + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } + export interface AccessGitHub { /** * The configuration parameters for the identity provider. To view the required @@ -604,6 +849,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessGitHub.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -611,6 +871,70 @@ export namespace IdentityProvider { scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; } + export namespace AccessGitHub { + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } + export interface AccessGoogle { /** * The configuration parameters for the identity provider. To view the required @@ -636,6 +960,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessGoogle.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -670,6 +1009,68 @@ export namespace IdentityProvider { */ email_claim_name?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessGoogleApps { @@ -697,6 +1098,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessGoogleApps.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -736,6 +1152,68 @@ export namespace IdentityProvider { */ email_claim_name?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessLinkedin { @@ -763,6 +1241,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessLinkedin.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -770,13 +1263,77 @@ export namespace IdentityProvider { scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; } - export interface AccessOIDC { + export namespace AccessLinkedin { /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. */ - config: AccessOIDC.Config; + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } + + export interface AccessOIDC { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + config: AccessOIDC.Config; /** * The name of the identity provider, shown to users on the login page. @@ -795,6 +1352,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessOIDC.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -854,6 +1426,68 @@ export namespace IdentityProvider { */ token_url?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessOkta { @@ -881,6 +1515,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessOkta.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -925,6 +1574,68 @@ export namespace IdentityProvider { */ okta_account?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessOnelogin { @@ -952,6 +1663,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessOnelogin.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -991,6 +1717,68 @@ export namespace IdentityProvider { */ onelogin_account?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessPingone { @@ -1018,6 +1806,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessPingone.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1057,6 +1860,68 @@ export namespace IdentityProvider { */ ping_env_id?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessSAML { @@ -1084,6 +1949,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessSAML.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1109,6 +1989,22 @@ export namespace IdentityProvider { */ email_attribute_name?: string; + /** + * Enable SAML assertion encryption. When enabled, the Identity Provider will + * encrypt SAML assertions using the certificate from the assigned certificate set. + * + * To enable encryption: + * + * 1. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate` + * 2. Set this field to `true` and include `saml_certificate_set_id` in the PUT + * request + * 3. Configure the public certificate in your external Identity Provider + * + * Note: Requires `saml_certificate_set_id` to be set when `true`. + */ + enable_encryption?: boolean; + /** * Add a list of attribute names that will be returned in the response header from * the Access callback. @@ -1150,6 +2046,68 @@ export namespace IdentityProvider { header_name?: string; } } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessYandex { @@ -1177,6 +2135,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessYandex.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1184,13 +2157,77 @@ export namespace IdentityProvider { scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; } - export interface AccessOnetimepin { + export namespace AccessYandex { /** - * The configuration parameters for the identity provider. To view the required - * parameters for a specific provider, refer to our - * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. */ - config: AccessOnetimepin.Config; + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } + + export interface AccessOnetimepin { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + config: AccessOnetimepin.Config; /** * The name of the identity provider, shown to users on the login page. @@ -1209,6 +2246,21 @@ export namespace IdentityProvider { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessOnetimepin.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1225,6 +2277,68 @@ export namespace IdentityProvider { export interface Config { redirect_url?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } } @@ -1265,6 +2379,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1331,6 +2453,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1358,6 +2488,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1385,6 +2523,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1441,6 +2587,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1502,6 +2656,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1529,6 +2691,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1610,6 +2780,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1676,6 +2854,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1737,6 +2923,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1798,6 +2992,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1823,6 +3025,22 @@ export namespace IdentityProviderParam { */ email_attribute_name?: string; + /** + * Enable SAML assertion encryption. When enabled, the Identity Provider will + * encrypt SAML assertions using the certificate from the assigned certificate set. + * + * To enable encryption: + * + * 1. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate` + * 2. Set this field to `true` and include `saml_certificate_set_id` in the PUT + * request + * 3. Configure the public certificate in your external Identity Provider + * + * Note: Requires `saml_certificate_set_id` to be set when `true`. + */ + enable_encryption?: boolean; + /** * Add a list of attribute names that will be returned in the response header from * the Access callback. @@ -1886,6 +3104,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -1913,6 +3139,14 @@ export namespace IdentityProviderParam { */ type: IdentityProvidersAPI.IdentityProviderTypeParam; + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2095,6 +3329,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessCentrify.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2139,6 +3388,68 @@ export namespace IdentityProviderListResponse { */ email_claim_name?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessFacebook { @@ -2166,6 +3477,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessFacebook.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2173,6 +3499,70 @@ export namespace IdentityProviderListResponse { scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; } + export namespace AccessFacebook { + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } + export interface AccessGitHub { /** * The configuration parameters for the identity provider. To view the required @@ -2198,6 +3588,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessGitHub.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2205,6 +3610,70 @@ export namespace IdentityProviderListResponse { scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; } + export namespace AccessGitHub { + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } + export interface AccessGoogle { /** * The configuration parameters for the identity provider. To view the required @@ -2230,6 +3699,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessGoogle.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2264,6 +3748,68 @@ export namespace IdentityProviderListResponse { */ email_claim_name?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessGoogleApps { @@ -2291,6 +3837,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessGoogleApps.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2330,6 +3891,68 @@ export namespace IdentityProviderListResponse { */ email_claim_name?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessLinkedin { @@ -2357,6 +3980,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessLinkedin.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2364,6 +4002,70 @@ export namespace IdentityProviderListResponse { scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; } + export namespace AccessLinkedin { + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } + export interface AccessOIDC { /** * The configuration parameters for the identity provider. To view the required @@ -2389,6 +4091,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessOIDC.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2448,6 +4165,68 @@ export namespace IdentityProviderListResponse { */ token_url?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessOkta { @@ -2475,6 +4254,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessOkta.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2519,6 +4313,68 @@ export namespace IdentityProviderListResponse { */ okta_account?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessOnelogin { @@ -2546,6 +4402,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessOnelogin.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2585,6 +4456,68 @@ export namespace IdentityProviderListResponse { */ onelogin_account?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessPingone { @@ -2612,6 +4545,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessPingone.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2651,6 +4599,68 @@ export namespace IdentityProviderListResponse { */ ping_env_id?: string; } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessSAML { @@ -2678,6 +4688,21 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessSAML.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. @@ -2703,6 +4728,22 @@ export namespace IdentityProviderListResponse { */ email_attribute_name?: string; + /** + * Enable SAML assertion encryption. When enabled, the Identity Provider will + * encrypt SAML assertions using the certificate from the assigned certificate set. + * + * To enable encryption: + * + * 1. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate` + * 2. Set this field to `true` and include `saml_certificate_set_id` in the PUT + * request + * 3. Configure the public certificate in your external Identity Provider + * + * Note: Requires `saml_certificate_set_id` to be set when `true`. + */ + enable_encryption?: boolean; + /** * Add a list of attribute names that will be returned in the response header from * the Access callback. @@ -2744,6 +4785,68 @@ export namespace IdentityProviderListResponse { header_name?: string; } } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } } export interface AccessYandex { @@ -2771,12 +4874,91 @@ export namespace IdentityProviderListResponse { */ id?: string; + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessYandex.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * The configuration settings for enabling a System for Cross-Domain Identity * Management (SCIM) with the identity provider. */ scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; } + + export namespace AccessYandex { + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } } export interface IdentityProviderDeleteResponse { @@ -2835,6 +5017,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -2930,6 +5120,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3008,6 +5206,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3047,6 +5253,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3086,6 +5300,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3154,6 +5376,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3227,6 +5457,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3266,6 +5504,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3359,6 +5605,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3437,6 +5691,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3510,6 +5772,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3583,6 +5853,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3608,6 +5886,22 @@ export declare namespace IdentityProviderCreateParams { */ email_attribute_name?: string; + /** + * Enable SAML assertion encryption. When enabled, the Identity Provider will + * encrypt SAML assertions using the certificate from the assigned certificate set. + * + * To enable encryption: + * + * 1. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate` + * 2. Set this field to `true` and include `saml_certificate_set_id` in the PUT + * request + * 3. Configure the public certificate in your external Identity Provider + * + * Note: Requires `saml_certificate_set_id` to be set when `true`. + */ + enable_encryption?: boolean; + /** * Add a list of attribute names that will be returned in the response header from * the Access callback. @@ -3683,6 +5977,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3722,6 +6024,14 @@ export declare namespace IdentityProviderCreateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3788,6 +6098,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3883,6 +6201,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -3961,6 +6287,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4000,6 +6334,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4039,6 +6381,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4107,6 +6457,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4180,6 +6538,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4219,6 +6585,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4312,6 +6686,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4390,6 +6772,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4463,6 +6853,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4536,6 +6934,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4561,6 +6967,22 @@ export declare namespace IdentityProviderUpdateParams { */ email_attribute_name?: string; + /** + * Enable SAML assertion encryption. When enabled, the Identity Provider will + * encrypt SAML assertions using the certificate from the assigned certificate set. + * + * To enable encryption: + * + * 1. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate` + * 2. Set this field to `true` and include `saml_certificate_set_id` in the PUT + * request + * 3. Configure the public certificate in your external Identity Provider + * + * Note: Requires `saml_certificate_set_id` to be set when `true`. + */ + enable_encryption?: boolean; + /** * Add a list of attribute names that will be returned in the response header from * the Access callback. @@ -4636,6 +7058,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4675,6 +7105,14 @@ export declare namespace IdentityProviderUpdateParams { */ zone_id?: string; + /** + * Body param: The UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + /** * Body param: The configuration settings for enabling a System for Cross-Domain * Identity Management (SCIM) with the identity provider. @@ -4760,5 +7198,9 @@ export declare namespace IdentityProviders { export { SCIM as SCIM }; - export { SAMLCertificate as SAMLCertificate }; + export { + SAMLCertificate as SAMLCertificate, + type SAMLCertificateCreateResponse as SAMLCertificateCreateResponse, + type SAMLCertificateCreateParams as SAMLCertificateCreateParams, + }; } diff --git a/src/resources/zero-trust/identity-providers/index.ts b/src/resources/zero-trust/identity-providers/index.ts index 07584aa8b0..20d2e99f41 100644 --- a/src/resources/zero-trust/identity-providers/index.ts +++ b/src/resources/zero-trust/identity-providers/index.ts @@ -16,5 +16,9 @@ export { type IdentityProviderDeleteParams, type IdentityProviderGetParams, } from './identity-providers'; -export { SAMLCertificate } from './saml-certificate'; +export { + SAMLCertificate, + type SAMLCertificateCreateResponse, + type SAMLCertificateCreateParams, +} from './saml-certificate'; export { SCIM } from './scim/index'; diff --git a/src/resources/zero-trust/identity-providers/saml-certificate.ts b/src/resources/zero-trust/identity-providers/saml-certificate.ts index 2f9b5b8a24..7b98e6b3cb 100644 --- a/src/resources/zero-trust/identity-providers/saml-certificate.ts +++ b/src/resources/zero-trust/identity-providers/saml-certificate.ts @@ -1,5 +1,119 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; -export class SAMLCertificate extends APIResource {} +export class SAMLCertificate extends APIResource { + /** + * Creates a new SAML encryption certificate set and assigns it to the specified + * SAML Identity Provider. This endpoint is idempotent - if the IdP already has a + * certificate set assigned, the existing certificate set is returned with a 200 + * status. + * + * **Workflow for enabling SAML encryption:** + * + * 1. Call this endpoint to create and assign a certificate set to the IdP + * 2. Update the IdP configuration (PUT `/identity_providers/{id}`) with: + * - `config.enable_encryption: true` + * - `saml_certificate_set_id: ` + * 3. Configure the certificate's public key in your external SAML Identity + * Provider + * + * @example + * ```ts + * const samlCertificate = + * await client.zeroTrust.identityProviders.samlCertificate.create( + * 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + create( + identityProviderId: string, + params: SAMLCertificateCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.post( + `/accounts/${account_id}/access/identity_providers/${identityProviderId}/saml_certificate`, + options, + ) as Core.APIPromise<{ result: SAMLCertificateCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * A SAML encryption certificate set containing current and optionally previous + * certificates for encryption key rotation. + */ +export interface SAMLCertificateCreateResponse { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateCreateResponse.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; +} + +export namespace SAMLCertificateCreateResponse { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } +} + +export interface SAMLCertificateCreateParams { + /** + * Identifier. + */ + account_id: string; +} + +export declare namespace SAMLCertificate { + export { + type SAMLCertificateCreateResponse as SAMLCertificateCreateResponse, + type SAMLCertificateCreateParams as SAMLCertificateCreateParams, + }; +} diff --git a/tests/api-resources/zero-trust/access/saml-certificates.test.ts b/tests/api-resources/zero-trust/access/saml-certificates.test.ts new file mode 100644 index 0000000000..c1eaf71c14 --- /dev/null +++ b/tests/api-resources/zero-trust/access/saml-certificates.test.ts @@ -0,0 +1,83 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource samlCertificates', () => { + test('list: only required params', async () => { + const responsePromise = client.zeroTrust.access.samlCertificates.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.zeroTrust.access.samlCertificates.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + id: 'a5bb4b3f-c2d1-4e6a-8f9b-1d3e4f5a6b7c,f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + page: 1, + per_page: 1, + }); + }); + + test('get: only required params', async () => { + const responsePromise = client.zeroTrust.access.samlCertificates.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.zeroTrust.access.samlCertificates.get( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); + + test('getPem: required and optional params', async () => { + const response = await client.zeroTrust.access.samlCertificates.getPem( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); + + test('rotate: only required params', async () => { + const responsePromise = client.zeroTrust.access.samlCertificates.rotate( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('rotate: required and optional params', async () => { + const response = await client.zeroTrust.access.samlCertificates.rotate( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); diff --git a/tests/api-resources/zero-trust/identity-providers/identity-providers.test.ts b/tests/api-resources/zero-trust/identity-providers/identity-providers.test.ts index 64e3727786..fdf996992d 100644 --- a/tests/api-resources/zero-trust/identity-providers/identity-providers.test.ts +++ b/tests/api-resources/zero-trust/identity-providers/identity-providers.test.ts @@ -43,6 +43,7 @@ describe('resource identityProviders', () => { name: 'Widget Corps IDP', type: 'onetimepin', account_id: 'account_id', + saml_certificate_set_id: 'c409ef44-e72c-41c8-8c0b-278c8a6f4fd8', scim_config: { enabled: true, identity_update_behavior: 'automatic', @@ -88,6 +89,7 @@ describe('resource identityProviders', () => { name: 'Widget Corps IDP', type: 'onetimepin', account_id: 'account_id', + saml_certificate_set_id: 'c409ef44-e72c-41c8-8c0b-278c8a6f4fd8', scim_config: { enabled: true, identity_update_behavior: 'automatic', diff --git a/tests/api-resources/zero-trust/identity-providers/saml-certificate.test.ts b/tests/api-resources/zero-trust/identity-providers/saml-certificate.test.ts new file mode 100644 index 0000000000..a16a682226 --- /dev/null +++ b/tests/api-resources/zero-trust/identity-providers/saml-certificate.test.ts @@ -0,0 +1,33 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource samlCertificate', () => { + test('create: only required params', async () => { + const responsePromise = client.zeroTrust.identityProviders.samlCertificate.create( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.zeroTrust.identityProviders.samlCertificate.create( + 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + }); +}); From bb92f41149b6909e1435ead52cf272c80dc408fb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 13:43:17 +0000 Subject: [PATCH 41/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/logpush/datasets/fields.ts | 3 +++ src/resources/logpush/datasets/jobs.ts | 3 +++ src/resources/logpush/jobs.ts | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 33d5094bde..cffe850a84 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2267 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 07c8355a3bde9e448309ec2c008254bf +openapi_spec_hash: e40632ce72b3338c9e17bfc5fb17e002 config_hash: 72738e61b53c6035f289a2387346a9cc diff --git a/src/resources/logpush/datasets/fields.ts b/src/resources/logpush/datasets/fields.ts index f8223c248f..a0a6b67cdf 100644 --- a/src/resources/logpush/datasets/fields.ts +++ b/src/resources/logpush/datasets/fields.ts @@ -41,6 +41,7 @@ export class Fields extends APIResource { | 'ipsec_logs' | 'magic_ids_detections' | 'mcp_portal_logs' + | 'mnm_flow_logs' | 'nel_reports' | 'network_analytics_logs' | 'page_shield_events' @@ -78,6 +79,7 @@ export class Fields extends APIResource { | 'ipsec_logs' | 'magic_ids_detections' | 'mcp_portal_logs' + | 'mnm_flow_logs' | 'nel_reports' | 'network_analytics_logs' | 'page_shield_events' @@ -114,6 +116,7 @@ export class Fields extends APIResource { | 'ipsec_logs' | 'magic_ids_detections' | 'mcp_portal_logs' + | 'mnm_flow_logs' | 'nel_reports' | 'network_analytics_logs' | 'page_shield_events' diff --git a/src/resources/logpush/datasets/jobs.ts b/src/resources/logpush/datasets/jobs.ts index 5faae9dbb0..df4d6e8b26 100644 --- a/src/resources/logpush/datasets/jobs.ts +++ b/src/resources/logpush/datasets/jobs.ts @@ -45,6 +45,7 @@ export class Jobs extends APIResource { | 'ipsec_logs' | 'magic_ids_detections' | 'mcp_portal_logs' + | 'mnm_flow_logs' | 'nel_reports' | 'network_analytics_logs' | 'page_shield_events' @@ -82,6 +83,7 @@ export class Jobs extends APIResource { | 'ipsec_logs' | 'magic_ids_detections' | 'mcp_portal_logs' + | 'mnm_flow_logs' | 'nel_reports' | 'network_analytics_logs' | 'page_shield_events' @@ -118,6 +120,7 @@ export class Jobs extends APIResource { | 'ipsec_logs' | 'magic_ids_detections' | 'mcp_portal_logs' + | 'mnm_flow_logs' | 'nel_reports' | 'network_analytics_logs' | 'page_shield_events' diff --git a/src/resources/logpush/jobs.ts b/src/resources/logpush/jobs.ts index 6904b3fc91..06090bcb0b 100644 --- a/src/resources/logpush/jobs.ts +++ b/src/resources/logpush/jobs.ts @@ -307,6 +307,7 @@ export interface LogpushJob { | 'ipsec_logs' | 'magic_ids_detections' | 'mcp_portal_logs' + | 'mnm_flow_logs' | 'nel_reports' | 'network_analytics_logs' | 'page_shield_events' @@ -635,6 +636,7 @@ export interface JobCreateParams { | 'ipsec_logs' | 'magic_ids_detections' | 'mcp_portal_logs' + | 'mnm_flow_logs' | 'nel_reports' | 'network_analytics_logs' | 'page_shield_events' From cfa0bdb1c40893e4daa131e2be688c99c63dbda4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 17:13:12 +0000 Subject: [PATCH 42/73] feat: feat(api): WC-5056: add Workers .../secrets-bulk endpoints * feat(api): WC-5056: add Workers .../secrets-bulk endpoints --- .stats.yml | 4 +- src/resources/workers-for-platforms/api.md | 2 + .../dispatch/namespaces/scripts/index.ts | 2 + .../dispatch/namespaces/scripts/scripts.ts | 4 + .../dispatch/namespaces/scripts/secrets.ts | 185 ++++++++++++++++++ src/resources/workers/api.md | 2 + src/resources/workers/scripts/index.ts | 2 + src/resources/workers/scripts/scripts.ts | 4 + src/resources/workers/scripts/secrets.ts | 180 +++++++++++++++++ .../namespaces/scripts/secrets.test.ts | 33 ++++ .../workers/scripts/secrets.test.ts | 27 +++ 11 files changed, 443 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index cffe850a84..bfa6026a1b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2267 +configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: e40632ce72b3338c9e17bfc5fb17e002 -config_hash: 72738e61b53c6035f289a2387346a9cc +config_hash: 7d27d493169a533f332f42e8a0f7f2cf diff --git a/src/resources/workers-for-platforms/api.md b/src/resources/workers-for-platforms/api.md index 756db453a4..d769cbb860 100644 --- a/src/resources/workers-for-platforms/api.md +++ b/src/resources/workers-for-platforms/api.md @@ -78,6 +78,7 @@ Types: - SecretUpdateResponse - SecretListResponse - SecretDeleteResponse +- SecretBulkUpdateResponse - SecretGetResponse Methods: @@ -85,6 +86,7 @@ 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.delete(dispatchNamespace, scriptName, secretName, { ...params }) -> SecretDeleteResponse | null +- client.workersForPlatforms.dispatch.namespaces.scripts.secrets.bulkUpdate(dispatchNamespace, scriptName, { ...params }) -> SecretBulkUpdateResponse - client.workersForPlatforms.dispatch.namespaces.scripts.secrets.get(dispatchNamespace, scriptName, secretName, { ...params }) -> SecretGetResponse ##### Tags diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/index.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/index.ts index 78fc5df264..63d84051e2 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/index.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/index.ts @@ -23,10 +23,12 @@ export { type SecretUpdateResponse, type SecretListResponse, type SecretDeleteResponse, + type SecretBulkUpdateResponse, type SecretGetResponse, type SecretUpdateParams, type SecretListParams, type SecretDeleteParams, + type SecretBulkUpdateParams, type SecretGetParams, } from './secrets'; export { diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts index 9294723945..90b84a0bc8 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts @@ -13,6 +13,8 @@ import * as ContentAPI from './content'; import { Content, ContentGetParams, ContentUpdateParams } from './content'; import * as SecretsAPI from './secrets'; import { + SecretBulkUpdateParams, + SecretBulkUpdateResponse, SecretDeleteParams, SecretDeleteResponse, SecretGetParams, @@ -1895,11 +1897,13 @@ export declare namespace Scripts { type SecretUpdateResponse as SecretUpdateResponse, type SecretListResponse as SecretListResponse, type SecretDeleteResponse as SecretDeleteResponse, + type SecretBulkUpdateResponse as SecretBulkUpdateResponse, type SecretGetResponse as SecretGetResponse, SecretListResponsesSinglePage as SecretListResponsesSinglePage, type SecretUpdateParams as SecretUpdateParams, type SecretListParams as SecretListParams, type SecretDeleteParams as SecretDeleteParams, + type SecretBulkUpdateParams as SecretBulkUpdateParams, type SecretGetParams as SecretGetParams, }; diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.ts index 2dc200282a..00dc55c40a 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.ts @@ -97,6 +97,45 @@ export class Secrets extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Create, update, or delete multiple secrets on a script in a single operation + * using JSON Merge Patch (RFC 7396). + * + * Usage: + * + * - To create or update a secret, set its value to a secret object. + * - To delete a secret, set its value to `null`. + * - Secrets not included in the request are left unchanged. + * + * @example + * ```ts + * const response = + * await client.workersForPlatforms.dispatch.namespaces.scripts.secrets.bulkUpdate( + * 'my-dispatch-namespace', + * 'this-is_my_script-01', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + bulkUpdate( + dispatchNamespace: string, + scriptName: string, + params: SecretBulkUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch( + `/accounts/${account_id}/workers/dispatch/namespaces/${dispatchNamespace}/scripts/${scriptName}/secrets-bulk`, + { + body, + ...options, + headers: { 'Content-Type': 'application/merge-patch+json', ...options?.headers }, + }, + ) as Core.APIPromise<{ result: SecretBulkUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + /** * Get a given secret binding (value omitted) on a script uploaded to a Workers for * Platforms namespace. @@ -239,6 +278,61 @@ export namespace SecretListResponse { export type SecretDeleteResponse = unknown; +/** + * Map of secret names to secret metadata for resulting secrets. + */ +export type SecretBulkUpdateResponse = { + [key: string]: + | SecretBulkUpdateResponse.WorkersBindingKindSecretText + | SecretBulkUpdateResponse.WorkersBindingKindSecretKey; +}; + +export namespace SecretBulkUpdateResponse { + export interface WorkersBindingKindSecretText { + /** + * A JavaScript variable name for the binding. + */ + name: string; + + /** + * The kind of resource that the binding provides. + */ + type: 'secret_text'; + } + + export interface WorkersBindingKindSecretKey { + /** + * Algorithm-specific key parameters. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). + */ + algorithm: unknown; + + /** + * Data format of the key. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). + */ + format: 'raw' | 'pkcs8' | 'spki' | 'jwk'; + + /** + * A JavaScript variable name for the binding. + */ + name: string; + + /** + * The kind of resource that the binding provides. + */ + type: 'secret_key'; + + /** + * Allowed operations with the key. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). + */ + usages: Array< + 'encrypt' | 'decrypt' | 'sign' | 'verify' | 'deriveKey' | 'deriveBits' | 'wrapKey' | 'unwrapKey' + >; + } +} + /** * A secret value accessible through a binding. */ @@ -389,6 +483,95 @@ export interface SecretDeleteParams { url_encoded?: boolean; } +export interface SecretBulkUpdateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: Map of secret names to secret values: + * + * - Set to a secret object to create or update. + * - Set to `null` to delete. + * - Omit to leave unchanged. + */ + secrets?: { + [key: string]: + | SecretBulkUpdateParams.WorkersBindingKindSecretText + | SecretBulkUpdateParams.WorkersBindingKindSecretKey + | null; + }; + + /** + * Body param: Optional version tags to apply to the new script version. + */ + version_tags?: { [key: string]: unknown }; +} + +export namespace SecretBulkUpdateParams { + export interface WorkersBindingKindSecretText { + /** + * A JavaScript variable name for the binding. + */ + name: string; + + /** + * The secret value to use. + */ + text: string; + + /** + * The kind of resource that the binding provides. + */ + type: 'secret_text'; + } + + export interface WorkersBindingKindSecretKey { + /** + * Algorithm-specific key parameters. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). + */ + algorithm: unknown; + + /** + * Data format of the key. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). + */ + format: 'raw' | 'pkcs8' | 'spki' | 'jwk'; + + /** + * A JavaScript variable name for the binding. + */ + name: string; + + /** + * The kind of resource that the binding provides. + */ + type: 'secret_key'; + + /** + * Allowed operations with the key. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). + */ + usages: Array< + 'encrypt' | 'decrypt' | 'sign' | 'verify' | 'deriveKey' | 'deriveBits' | 'wrapKey' | 'unwrapKey' + >; + + /** + * Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". + */ + key_base64?: string; + + /** + * Key data in + * [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) + * format. Required if `format` is "jwk". + */ + key_jwk?: unknown; + } +} + export interface SecretGetParams { /** * Path param: Identifier. @@ -408,11 +591,13 @@ export declare namespace Secrets { type SecretUpdateResponse as SecretUpdateResponse, type SecretListResponse as SecretListResponse, type SecretDeleteResponse as SecretDeleteResponse, + type SecretBulkUpdateResponse as SecretBulkUpdateResponse, type SecretGetResponse as SecretGetResponse, SecretListResponsesSinglePage as SecretListResponsesSinglePage, type SecretUpdateParams as SecretUpdateParams, type SecretListParams as SecretListParams, type SecretDeleteParams as SecretDeleteParams, + type SecretBulkUpdateParams as SecretBulkUpdateParams, type SecretGetParams as SecretGetParams, }; } diff --git a/src/resources/workers/api.md b/src/resources/workers/api.md index a19304a789..be3c389d4c 100644 --- a/src/resources/workers/api.md +++ b/src/resources/workers/api.md @@ -191,6 +191,7 @@ Types: - SecretUpdateResponse - SecretListResponse - SecretDeleteResponse +- SecretBulkUpdateResponse - SecretGetResponse Methods: @@ -198,6 +199,7 @@ Methods: - client.workers.scripts.secrets.update(scriptName, { ...params }) -> SecretUpdateResponse - client.workers.scripts.secrets.list(scriptName, { ...params }) -> SecretListResponsesSinglePage - client.workers.scripts.secrets.delete(scriptName, secretName, { ...params }) -> SecretDeleteResponse | null +- client.workers.scripts.secrets.bulkUpdate(scriptName, { ...params }) -> SecretBulkUpdateResponse - client.workers.scripts.secrets.get(scriptName, secretName, { ...params }) -> SecretGetResponse ### ScriptAndVersionSettings diff --git a/src/resources/workers/scripts/index.ts b/src/resources/workers/scripts/index.ts index 6fe0155b7b..35e774900a 100644 --- a/src/resources/workers/scripts/index.ts +++ b/src/resources/workers/scripts/index.ts @@ -48,10 +48,12 @@ export { type SecretUpdateResponse, type SecretListResponse, type SecretDeleteResponse, + type SecretBulkUpdateResponse, type SecretGetResponse, type SecretUpdateParams, type SecretListParams, type SecretDeleteParams, + type SecretBulkUpdateParams, type SecretGetParams, } from './secrets'; export { Settings, type SettingEditParams, type SettingGetParams } from './settings'; diff --git a/src/resources/workers/scripts/scripts.ts b/src/resources/workers/scripts/scripts.ts index ec05e43abb..e89ab5bd5d 100644 --- a/src/resources/workers/scripts/scripts.ts +++ b/src/resources/workers/scripts/scripts.ts @@ -34,6 +34,8 @@ import { } from './script-and-version-settings'; import * as SecretsAPI from './secrets'; import { + SecretBulkUpdateParams, + SecretBulkUpdateResponse, SecretDeleteParams, SecretDeleteResponse, SecretGetParams, @@ -3074,11 +3076,13 @@ export declare namespace Scripts { type SecretUpdateResponse as SecretUpdateResponse, type SecretListResponse as SecretListResponse, type SecretDeleteResponse as SecretDeleteResponse, + type SecretBulkUpdateResponse as SecretBulkUpdateResponse, type SecretGetResponse as SecretGetResponse, SecretListResponsesSinglePage as SecretListResponsesSinglePage, type SecretUpdateParams as SecretUpdateParams, type SecretListParams as SecretListParams, type SecretDeleteParams as SecretDeleteParams, + type SecretBulkUpdateParams as SecretBulkUpdateParams, type SecretGetParams as SecretGetParams, }; diff --git a/src/resources/workers/scripts/secrets.ts b/src/resources/workers/scripts/secrets.ts index 9424c75e35..e5d9f25d1d 100644 --- a/src/resources/workers/scripts/secrets.ts +++ b/src/resources/workers/scripts/secrets.ts @@ -89,6 +89,40 @@ export class Secrets extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Create, update, or delete multiple secrets on a script in a single operation + * using JSON Merge Patch (RFC 7396). + * + * Usage: + * + * - To create or update a secret, set its value to a secret object. + * - To delete a secret, set its value to `null`. + * - Secrets not included in the request are left unchanged. + * + * @example + * ```ts + * const response = + * await client.workers.scripts.secrets.bulkUpdate( + * 'this-is_my_script-01', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + bulkUpdate( + scriptName: string, + params: SecretBulkUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/workers/scripts/${scriptName}/secrets-bulk`, { + body, + ...options, + headers: { 'Content-Type': 'application/merge-patch+json', ...options?.headers }, + }) as Core.APIPromise<{ result: SecretBulkUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + /** * Get a given secret binding (value omitted) on a script. * @@ -227,6 +261,61 @@ export namespace SecretListResponse { export type SecretDeleteResponse = unknown; +/** + * Map of secret names to secret metadata for resulting secrets. + */ +export type SecretBulkUpdateResponse = { + [key: string]: + | SecretBulkUpdateResponse.WorkersBindingKindSecretText + | SecretBulkUpdateResponse.WorkersBindingKindSecretKey; +}; + +export namespace SecretBulkUpdateResponse { + export interface WorkersBindingKindSecretText { + /** + * A JavaScript variable name for the binding. + */ + name: string; + + /** + * The kind of resource that the binding provides. + */ + type: 'secret_text'; + } + + export interface WorkersBindingKindSecretKey { + /** + * Algorithm-specific key parameters. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). + */ + algorithm: unknown; + + /** + * Data format of the key. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). + */ + format: 'raw' | 'pkcs8' | 'spki' | 'jwk'; + + /** + * A JavaScript variable name for the binding. + */ + name: string; + + /** + * The kind of resource that the binding provides. + */ + type: 'secret_key'; + + /** + * Allowed operations with the key. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). + */ + usages: Array< + 'encrypt' | 'decrypt' | 'sign' | 'verify' | 'deriveKey' | 'deriveBits' | 'wrapKey' | 'unwrapKey' + >; + } +} + /** * A secret value accessible through a binding. */ @@ -377,6 +466,95 @@ export interface SecretDeleteParams { url_encoded?: boolean; } +export interface SecretBulkUpdateParams { + /** + * Path param: Identifier. + */ + account_id: string; + + /** + * Body param: Map of secret names to secret values: + * + * - Set to a secret object to create or update. + * - Set to `null` to delete. + * - Omit to leave unchanged. + */ + secrets?: { + [key: string]: + | SecretBulkUpdateParams.WorkersBindingKindSecretText + | SecretBulkUpdateParams.WorkersBindingKindSecretKey + | null; + }; + + /** + * Body param: Optional version tags to apply to the new script version. + */ + version_tags?: { [key: string]: unknown }; +} + +export namespace SecretBulkUpdateParams { + export interface WorkersBindingKindSecretText { + /** + * A JavaScript variable name for the binding. + */ + name: string; + + /** + * The secret value to use. + */ + text: string; + + /** + * The kind of resource that the binding provides. + */ + type: 'secret_text'; + } + + export interface WorkersBindingKindSecretKey { + /** + * Algorithm-specific key parameters. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#algorithm). + */ + algorithm: unknown; + + /** + * Data format of the key. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#format). + */ + format: 'raw' | 'pkcs8' | 'spki' | 'jwk'; + + /** + * A JavaScript variable name for the binding. + */ + name: string; + + /** + * The kind of resource that the binding provides. + */ + type: 'secret_key'; + + /** + * Allowed operations with the key. + * [Learn more](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#keyUsages). + */ + usages: Array< + 'encrypt' | 'decrypt' | 'sign' | 'verify' | 'deriveKey' | 'deriveBits' | 'wrapKey' | 'unwrapKey' + >; + + /** + * Base64-encoded key data. Required if `format` is "raw", "pkcs8", or "spki". + */ + key_base64?: string; + + /** + * Key data in + * [JSON Web Key](https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/importKey#json_web_key) + * format. Required if `format` is "jwk". + */ + key_jwk?: unknown; + } +} + export interface SecretGetParams { /** * Path param: Identifier. @@ -396,11 +574,13 @@ export declare namespace Secrets { type SecretUpdateResponse as SecretUpdateResponse, type SecretListResponse as SecretListResponse, type SecretDeleteResponse as SecretDeleteResponse, + type SecretBulkUpdateResponse as SecretBulkUpdateResponse, type SecretGetResponse as SecretGetResponse, SecretListResponsesSinglePage as SecretListResponsesSinglePage, type SecretUpdateParams as SecretUpdateParams, type SecretListParams as SecretListParams, type SecretDeleteParams as SecretDeleteParams, + type SecretBulkUpdateParams as SecretBulkUpdateParams, type SecretGetParams as SecretGetParams, }; } diff --git a/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.test.ts b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.test.ts index 4010149999..36a3f1ede0 100644 --- a/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.test.ts +++ b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/secrets.test.ts @@ -91,6 +91,39 @@ describe('resource secrets', () => { ); }); + test('bulkUpdate: only required params', async () => { + const responsePromise = client.workersForPlatforms.dispatch.namespaces.scripts.secrets.bulkUpdate( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('bulkUpdate: required and optional params', async () => { + const response = await client.workersForPlatforms.dispatch.namespaces.scripts.secrets.bulkUpdate( + 'my-dispatch-namespace', + 'this-is_my_script-01', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + secrets: { + foo: { + name: 'myBinding', + text: 'My secret.', + type: 'secret_text', + }, + }, + version_tags: { foo: 'bar' }, + }, + ); + }); + test('get: only required params', async () => { const responsePromise = client.workersForPlatforms.dispatch.namespaces.scripts.secrets.get( 'my-dispatch-namespace', diff --git a/tests/api-resources/workers/scripts/secrets.test.ts b/tests/api-resources/workers/scripts/secrets.test.ts index 7c2fab8946..f3cceadfe1 100644 --- a/tests/api-resources/workers/scripts/secrets.test.ts +++ b/tests/api-resources/workers/scripts/secrets.test.ts @@ -74,6 +74,33 @@ describe('resource secrets', () => { }); }); + test('bulkUpdate: only required params', async () => { + const responsePromise = client.workers.scripts.secrets.bulkUpdate('this-is_my_script-01', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('bulkUpdate: required and optional params', async () => { + const response = await client.workers.scripts.secrets.bulkUpdate('this-is_my_script-01', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + secrets: { + foo: { + name: 'myBinding', + text: 'My secret.', + type: 'secret_text', + }, + }, + version_tags: { foo: 'bar' }, + }); + }); + test('get: only required params', async () => { const responsePromise = client.workers.scripts.secrets.get('this-is_my_script-01', 'mySecret', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', From 3ff370af252a34027b5dac3c873258a7aa0030a6 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 18:38:26 +0000 Subject: [PATCH 43/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/ai/models/models.ts | 6 ++++++ tests/api-resources/ai/models/models.test.ts | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index bfa6026a1b..8d5fd05f9e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: e40632ce72b3338c9e17bfc5fb17e002 +openapi_spec_hash: c0d553c22ef1e807dd815f71023050f4 config_hash: 7d27d493169a533f332f42e8a0f7f2cf diff --git a/src/resources/ai/models/models.ts b/src/resources/ai/models/models.ts index 51d230466c..ab22c90174 100644 --- a/src/resources/ai/models/models.ts +++ b/src/resources/ai/models/models.ts @@ -40,6 +40,12 @@ export interface ModelListParams extends V4PagePaginationArrayParams { */ author?: string; + /** + * Query param: If set, return models in the requested marketplace format instead + * of the default response. + */ + format?: 'openrouter'; + /** * Query param: Filter to hide experimental models */ diff --git a/tests/api-resources/ai/models/models.test.ts b/tests/api-resources/ai/models/models.test.ts index dd734d822b..99e11fe13f 100644 --- a/tests/api-resources/ai/models/models.test.ts +++ b/tests/api-resources/ai/models/models.test.ts @@ -25,6 +25,7 @@ describe('resource models', () => { const response = await client.ai.models.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', author: 'author', + format: 'openrouter', hide_experimental: true, page: 0, per_page: 0, From dac67f09cfaf0d8841dbb4fa89b372d28e3c8022 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 15 May 2026 19:40:38 +0000 Subject: [PATCH 44/73] feat: feat(r2): add R2 bucket objects resource mapping (APIX-674) * fix(r2): remove skip test * feat(r2): add R2 bucket objects resource mapping (APIX-674) Map R2 object CRUD operations to SDK resources: - list: GET /accounts/{account_id}/r2/buckets/{bucket_name}/objects - get: GET /accounts/{account_id}/r2/buckets/{bucket_name}/objects/{object_key} - upload: PUT /accounts/{account_id}/r2/buckets/{bucket_name}/objects/{object_key} - delete: DELETE /accounts/{account_id}/r2/buckets/{bucket_name}/objects/{object_key} These routes are implemented in r2-gateway-worker but were missing from the published OpenAPI definition and Stainless config. Closes APIX-674. --- .stats.yml | 4 +- scripts/detect-breaking-changes | 1 + src/resources/r2/api.md | 15 + src/resources/r2/buckets/buckets.ts | 27 ++ src/resources/r2/buckets/index.ts | 11 + src/resources/r2/buckets/objects.ts | 419 ++++++++++++++++++ .../api-resources/r2/buckets/objects.test.ts | 96 ++++ 7 files changed, 571 insertions(+), 2 deletions(-) create mode 100644 src/resources/r2/buckets/objects.ts create mode 100644 tests/api-resources/r2/buckets/objects.test.ts diff --git a/.stats.yml b/.stats.yml index 8d5fd05f9e..cc241cd427 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2269 +configured_endpoints: 2273 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: c0d553c22ef1e807dd815f71023050f4 -config_hash: 7d27d493169a533f332f42e8a0f7f2cf +config_hash: 245f966442f3af14c23b79cbfdf06161 diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 4185e876dd..93d906eaf1 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -431,6 +431,7 @@ TEST_PATHS=( tests/api-resources/r2/buckets/locks.test.ts tests/api-resources/r2/buckets/metrics.test.ts tests/api-resources/r2/buckets/sippy.test.ts + tests/api-resources/r2/buckets/objects.test.ts tests/api-resources/r2/temporary-credentials.test.ts tests/api-resources/r2/super-slurper/super-slurper.test.ts tests/api-resources/r2/super-slurper/jobs/jobs.test.ts diff --git a/src/resources/r2/api.md b/src/resources/r2/api.md index 3ad53f236e..fab4224bda 100644 --- a/src/resources/r2/api.md +++ b/src/resources/r2/api.md @@ -126,6 +126,21 @@ Methods: - client.r2.buckets.sippy.delete(bucketName, { ...params }) -> SippyDeleteResponse - client.r2.buckets.sippy.get(bucketName, { ...params }) -> Sippy +### Objects + +Types: + +- ObjectListResponse +- ObjectDeleteResponse +- ObjectUploadResponse + +Methods: + +- client.r2.buckets.objects.list(bucketName, { ...params }) -> ObjectListResponsesCursorPagination +- client.r2.buckets.objects.delete(bucketName, objectKey, { ...params }) -> ObjectDeleteResponse +- client.r2.buckets.objects.get(bucketName, objectKey, { ...params }) -> Response +- client.r2.buckets.objects.upload(bucketName, objectKey, body, { ...params }) -> ObjectUploadResponse + ## TemporaryCredentials Types: diff --git a/src/resources/r2/buckets/buckets.ts b/src/resources/r2/buckets/buckets.ts index a19a8b4ca7..890fd2021d 100644 --- a/src/resources/r2/buckets/buckets.ts +++ b/src/resources/r2/buckets/buckets.ts @@ -36,6 +36,18 @@ import * as LocksAPI from './locks'; import { LockGetParams, LockGetResponse, LockUpdateParams, LockUpdateResponse, Locks } from './locks'; import * as MetricsAPI from './metrics'; import { MetricListParams, MetricListResponse, Metrics } from './metrics'; +import * as ObjectsAPI from './objects'; +import { + ObjectDeleteParams, + ObjectDeleteResponse, + ObjectGetParams, + ObjectListParams, + ObjectListResponse, + ObjectListResponsesCursorPagination, + ObjectUploadParams, + ObjectUploadResponse, + Objects, +} from './objects'; import * as SippyAPI from './sippy'; import { Provider, @@ -59,6 +71,7 @@ export class Buckets extends APIResource { locks: LocksAPI.Locks = new LocksAPI.Locks(this._client); metrics: MetricsAPI.Metrics = new MetricsAPI.Metrics(this._client); sippy: SippyAPI.SippyResource = new SippyAPI.SippyResource(this._client); + objects: ObjectsAPI.Objects = new ObjectsAPI.Objects(this._client); /** * Creates a new R2 bucket. @@ -363,6 +376,8 @@ Buckets.EventNotifications = EventNotifications; Buckets.Locks = Locks; Buckets.Metrics = Metrics; Buckets.SippyResource = SippyResource; +Buckets.Objects = Objects; +Buckets.ObjectListResponsesCursorPagination = ObjectListResponsesCursorPagination; export declare namespace Buckets { export { @@ -431,4 +446,16 @@ export declare namespace Buckets { type SippyDeleteParams as SippyDeleteParams, type SippyGetParams as SippyGetParams, }; + + export { + Objects as Objects, + type ObjectListResponse as ObjectListResponse, + type ObjectDeleteResponse as ObjectDeleteResponse, + type ObjectUploadResponse as ObjectUploadResponse, + ObjectListResponsesCursorPagination as ObjectListResponsesCursorPagination, + type ObjectListParams as ObjectListParams, + type ObjectDeleteParams as ObjectDeleteParams, + type ObjectGetParams as ObjectGetParams, + type ObjectUploadParams as ObjectUploadParams, + }; } diff --git a/src/resources/r2/buckets/index.ts b/src/resources/r2/buckets/index.ts index 8e15ad1e26..923f34c644 100644 --- a/src/resources/r2/buckets/index.ts +++ b/src/resources/r2/buckets/index.ts @@ -47,6 +47,17 @@ export { type LockGetParams, } from './locks'; export { Metrics, type MetricListResponse, type MetricListParams } from './metrics'; +export { + ObjectListResponsesCursorPagination, + Objects, + type ObjectListResponse, + type ObjectDeleteResponse, + type ObjectUploadResponse, + type ObjectListParams, + type ObjectDeleteParams, + type ObjectGetParams, + type ObjectUploadParams, +} from './objects'; export { SippyResource, type Provider, diff --git a/src/resources/r2/buckets/objects.ts b/src/resources/r2/buckets/objects.ts new file mode 100644 index 0000000000..f72435cf6f --- /dev/null +++ b/src/resources/r2/buckets/objects.ts @@ -0,0 +1,419 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as Core from '../../../core'; +import { CursorPagination, type CursorPaginationParams } from '../../../pagination'; +import { type BlobLike } from '../../../uploads'; +import { type Response } from '../../../_shims/index'; + +export class Objects extends APIResource { + /** + * Lists objects in an R2 bucket. Returns object metadata including key, size, + * etag, last modified date, HTTP metadata, and custom metadata. + * + * For most workloads, we recommend using R2's + * [S3-compatible API](https://developers.cloudflare.com/r2/api/s3/api/) or a + * [Worker with an R2 binding](https://developers.cloudflare.com/r2/api/workers/workers-api-reference/) + * instead. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const objectListResponse of client.r2.buckets.objects.list( + * 'example-bucket', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * )) { + * // ... + * } + * ``` + */ + list( + bucketName: string, + params: ObjectListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, jurisdiction, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/r2/buckets/${bucketName}/objects`, + ObjectListResponsesCursorPagination, + { + query, + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }, + ); + } + + /** + * Deletes an object from an R2 bucket. + * + * For most workloads, we recommend using R2's + * [S3-compatible API](https://developers.cloudflare.com/r2/api/s3/api/) or a + * [Worker with an R2 binding](https://developers.cloudflare.com/r2/api/workers/workers-api-reference/) + * instead. + * + * @example + * ```ts + * const object = await client.r2.buckets.objects.delete( + * 'example-bucket', + * 'path/to/my-object.txt', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + delete( + bucketName: string, + objectKey: string, + params: ObjectDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction } = params; + return ( + this._client.delete(`/accounts/${account_id}/r2/buckets/${bucketName}/objects/${objectKey}`, { + ...options, + headers: { + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...options?.headers, + }, + }) as Core.APIPromise<{ result: ObjectDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Retrieves an object from an R2 bucket. Returns the object body along with + * metadata headers. + * + * For most workloads, we recommend using R2's + * [S3-compatible API](https://developers.cloudflare.com/r2/api/s3/api/) or a + * [Worker with an R2 binding](https://developers.cloudflare.com/r2/api/workers/workers-api-reference/) + * instead. + * + * @example + * ```ts + * const object = await client.r2.buckets.objects.get( + * 'example-bucket', + * 'path/to/my-object.txt', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * + * const content = await object.blob(); + * console.log(content); + * ``` + */ + get( + bucketName: string, + objectKey: string, + params: ObjectGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { + account_id, + jurisdiction, + 'If-Modified-Since': ifModifiedSince, + 'If-None-Match': ifNoneMatch, + } = params; + return this._client.get(`/accounts/${account_id}/r2/buckets/${bucketName}/objects/${objectKey}`, { + ...options, + headers: { + Accept: 'application/octet-stream', + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...(ifModifiedSince != null ? { 'If-Modified-Since': ifModifiedSince } : undefined), + ...(ifNoneMatch != null ? { 'If-None-Match': ifNoneMatch } : undefined), + ...options?.headers, + }, + __binaryResponse: true, + }); + } + + /** + * Uploads an object to an R2 bucket. The object body is provided as the request + * body. Returns metadata about the uploaded object. + * + * The maximum upload size for this endpoint is 300 MB. For most workloads, we + * recommend using R2's + * [S3-compatible API](https://developers.cloudflare.com/r2/api/s3/api/) or a + * [Worker with an R2 binding](https://developers.cloudflare.com/r2/api/workers/workers-api-reference/) + * instead. + * + * @example + * ```ts + * const response = await client.r2.buckets.objects.upload( + * 'example-bucket', + * 'path/to/my-object.txt', + * fs.createReadStream('path/to/file'), + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + upload( + bucketName: string, + objectKey: string, + body: string | ArrayBufferView | ArrayBuffer | BlobLike, + params: ObjectUploadParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, jurisdiction, 'cf-r2-storage-class': cfR2StorageClass } = params; + return ( + this._client.put(`/accounts/${account_id}/r2/buckets/${bucketName}/objects/${objectKey}`, { + body: body, + ...options, + headers: { + 'Content-Type': 'application/octet-stream', + ...(jurisdiction?.toString() != null ? + { 'cf-r2-jurisdiction': jurisdiction?.toString() } + : undefined), + ...(cfR2StorageClass?.toString() != null ? + { 'cf-r2-storage-class': cfR2StorageClass?.toString() } + : undefined), + ...options?.headers, + }, + __binaryRequest: true, + }) as Core.APIPromise<{ result: ObjectUploadResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class ObjectListResponsesCursorPagination extends CursorPagination {} + +/** + * Metadata for an R2 object. + */ +export interface ObjectListResponse { + /** + * Custom metadata key-value pairs associated with the object. + */ + custom_metadata?: { [key: string]: string }; + + /** + * The entity tag for the object. In JSON list/get responses this is the raw hex + * digest (without surrounding quotes). The HTTP `ETag` response header on Get + * Object follows RFC 7232 and IS wrapped in surrounding double-quotes. + */ + etag?: string; + + /** + * HTTP metadata associated with an R2 object. + */ + http_metadata?: ObjectListResponse.HTTPMetadata; + + /** + * The object key (name). + */ + key?: string; + + /** + * The date and time the object was last modified. + */ + last_modified?: string; + + /** + * The size of the object in bytes. + */ + size?: number; + + /** + * Whether the object is encrypted with a customer-supplied encryption key. + */ + ssec?: boolean; + + /** + * Storage class for newly uploaded objects, unless specified otherwise. + */ + storage_class?: 'Standard' | 'InfrequentAccess'; +} + +export namespace ObjectListResponse { + /** + * HTTP metadata associated with an R2 object. + */ + export interface HTTPMetadata { + /** + * Specifies caching behavior for the object. + */ + cacheControl?: string; + + /** + * The date and time at which the object's cache entry expires. + */ + cacheExpiry?: string; + + /** + * Specifies presentational information for the object. + */ + contentDisposition?: string; + + /** + * Specifies the content encoding applied to the object. + */ + contentEncoding?: string; + + /** + * The language of the object content. + */ + contentLanguage?: string; + + /** + * The MIME type of the object. + */ + contentType?: string; + } +} + +/** + * Result of a successful object deletion. + */ +export interface ObjectDeleteResponse { + /** + * The key (name) of the deleted object. + */ + key?: string; +} + +/** + * Result of a successful object upload. + */ +export interface ObjectUploadResponse { + /** + * The entity tag for the uploaded object. + */ + etag?: string; + + /** + * The key (name) of the uploaded object. + */ + key?: string; + + /** + * The size of the uploaded object in bytes (as a string). + */ + size?: string; + + /** + * Storage class for newly uploaded objects, unless specified otherwise. + */ + storage_class?: 'Standard' | 'InfrequentAccess'; + + /** + * The date and time the object was uploaded. + */ + uploaded?: string; + + /** + * The version UUID of the uploaded object. + */ + version?: string; +} + +export interface ObjectListParams extends CursorPaginationParams { + /** + * Path param: Account ID. + */ + account_id: string; + + /** + * Query param: A single character used to group keys. All keys that contain the + * delimiter between the prefix and the first occurrence of the delimiter after the + * prefix are grouped under a single result element. + */ + delimiter?: string; + + /** + * Query param: Restricts results to only those objects whose keys begin with the + * specified prefix. + */ + prefix?: string; + + /** + * Query param: Returns objects with keys that come after the specified key in + * lexicographic order. + */ + start_after?: string; + + /** + * Header param: Jurisdiction where objects in this bucket are guaranteed to be + * stored. + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface ObjectDeleteParams { + /** + * Path param: Account ID. + */ + account_id: string; + + /** + * Header param: Jurisdiction where objects in this bucket are guaranteed to be + * stored. + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; +} + +export interface ObjectGetParams { + /** + * Path param: Account ID. + */ + account_id: string; + + /** + * Header param: Jurisdiction where objects in this bucket are guaranteed to be + * stored. + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; + + /** + * Header param: Returns the object only if it has been modified since the + * specified time. Must be formatted as an HTTP-date (RFC 7231), e.g. + * `Tue, 15 Jan 2024 10:30:00 GMT`. + */ + 'If-Modified-Since'?: string; + + /** + * Header param: Returns the object only if its ETag does not match the given + * value. + */ + 'If-None-Match'?: string; +} + +export interface ObjectUploadParams { + /** + * Path param: Account ID. + */ + account_id: string; + + /** + * Header param: Jurisdiction where objects in this bucket are guaranteed to be + * stored. + */ + jurisdiction?: 'default' | 'eu' | 'fedramp'; + + /** + * Header param: Storage class for newly uploaded objects, unless specified + * otherwise. + */ + 'cf-r2-storage-class'?: 'Standard' | 'InfrequentAccess'; +} + +Objects.ObjectListResponsesCursorPagination = ObjectListResponsesCursorPagination; + +export declare namespace Objects { + export { + type ObjectListResponse as ObjectListResponse, + type ObjectDeleteResponse as ObjectDeleteResponse, + type ObjectUploadResponse as ObjectUploadResponse, + ObjectListResponsesCursorPagination as ObjectListResponsesCursorPagination, + type ObjectListParams as ObjectListParams, + type ObjectDeleteParams as ObjectDeleteParams, + type ObjectGetParams as ObjectGetParams, + type ObjectUploadParams as ObjectUploadParams, + }; +} diff --git a/tests/api-resources/r2/buckets/objects.test.ts b/tests/api-resources/r2/buckets/objects.test.ts new file mode 100644 index 0000000000..b084489f2a --- /dev/null +++ b/tests/api-resources/r2/buckets/objects.test.ts @@ -0,0 +1,96 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare, { toFile } from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource objects', () => { + test('list: only required params', async () => { + const responsePromise = client.r2.buckets.objects.list('example-bucket', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.r2.buckets.objects.list('example-bucket', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + cursor: 'cursor', + delimiter: 'delimiter', + per_page: 1, + prefix: 'prefix', + start_after: 'start_after', + jurisdiction: 'default', + }); + }); + + test('delete: only required params', async () => { + const responsePromise = client.r2.buckets.objects.delete('example-bucket', 'path/to/my-object.txt', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.r2.buckets.objects.delete('example-bucket', 'path/to/my-object.txt', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + jurisdiction: 'default', + }); + }); + + // Mock server doesn't support application/octet-stream responses + test.skip('get: required and optional params', async () => { + const response = await client.r2.buckets.objects.get('example-bucket', 'path/to/my-object.txt', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + jurisdiction: 'default', + 'If-Modified-Since': 'If-Modified-Since', + 'If-None-Match': 'If-None-Match', + }); + }); + + test('upload: only required params', async () => { + const responsePromise = client.r2.buckets.objects.upload( + 'example-bucket', + 'path/to/my-object.txt', + await toFile(Buffer.from('Example data'), 'README.md'), + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('upload: required and optional params', async () => { + const response = await client.r2.buckets.objects.upload( + 'example-bucket', + 'path/to/my-object.txt', + await toFile(Buffer.from('Example data'), 'README.md'), + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + jurisdiction: 'default', + 'cf-r2-storage-class': 'Standard', + }, + ); + }); +}); From 76e781bfa564bd6985cd9f88048a44ea142f1099 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 14:20:38 +0000 Subject: [PATCH 45/73] feat: feat(observability): adds Workers > Observability > Queries * feat(observability): adds Workers > Observability > Queries --- .stats.yml | 4 +- scripts/detect-breaking-changes | 1 + src/resources/workers/api.md | 12 + src/resources/workers/observability/index.ts | 8 + .../workers/observability/observability.ts | 21 + .../workers/observability/queries.ts | 819 ++++++++++++++++++ .../workers/observability/queries.test.ts | 91 ++ 7 files changed, 954 insertions(+), 2 deletions(-) create mode 100644 src/resources/workers/observability/queries.ts create mode 100644 tests/api-resources/workers/observability/queries.test.ts diff --git a/.stats.yml b/.stats.yml index cc241cd427..00e52b74b0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2273 +configured_endpoints: 2275 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: c0d553c22ef1e807dd815f71023050f4 -config_hash: 245f966442f3af14c23b79cbfdf06161 +config_hash: 2d1850b4aac63bb32193367c174c33cd diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 93d906eaf1..8ffc9d919d 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -208,6 +208,7 @@ TEST_PATHS=( tests/api-resources/workers/observability/observability.test.ts tests/api-resources/workers/observability/telemetry.test.ts tests/api-resources/workers/observability/destinations.test.ts + tests/api-resources/workers/observability/queries.test.ts tests/api-resources/kv/kv.test.ts tests/api-resources/kv/namespaces/namespaces.test.ts tests/api-resources/kv/namespaces/keys.test.ts diff --git a/src/resources/workers/api.md b/src/resources/workers/api.md index be3c389d4c..3d3d269fcb 100644 --- a/src/resources/workers/api.md +++ b/src/resources/workers/api.md @@ -286,3 +286,15 @@ Methods: - client.workers.observability.destinations.update(slug, { ...params }) -> DestinationUpdateResponse - client.workers.observability.destinations.list({ ...params }) -> DestinationListResponsesSinglePage - client.workers.observability.destinations.delete(slug, { ...params }) -> DestinationDeleteResponse + +### Queries + +Types: + +- QueryCreateResponse +- QueryListResponse + +Methods: + +- client.workers.observability.queries.create({ ...params }) -> QueryCreateResponse +- client.workers.observability.queries.list({ ...params }) -> QueryListResponsesSinglePage diff --git a/src/resources/workers/observability/index.ts b/src/resources/workers/observability/index.ts index 03c6076857..bf6b2f2066 100644 --- a/src/resources/workers/observability/index.ts +++ b/src/resources/workers/observability/index.ts @@ -13,6 +13,14 @@ export { type DestinationDeleteParams, } from './destinations'; export { Observability } from './observability'; +export { + QueryListResponsesSinglePage, + Queries, + type QueryCreateResponse, + type QueryListResponse, + type QueryCreateParams, + type QueryListParams, +} from './queries'; export { TelemetryKeysResponsesSinglePage, TelemetryValuesResponsesSinglePage, diff --git a/src/resources/workers/observability/observability.ts b/src/resources/workers/observability/observability.ts index 72f7cac7b4..434b53083b 100644 --- a/src/resources/workers/observability/observability.ts +++ b/src/resources/workers/observability/observability.ts @@ -14,6 +14,15 @@ import { DestinationUpdateResponse, Destinations, } from './destinations'; +import * as QueriesAPI from './queries'; +import { + Queries, + QueryCreateParams, + QueryCreateResponse, + QueryListParams, + QueryListResponse, + QueryListResponsesSinglePage, +} from './queries'; import * as TelemetryAPI from './telemetry'; import { Telemetry, @@ -30,6 +39,7 @@ import { export class Observability extends APIResource { telemetry: TelemetryAPI.Telemetry = new TelemetryAPI.Telemetry(this._client); destinations: DestinationsAPI.Destinations = new DestinationsAPI.Destinations(this._client); + queries: QueriesAPI.Queries = new QueriesAPI.Queries(this._client); } Observability.Telemetry = Telemetry; @@ -37,6 +47,8 @@ Observability.TelemetryKeysResponsesSinglePage = TelemetryKeysResponsesSinglePag Observability.TelemetryValuesResponsesSinglePage = TelemetryValuesResponsesSinglePage; Observability.Destinations = Destinations; Observability.DestinationListResponsesSinglePage = DestinationListResponsesSinglePage; +Observability.Queries = Queries; +Observability.QueryListResponsesSinglePage = QueryListResponsesSinglePage; export declare namespace Observability { export { @@ -63,4 +75,13 @@ export declare namespace Observability { type DestinationListParams as DestinationListParams, type DestinationDeleteParams as DestinationDeleteParams, }; + + export { + Queries as Queries, + type QueryCreateResponse as QueryCreateResponse, + type QueryListResponse as QueryListResponse, + QueryListResponsesSinglePage as QueryListResponsesSinglePage, + type QueryCreateParams as QueryCreateParams, + type QueryListParams as QueryListParams, + }; } diff --git a/src/resources/workers/observability/queries.ts b/src/resources/workers/observability/queries.ts new file mode 100644 index 0000000000..754c1d7b6e --- /dev/null +++ b/src/resources/workers/observability/queries.ts @@ -0,0 +1,819 @@ +// 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 Queries extends APIResource { + /** + * Persist query for later use. + * + * @example + * ```ts + * const query = + * await client.workers.observability.queries.create({ + * account_id: 'account_id', + * description: 'Query description', + * name: 'x', + * parameters: {}, + * }); + * ``` + */ + create(params: QueryCreateParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/workers/observability/queries`, { + body, + ...options, + }) as Core.APIPromise<{ result: QueryCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List saved queries. + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const queryListResponse of client.workers.observability.queries.list( + * { account_id: 'account_id' }, + * )) { + * // ... + * } + * ``` + */ + list( + params: QueryListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/workers/observability/queries`, + QueryListResponsesSinglePage, + { query, ...options }, + ); + } +} + +export class QueryListResponsesSinglePage extends SinglePage {} + +export interface QueryCreateResponse { + id: string; + + /** + * If the query wasn't explcitly saved + */ + adhoc: boolean; + + created: string; + + createdBy: string; + + description: string | null; + + /** + * Query name + */ + name: string; + + parameters: QueryCreateResponse.Parameters; + + updated: string; + + updatedBy: string; +} + +export namespace QueryCreateResponse { + export interface Parameters { + /** + * Create Calculations to compute as part of the query. + */ + calculations?: Array; + + /** + * Set the Datasets to query. Leave it empty to query all the datasets. + */ + datasets?: Array; + + /** + * Set a Flag to describe how to combine the filters on the query. + */ + filterCombination?: 'and' | 'or' | 'AND' | 'OR'; + + /** + * Configure the Filters to apply to the query. Supports nested groups via kind: + * 'group'. + */ + filters?: Array; + + /** + * Define how to group the results of the query. + */ + groupBys?: Array; + + /** + * Configure the Having clauses that filter on calculations in the query result. + */ + havings?: Array; + + /** + * Set a limit on the number of results / records returned by the query + */ + limit?: number; + + /** + * Define an expression to search using full-text search. + */ + needle?: Parameters.Needle; + + /** + * Configure the order of the results returned by the query. + */ + orderBy?: Parameters.OrderBy; + } + + export namespace Parameters { + export interface Calculation { + operator: + | 'uniq' + | 'count' + | 'max' + | 'min' + | 'sum' + | 'avg' + | 'median' + | 'p001' + | 'p01' + | 'p05' + | 'p10' + | 'p25' + | 'p75' + | 'p90' + | 'p95' + | 'p99' + | 'p999' + | 'stddev' + | 'variance' + | 'COUNT_DISTINCT' + | 'COUNT' + | 'MAX' + | 'MIN' + | 'SUM' + | 'AVG' + | 'MEDIAN' + | 'P001' + | 'P01' + | 'P05' + | 'P10' + | 'P25' + | 'P75' + | 'P90' + | 'P95' + | 'P99' + | 'P999' + | 'STDDEV' + | 'VARIANCE'; + + alias?: string; + + key?: string; + + keyType?: 'string' | 'number' | 'boolean'; + } + + export interface UnionMember0 { + filterCombination: 'and' | 'or' | 'AND' | 'OR'; + + filters: Array; + + kind: 'group'; + } + + /** + * A filter condition applied to query results. Use the keys and values endpoints + * to discover available fields and their values before constructing filters. + */ + export interface WorkersObservabilityFilterLeaf { + /** + * Filter field name. Use verified keys from previous query results or the keys + * endpoint. Common keys include $metadata.service, $metadata.origin, + * $metadata.trigger, $metadata.message, and $metadata.error. + */ + key: string; + + /** + * Comparison operator. String operators: includes, not_includes, starts_with, + * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated + * values). Numeric: eq, neq, gt, gte, lt, lte. + */ + operation: + | 'includes' + | 'not_includes' + | 'starts_with' + | 'regex' + | 'exists' + | 'is_null' + | 'in' + | 'not_in' + | 'eq' + | 'neq' + | 'gt' + | 'gte' + | 'lt' + | 'lte' + | '=' + | '!=' + | '>' + | '>=' + | '<' + | '<=' + | 'INCLUDES' + | 'DOES_NOT_INCLUDE' + | 'MATCH_REGEX' + | 'EXISTS' + | 'DOES_NOT_EXIST' + | 'IN' + | 'NOT_IN' + | 'STARTS_WITH'; + + /** + * Data type of the filter field. Must match the actual type of the key being + * filtered. + */ + type: 'string' | 'number' | 'boolean'; + + /** + * Discriminator for leaf filter nodes. Always 'filter' when present; may be + * omitted. + */ + kind?: 'filter'; + + /** + * Comparison value. Must match actual values in your data — verify with the values + * endpoint. Ensure the value type (string/number/boolean) matches the field type. + * String comparisons are case-sensitive. Regex uses RE2 syntax (no + * lookaheads/lookbehinds). + */ + value?: string | number | boolean; + } + + export interface GroupBy { + type: 'string' | 'number' | 'boolean'; + + value: string; + } + + export interface Having { + key: string; + + operation: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte'; + + value: number; + } + + /** + * Define an expression to search using full-text search. + */ + export interface Needle { + value: string | number | boolean; + + isRegex?: boolean; + + matchCase?: boolean; + } + + /** + * Configure the order of the results returned by the query. + */ + export interface OrderBy { + /** + * Configure which Calculation to order the results by. + */ + value: string; + + /** + * Set the order of the results + */ + order?: 'asc' | 'desc'; + } + } +} + +export interface QueryListResponse { + id: string; + + /** + * If the query wasn't explcitly saved + */ + adhoc: boolean; + + created: string; + + createdBy: string; + + description: string | null; + + /** + * Query name + */ + name: string; + + parameters: QueryListResponse.Parameters; + + updated: string; + + updatedBy: string; +} + +export namespace QueryListResponse { + export interface Parameters { + /** + * Create Calculations to compute as part of the query. + */ + calculations?: Array; + + /** + * Set the Datasets to query. Leave it empty to query all the datasets. + */ + datasets?: Array; + + /** + * Set a Flag to describe how to combine the filters on the query. + */ + filterCombination?: 'and' | 'or' | 'AND' | 'OR'; + + /** + * Configure the Filters to apply to the query. Supports nested groups via kind: + * 'group'. + */ + filters?: Array; + + /** + * Define how to group the results of the query. + */ + groupBys?: Array; + + /** + * Configure the Having clauses that filter on calculations in the query result. + */ + havings?: Array; + + /** + * Set a limit on the number of results / records returned by the query + */ + limit?: number; + + /** + * Define an expression to search using full-text search. + */ + needle?: Parameters.Needle; + + /** + * Configure the order of the results returned by the query. + */ + orderBy?: Parameters.OrderBy; + } + + export namespace Parameters { + export interface Calculation { + operator: + | 'uniq' + | 'count' + | 'max' + | 'min' + | 'sum' + | 'avg' + | 'median' + | 'p001' + | 'p01' + | 'p05' + | 'p10' + | 'p25' + | 'p75' + | 'p90' + | 'p95' + | 'p99' + | 'p999' + | 'stddev' + | 'variance' + | 'COUNT_DISTINCT' + | 'COUNT' + | 'MAX' + | 'MIN' + | 'SUM' + | 'AVG' + | 'MEDIAN' + | 'P001' + | 'P01' + | 'P05' + | 'P10' + | 'P25' + | 'P75' + | 'P90' + | 'P95' + | 'P99' + | 'P999' + | 'STDDEV' + | 'VARIANCE'; + + alias?: string; + + key?: string; + + keyType?: 'string' | 'number' | 'boolean'; + } + + export interface UnionMember0 { + filterCombination: 'and' | 'or' | 'AND' | 'OR'; + + filters: Array; + + kind: 'group'; + } + + /** + * A filter condition applied to query results. Use the keys and values endpoints + * to discover available fields and their values before constructing filters. + */ + export interface WorkersObservabilityFilterLeaf { + /** + * Filter field name. Use verified keys from previous query results or the keys + * endpoint. Common keys include $metadata.service, $metadata.origin, + * $metadata.trigger, $metadata.message, and $metadata.error. + */ + key: string; + + /** + * Comparison operator. String operators: includes, not_includes, starts_with, + * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated + * values). Numeric: eq, neq, gt, gte, lt, lte. + */ + operation: + | 'includes' + | 'not_includes' + | 'starts_with' + | 'regex' + | 'exists' + | 'is_null' + | 'in' + | 'not_in' + | 'eq' + | 'neq' + | 'gt' + | 'gte' + | 'lt' + | 'lte' + | '=' + | '!=' + | '>' + | '>=' + | '<' + | '<=' + | 'INCLUDES' + | 'DOES_NOT_INCLUDE' + | 'MATCH_REGEX' + | 'EXISTS' + | 'DOES_NOT_EXIST' + | 'IN' + | 'NOT_IN' + | 'STARTS_WITH'; + + /** + * Data type of the filter field. Must match the actual type of the key being + * filtered. + */ + type: 'string' | 'number' | 'boolean'; + + /** + * Discriminator for leaf filter nodes. Always 'filter' when present; may be + * omitted. + */ + kind?: 'filter'; + + /** + * Comparison value. Must match actual values in your data — verify with the values + * endpoint. Ensure the value type (string/number/boolean) matches the field type. + * String comparisons are case-sensitive. Regex uses RE2 syntax (no + * lookaheads/lookbehinds). + */ + value?: string | number | boolean; + } + + export interface GroupBy { + type: 'string' | 'number' | 'boolean'; + + value: string; + } + + export interface Having { + key: string; + + operation: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte'; + + value: number; + } + + /** + * Define an expression to search using full-text search. + */ + export interface Needle { + value: string | number | boolean; + + isRegex?: boolean; + + matchCase?: boolean; + } + + /** + * Configure the order of the results returned by the query. + */ + export interface OrderBy { + /** + * Configure which Calculation to order the results by. + */ + value: string; + + /** + * Set the order of the results + */ + order?: 'asc' | 'desc'; + } + } +} + +export interface QueryCreateParams { + /** + * Path param: Your Cloudflare account ID. + */ + account_id: string; + + /** + * Body param + */ + description: string | null; + + /** + * Body param: Query name + */ + name: string; + + /** + * Body param + */ + parameters: QueryCreateParams.Parameters; +} + +export namespace QueryCreateParams { + export interface Parameters { + /** + * Create Calculations to compute as part of the query. + */ + calculations?: Array; + + /** + * Set the Datasets to query. Leave it empty to query all the datasets. + */ + datasets?: Array; + + /** + * Set a Flag to describe how to combine the filters on the query. + */ + filterCombination?: 'and' | 'or' | 'AND' | 'OR'; + + /** + * Configure the Filters to apply to the query. Supports nested groups via kind: + * 'group'. + */ + filters?: Array; + + /** + * Define how to group the results of the query. + */ + groupBys?: Array; + + /** + * Configure the Having clauses that filter on calculations in the query result. + */ + havings?: Array; + + /** + * Set a limit on the number of results / records returned by the query + */ + limit?: number; + + /** + * Define an expression to search using full-text search. + */ + needle?: Parameters.Needle; + + /** + * Configure the order of the results returned by the query. + */ + orderBy?: Parameters.OrderBy; + } + + export namespace Parameters { + export interface Calculation { + operator: + | 'uniq' + | 'count' + | 'max' + | 'min' + | 'sum' + | 'avg' + | 'median' + | 'p001' + | 'p01' + | 'p05' + | 'p10' + | 'p25' + | 'p75' + | 'p90' + | 'p95' + | 'p99' + | 'p999' + | 'stddev' + | 'variance' + | 'COUNT_DISTINCT' + | 'COUNT' + | 'MAX' + | 'MIN' + | 'SUM' + | 'AVG' + | 'MEDIAN' + | 'P001' + | 'P01' + | 'P05' + | 'P10' + | 'P25' + | 'P75' + | 'P90' + | 'P95' + | 'P99' + | 'P999' + | 'STDDEV' + | 'VARIANCE'; + + alias?: string; + + key?: string; + + keyType?: 'string' | 'number' | 'boolean'; + } + + export interface UnionMember0 { + filterCombination: 'and' | 'or' | 'AND' | 'OR'; + + filters: Array; + + kind: 'group'; + } + + /** + * A filter condition applied to query results. Use the keys and values endpoints + * to discover available fields and their values before constructing filters. + */ + export interface WorkersObservabilityFilterLeaf { + /** + * Filter field name. Use verified keys from previous query results or the keys + * endpoint. Common keys include $metadata.service, $metadata.origin, + * $metadata.trigger, $metadata.message, and $metadata.error. + */ + key: string; + + /** + * Comparison operator. String operators: includes, not_includes, starts_with, + * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated + * values). Numeric: eq, neq, gt, gte, lt, lte. + */ + operation: + | 'includes' + | 'not_includes' + | 'starts_with' + | 'regex' + | 'exists' + | 'is_null' + | 'in' + | 'not_in' + | 'eq' + | 'neq' + | 'gt' + | 'gte' + | 'lt' + | 'lte' + | '=' + | '!=' + | '>' + | '>=' + | '<' + | '<=' + | 'INCLUDES' + | 'DOES_NOT_INCLUDE' + | 'MATCH_REGEX' + | 'EXISTS' + | 'DOES_NOT_EXIST' + | 'IN' + | 'NOT_IN' + | 'STARTS_WITH'; + + /** + * Data type of the filter field. Must match the actual type of the key being + * filtered. + */ + type: 'string' | 'number' | 'boolean'; + + /** + * Discriminator for leaf filter nodes. Always 'filter' when present; may be + * omitted. + */ + kind?: 'filter'; + + /** + * Comparison value. Must match actual values in your data — verify with the values + * endpoint. Ensure the value type (string/number/boolean) matches the field type. + * String comparisons are case-sensitive. Regex uses RE2 syntax (no + * lookaheads/lookbehinds). + */ + value?: string | number | boolean; + } + + export interface GroupBy { + type: 'string' | 'number' | 'boolean'; + + value: string; + } + + export interface Having { + key: string; + + operation: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte'; + + value: number; + } + + /** + * Define an expression to search using full-text search. + */ + export interface Needle { + value: string | number | boolean; + + isRegex?: boolean; + + matchCase?: boolean; + } + + /** + * Configure the order of the results returned by the query. + */ + export interface OrderBy { + /** + * Configure which Calculation to order the results by. + */ + value: string; + + /** + * Set the order of the results + */ + order?: 'asc' | 'desc'; + } + } +} + +export interface QueryListParams { + /** + * Path param: Your Cloudflare account ID. + */ + account_id: string; + + /** + * Query param + */ + order?: 'asc' | 'desc'; + + /** + * Query param + */ + orderBy?: 'created' | 'updated'; + + /** + * Query param + */ + page?: number; + + /** + * Query param + */ + perPage?: number; +} + +Queries.QueryListResponsesSinglePage = QueryListResponsesSinglePage; + +export declare namespace Queries { + export { + type QueryCreateResponse as QueryCreateResponse, + type QueryListResponse as QueryListResponse, + QueryListResponsesSinglePage as QueryListResponsesSinglePage, + type QueryCreateParams as QueryCreateParams, + type QueryListParams as QueryListParams, + }; +} diff --git a/tests/api-resources/workers/observability/queries.test.ts b/tests/api-resources/workers/observability/queries.test.ts new file mode 100644 index 0000000000..2080f3b6a7 --- /dev/null +++ b/tests/api-resources/workers/observability/queries.test.ts @@ -0,0 +1,91 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource queries', () => { + test('create: only required params', async () => { + const responsePromise = client.workers.observability.queries.create({ + account_id: 'account_id', + description: 'Query description', + name: 'x', + parameters: {}, + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.workers.observability.queries.create({ + account_id: 'account_id', + description: 'Query description', + name: 'x', + parameters: { + calculations: [ + { + operator: 'uniq', + alias: 'alias', + key: 'key', + keyType: 'string', + }, + ], + datasets: ['string'], + filterCombination: 'and', + filters: [ + { + filterCombination: 'and', + filters: [{}], + kind: 'group', + }, + ], + groupBys: [{ type: 'string', value: 'value' }], + havings: [ + { + key: 'key', + operation: 'eq', + value: 0, + }, + ], + limit: 0, + needle: { + value: 'string', + isRegex: true, + matchCase: true, + }, + orderBy: { value: 'value', order: 'asc' }, + }, + }); + }); + + test('list: only required params', async () => { + const responsePromise = client.workers.observability.queries.list({ account_id: 'account_id' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.workers.observability.queries.list({ + account_id: 'account_id', + order: 'asc', + orderBy: 'created', + page: 1, + perPage: 5, + }); + }); +}); From e171257050a90096b38498bac4a22cf4acf71df1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 16:02:54 +0000 Subject: [PATCH 46/73] chore(api): update composite API spec --- .stats.yml | 4 +- scripts/detect-breaking-changes | 2 - src/resources/addressing/addressing.ts | 31 +- src/resources/addressing/api.md | 24 -- src/resources/addressing/index.ts | 15 +- .../addressing/regional-hostnames/index.ts | 22 +- .../regional-hostnames/regional-hostnames.ts | 353 +----------------- .../addressing/regional-hostnames/regions.ts | 60 +-- src/resources/intel/sinkholes.ts | 18 +- .../regional-hostnames.test.ts | 114 ------ .../regional-hostnames/regions.test.ts | 31 -- 11 files changed, 19 insertions(+), 655 deletions(-) delete mode 100644 tests/api-resources/addressing/regional-hostnames/regional-hostnames.test.ts delete mode 100644 tests/api-resources/addressing/regional-hostnames/regions.test.ts diff --git a/.stats.yml b/.stats.yml index 00e52b74b0..f7d3215ba8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2275 +configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: c0d553c22ef1e807dd815f71023050f4 +openapi_spec_hash: 6dd8b8e98bf595c381a979bd28245966 config_hash: 2d1850b4aac63bb32193367c174c33cd diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 8ffc9d919d..7ea6990be6 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -265,8 +265,6 @@ TEST_PATHS=( tests/api-resources/spectrum/analytics/events/summaries.test.ts tests/api-resources/spectrum/apps.test.ts tests/api-resources/addressing/addressing.test.ts - tests/api-resources/addressing/regional-hostnames/regional-hostnames.test.ts - tests/api-resources/addressing/regional-hostnames/regions.test.ts tests/api-resources/addressing/services.test.ts tests/api-resources/addressing/address-maps/address-maps.test.ts tests/api-resources/addressing/address-maps/accounts.test.ts diff --git a/src/resources/addressing/addressing.ts b/src/resources/addressing/addressing.ts index 06599a8421..e82b9b32ec 100644 --- a/src/resources/addressing/addressing.ts +++ b/src/resources/addressing/addressing.ts @@ -38,20 +38,7 @@ import { 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'; +import { RegionalHostnames } from './regional-hostnames/regional-hostnames'; export class Addressing extends APIResource { regionalHostnames: RegionalHostnamesAPI.RegionalHostnames = new RegionalHostnamesAPI.RegionalHostnames( @@ -64,7 +51,6 @@ export class Addressing extends APIResource { } Addressing.RegionalHostnames = RegionalHostnames; -Addressing.RegionalHostnameListResponsesSinglePage = RegionalHostnameListResponsesSinglePage; Addressing.Services = Services; Addressing.ServiceListResponsesSinglePage = ServiceListResponsesSinglePage; Addressing.AddressMaps = AddressMaps; @@ -74,20 +60,7 @@ 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 { RegionalHostnames as RegionalHostnames }; export { Services as Services, diff --git a/src/resources/addressing/api.md b/src/resources/addressing/api.md index 8d08b3052a..eb7d668dfa 100644 --- a/src/resources/addressing/api.md +++ b/src/resources/addressing/api.md @@ -2,32 +2,8 @@ ## RegionalHostnames -Types: - -- RegionalHostnameCreateResponse -- RegionalHostnameListResponse -- RegionalHostnameDeleteResponse -- RegionalHostnameEditResponse -- RegionalHostnameGetResponse - -Methods: - -- client.addressing.regionalHostnames.create({ ...params }) -> RegionalHostnameCreateResponse -- client.addressing.regionalHostnames.list({ ...params }) -> RegionalHostnameListResponsesSinglePage -- client.addressing.regionalHostnames.delete(hostname, { ...params }) -> RegionalHostnameDeleteResponse -- client.addressing.regionalHostnames.edit(hostname, { ...params }) -> RegionalHostnameEditResponse -- client.addressing.regionalHostnames.get(hostname, { ...params }) -> RegionalHostnameGetResponse - ### Regions -Types: - -- RegionListResponse - -Methods: - -- client.addressing.regionalHostnames.regions.list({ ...params }) -> RegionListResponsesSinglePage - ## Services Types: diff --git a/src/resources/addressing/index.ts b/src/resources/addressing/index.ts index 6b64a96cdf..81716dd30e 100644 --- a/src/resources/addressing/index.ts +++ b/src/resources/addressing/index.ts @@ -32,20 +32,7 @@ export { type PrefixEditParams, type PrefixGetParams, } from './prefixes/index'; -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/index'; +export { RegionalHostnames } from './regional-hostnames/index'; export { ServiceListResponsesSinglePage, Services, diff --git a/src/resources/addressing/regional-hostnames/index.ts b/src/resources/addressing/regional-hostnames/index.ts index 527ec41ccf..5dc0b83fec 100644 --- a/src/resources/addressing/regional-hostnames/index.ts +++ b/src/resources/addressing/regional-hostnames/index.ts @@ -1,22 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - 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'; +export { RegionalHostnames } from './regional-hostnames'; +export { Regions } from './regions'; diff --git a/src/resources/addressing/regional-hostnames/regional-hostnames.ts b/src/resources/addressing/regional-hostnames/regional-hostnames.ts index 53c5c9a505..ed99a75232 100644 --- a/src/resources/addressing/regional-hostnames/regional-hostnames.ts +++ b/src/resources/addressing/regional-hostnames/regional-hostnames.ts @@ -1,364 +1,15 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; import * as RegionsAPI from './regions'; -import { RegionListParams, RegionListResponse, RegionListResponsesSinglePage, Regions } from './regions'; -import { SinglePage } from '../../../pagination'; +import { Regions } from './regions'; export class RegionalHostnames extends APIResource { regions: RegionsAPI.Regions = new RegionsAPI.Regions(this._client); - - /** - * Create a new Regional Hostname entry. Cloudflare will only use data centers that - * are physically located within the chosen region to decrypt and service HTTPS - * traffic. Learn more about - * [Regional Services](https://developers.cloudflare.com/data-localization/regional-services/get-started/). - * - * @example - * ```ts - * const regionalHostname = - * await client.addressing.regionalHostnames.create({ - * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - * hostname: 'foo.example.com', - * region_key: 'ca', - * }); - * ``` - */ - create( - params: RegionalHostnameCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id, ...body } = params; - return ( - this._client.post(`/zones/${zone_id}/addressing/regional_hostnames`, { - body, - ...options, - }) as Core.APIPromise<{ result: RegionalHostnameCreateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * List all Regional Hostnames within a zone. - * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const regionalHostnameListResponse of client.addressing.regionalHostnames.list( - * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * )) { - * // ... - * } - * ``` - */ - list( - params: RegionalHostnameListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { - const { zone_id } = params; - return this._client.getAPIList( - `/zones/${zone_id}/addressing/regional_hostnames`, - RegionalHostnameListResponsesSinglePage, - options, - ); - } - - /** - * Delete the region configuration for a specific Regional Hostname. - * - * @example - * ```ts - * const regionalHostname = - * await client.addressing.regionalHostnames.delete( - * 'foo.example.com', - * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * ); - * ``` - */ - delete( - hostname: string, - params: RegionalHostnameDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id } = params; - return this._client.delete(`/zones/${zone_id}/addressing/regional_hostnames/${hostname}`, options); - } - - /** - * Update the configuration for a specific Regional Hostname. Only the region_key - * of a hostname is mutable. - * - * @example - * ```ts - * const response = - * await client.addressing.regionalHostnames.edit( - * 'foo.example.com', - * { - * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - * region_key: 'ca', - * }, - * ); - * ``` - */ - edit( - hostname: string, - params: RegionalHostnameEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id, ...body } = params; - return ( - this._client.patch(`/zones/${zone_id}/addressing/regional_hostnames/${hostname}`, { - body, - ...options, - }) as Core.APIPromise<{ result: RegionalHostnameEditResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Fetch the configuration for a specific Regional Hostname, within a zone. - * - * @example - * ```ts - * const regionalHostname = - * await client.addressing.regionalHostnames.get( - * 'foo.example.com', - * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * ); - * ``` - */ - get( - hostname: string, - params: RegionalHostnameGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { zone_id } = params; - return ( - this._client.get( - `/zones/${zone_id}/addressing/regional_hostnames/${hostname}`, - options, - ) as Core.APIPromise<{ result: RegionalHostnameGetResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class RegionalHostnameListResponsesSinglePage extends SinglePage {} - -export interface RegionalHostnameCreateResponse { - /** - * When the regional hostname was created - */ - created_on: string; - - /** - * DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are - * supported for one level, e.g `*.example.com` - */ - hostname: string; - - /** - * Identifying key for the region - */ - region_key: string; - - /** - * Configure which routing method to use for the regional hostname - */ - routing?: string; -} - -export interface RegionalHostnameListResponse { - /** - * When the regional hostname was created - */ - created_on: string; - - /** - * DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are - * supported for one level, e.g `*.example.com` - */ - hostname: string; - - /** - * Identifying key for the region - */ - region_key: string; - - /** - * Configure which routing method to use for the regional hostname - */ - routing?: string; -} - -export interface RegionalHostnameDeleteResponse { - errors: Array; - - messages: Array; - - /** - * Whether the API call was successful. - */ - success: true; -} - -export namespace RegionalHostnameDeleteResponse { - export interface Error { - code: number; - - message: string; - - documentation_url?: string; - - source?: Error.Source; - } - - export namespace Error { - export interface Source { - pointer?: string; - } - } - - export interface Message { - code: number; - - message: string; - - documentation_url?: string; - - source?: Message.Source; - } - - export namespace Message { - export interface Source { - pointer?: string; - } - } -} - -export interface RegionalHostnameEditResponse { - /** - * When the regional hostname was created - */ - created_on: string; - - /** - * DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are - * supported for one level, e.g `*.example.com` - */ - hostname: string; - - /** - * Identifying key for the region - */ - region_key: string; - - /** - * Configure which routing method to use for the regional hostname - */ - routing?: string; -} - -export interface RegionalHostnameGetResponse { - /** - * When the regional hostname was created - */ - created_on: string; - - /** - * DNS hostname to be regionalized, must be a subdomain of the zone. Wildcards are - * supported for one level, e.g `*.example.com` - */ - hostname: string; - - /** - * Identifying key for the region - */ - region_key: string; - - /** - * Configure which routing method to use for the regional hostname - */ - routing?: string; -} - -export interface RegionalHostnameCreateParams { - /** - * Path param: Identifier. - */ - zone_id: string; - - /** - * Body param: DNS hostname to be regionalized, must be a subdomain of the zone. - * Wildcards are supported for one level, e.g `*.example.com` - */ - hostname: string; - - /** - * Body param: Identifying key for the region - */ - region_key: string; - - /** - * Body param: Configure which routing method to use for the regional hostname - */ - routing?: string; -} - -export interface RegionalHostnameListParams { - /** - * Identifier. - */ - zone_id: string; -} - -export interface RegionalHostnameDeleteParams { - /** - * Identifier. - */ - zone_id: string; -} - -export interface RegionalHostnameEditParams { - /** - * Path param: Identifier. - */ - zone_id: string; - - /** - * Body param: Identifying key for the region - */ - region_key: string; } -export interface RegionalHostnameGetParams { - /** - * Identifier. - */ - zone_id: string; -} - -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, - }; + export { Regions as Regions }; } diff --git a/src/resources/addressing/regional-hostnames/regions.ts b/src/resources/addressing/regional-hostnames/regions.ts index 0f11942e41..6fc7e68865 100644 --- a/src/resources/addressing/regional-hostnames/regions.ts +++ b/src/resources/addressing/regional-hostnames/regions.ts @@ -1,63 +1,5 @@ // 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 Regions extends APIResource { - /** - * List all Regional Services regions available for use by this account. - * - * @example - * ```ts - * // Automatically fetches more pages as needed. - * for await (const regionListResponse of client.addressing.regionalHostnames.regions.list( - * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - * )) { - * // ... - * } - * ``` - */ - list( - params: RegionListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { - const { account_id } = params; - return this._client.getAPIList( - `/accounts/${account_id}/addressing/regional_hostnames/regions`, - RegionListResponsesSinglePage, - options, - ); - } -} - -export class RegionListResponsesSinglePage extends SinglePage {} - -export interface RegionListResponse { - /** - * Identifying key for the region - */ - key?: string; - - /** - * Human-readable text label for the region - */ - label?: string; -} - -export interface RegionListParams { - /** - * Identifier. - */ - account_id: string; -} - -Regions.RegionListResponsesSinglePage = RegionListResponsesSinglePage; - -export declare namespace Regions { - export { - type RegionListResponse as RegionListResponse, - RegionListResponsesSinglePage as RegionListResponsesSinglePage, - type RegionListParams as RegionListParams, - }; -} +export class Regions extends APIResource {} diff --git a/src/resources/intel/sinkholes.ts b/src/resources/intel/sinkholes.ts index 07ef8b3387..45b0bb5dce 100644 --- a/src/resources/intel/sinkholes.ts +++ b/src/resources/intel/sinkholes.ts @@ -6,7 +6,7 @@ import { SinglePage } from '../../pagination'; export class Sinkholes extends APIResource { /** - * List sinkholes owned by this account + * Lists sinkholes owned by the account for redirecting malicious traffic. * * @example * ```ts @@ -31,44 +31,44 @@ export class SinkholesSinglePage extends SinglePage {} export interface Sinkhole { /** - * The unique identifier for the sinkhole + * The unique identifier for the sinkhole. */ id?: number; /** - * The account tag that owns this sinkhole + * The account tag that owns this sinkhole. */ account_tag?: string; /** - * The date and time when the sinkhole was created + * The date and time when the sinkhole was created. */ created_on?: string; /** - * The date and time when the sinkhole was last modified + * The date and time when the sinkhole was last modified. */ modified_on?: string; /** - * The name of the sinkhole + * The name of the sinkhole. */ name?: string; /** - * The name of the R2 bucket to store results + * The name of the R2 bucket to store results. */ r2_bucket?: string; /** - * The id of the R2 instance + * The id of the R2 instance. */ r2_id?: string; } export interface SinkholeListParams { /** - * Identifier + * Identifier. */ account_id: string; } diff --git a/tests/api-resources/addressing/regional-hostnames/regional-hostnames.test.ts b/tests/api-resources/addressing/regional-hostnames/regional-hostnames.test.ts deleted file mode 100644 index 0652d2bfad..0000000000 --- a/tests/api-resources/addressing/regional-hostnames/regional-hostnames.test.ts +++ /dev/null @@ -1,114 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const client = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource regionalHostnames', () => { - test('create: only required params', async () => { - const responsePromise = client.addressing.regionalHostnames.create({ - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - hostname: 'foo.example.com', - region_key: 'ca', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('create: required and optional params', async () => { - const response = await client.addressing.regionalHostnames.create({ - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - hostname: 'foo.example.com', - region_key: 'ca', - routing: 'dns', - }); - }); - - test('list: only required params', async () => { - const responsePromise = client.addressing.regionalHostnames.list({ - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('list: required and optional params', async () => { - const response = await client.addressing.regionalHostnames.list({ - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - }); - - test('delete: only required params', async () => { - const responsePromise = client.addressing.regionalHostnames.delete('foo.example.com', { - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('delete: required and optional params', async () => { - const response = await client.addressing.regionalHostnames.delete('foo.example.com', { - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - }); - - test('edit: only required params', async () => { - const responsePromise = client.addressing.regionalHostnames.edit('foo.example.com', { - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - region_key: 'ca', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('edit: required and optional params', async () => { - const response = await client.addressing.regionalHostnames.edit('foo.example.com', { - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - region_key: 'ca', - }); - }); - - test('get: only required params', async () => { - const responsePromise = client.addressing.regionalHostnames.get('foo.example.com', { - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('get: required and optional params', async () => { - const response = await client.addressing.regionalHostnames.get('foo.example.com', { - zone_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - }); -}); diff --git a/tests/api-resources/addressing/regional-hostnames/regions.test.ts b/tests/api-resources/addressing/regional-hostnames/regions.test.ts deleted file mode 100644 index 4eb06fad02..0000000000 --- a/tests/api-resources/addressing/regional-hostnames/regions.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const client = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource regions', () => { - test('list: only required params', async () => { - const responsePromise = client.addressing.regionalHostnames.regions.list({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('list: required and optional params', async () => { - const response = await client.addressing.regionalHostnames.regions.list({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - }); -}); From b63410867aa2c6bd5e7d85fa8ea5af2cdd1b8f21 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 18:32:37 +0000 Subject: [PATCH 47/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/spectrum/apps.ts | 36 +++++++++++++++++++++++ tests/api-resources/spectrum/apps.test.ts | 2 ++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f7d3215ba8..33cd2848e3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 6dd8b8e98bf595c381a979bd28245966 +openapi_spec_hash: bfc851ee1d17f59070f2c6cbcbdcb4d9 config_hash: 2d1850b4aac63bb32193367c174c33cd diff --git a/src/resources/spectrum/apps.ts b/src/resources/spectrum/apps.ts index ffc5617994..78829d4f58 100644 --- a/src/resources/spectrum/apps.ts +++ b/src/resources/spectrum/apps.ts @@ -194,6 +194,12 @@ export namespace AppCreateResponse { * The type of TLS termination associated with the application. */ tls?: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Optional UUID of a virtual network for routing origin traffic through tunnel + * virtual networks. + */ + virtual_network_id?: string; } export interface SpectrumConfigPaygoAppConfig { @@ -321,6 +327,12 @@ export namespace AppUpdateResponse { * The type of TLS termination associated with the application. */ tls?: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Optional UUID of a virtual network for routing origin traffic through tunnel + * virtual networks. + */ + virtual_network_id?: string; } export interface SpectrumConfigPaygoAppConfig { @@ -448,6 +460,12 @@ export namespace AppListResponse { * The type of TLS termination associated with the application. */ tls?: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Optional UUID of a virtual network for routing origin traffic through tunnel + * virtual networks. + */ + virtual_network_id?: string; } export interface SpectrumConfigPaygoAppConfig { @@ -582,6 +600,12 @@ export namespace AppGetResponse { * The type of TLS termination associated with the application. */ tls?: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Optional UUID of a virtual network for routing origin traffic through tunnel + * virtual networks. + */ + virtual_network_id?: string; } export interface SpectrumConfigPaygoAppConfig { @@ -701,6 +725,12 @@ export declare namespace AppCreateParams { * Body param: The type of TLS termination associated with the application. */ tls?: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Body param: Optional UUID of a virtual network for routing origin traffic + * through tunnel virtual networks. + */ + virtual_network_id?: string; } export interface SpectrumConfigPaygoAppConfig { @@ -811,6 +841,12 @@ export declare namespace AppUpdateParams { * Body param: The type of TLS termination associated with the application. */ tls?: 'off' | 'flexible' | 'full' | 'strict'; + + /** + * Body param: Optional UUID of a virtual network for routing origin traffic + * through tunnel virtual networks. + */ + virtual_network_id?: string; } export interface SpectrumConfigPaygoAppConfig { diff --git a/tests/api-resources/spectrum/apps.test.ts b/tests/api-resources/spectrum/apps.test.ts index a0eb7bc824..011ac68fac 100644 --- a/tests/api-resources/spectrum/apps.test.ts +++ b/tests/api-resources/spectrum/apps.test.ts @@ -46,6 +46,7 @@ describe('resource apps', () => { origin_port: 22, proxy_protocol: 'off', tls: 'off', + virtual_network_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); }); @@ -85,6 +86,7 @@ describe('resource apps', () => { origin_port: 22, proxy_protocol: 'off', tls: 'off', + virtual_network_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', }); }); From 111d6303f45890e07594214470e07bd63286dcbb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 18:59:13 +0000 Subject: [PATCH 48/73] feat: chore: skip failing tests from CI run 26052878605 * chore: skip failing tests from CI run 26052878605 Skips added for failing prism tests on cloudflare-typescript PR #2753: - r2.buckets.objects.{list,delete,upload}: HTTP 404 (route not in spec) - workers.observability.queries.create: HTTP 422 (mock validation) - zero_trust.access.saml_certificates.{list,get,get_pem,rotate}: HTTP 404 - zero_trust.identity_providers.saml_certificate.create: HTTP 404 CI run: https://github.com/cloudflare/cloudflare-typescript/actions/runs/26052878605 --- .stats.yml | 2 +- .../api-resources/r2/buckets/objects.test.ts | 18 ++++++++++------ .../workers/observability/queries.test.ts | 6 ++++-- .../access/saml-certificates.test.ts | 21 ++++++++++++------- .../saml-certificate.test.ts | 6 ++++-- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/.stats.yml b/.stats.yml index 33cd2848e3..ef37a18efc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: bfc851ee1d17f59070f2c6cbcbdcb4d9 -config_hash: 2d1850b4aac63bb32193367c174c33cd +config_hash: ff702e6633bc9b42cafeaec77b59bbe5 diff --git a/tests/api-resources/r2/buckets/objects.test.ts b/tests/api-resources/r2/buckets/objects.test.ts index b084489f2a..981330c808 100644 --- a/tests/api-resources/r2/buckets/objects.test.ts +++ b/tests/api-resources/r2/buckets/objects.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource objects', () => { - test('list: only required params', async () => { + // HTTP 404 error from prism + test.skip('list: only required params', async () => { const responsePromise = client.r2.buckets.objects.list('example-bucket', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -23,7 +24,8 @@ describe('resource objects', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('list: required and optional params', async () => { const response = await client.r2.buckets.objects.list('example-bucket', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', cursor: 'cursor', @@ -35,7 +37,8 @@ describe('resource objects', () => { }); }); - test('delete: only required params', async () => { + // HTTP 404 error from prism + test.skip('delete: only required params', async () => { const responsePromise = client.r2.buckets.objects.delete('example-bucket', 'path/to/my-object.txt', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -48,7 +51,8 @@ describe('resource objects', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('delete: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('delete: required and optional params', async () => { const response = await client.r2.buckets.objects.delete('example-bucket', 'path/to/my-object.txt', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', jurisdiction: 'default', @@ -65,7 +69,8 @@ describe('resource objects', () => { }); }); - test('upload: only required params', async () => { + // HTTP 404 error from prism + test.skip('upload: only required params', async () => { const responsePromise = client.r2.buckets.objects.upload( 'example-bucket', 'path/to/my-object.txt', @@ -81,7 +86,8 @@ describe('resource objects', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('upload: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('upload: required and optional params', async () => { const response = await client.r2.buckets.objects.upload( 'example-bucket', 'path/to/my-object.txt', diff --git a/tests/api-resources/workers/observability/queries.test.ts b/tests/api-resources/workers/observability/queries.test.ts index 2080f3b6a7..2ae40beaa6 100644 --- a/tests/api-resources/workers/observability/queries.test.ts +++ b/tests/api-resources/workers/observability/queries.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource queries', () => { - test('create: only required params', async () => { + // HTTP 422 error from prism + test.skip('create: only required params', async () => { const responsePromise = client.workers.observability.queries.create({ account_id: 'account_id', description: 'Query description', @@ -26,7 +27,8 @@ describe('resource queries', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { + // HTTP 422 error from prism + test.skip('create: required and optional params', async () => { const response = await client.workers.observability.queries.create({ account_id: 'account_id', description: 'Query description', diff --git a/tests/api-resources/zero-trust/access/saml-certificates.test.ts b/tests/api-resources/zero-trust/access/saml-certificates.test.ts index c1eaf71c14..7cb48a1260 100644 --- a/tests/api-resources/zero-trust/access/saml-certificates.test.ts +++ b/tests/api-resources/zero-trust/access/saml-certificates.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource samlCertificates', () => { - test('list: only required params', async () => { + // HTTP 404 error from prism + test.skip('list: only required params', async () => { const responsePromise = client.zeroTrust.access.samlCertificates.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); @@ -23,7 +24,8 @@ describe('resource samlCertificates', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('list: required and optional params', async () => { const response = await client.zeroTrust.access.samlCertificates.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', id: 'a5bb4b3f-c2d1-4e6a-8f9b-1d3e4f5a6b7c,f174e90a-fafe-4643-bbbc-4a0ed4fc8415', @@ -32,7 +34,8 @@ describe('resource samlCertificates', () => { }); }); - test('get: only required params', async () => { + // HTTP 404 error from prism + test.skip('get: only required params', async () => { const responsePromise = client.zeroTrust.access.samlCertificates.get( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, @@ -46,21 +49,24 @@ describe('resource samlCertificates', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('get: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('get: required and optional params', async () => { const response = await client.zeroTrust.access.samlCertificates.get( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); }); - test('getPem: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('getPem: required and optional params', async () => { const response = await client.zeroTrust.access.samlCertificates.getPem( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); }); - test('rotate: only required params', async () => { + // HTTP 404 error from prism + test.skip('rotate: only required params', async () => { const responsePromise = client.zeroTrust.access.samlCertificates.rotate( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, @@ -74,7 +80,8 @@ describe('resource samlCertificates', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('rotate: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('rotate: required and optional params', async () => { const response = await client.zeroTrust.access.samlCertificates.rotate( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, diff --git a/tests/api-resources/zero-trust/identity-providers/saml-certificate.test.ts b/tests/api-resources/zero-trust/identity-providers/saml-certificate.test.ts index a16a682226..4d5c01dd74 100644 --- a/tests/api-resources/zero-trust/identity-providers/saml-certificate.test.ts +++ b/tests/api-resources/zero-trust/identity-providers/saml-certificate.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource samlCertificate', () => { - test('create: only required params', async () => { + // HTTP 404 error from prism + test.skip('create: only required params', async () => { const responsePromise = client.zeroTrust.identityProviders.samlCertificate.create( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, @@ -24,7 +25,8 @@ describe('resource samlCertificate', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { + // HTTP 404 error from prism + test.skip('create: required and optional params', async () => { const response = await client.zeroTrust.identityProviders.samlCertificate.create( 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, From 8b945e966ddc951f887a8d6bd48db0d53fe42fb3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 20:34:27 +0000 Subject: [PATCH 49/73] feat: feat(secrets_store): add Terraform configuration for secrets_store resources * feat(secrets_store): add Terraform configuration for secrets_store resources --- .stats.yml | 4 +- src/resources/secrets-store/api.md | 2 + src/resources/secrets-store/index.ts | 2 + src/resources/secrets-store/secrets-store.ts | 4 ++ src/resources/secrets-store/stores/index.ts | 2 + src/resources/secrets-store/stores/stores.ts | 61 +++++++++++++++++++ .../secrets-store/stores/stores.test.ts | 21 +++++++ 7 files changed, 94 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ef37a18efc..479e6a190f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2269 +configured_endpoints: 2270 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: bfc851ee1d17f59070f2c6cbcbdcb4d9 -config_hash: ff702e6633bc9b42cafeaec77b59bbe5 +config_hash: b778c5565760a2c688557888c4ebd31a diff --git a/src/resources/secrets-store/api.md b/src/resources/secrets-store/api.md index bd8c15b265..e6fb1c65c1 100644 --- a/src/resources/secrets-store/api.md +++ b/src/resources/secrets-store/api.md @@ -7,12 +7,14 @@ Types: - StoreCreateResponse - StoreListResponse - StoreDeleteResponse +- StoreGetResponse Methods: - client.secretsStore.stores.create({ ...params }) -> StoreCreateResponse - client.secretsStore.stores.list({ ...params }) -> StoreListResponsesV4PagePaginationArray - client.secretsStore.stores.delete(storeId, { ...params }) -> StoreDeleteResponse | null +- client.secretsStore.stores.get(storeId, { ...params }) -> StoreGetResponse ### Secrets diff --git a/src/resources/secrets-store/index.ts b/src/resources/secrets-store/index.ts index 0f363f4238..52d7a498c7 100644 --- a/src/resources/secrets-store/index.ts +++ b/src/resources/secrets-store/index.ts @@ -8,7 +8,9 @@ export { type StoreCreateResponse, type StoreListResponse, type StoreDeleteResponse, + type StoreGetResponse, type StoreCreateParams, type StoreListParams, type StoreDeleteParams, + type StoreGetParams, } from './stores/index'; diff --git a/src/resources/secrets-store/secrets-store.ts b/src/resources/secrets-store/secrets-store.ts index 2e4055006d..a9590c4e42 100644 --- a/src/resources/secrets-store/secrets-store.ts +++ b/src/resources/secrets-store/secrets-store.ts @@ -9,6 +9,8 @@ import { StoreCreateResponse, StoreDeleteParams, StoreDeleteResponse, + StoreGetParams, + StoreGetResponse, StoreListParams, StoreListResponse, StoreListResponsesV4PagePaginationArray, @@ -30,10 +32,12 @@ export declare namespace SecretsStore { type StoreCreateResponse as StoreCreateResponse, type StoreListResponse as StoreListResponse, type StoreDeleteResponse as StoreDeleteResponse, + type StoreGetResponse as StoreGetResponse, StoreListResponsesV4PagePaginationArray as StoreListResponsesV4PagePaginationArray, type StoreCreateParams as StoreCreateParams, type StoreListParams as StoreListParams, type StoreDeleteParams as StoreDeleteParams, + type StoreGetParams as StoreGetParams, }; export { Quota as Quota, type QuotaGetResponse as QuotaGetResponse, type QuotaGetParams as QuotaGetParams }; diff --git a/src/resources/secrets-store/stores/index.ts b/src/resources/secrets-store/stores/index.ts index 742c7b989d..2faa8b5c34 100644 --- a/src/resources/secrets-store/stores/index.ts +++ b/src/resources/secrets-store/stores/index.ts @@ -25,7 +25,9 @@ export { type StoreCreateResponse, type StoreListResponse, type StoreDeleteResponse, + type StoreGetResponse, type StoreCreateParams, type StoreListParams, type StoreDeleteParams, + type StoreGetParams, } from './stores'; diff --git a/src/resources/secrets-store/stores/stores.ts b/src/resources/secrets-store/stores/stores.ts index 8bee25ccec..e5a55e67f0 100644 --- a/src/resources/secrets-store/stores/stores.ts +++ b/src/resources/secrets-store/stores/stores.ts @@ -100,6 +100,31 @@ export class Stores extends APIResource { }) as Core.APIPromise<{ result: StoreDeleteResponse | null }> )._thenUnwrap((obj) => obj.result); } + + /** + * Returns details of a single store + * + * @example + * ```ts + * const store = await client.secretsStore.stores.get( + * '023e105f4ecef8ad9ca31a8372d0c353', + * { account_id: '985e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + get( + storeId: string, + params: StoreGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/secrets_store/stores/${storeId}`, + options, + ) as Core.APIPromise<{ result: StoreGetResponse }> + )._thenUnwrap((obj) => obj.result); + } } export class StoreListResponsesV4PagePaginationArray extends V4PagePaginationArray {} @@ -163,6 +188,33 @@ export interface StoreListResponse { */ export type StoreDeleteResponse = unknown; +export interface StoreGetResponse { + /** + * Store Identifier + */ + id: string; + + /** + * Whenthe secret was created. + */ + created: string; + + /** + * When the secret was modified. + */ + modified: string; + + /** + * The name of the store + */ + name: string; + + /** + * Account Identifier + */ + account_id?: string; +} + export interface StoreCreateParams { /** * Path param: Account Identifier @@ -206,6 +258,13 @@ export interface StoreDeleteParams { force?: boolean; } +export interface StoreGetParams { + /** + * Account Identifier + */ + account_id: string; +} + Stores.StoreListResponsesV4PagePaginationArray = StoreListResponsesV4PagePaginationArray; Stores.Secrets = Secrets; Stores.SecretCreateResponsesSinglePage = SecretCreateResponsesSinglePage; @@ -216,10 +275,12 @@ export declare namespace Stores { type StoreCreateResponse as StoreCreateResponse, type StoreListResponse as StoreListResponse, type StoreDeleteResponse as StoreDeleteResponse, + type StoreGetResponse as StoreGetResponse, StoreListResponsesV4PagePaginationArray as StoreListResponsesV4PagePaginationArray, type StoreCreateParams as StoreCreateParams, type StoreListParams as StoreListParams, type StoreDeleteParams as StoreDeleteParams, + type StoreGetParams as StoreGetParams, }; export { diff --git a/tests/api-resources/secrets-store/stores/stores.test.ts b/tests/api-resources/secrets-store/stores/stores.test.ts index 4ff2b6cf41..1e2f26bb1d 100644 --- a/tests/api-resources/secrets-store/stores/stores.test.ts +++ b/tests/api-resources/secrets-store/stores/stores.test.ts @@ -79,4 +79,25 @@ describe('resource stores', () => { force: true, }); }); + + // SKIP: prism error for 422 Unprocessable Entity + test.skip('get: only required params', async () => { + const responsePromise = client.secretsStore.stores.get('023e105f4ecef8ad9ca31a8372d0c353', { + account_id: '985e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // SKIP: prism error for 422 Unprocessable Entity + test.skip('get: required and optional params', async () => { + const response = await client.secretsStore.stores.get('023e105f4ecef8ad9ca31a8372d0c353', { + account_id: '985e105f4ecef8ad9ca31a8372d0c353', + }); + }); }); From 1b08e7f41039d1190c42f1e6c5901d9c47442f63 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 21:30:41 +0000 Subject: [PATCH 50/73] chore(api): update composite API spec --- .stats.yml | 2 +- .../custom-certificates/custom-certificates.ts | 18 ++++++++++-------- .../custom-certificates.test.ts | 6 ++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.stats.yml b/.stats.yml index 479e6a190f..117d4e9236 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2270 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: bfc851ee1d17f59070f2c6cbcbdcb4d9 +openapi_spec_hash: 93e1b585e051ba2ab493bfb66f8b751d config_hash: b778c5565760a2c688557888c4ebd31a diff --git a/src/resources/custom-certificates/custom-certificates.ts b/src/resources/custom-certificates/custom-certificates.ts index 49fb90c45a..da07b19164 100644 --- a/src/resources/custom-certificates/custom-certificates.ts +++ b/src/resources/custom-certificates/custom-certificates.ts @@ -21,8 +21,6 @@ export class CustomCertificates extends APIResource { * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * certificate: * '-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n', - * private_key: - * '-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n', * }); * ``` */ @@ -291,11 +289,6 @@ export interface CustomCertificateCreateParams { */ certificate: string; - /** - * Body param: The zone's private key. - */ - private_key: string; - /** * Body param: A ubiquitous bundle has the highest probability of being verified * everywhere, even by clients using outdated or unusual trust stores. An optimal @@ -340,6 +333,13 @@ export interface CustomCertificateCreateParams { */ policy?: string; + /** + * Body param: The zone's private key. Not required if custom_csr_id is provided, + * in which case the private key is retrieved from the CSR record held by + * Cloudflare. + */ + private_key?: string; + /** * Body param: The type 'legacy_custom' enables support for legacy clients which do * not include SNI in the TLS handshake. @@ -427,7 +427,9 @@ export interface CustomCertificateEditParams { policy?: string; /** - * Body param: The zone's private key. + * Body param: The zone's private key. Not required if custom_csr_id is provided, + * in which case the private key is retrieved from the CSR record held by + * Cloudflare. */ private_key?: string; } diff --git a/tests/api-resources/custom-certificates/custom-certificates.test.ts b/tests/api-resources/custom-certificates/custom-certificates.test.ts index f1f42ea5e7..a3a9510159 100644 --- a/tests/api-resources/custom-certificates/custom-certificates.test.ts +++ b/tests/api-resources/custom-certificates/custom-certificates.test.ts @@ -15,8 +15,6 @@ describe('resource customCertificates', () => { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', certificate: '-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n', - private_key: - '-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n', }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); @@ -32,13 +30,13 @@ describe('resource customCertificates', () => { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', certificate: '-----BEGIN CERTIFICATE-----\nMIIDtTCCAp2gAwIBAgIJAMHAwfXZ5/PWMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV\nBAYTAkFVMRMwEQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBX\naWRnaXRzIFB0eSBMdGQwHhcNMTYwODI0MTY0MzAxWhcNMTYxMTIyMTY0MzAxWjBF\nMQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50\nZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB\nCgKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmGdtcGbg/1\nCGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKnabIRuGvB\nKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpidtnKX/a+5\n0GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+pyFxIXjbEI\ndZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pEewooaeO2\nizNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABo4GnMIGkMB0GA1UdDgQWBBT/LbE4\n9rWf288N6sJA5BRb6FJIGDB1BgNVHSMEbjBsgBT/LbE49rWf288N6sJA5BRb6FJI\nGKFJpEcwRTELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNV\nBAoTGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZIIJAMHAwfXZ5/PWMAwGA1UdEwQF\nMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAHHFwl0tH0quUYZYO0dZYt4R7SJ0pCm2\n2satiyzHl4OnXcHDpekAo7/a09c6Lz6AU83cKy/+x3/djYHXWba7HpEu0dR3ugQP\nMlr4zrhd9xKZ0KZKiYmtJH+ak4OM4L3FbT0owUZPyjLSlhMtJVcoRp5CJsjAMBUG\nSvD8RX+T01wzox/Qb+lnnNnOlaWpqu8eoOenybxKp1a9ULzIVvN/LAcc+14vioFq\n2swRWtmocBAs8QR9n4uvbpiYvS8eYueDCWMM4fvFfBhaDZ3N9IbtySh3SpFdQDhw\nYbjM2rxXiyLGxB4Bol7QTv4zHif7Zt89FReT/NBy4rzaskDJY5L6xmY=\n-----END CERTIFICATE-----\n', - private_key: - '-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n', bundle_method: 'ubiquitous', custom_csr_id: '7b163417-1d2b-4c84-a38a-2fb7a0cd7752', deploy: 'staging', geo_restrictions: { label: 'us' }, policy: '(country: US) or (region: EU)', + private_key: + '-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAwQHoetcl9+5ikGzV6cMzWtWPJHqXT3wpbEkRU9Yz7lgvddmG\ndtcGbg/1CGZu0jJGkMoppoUo4c3dts3iwqRYmBikUP77wwY2QGmDZw2FvkJCJlKn\nabIRuGvBKwzESIXgKk2016aTP6/dAjEHyo6SeoK8lkIySUvK0fyOVlsiEsCmOpid\ntnKX/a+50GjB79CJH4ER2lLVZnhePFR/zUOyPxZQQ4naHf7yu/b5jhO0f8fwt+py\nFxIXjbEIdZliWRkRMtzrHOJIhrmJ2A1J7iOrirbbwillwjjNVUWPf3IJ3M12S9pE\newooaeO2izNTERcG9HzAacbVRn2Y2SWIyT/18QIDAQABAoIBACbhTYXBZYKmYPCb\nHBR1IBlCQA2nLGf0qRuJNJZg5iEzXows/6tc8YymZkQE7nolapWsQ+upk2y5Xdp/\naxiuprIs9JzkYK8Ox0r+dlwCG1kSW+UAbX0bQ/qUqlsTvU6muVuMP8vZYHxJ3wmb\n+ufRBKztPTQ/rYWaYQcgC0RWI20HTFBMxlTAyNxYNWzX7RKFkGVVyB9RsAtmcc8g\n+j4OdosbfNoJPS0HeIfNpAznDfHKdxDk2Yc1tV6RHBrC1ynyLE9+TaflIAdo2MVv\nKLMLq51GqYKtgJFIlBRPQqKoyXdz3fGvXrTkf/WY9QNq0J1Vk5ERePZ54mN8iZB7\n9lwy/AkCgYEA6FXzosxswaJ2wQLeoYc7ceaweX/SwTvxHgXzRyJIIT0eJWgx13Wo\n/WA3Iziimsjf6qE+SI/8laxPp2A86VMaIt3Z3mJN/CqSVGw8LK2AQst+OwdPyDMu\niacE8lj/IFGC8mwNUAb9CzGU3JpU4PxxGFjS/eMtGeRXCWkK4NE+G08CgYEA1Kp9\nN2JrVlqUz+gAX+LPmE9OEMAS9WQSQsfCHGogIFDGGcNf7+uwBM7GAaSJIP01zcoe\nVAgWdzXCv3FLhsaZoJ6RyLOLay5phbu1iaTr4UNYm5WtYTzMzqh8l1+MFFDl9xDB\nvULuCIIrglM5MeS/qnSg1uMoH2oVPj9TVst/ir8CgYEAxrI7Ws9Zc4Bt70N1As+U\nlySjaEVZCMkqvHJ6TCuVZFfQoE0r0whdLdRLU2PsLFP+q7qaeZQqgBaNSKeVcDYR\n9B+nY/jOmQoPewPVsp/vQTCnE/R81spu0mp0YI6cIheT1Z9zAy322svcc43JaWB7\nmEbeqyLOP4Z4qSOcmghZBSECgYACvR9Xs0DGn+wCsW4vze/2ei77MD4OQvepPIFX\ndFZtlBy5ADcgE9z0cuVB6CiL8DbdK5kwY9pGNr8HUCI03iHkW6Zs+0L0YmihfEVe\nPG19PSzK9CaDdhD9KFZSbLyVFmWfxOt50H7YRTTiPMgjyFpfi5j2q348yVT0tEQS\nfhRqaQKBgAcWPokmJ7EbYQGeMbS7HC8eWO/RyamlnSffdCdSc7ue3zdVJxpAkQ8W\nqu80pEIF6raIQfAf8MXiiZ7auFOSnHQTXUbhCpvDLKi0Mwq3G8Pl07l+2s6dQG6T\nlv6XTQaMyf6n1yjzL+fzDrH3qXMxHMO/b13EePXpDMpY7HQpoLDi\n-----END RSA PRIVATE KEY-----\n', type: 'sni_custom', }); }); From 48e2fba05d33cc612bc5ca129ccc5bc1464d8497 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 22:42:43 +0000 Subject: [PATCH 51/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/cloudforce-one/threat-events/countries.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 117d4e9236..e528195122 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2270 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 93e1b585e051ba2ab493bfb66f8b751d +openapi_spec_hash: 6e4ceb024bdd7dafb6968230be096bb1 config_hash: b778c5565760a2c688557888c4ebd31a diff --git a/src/resources/cloudforce-one/threat-events/countries.ts b/src/resources/cloudforce-one/threat-events/countries.ts index 3177e14904..923cdfe9e3 100644 --- a/src/resources/cloudforce-one/threat-events/countries.ts +++ b/src/resources/cloudforce-one/threat-events/countries.ts @@ -32,6 +32,8 @@ export namespace CountryListResponse { export namespace CountryListResponseItem { export interface Result { + alpha2: string; + alpha3: string; name: string; From 758b0de1a450fd915bd6190b77647201c819aecc Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 08:25:29 +0000 Subject: [PATCH 52/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/aisearch/instances/instances.ts | 6 ++++++ src/resources/aisearch/namespaces/instances/instances.ts | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index e528195122..62d59a1c33 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2270 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 6e4ceb024bdd7dafb6968230be096bb1 +openapi_spec_hash: 82017cd80d5b49cbf4bad39374e95cb6 config_hash: b778c5565760a2c688557888c4ebd31a diff --git a/src/resources/aisearch/instances/instances.ts b/src/resources/aisearch/instances/instances.ts index 3cc0f853ff..1f418b14a6 100644 --- a/src/resources/aisearch/instances/instances.ts +++ b/src/resources/aisearch/instances/instances.ts @@ -2314,6 +2314,12 @@ export namespace InstanceSearchResponse { export interface InstanceStatsResponse { completed?: number; + /** + * True when status counts are unavailable (e.g. legacy stats query exceeded D1 + * statement-size limit). Counts are omitted in this case. + */ + degraded?: boolean; + /** * Engine-specific metadata. Present only for managed (v3) instances. */ diff --git a/src/resources/aisearch/namespaces/instances/instances.ts b/src/resources/aisearch/namespaces/instances/instances.ts index 222e627312..3379ac6c1f 100644 --- a/src/resources/aisearch/namespaces/instances/instances.ts +++ b/src/resources/aisearch/namespaces/instances/instances.ts @@ -2365,6 +2365,12 @@ export namespace InstanceSearchResponse { export interface InstanceStatsResponse { completed?: number; + /** + * True when status counts are unavailable (e.g. legacy stats query exceeded D1 + * statement-size limit). Counts are omitted in this case. + */ + degraded?: boolean; + /** * Engine-specific metadata. Present only for managed (v3) instances. */ From 66496e740b0221b9b57dec5f8a566211c7151a56 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 12:01:53 +0000 Subject: [PATCH 53/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/radar/http/http.ts | 50 ++++++++ .../workers/observability/destinations.ts | 10 +- .../workers/observability/queries.ts | 24 ++-- .../workers/observability/telemetry.ts | 120 ++++++++++++------ tests/api-resources/radar/http/http.test.ts | 2 + 6 files changed, 157 insertions(+), 51 deletions(-) diff --git a/.stats.yml b/.stats.yml index 62d59a1c33..a8b94591f9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2270 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 82017cd80d5b49cbf4bad39374e95cb6 +openapi_spec_hash: 2c458c0f5c0915d0daa7a320aa28da38 config_hash: b778c5565760a2c688557888c4ebd31a diff --git a/src/resources/radar/http/http.ts b/src/resources/radar/http/http.ts index b37a5a2eb9..ab2fc7f5de 100644 --- a/src/resources/radar/http/http.ts +++ b/src/resources/radar/http/http.ts @@ -85,6 +85,7 @@ export class HTTP extends APIResource { | 'BOT_CLASS' | 'BROWSER' | 'BROWSER_FAMILY' + | 'CONTENT_TYPE' | 'DEVICE_TYPE' | 'HTTP_PROTOCOL' | 'HTTP_VERSION' @@ -104,6 +105,7 @@ export class HTTP extends APIResource { | 'BOT_CLASS' | 'BROWSER' | 'BROWSER_FAMILY' + | 'CONTENT_TYPE' | 'DEVICE_TYPE' | 'HTTP_PROTOCOL' | 'HTTP_VERSION' @@ -122,6 +124,7 @@ export class HTTP extends APIResource { | 'BOT_CLASS' | 'BROWSER' | 'BROWSER_FAMILY' + | 'CONTENT_TYPE' | 'DEVICE_TYPE' | 'HTTP_PROTOCOL' | 'HTTP_VERSION' @@ -188,6 +191,7 @@ export class HTTP extends APIResource { | 'BOT_CLASS' | 'BROWSER' | 'BROWSER_FAMILY' + | 'CONTENT_TYPE' | 'DEVICE_TYPE' | 'HTTP_PROTOCOL' | 'HTTP_VERSION' @@ -207,6 +211,7 @@ export class HTTP extends APIResource { | 'BOT_CLASS' | 'BROWSER' | 'BROWSER_FAMILY' + | 'CONTENT_TYPE' | 'DEVICE_TYPE' | 'HTTP_PROTOCOL' | 'HTTP_VERSION' @@ -225,6 +230,7 @@ export class HTTP extends APIResource { | 'BOT_CLASS' | 'BROWSER' | 'BROWSER_FAMILY' + | 'CONTENT_TYPE' | 'DEVICE_TYPE' | 'HTTP_PROTOCOL' | 'HTTP_VERSION' @@ -682,6 +688,28 @@ export interface HTTPSummaryV2Params { */ botClass?: Array<'LIKELY_AUTOMATED' | 'LIKELY_HUMAN'>; + /** + * Filters results by content type category. + */ + contentType?: Array< + | 'HTML' + | 'IMAGES' + | 'JSON' + | 'JAVASCRIPT' + | 'CSS' + | 'PLAIN_TEXT' + | 'FONTS' + | 'XML' + | 'YAML' + | 'VIDEO' + | 'AUDIO' + | 'MARKDOWN' + | 'DOCUMENTS' + | 'BINARY' + | 'SERIALIZATION' + | 'OTHER' + >; + /** * Filters results by continent. Specify a comma-separated list of alpha-2 codes. * Prefix with `-` to exclude continents from results. For example, `-EU,NA` @@ -916,6 +944,28 @@ export interface HTTPTimeseriesGroupsV2Params { */ botClass?: Array<'LIKELY_AUTOMATED' | 'LIKELY_HUMAN'>; + /** + * Filters results by content type category. + */ + contentType?: Array< + | 'HTML' + | 'IMAGES' + | 'JSON' + | 'JAVASCRIPT' + | 'CSS' + | 'PLAIN_TEXT' + | 'FONTS' + | 'XML' + | 'YAML' + | 'VIDEO' + | 'AUDIO' + | 'MARKDOWN' + | 'DOCUMENTS' + | 'BINARY' + | 'SERIALIZATION' + | 'OTHER' + >; + /** * Filters results by continent. Specify a comma-separated list of alpha-2 codes. * Prefix with `-` to exclude continents from results. For example, `-EU,NA` diff --git a/src/resources/workers/observability/destinations.ts b/src/resources/workers/observability/destinations.ts index 273255990a..ba4409287c 100644 --- a/src/resources/workers/observability/destinations.ts +++ b/src/resources/workers/observability/destinations.ts @@ -141,7 +141,7 @@ export namespace DestinationCreateResponse { export interface Configuration { destination_conf: string; - logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs'; + logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs' | 'opentelemetry-metrics'; logpushJob: number; @@ -167,7 +167,7 @@ export namespace DestinationUpdateResponse { export interface Configuration { destination_conf: string; - logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs'; + logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs' | 'opentelemetry-metrics'; logpushJob: number; @@ -197,7 +197,7 @@ export namespace DestinationListResponse { jobStatus: Configuration.JobStatus; - logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs'; + logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs' | 'opentelemetry-metrics'; type: 'logpush'; @@ -231,7 +231,7 @@ export namespace DestinationDeleteResponse { export interface Configuration { destination_conf: string; - logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs'; + logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs' | 'opentelemetry-metrics'; logpushJob: number; @@ -272,7 +272,7 @@ export namespace DestinationCreateParams { export interface Configuration { headers: { [key: string]: string }; - logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs'; + logpushDataset: 'opentelemetry-traces' | 'opentelemetry-logs' | 'opentelemetry-metrics'; type: 'logpush'; diff --git a/src/resources/workers/observability/queries.ts b/src/resources/workers/observability/queries.ts index 754c1d7b6e..d780d19d95 100644 --- a/src/resources/workers/observability/queries.ts +++ b/src/resources/workers/observability/queries.ts @@ -203,13 +203,14 @@ export namespace QueryCreateResponse { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -234,7 +235,8 @@ export namespace QueryCreateResponse { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being @@ -445,13 +447,14 @@ export namespace QueryListResponse { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -476,7 +479,8 @@ export namespace QueryListResponse { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being @@ -683,13 +687,14 @@ export namespace QueryCreateParams { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -714,7 +719,8 @@ export namespace QueryCreateParams { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being diff --git a/src/resources/workers/observability/telemetry.ts b/src/resources/workers/observability/telemetry.ts index 0e896e41b6..91a342f6dc 100644 --- a/src/resources/workers/observability/telemetry.ts +++ b/src/resources/workers/observability/telemetry.ts @@ -106,8 +106,8 @@ export interface TelemetryKeysResponse { */ export interface TelemetryQueryResponse { /** - * The query run metadata including the query definition, execution status, and - * timeframe. + * Represents a single execution of a query against Workers Observability data, + * including the query definition, execution status, and performance statistics. */ run: TelemetryQueryResponse.Run; @@ -159,8 +159,8 @@ export interface TelemetryQueryResponse { export namespace TelemetryQueryResponse { /** - * The query run metadata including the query definition, execution status, and - * timeframe. + * Represents a single execution of a query against Workers Observability data, + * including the query definition, execution status, and performance statistics. */ export interface Run { /** @@ -373,13 +373,14 @@ export namespace TelemetryQueryResponse { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -404,7 +405,8 @@ export namespace TelemetryQueryResponse { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being @@ -763,7 +765,7 @@ export namespace TelemetryQueryResponse { * Raw log payload. May be a string or a structured object depending on how the log * was emitted. */ - source: string | unknown; + source: string | { [key: string]: unknown }; /** * Event timestamp as a Unix epoch in milliseconds. @@ -774,7 +776,7 @@ export namespace TelemetryQueryResponse { * Cloudflare Containers event information that enriches your logs for identifying * and debugging issues. */ - $containers?: unknown; + $containers?: { [key: string]: unknown }; /** * Cloudflare Workers event information that enriches your logs for identifying and @@ -804,9 +806,6 @@ export namespace TelemetryQueryResponse { */ cloudService?: string; - /** - * Whether this was a cold start (1) or warm invocation (0). - */ coldStart?: number; /** @@ -973,6 +972,8 @@ export namespace TelemetryQueryResponse { outcome?: string; + preview?: UnionMember0.Preview; + scriptVersion?: UnionMember0.ScriptVersion; spanId?: string; @@ -983,6 +984,14 @@ export namespace TelemetryQueryResponse { } export namespace UnionMember0 { + export interface Preview { + id?: string; + + name?: string; + + slug?: string; + } + export interface ScriptVersion { id?: string; @@ -1028,6 +1037,8 @@ export namespace TelemetryQueryResponse { executionModel?: 'durableObject' | 'stateless'; + preview?: UnionMember1.Preview; + scriptVersion?: UnionMember1.ScriptVersion; spanId?: string; @@ -1046,6 +1057,14 @@ export namespace TelemetryQueryResponse { timestamp: number; } + export interface Preview { + id?: string; + + name?: string; + + slug?: string; + } + export interface ScriptVersion { id?: string; @@ -1143,7 +1162,7 @@ export namespace TelemetryQueryResponse { * Raw log payload. May be a string or a structured object depending on how the log * was emitted. */ - source: string | unknown; + source: string | { [key: string]: unknown }; /** * Event timestamp as a Unix epoch in milliseconds. @@ -1154,7 +1173,7 @@ export namespace TelemetryQueryResponse { * Cloudflare Containers event information that enriches your logs for identifying * and debugging issues. */ - $containers?: unknown; + $containers?: { [key: string]: unknown }; /** * Cloudflare Workers event information that enriches your logs for identifying and @@ -1184,9 +1203,6 @@ export namespace TelemetryQueryResponse { */ cloudService?: string; - /** - * Whether this was a cold start (1) or warm invocation (0). - */ coldStart?: number; /** @@ -1353,6 +1369,8 @@ export namespace TelemetryQueryResponse { outcome?: string; + preview?: UnionMember0.Preview; + scriptVersion?: UnionMember0.ScriptVersion; spanId?: string; @@ -1363,6 +1381,14 @@ export namespace TelemetryQueryResponse { } export namespace UnionMember0 { + export interface Preview { + id?: string; + + name?: string; + + slug?: string; + } + export interface ScriptVersion { id?: string; @@ -1408,6 +1434,8 @@ export namespace TelemetryQueryResponse { executionModel?: 'durableObject' | 'stateless'; + preview?: UnionMember1.Preview; + scriptVersion?: UnionMember1.ScriptVersion; spanId?: string; @@ -1426,6 +1454,14 @@ export namespace TelemetryQueryResponse { timestamp: number; } + export interface Preview { + id?: string; + + name?: string; + + slug?: string; + } + export interface ScriptVersion { id?: string; @@ -1571,13 +1607,14 @@ export namespace TelemetryKeysParams { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -1602,7 +1639,8 @@ export namespace TelemetryKeysParams { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being @@ -1640,13 +1678,14 @@ export namespace TelemetryKeysParams { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -1671,7 +1710,8 @@ export namespace TelemetryKeysParams { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being @@ -1908,7 +1948,7 @@ export namespace TelemetryQueryParams { export namespace Parameters { export interface Calculation { /** - * Aggregation operator to apply. Examples: count, avg, sum, min, max, p50, p90, + * Aggregation operator to apply. Examples: count, avg, sum, min, max, median, p90, * p95, p99, uniq, stddev, variance. */ operator: @@ -2001,13 +2041,14 @@ export namespace TelemetryQueryParams { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -2032,7 +2073,8 @@ export namespace TelemetryQueryParams { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being @@ -2070,13 +2112,14 @@ export namespace TelemetryQueryParams { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -2101,7 +2144,8 @@ export namespace TelemetryQueryParams { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being @@ -2275,13 +2319,14 @@ export namespace TelemetryValuesParams { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -2306,7 +2351,8 @@ export namespace TelemetryValuesParams { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being @@ -2344,13 +2390,14 @@ export namespace TelemetryValuesParams { /** * Comparison operator. String operators: includes, not_includes, starts_with, - * regex. Existence: exists, is_null. Set membership: in, not_in (comma-separated - * values). Numeric: eq, neq, gt, gte, lt, lte. + * ends_with, regex. Existence: exists, is_null. Set membership: in, not_in + * (comma-separated values). Numeric: eq, neq, gt, gte, lt, lte. */ operation: | 'includes' | 'not_includes' | 'starts_with' + | 'ends_with' | 'regex' | 'exists' | 'is_null' @@ -2375,7 +2422,8 @@ export namespace TelemetryValuesParams { | 'DOES_NOT_EXIST' | 'IN' | 'NOT_IN' - | 'STARTS_WITH'; + | 'STARTS_WITH' + | 'ENDS_WITH'; /** * Data type of the filter field. Must match the actual type of the key being diff --git a/tests/api-resources/radar/http/http.test.ts b/tests/api-resources/radar/http/http.test.ts index 473eb3fcdf..75ee7e9102 100644 --- a/tests/api-resources/radar/http/http.test.ts +++ b/tests/api-resources/radar/http/http.test.ts @@ -37,6 +37,7 @@ describe('resource http', () => { apiTraffic: ['API'], asn: ['string'], botClass: ['LIKELY_AUTOMATED'], + contentType: ['HTML'], continent: ['string'], dateEnd: ['2019-12-27T18:11:19.117Z'], dateRange: ['7d'], @@ -135,6 +136,7 @@ describe('resource http', () => { apiTraffic: ['API'], asn: ['string'], botClass: ['LIKELY_AUTOMATED'], + contentType: ['HTML'], continent: ['string'], dateEnd: ['2019-12-27T18:11:19.117Z'], dateRange: ['7d'], From ebc5d5b87bfa856bd35e529192668db12e1b4dbd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 15:14:01 +0000 Subject: [PATCH 54/73] chore(api): update composite API spec --- .stats.yml | 4 +- scripts/detect-breaking-changes | 1 - src/resources/billing/api.md | 8 -- src/resources/billing/billing.ts | 8 +- src/resources/billing/index.ts | 2 +- src/resources/billing/usage.ts | 109 +--------------------- tests/api-resources/billing/usage.test.ts | 31 ------ 7 files changed, 6 insertions(+), 157 deletions(-) delete mode 100644 tests/api-resources/billing/usage.test.ts diff --git a/.stats.yml b/.stats.yml index a8b94591f9..09a0c61376 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2270 +configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 2c458c0f5c0915d0daa7a320aa28da38 +openapi_spec_hash: 8540f176024efef3ee799015ad4a2dd9 config_hash: b778c5565760a2c688557888c4ebd31a diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 7ea6990be6..7920d4f14c 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -279,7 +279,6 @@ TEST_PATHS=( tests/api-resources/audit-logs.test.ts tests/api-resources/billing/billing.test.ts tests/api-resources/billing/profiles.test.ts - tests/api-resources/billing/usage.test.ts tests/api-resources/brand-protection/brand-protection.test.ts tests/api-resources/brand-protection/queries.test.ts tests/api-resources/brand-protection/matches.test.ts diff --git a/src/resources/billing/api.md b/src/resources/billing/api.md index e91cbb571d..610f577164 100644 --- a/src/resources/billing/api.md +++ b/src/resources/billing/api.md @@ -11,11 +11,3 @@ Methods: - client.billing.profiles.get({ ...params }) -> ProfileGetResponse ## Usage - -Types: - -- UsagePaygoResponse - -Methods: - -- client.billing.usage.paygo({ ...params }) -> UsagePaygoResponse diff --git a/src/resources/billing/billing.ts b/src/resources/billing/billing.ts index 7aab67ec76..3e8620705f 100644 --- a/src/resources/billing/billing.ts +++ b/src/resources/billing/billing.ts @@ -4,7 +4,7 @@ import { APIResource } from '../../resource'; import * as ProfilesAPI from './profiles'; import { ProfileGetParams, ProfileGetResponse, Profiles } from './profiles'; import * as UsageAPI from './usage'; -import { Usage, UsagePaygoParams, UsagePaygoResponse } from './usage'; +import { Usage } from './usage'; export class Billing extends APIResource { profiles: ProfilesAPI.Profiles = new ProfilesAPI.Profiles(this._client); @@ -21,9 +21,5 @@ export declare namespace Billing { type ProfileGetParams as ProfileGetParams, }; - export { - Usage as Usage, - type UsagePaygoResponse as UsagePaygoResponse, - type UsagePaygoParams as UsagePaygoParams, - }; + export { Usage as Usage }; } diff --git a/src/resources/billing/index.ts b/src/resources/billing/index.ts index 9abd219889..6a4ef8bc0f 100644 --- a/src/resources/billing/index.ts +++ b/src/resources/billing/index.ts @@ -2,4 +2,4 @@ export { Billing } from './billing'; export { Profiles, type ProfileGetResponse, type ProfileGetParams } from './profiles'; -export { Usage, type UsagePaygoResponse, type UsagePaygoParams } from './usage'; +export { Usage } from './usage'; diff --git a/src/resources/billing/usage.ts b/src/resources/billing/usage.ts index b11a7cf873..abbcd69967 100644 --- a/src/resources/billing/usage.ts +++ b/src/resources/billing/usage.ts @@ -1,112 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import * as Core from '../../core'; -export class Usage extends APIResource { - /** - * Returns billable usage data for PayGo (self-serve) accounts. When no query - * parameters are provided, returns usage for the current billing period. This - * endpoint is currently in alpha and access is restricted to select accounts. - * While in alpha, the endpoint may get breaking changes. - */ - paygo(params: UsagePaygoParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, ...query } = params; - return ( - this._client.get(`/accounts/${account_id}/billing/usage/paygo`, { - query, - ...options, - }) as Core.APIPromise<{ result: UsagePaygoResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -/** - * Contains the array of billable usage records. - */ -export type UsagePaygoResponse = Array; - -export namespace UsagePaygoResponse { - /** - * Represents a single billable usage record. - */ - export interface UsagePaygoResponseItem { - /** - * Specifies the billing currency code (ISO 4217). - */ - BillingCurrency: string; - - /** - * Indicates the start of the billing period. - */ - BillingPeriodStart: string; - - /** - * Indicates the end of the charge period. - */ - ChargePeriodEnd: string; - - /** - * Indicates the start of the charge period. - */ - ChargePeriodStart: string; - - /** - * Specifies the quantity consumed during this charge period. - */ - ConsumedQuantity: number; - - /** - * A display name for the unit of measurement used for the product (for example, - * "GB-months", "GB-seconds"). May be empty when the unit is implicit in the - * service name. - */ - ConsumedUnit: string; - - /** - * Specifies the cost for this charge period in the billing currency. - */ - ContractedCost: number; - - /** - * Specifies the cumulated cost for the billing period in the billing currency. - */ - CumulatedContractedCost: number; - - /** - * Specifies the cumulated pricing quantity for the billing period. - */ - CumulatedPricingQuantity: number; - - /** - * Specifies the pricing quantity for this charge period. - */ - PricingQuantity: number; - - /** - * Identifies the Cloudflare service. - */ - ServiceName: string; - } -} - -export interface UsagePaygoParams { - /** - * Path param: Represents a Cloudflare resource identifier tag. - */ - account_id: string; - - /** - * Query param: Defines the start date for the usage query (e.g., 2025-02-01). - */ - from?: string; - - /** - * Query param: Defines the end date for the usage query (e.g., 2025-03-01). - */ - to?: string; -} - -export declare namespace Usage { - export { type UsagePaygoResponse as UsagePaygoResponse, type UsagePaygoParams as UsagePaygoParams }; -} +export class Usage extends APIResource {} diff --git a/tests/api-resources/billing/usage.test.ts b/tests/api-resources/billing/usage.test.ts deleted file mode 100644 index c3c3f8ad2f..0000000000 --- a/tests/api-resources/billing/usage.test.ts +++ /dev/null @@ -1,31 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import Cloudflare from 'cloudflare'; -import { Response } from 'node-fetch'; - -const client = new Cloudflare({ - apiKey: '144c9defac04969c7bfad8efaa8ea194', - apiEmail: 'user@example.com', - baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', -}); - -describe('resource usage', () => { - test('paygo: only required params', async () => { - const responsePromise = client.billing.usage.paygo({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); - const rawResponse = await responsePromise.asResponse(); - expect(rawResponse).toBeInstanceOf(Response); - const response = await responsePromise; - expect(response).not.toBeInstanceOf(Response); - const dataAndResponse = await responsePromise.withResponse(); - expect(dataAndResponse.data).toBe(response); - expect(dataAndResponse.response).toBe(rawResponse); - }); - - test('paygo: required and optional params', async () => { - const response = await client.billing.usage.paygo({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - from: '2025-02-01', - to: '2025-03-01', - }); - }); -}); From f0858ff974a1de260c3aa045875729dd3ecf3e72 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 16:10:17 +0000 Subject: [PATCH 55/73] feat: chore: skip custom_certificates.create from CI run 26106703110 * chore: skip custom_certificates.create from CI run 26106703110 Failing prism test on cloudflare-typescript PR #2753 sync: - custom_certificates.create: HTTP 422 (mock returns 422 with empty errors body) CI run: https://github.com/cloudflare/cloudflare-typescript/actions/runs/26106703110 --- .stats.yml | 2 +- .../custom-certificates/custom-certificates.test.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index 09a0c61376..08f37eed69 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 8540f176024efef3ee799015ad4a2dd9 -config_hash: b778c5565760a2c688557888c4ebd31a +config_hash: 4733f7fff69e7d9c38a41bc80ef377de diff --git a/tests/api-resources/custom-certificates/custom-certificates.test.ts b/tests/api-resources/custom-certificates/custom-certificates.test.ts index a3a9510159..90c38fc617 100644 --- a/tests/api-resources/custom-certificates/custom-certificates.test.ts +++ b/tests/api-resources/custom-certificates/custom-certificates.test.ts @@ -10,7 +10,8 @@ const client = new Cloudflare({ }); describe('resource customCertificates', () => { - test('create: only required params', async () => { + // HTTP 422 error from prism + test.skip('create: only required params', async () => { const responsePromise = client.customCertificates.create({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', certificate: @@ -25,7 +26,8 @@ describe('resource customCertificates', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: required and optional params', async () => { + // HTTP 422 error from prism + test.skip('create: required and optional params', async () => { const response = await client.customCertificates.create({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', certificate: From 8282ba002b94b09c15c5122e98421068f842da57 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 16:17:12 +0000 Subject: [PATCH 56/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 08f37eed69..57c3771824 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 8540f176024efef3ee799015ad4a2dd9 -config_hash: 4733f7fff69e7d9c38a41bc80ef377de +config_hash: 86a9b8037b215f0a9c5c69239f9c6cfd From 2f2d2b4ffcef35a0c519b1563df2591f364fdb2d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 18:41:47 +0000 Subject: [PATCH 57/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/organizations/organization-profile.ts | 4 ++-- src/resources/organizations/organizations.ts | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index 57c3771824..3a6ad498e2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 8540f176024efef3ee799015ad4a2dd9 +openapi_spec_hash: d440b6377c255296d9fdc0b89e59b511 config_hash: 86a9b8037b215f0a9c5c69239f9c6cfd diff --git a/src/resources/organizations/organization-profile.ts b/src/resources/organizations/organization-profile.ts index 30e8d3acd1..b4fec7ec80 100644 --- a/src/resources/organizations/organization-profile.ts +++ b/src/resources/organizations/organization-profile.ts @@ -5,7 +5,7 @@ import * as Core from '../../core'; export class OrganizationProfileResource extends APIResource { /** - * Modify organization profile. (Currently in Closed Beta - see + * Modify organization profile. (Currently in Public Beta - see * https://developers.cloudflare.com/fundamentals/organizations/) */ update( @@ -21,7 +21,7 @@ export class OrganizationProfileResource extends APIResource { } /** - * Get an organizations profile if it exists. (Currently in Closed Beta - see + * Get an organizations profile if it exists. (Currently in Public Beta - see * https://developers.cloudflare.com/fundamentals/organizations/) */ get(organizationId: string, options?: Core.RequestOptions): Core.APIPromise { diff --git a/src/resources/organizations/organizations.ts b/src/resources/organizations/organizations.ts index cb4c6b8d56..24029702e7 100644 --- a/src/resources/organizations/organizations.ts +++ b/src/resources/organizations/organizations.ts @@ -19,7 +19,7 @@ export class Organizations extends APIResource { logs: LogsAPI.Logs = new LogsAPI.Logs(this._client); /** - * Create a new organization for a user. (Currently in Closed Beta - see + * Create a new organization for a user. (Currently in Public Beta - see * https://developers.cloudflare.com/fundamentals/organizations/) */ create(body: OrganizationCreateParams, options?: Core.RequestOptions): Core.APIPromise { @@ -29,7 +29,7 @@ export class Organizations extends APIResource { } /** - * Modify organization. (Currently in Closed Beta - see + * Modify organization. (Currently in Public Beta - see * https://developers.cloudflare.com/fundamentals/organizations/) */ update( @@ -46,7 +46,7 @@ export class Organizations extends APIResource { /** * Retrieve a list of organizations a particular user has access to. (Currently in - * Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) + * Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/) */ list( query?: OrganizationListParams, @@ -66,7 +66,7 @@ export class Organizations extends APIResource { /** * Delete an organization. The organization MUST be empty before deleting. It must * not contain any sub-organizations, accounts, members or users. (Currently in - * Closed Beta - see https://developers.cloudflare.com/fundamentals/organizations/) + * Public Beta - see https://developers.cloudflare.com/fundamentals/organizations/) */ delete(organizationId: string, options?: Core.RequestOptions): Core.APIPromise { return ( @@ -77,7 +77,7 @@ export class Organizations extends APIResource { } /** - * Retrieve the details of a certain organization. (Currently in Closed Beta - see + * Retrieve the details of a certain organization. (Currently in Public Beta - see * https://developers.cloudflare.com/fundamentals/organizations/) */ get(organizationId: string, options?: Core.RequestOptions): Core.APIPromise { From 6ee9bc0c37bd9943dadb5e83a43f827826e95c31 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 21:17:59 +0000 Subject: [PATCH 58/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 3a6ad498e2..18cd6c5a6b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: d440b6377c255296d9fdc0b89e59b511 +openapi_spec_hash: 47ba059c643c2fa4d24ca81d3ce8ffc3 config_hash: 86a9b8037b215f0a9c5c69239f9c6cfd From 649a72c699668f9a466577ebbaff27dc0f108432 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 06:08:21 +0000 Subject: [PATCH 59/73] chore(api): update composite API spec --- .stats.yml | 2 +- .../access/applications/policies.ts | 40 +- .../identity-providers/identity-providers.ts | 683 ++++++++++++++++-- 3 files changed, 660 insertions(+), 65 deletions(-) diff --git a/.stats.yml b/.stats.yml index 18cd6c5a6b..17922aede5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 47ba059c643c2fa4d24ca81d3ce8ffc3 +openapi_spec_hash: b3e28b3635caf14765747dd14abcac1a config_hash: 86a9b8037b215f0a9c5c69239f9c6cfd diff --git a/src/resources/zero-trust/access/applications/policies.ts b/src/resources/zero-trust/access/applications/policies.ts index acfd72c6c8..9c771cdf4f 100644 --- a/src/resources/zero-trust/access/applications/policies.ts +++ b/src/resources/zero-trust/access/applications/policies.ts @@ -332,7 +332,8 @@ export type AccessRule = | AccessRule.AccessOIDCClaimRule | ServiceTokenRule | AccessRule.AccessLinkedAppTokenRule - | AccessRule.AccessUserRiskScoreRule; + | AccessRule.AccessUserRiskScoreRule + | AccessRule.AccessCloudflareAccountMemberRule; export namespace AccessRule { /** @@ -452,6 +453,23 @@ export namespace AccessRule { user_risk_score: Array<'low' | 'medium' | 'high' | 'unscored'>; } } + + /** + * Matches users who are members of a specific Cloudflare account. Requires a + * Cloudflare identity provider. + */ + export interface AccessCloudflareAccountMemberRule { + cloudflare_account_member: AccessCloudflareAccountMemberRule.CloudflareAccountMember; + } + + export namespace AccessCloudflareAccountMemberRule { + export interface CloudflareAccountMember { + /** + * Identifier. + */ + account_id?: string; + } + } } /** @@ -482,7 +500,8 @@ export type AccessRuleParam = | AccessRuleParam.AccessOIDCClaimRule | ServiceTokenRuleParam | AccessRuleParam.AccessLinkedAppTokenRule - | AccessRuleParam.AccessUserRiskScoreRule; + | AccessRuleParam.AccessUserRiskScoreRule + | AccessRuleParam.AccessCloudflareAccountMemberRule; export namespace AccessRuleParam { /** @@ -602,6 +621,23 @@ export namespace AccessRuleParam { user_risk_score: Array<'low' | 'medium' | 'high' | 'unscored'>; } } + + /** + * Matches users who are members of a specific Cloudflare account. Requires a + * Cloudflare identity provider. + */ + export interface AccessCloudflareAccountMemberRule { + cloudflare_account_member: AccessCloudflareAccountMemberRule.CloudflareAccountMember; + } + + export namespace AccessCloudflareAccountMemberRule { + export interface CloudflareAccountMember { + /** + * Identifier. + */ + account_id?: string; + } + } } /** diff --git a/src/resources/zero-trust/identity-providers/identity-providers.ts b/src/resources/zero-trust/identity-providers/identity-providers.ts index 33253718a6..247b347509 100644 --- a/src/resources/zero-trust/identity-providers/identity-providers.ts +++ b/src/resources/zero-trust/identity-providers/identity-providers.ts @@ -562,7 +562,8 @@ export type IdentityProvider = | IdentityProvider.AccessPingone | IdentityProvider.AccessSAML | IdentityProvider.AccessYandex - | IdentityProvider.AccessOnetimepin; + | IdentityProvider.AccessOnetimepin + | IdentityProvider.AccessCloudflare; export namespace IdentityProvider { export interface AccessCentrify { @@ -2340,6 +2341,133 @@ export namespace IdentityProvider { } } } + + export interface AccessCloudflare { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + config: AccessCloudflare.Config; + + /** + * The name of the identity provider, shown to users on the login page. + */ + name: string; + + /** + * The type of identity provider. To determine the value for a specific provider, + * refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + type: IdentityProvidersAPI.IdentityProviderType; + + /** + * UUID. + */ + id?: string; + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessCloudflare.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + + /** + * The configuration settings for enabling a System for Cross-Domain Identity + * Management (SCIM) with the identity provider. + */ + scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; + } + + export namespace AccessCloudflare { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + export interface Config { + redirect_url?: string; + + /** + * When enabled, only users who are members of your Cloudflare account can + * authenticate through this identity provider. When disabled, any user with a + * Cloudflare account can authenticate, subject to your Access policies. + */ + restrict_to_account_members?: boolean; + } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } } export type IdentityProviderParam = @@ -2356,7 +2484,8 @@ export type IdentityProviderParam = | IdentityProviderParam.AccessPingone | IdentityProviderParam.AccessSAML | IdentityProviderParam.AccessYandex - | IdentityProviderParam.AccessOnetimepin; + | IdentityProviderParam.AccessOnetimepin + | IdentityProviderParam.AccessCloudflare; export namespace IdentityProviderParam { export interface AccessCentrify { @@ -3162,6 +3291,57 @@ export namespace IdentityProviderParam { */ export interface Config {} } + + export interface AccessCloudflare { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + config: AccessCloudflare.Config; + + /** + * The name of the identity provider, shown to users on the login page. + */ + name: string; + + /** + * The type of identity provider. To determine the value for a specific provider, + * refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + type: IdentityProvidersAPI.IdentityProviderTypeParam; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + + /** + * The configuration settings for enabling a System for Cross-Domain Identity + * Management (SCIM) with the identity provider. + */ + scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfigParam; + } + + export namespace AccessCloudflare { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + export interface Config { + /** + * When enabled, only users who are members of your Cloudflare account can + * authenticate through this identity provider. When disabled, any user with a + * Cloudflare account can authenticate, subject to your Access policies. + */ + restrict_to_account_members?: boolean; + } + } } /** @@ -3265,7 +3445,8 @@ export type IdentityProviderType = | 'okta' | 'onelogin' | 'pingone' - | 'yandex'; + | 'yandex' + | 'cloudflare'; /** * The type of identity provider. To determine the value for a specific provider, @@ -3286,7 +3467,8 @@ export type IdentityProviderTypeParam = | 'okta' | 'onelogin' | 'pingone' - | 'yandex'; + | 'yandex' + | 'cloudflare'; export type IdentityProviderListResponse = | AzureAD @@ -3301,7 +3483,9 @@ export type IdentityProviderListResponse = | IdentityProviderListResponse.AccessOnelogin | IdentityProviderListResponse.AccessPingone | IdentityProviderListResponse.AccessSAML - | IdentityProviderListResponse.AccessYandex; + | IdentityProviderListResponse.AccessYandex + | IdentityProviderListResponse.AccessOnetimepin + | IdentityProviderListResponse.AccessCloudflare; export namespace IdentityProviderListResponse { export interface AccessCentrify { @@ -4959,109 +5143,357 @@ export namespace IdentityProviderListResponse { } } } -} - -export interface IdentityProviderDeleteResponse { - /** - * UUID. - */ - id?: string; -} - -export type IdentityProviderCreateParams = - | IdentityProviderCreateParams.AzureAD - | IdentityProviderCreateParams.AccessCentrify - | IdentityProviderCreateParams.AccessFacebook - | IdentityProviderCreateParams.AccessGitHub - | IdentityProviderCreateParams.AccessGoogle - | IdentityProviderCreateParams.AccessGoogleApps - | IdentityProviderCreateParams.AccessLinkedin - | IdentityProviderCreateParams.AccessOIDC - | IdentityProviderCreateParams.AccessOkta - | IdentityProviderCreateParams.AccessOnelogin - | IdentityProviderCreateParams.AccessPingone - | IdentityProviderCreateParams.AccessSAML - | IdentityProviderCreateParams.AccessYandex - | IdentityProviderCreateParams.AccessOnetimepin; -export declare namespace IdentityProviderCreateParams { - export interface AzureAD { + export interface AccessOnetimepin { /** - * Body param: The configuration parameters for the identity provider. To view the - * required parameters for a specific provider, refer to our + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). */ - config: AzureAD.Config; + config: AccessOnetimepin.Config; /** - * Body param: The name of the identity provider, shown to users on the login page. + * The name of the identity provider, shown to users on the login page. */ name: string; /** - * Body param: The type of identity provider. To determine the value for a specific - * provider, refer to our + * The type of identity provider. To determine the value for a specific provider, + * refer to our * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). */ - type: IdentityProviderTypeParam; + type: IdentityProvidersAPI.IdentityProviderType; /** - * Path param: The Account ID to use for this endpoint. Mutually exclusive with the - * Zone ID. + * UUID. */ - account_id?: string; + id?: string; /** - * Path param: The Zone ID to use for this endpoint. Mutually exclusive with the - * Account ID. + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. */ - zone_id?: string; + saml_certificate_set?: AccessOnetimepin.SAMLCertificateSet; /** - * Body param: The UID of the SAML encryption certificate set assigned to this - * Identity Provider. Only present for SAML identity providers with encryption - * configured. Create a certificate set via POST to + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to * `/identity_providers/{id}/saml_certificate`. */ saml_certificate_set_id?: string; /** - * Body param: The configuration settings for enabling a System for Cross-Domain - * Identity Management (SCIM) with the identity provider. + * The configuration settings for enabling a System for Cross-Domain Identity + * Management (SCIM) with the identity provider. */ - scim_config?: IdentityProviderSCIMConfigParam; + scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; } - export namespace AzureAD { + export namespace AccessOnetimepin { /** * The configuration parameters for the identity provider. To view the required * parameters for a specific provider, refer to our * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). */ export interface Config { + redirect_url?: string; + } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { /** - * Custom claims + * Timestamp when the certificate set was created */ - claims?: Array; + created_at: string; /** - * Your OAuth Client ID + * Unique identifier for the certificate set */ - client_id?: string; + uid: string; /** - * Your OAuth Client Secret + * Timestamp when the certificate set was last updated (e.g., during rotation) */ - client_secret?: string; + updated_at: string; /** - * Should Cloudflare try to load authentication contexts from your account + * The currently active certificate used for encrypting SAML assertions */ - conditional_access_enabled?: boolean; + current_certificate?: SAMLCertificateSet.CurrentCertificate; /** - * Your Azure directory uuid - */ + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } + + export interface AccessCloudflare { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + config: AccessCloudflare.Config; + + /** + * The name of the identity provider, shown to users on the login page. + */ + name: string; + + /** + * The type of identity provider. To determine the value for a specific provider, + * refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + type: IdentityProvidersAPI.IdentityProviderType; + + /** + * UUID. + */ + id?: string; + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + saml_certificate_set?: AccessCloudflare.SAMLCertificateSet; + + /** + * The UID of the SAML encryption certificate set assigned to this Identity + * Provider. Only present for SAML identity providers with encryption configured. + * Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + + /** + * The configuration settings for enabling a System for Cross-Domain Identity + * Management (SCIM) with the identity provider. + */ + scim_config?: IdentityProvidersAPI.IdentityProviderSCIMConfig; + } + + export namespace AccessCloudflare { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + export interface Config { + redirect_url?: string; + + /** + * When enabled, only users who are members of your Cloudflare account can + * authenticate through this identity provider. When disabled, any user with a + * Cloudflare account can authenticate, subject to your Access policies. + */ + restrict_to_account_members?: boolean; + } + + /** + * The SAML encryption certificate set details, including current and previous + * certificates. Only present for SAML identity providers with a certificate set + * assigned. + */ + export interface SAMLCertificateSet { + /** + * Timestamp when the certificate set was created + */ + created_at: string; + + /** + * Unique identifier for the certificate set + */ + uid: string; + + /** + * Timestamp when the certificate set was last updated (e.g., during rotation) + */ + updated_at: string; + + /** + * The currently active certificate used for encrypting SAML assertions + */ + current_certificate?: SAMLCertificateSet.CurrentCertificate; + + /** + * The previous certificate, maintained during rotation to ensure continuity. Null + * if no rotation has occurred. Mirrors the structure of `saml_certificate`. + */ + previous_certificate?: unknown | null; + } + + export namespace SAMLCertificateSet { + /** + * The currently active certificate used for encrypting SAML assertions + */ + export interface CurrentCertificate { + /** + * Indicates whether this is the currently active certificate + */ + is_current: boolean; + + /** + * Certificate expiration date. Certificates are automatically rotated 30 days + * before expiration. + */ + not_after: string; + + /** + * PEM-encoded X.509 certificate containing the public key. Configure this + * certificate in your external SAML Identity Provider to enable encryption. + */ + public_certificate: string; + + /** + * Unique identifier for the certificate + */ + uid: string; + } + } + } +} + +export interface IdentityProviderDeleteResponse { + /** + * UUID. + */ + id?: string; +} + +export type IdentityProviderCreateParams = + | IdentityProviderCreateParams.AzureAD + | IdentityProviderCreateParams.AccessCentrify + | IdentityProviderCreateParams.AccessFacebook + | IdentityProviderCreateParams.AccessGitHub + | IdentityProviderCreateParams.AccessGoogle + | IdentityProviderCreateParams.AccessGoogleApps + | IdentityProviderCreateParams.AccessLinkedin + | IdentityProviderCreateParams.AccessOIDC + | IdentityProviderCreateParams.AccessOkta + | IdentityProviderCreateParams.AccessOnelogin + | IdentityProviderCreateParams.AccessPingone + | IdentityProviderCreateParams.AccessSAML + | IdentityProviderCreateParams.AccessYandex + | IdentityProviderCreateParams.AccessOnetimepin + | IdentityProviderCreateParams.AccessCloudflare; + +export declare namespace IdentityProviderCreateParams { + export interface AzureAD { + /** + * Body param: The configuration parameters for the identity provider. To view the + * required parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + config: AzureAD.Config; + + /** + * Body param: The name of the identity provider, shown to users on the login page. + */ + name: string; + + /** + * Body param: The type of identity provider. To determine the value for a specific + * provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + type: IdentityProviderTypeParam; + + /** + * 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 UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + + /** + * Body param: The configuration settings for enabling a System for Cross-Domain + * Identity Management (SCIM) with the identity provider. + */ + scim_config?: IdentityProviderSCIMConfigParam; + } + + export namespace AzureAD { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + export interface Config { + /** + * Custom claims + */ + claims?: Array; + + /** + * Your OAuth Client ID + */ + client_id?: string; + + /** + * Your OAuth Client Secret + */ + client_secret?: string; + + /** + * Should Cloudflare try to load authentication contexts from your account + */ + conditional_access_enabled?: boolean; + + /** + * Your Azure directory uuid + */ directory_id?: string; /** @@ -6047,6 +6479,69 @@ export declare namespace IdentityProviderCreateParams { */ export interface Config {} } + + export interface AccessCloudflare { + /** + * Body param: The configuration parameters for the identity provider. To view the + * required parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + config: AccessCloudflare.Config; + + /** + * Body param: The name of the identity provider, shown to users on the login page. + */ + name: string; + + /** + * Body param: The type of identity provider. To determine the value for a specific + * provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + type: IdentityProviderTypeParam; + + /** + * 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 UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + + /** + * Body param: The configuration settings for enabling a System for Cross-Domain + * Identity Management (SCIM) with the identity provider. + */ + scim_config?: IdentityProviderSCIMConfigParam; + } + + export namespace AccessCloudflare { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + export interface Config { + /** + * When enabled, only users who are members of your Cloudflare account can + * authenticate through this identity provider. When disabled, any user with a + * Cloudflare account can authenticate, subject to your Access policies. + */ + restrict_to_account_members?: boolean; + } + } } export type IdentityProviderUpdateParams = @@ -6063,7 +6558,8 @@ export type IdentityProviderUpdateParams = | IdentityProviderUpdateParams.AccessPingone | IdentityProviderUpdateParams.AccessSAML | IdentityProviderUpdateParams.AccessYandex - | IdentityProviderUpdateParams.AccessOnetimepin; + | IdentityProviderUpdateParams.AccessOnetimepin + | IdentityProviderUpdateParams.AccessCloudflare; export declare namespace IdentityProviderUpdateParams { export interface AzureAD { @@ -7128,6 +7624,69 @@ export declare namespace IdentityProviderUpdateParams { */ export interface Config {} } + + export interface AccessCloudflare { + /** + * Body param: The configuration parameters for the identity provider. To view the + * required parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + config: AccessCloudflare.Config; + + /** + * Body param: The name of the identity provider, shown to users on the login page. + */ + name: string; + + /** + * Body param: The type of identity provider. To determine the value for a specific + * provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + type: IdentityProviderTypeParam; + + /** + * 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 UID of the SAML encryption certificate set assigned to this + * Identity Provider. Only present for SAML identity providers with encryption + * configured. Create a certificate set via POST to + * `/identity_providers/{id}/saml_certificate`. + */ + saml_certificate_set_id?: string; + + /** + * Body param: The configuration settings for enabling a System for Cross-Domain + * Identity Management (SCIM) with the identity provider. + */ + scim_config?: IdentityProviderSCIMConfigParam; + } + + export namespace AccessCloudflare { + /** + * The configuration parameters for the identity provider. To view the required + * parameters for a specific provider, refer to our + * [developer documentation](https://developers.cloudflare.com/cloudflare-one/identity/idp-integration/). + */ + export interface Config { + /** + * When enabled, only users who are members of your Cloudflare account can + * authenticate through this identity provider. When disabled, any user with a + * Cloudflare account can authenticate, subject to your Access policies. + */ + restrict_to_account_members?: boolean; + } + } } export interface IdentityProviderListParams extends V4PagePaginationArrayParams { From 4837566e7c85cd7025b07664fd04df60d3d6b1f5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 08:40:10 +0000 Subject: [PATCH 60/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/radar/http/http.ts | 22 +++++++++++++++++++++ tests/api-resources/radar/http/http.test.ts | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 17922aede5..3e82f018a2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: b3e28b3635caf14765747dd14abcac1a +openapi_spec_hash: 7720bdb8e0aa36160e01eccca453f6fa config_hash: 86a9b8037b215f0a9c5c69239f9c6cfd diff --git a/src/resources/radar/http/http.ts b/src/resources/radar/http/http.ts index ab2fc7f5de..6345b7b59b 100644 --- a/src/resources/radar/http/http.ts +++ b/src/resources/radar/http/http.ts @@ -830,6 +830,28 @@ export interface HTTPTimeseriesParams { */ browserFamily?: Array<'CHROME' | 'EDGE' | 'FIREFOX' | 'SAFARI'>; + /** + * Filters results by content type category. + */ + contentType?: Array< + | 'HTML' + | 'IMAGES' + | 'JSON' + | 'JAVASCRIPT' + | 'CSS' + | 'PLAIN_TEXT' + | 'FONTS' + | 'XML' + | 'YAML' + | 'VIDEO' + | 'AUDIO' + | 'MARKDOWN' + | 'DOCUMENTS' + | 'BINARY' + | 'SERIALIZATION' + | 'OTHER' + >; + /** * Filters results by continent. Specify a comma-separated list of alpha-2 codes. * Prefix with `-` to exclude continents from results. For example, `-EU,NA` diff --git a/tests/api-resources/radar/http/http.test.ts b/tests/api-resources/radar/http/http.test.ts index 75ee7e9102..de9bb0ea15 100644 --- a/tests/api-resources/radar/http/http.test.ts +++ b/tests/api-resources/radar/http/http.test.ts @@ -87,6 +87,7 @@ describe('resource http', () => { asn: ['string'], botClass: ['LIKELY_AUTOMATED'], browserFamily: ['CHROME'], + contentType: ['HTML'], continent: ['string'], dateEnd: ['2019-12-27T18:11:19.117Z'], dateRange: ['7d'], From 7956761ee3065a65dc594535e05df87cd4458b87 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 13:35:29 +0000 Subject: [PATCH 61/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/email-security/investigate/investigate.ts | 5 ----- .../email-security/investigate/investigate.test.ts | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3e82f018a2..73f8efb9a8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 7720bdb8e0aa36160e01eccca453f6fa +openapi_spec_hash: f77a56d76418917ba1729b1df9411661 config_hash: 86a9b8037b215f0a9c5c69239f9c6cfd diff --git a/src/resources/email-security/investigate/investigate.ts b/src/resources/email-security/investigate/investigate.ts index ed8cf1df14..0360022d24 100644 --- a/src/resources/email-security/investigate/investigate.ts +++ b/src/resources/email-security/investigate/investigate.ts @@ -623,11 +623,6 @@ export interface InvestigateListParams extends V4PagePaginationArrayParams { */ account_id: string; - /** - * Query param: Whether to include the message action log in the response. - */ - action_log?: boolean; - /** * Query param */ diff --git a/tests/api-resources/email-security/investigate/investigate.test.ts b/tests/api-resources/email-security/investigate/investigate.test.ts index f650dcfe6e..39983d6c37 100644 --- a/tests/api-resources/email-security/investigate/investigate.test.ts +++ b/tests/api-resources/email-security/investigate/investigate.test.ts @@ -26,7 +26,6 @@ describe('resource investigate', () => { test('list: required and optional params', async () => { const response = await client.emailSecurity.investigate.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', - action_log: true, alert_id: 'alert_id', cursor: 'cursor', delivery_status: 'delivered', From 6ca594ce22ca3625c3a777c3a548732dacafbd53 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 14:06:50 +0000 Subject: [PATCH 62/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 73f8efb9a8..f01d25b44c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2269 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: f77a56d76418917ba1729b1df9411661 +openapi_spec_hash: 8971031a5a99754bad74cc2f51730e51 config_hash: 86a9b8037b215f0a9c5c69239f9c6cfd From a68802a4391fba991e156ee93f92c9512fdae933 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 14:44:01 +0000 Subject: [PATCH 63/73] feat: feat(billing): add billable usage endpoints for accounts and organizations (v2) * feat(billing): add billable usage endpoints for accounts and organizations (v2) --- .stats.yml | 4 +- scripts/detect-breaking-changes | 3 + src/resources/billing/api.md | 10 + src/resources/billing/billing.ts | 10 +- src/resources/billing/index.ts | 8 +- src/resources/billing/usage.ts | 365 +++++++++++++++++- src/resources/organizations/api.md | 12 + src/resources/organizations/billing.ts | 3 + .../organizations/billing/billing.ts | 15 + src/resources/organizations/billing/index.ts | 4 + src/resources/organizations/billing/usage.ts | 270 +++++++++++++ src/resources/organizations/index.ts | 1 + src/resources/organizations/organizations.ts | 6 + tests/api-resources/billing/usage.test.ts | 51 +++ .../organizations/billing/usage.test.ts | 47 +++ .../organizations/logs/audit.test.ts | 4 +- 16 files changed, 805 insertions(+), 8 deletions(-) create mode 100644 src/resources/organizations/billing.ts create mode 100644 src/resources/organizations/billing/billing.ts create mode 100644 src/resources/organizations/billing/index.ts create mode 100644 src/resources/organizations/billing/usage.ts create mode 100644 tests/api-resources/billing/usage.test.ts create mode 100644 tests/api-resources/organizations/billing/usage.test.ts diff --git a/.stats.yml b/.stats.yml index f01d25b44c..d79ed4d5be 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2269 +configured_endpoints: 2272 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 8971031a5a99754bad74cc2f51730e51 -config_hash: 86a9b8037b215f0a9c5c69239f9c6cfd +config_hash: 0148d517bb02129e9e259f11db3933eb diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 7920d4f14c..79d033667d 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -20,6 +20,8 @@ TEST_PATHS=( tests/api-resources/organizations/organization-profile.test.ts tests/api-resources/organizations/logs/logs.test.ts tests/api-resources/organizations/logs/audit.test.ts + tests/api-resources/organizations/billing/billing.test.ts + tests/api-resources/organizations/billing/usage.test.ts tests/api-resources/origin-ca-certificates.test.ts tests/api-resources/ips.test.ts tests/api-resources/memberships.test.ts @@ -279,6 +281,7 @@ TEST_PATHS=( tests/api-resources/audit-logs.test.ts tests/api-resources/billing/billing.test.ts tests/api-resources/billing/profiles.test.ts + tests/api-resources/billing/usage.test.ts tests/api-resources/brand-protection/brand-protection.test.ts tests/api-resources/brand-protection/queries.test.ts tests/api-resources/brand-protection/matches.test.ts diff --git a/src/resources/billing/api.md b/src/resources/billing/api.md index 610f577164..37464355c0 100644 --- a/src/resources/billing/api.md +++ b/src/resources/billing/api.md @@ -11,3 +11,13 @@ Methods: - client.billing.profiles.get({ ...params }) -> ProfileGetResponse ## Usage + +Types: + +- UsageGetResponse +- UsagePaygoResponse + +Methods: + +- client.billing.usage.get({ ...params }) -> UsageGetResponse +- client.billing.usage.paygo({ ...params }) -> UsagePaygoResponse diff --git a/src/resources/billing/billing.ts b/src/resources/billing/billing.ts index 3e8620705f..54f01767a3 100644 --- a/src/resources/billing/billing.ts +++ b/src/resources/billing/billing.ts @@ -4,7 +4,7 @@ import { APIResource } from '../../resource'; import * as ProfilesAPI from './profiles'; import { ProfileGetParams, ProfileGetResponse, Profiles } from './profiles'; import * as UsageAPI from './usage'; -import { Usage } from './usage'; +import { Usage, UsageGetParams, UsageGetResponse, UsagePaygoParams, UsagePaygoResponse } from './usage'; export class Billing extends APIResource { profiles: ProfilesAPI.Profiles = new ProfilesAPI.Profiles(this._client); @@ -21,5 +21,11 @@ export declare namespace Billing { type ProfileGetParams as ProfileGetParams, }; - export { Usage as Usage }; + export { + Usage as Usage, + type UsageGetResponse as UsageGetResponse, + type UsagePaygoResponse as UsagePaygoResponse, + type UsageGetParams as UsageGetParams, + type UsagePaygoParams as UsagePaygoParams, + }; } diff --git a/src/resources/billing/index.ts b/src/resources/billing/index.ts index 6a4ef8bc0f..5b7aea6bc7 100644 --- a/src/resources/billing/index.ts +++ b/src/resources/billing/index.ts @@ -2,4 +2,10 @@ export { Billing } from './billing'; export { Profiles, type ProfileGetResponse, type ProfileGetParams } from './profiles'; -export { Usage } from './usage'; +export { + Usage, + type UsageGetResponse, + type UsagePaygoResponse, + type UsageGetParams, + type UsagePaygoParams, +} from './usage'; diff --git a/src/resources/billing/usage.ts b/src/resources/billing/usage.ts index abbcd69967..c4ba65743d 100644 --- a/src/resources/billing/usage.ts +++ b/src/resources/billing/usage.ts @@ -1,5 +1,368 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; +import * as Core from '../../core'; -export class Usage extends APIResource {} +export class Usage extends APIResource { + /** + * Returns cost and usage data for a single Cloudflare account, aligned with the + * [FinOps FOCUS v1.3](https://focus.finops.org/focus-specification/v1-3/) Cost and + * Usage dataset specification. + * + * Each record represents one billable metric for one account on one day. This + * includes all metered usage, including usage that falls within free-tier + * allowances and may result in zero cost. + * + * **Note:** Cost and pricing fields are not yet populated and will be absent from + * responses until billing integration is complete. + * + * When `from` and `to` are omitted, defaults to the start of the current month + * through today. The maximum date range is 31 days. + */ + get(params: UsageGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/billable/usage`, { query, ...options }) as Core.APIPromise<{ + result: UsageGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Returns billable usage data for PayGo (self-serve) accounts. When no query + * parameters are provided, returns usage for the current billing period. This + * endpoint is currently in alpha and access is restricted to select accounts. + * While in alpha, the endpoint may get breaking changes. + */ + paygo(params: UsagePaygoParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...query } = params; + return ( + this._client.get(`/accounts/${account_id}/paygo-usage`, { query, ...options }) as Core.APIPromise<{ + result: UsagePaygoResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * Contains the array of cost and usage records. + */ +export type UsageGetResponse = Array; + +export namespace UsageGetResponse { + /** + * A single cost and usage record for a metered product within a specific charge + * period, aligned with the FinOps FOCUS v1.3 specification. + */ + export interface UsageGetResponseItem { + /** + * Public identifier of the Cloudflare account (account tag). + */ + BillingAccountId: string; + + /** + * Display name of the Cloudflare account. + */ + BillingAccountName: string; + + /** + * Highest-level classification of a charge based on the nature of how it gets + * billed. Currently only "Usage" is supported. + */ + ChargeCategory: 'Usage'; + + /** + * Self-contained summary of the charge's purpose and price. + */ + ChargeDescription: string; + + /** + * Indicates how often a charge occurs. Currently only "Usage-Based" is supported. + */ + ChargeFrequency: 'Usage-Based'; + + /** + * Exclusive end of the time interval during which the usage was consumed. + */ + ChargePeriodEnd: string; + + /** + * Inclusive start of the time interval during which the usage was consumed. + */ + ChargePeriodStart: string; + + /** + * Measured usage amount within the charge period. Reflects raw metered consumption + * before pricing transformations. + */ + ConsumedQuantity: number; + + /** + * Unit of measure for the consumed quantity (e.g., "GB", "Requests", + * "vCPU-Hours"). + */ + ConsumedUnit: string; + + /** + * Name of the entity providing the underlying infrastructure or platform. + */ + HostProviderName: string; + + /** + * Name of the entity responsible for invoicing for the services consumed. + */ + InvoiceIssuerName: string; + + /** + * Name of the entity that made the services available for purchase. + */ + ServiceProviderName: string; + + /** + * The display name of the billable metric. Cloudflare extension; replaces FOCUS + * SkuMeter. + */ + x_BillableMetricName: string; + + /** + * A charge serving as the basis for invoicing, inclusive of all reduced rates and + * discounts while excluding the amortization of upfront charges (one-time or + * recurring). + */ + BilledCost?: number | null; + + /** + * Currency that a charge was billed in (ISO 4217). + */ + BillingCurrency?: string | null; + + /** + * Exclusive end of the billing cycle that contains this usage record. + */ + BillingPeriodEnd?: string | null; + + /** + * Inclusive start of the billing cycle that contains this usage record. + */ + BillingPeriodStart?: string | null; + + /** + * Indicates whether the row represents a correction to one or more charges + * invoiced in a previous billing period. + */ + ChargeClass?: 'Correction' | null; + + /** + * Cost calculated by multiplying ContractedUnitPrice and the corresponding + * PricingQuantity. + */ + ContractedCost?: number | null; + + /** + * The agreed-upon unit price for a single PricingUnit of the associated billable + * metric, inclusive of negotiated discounts, if present, while excluding any other + * discounts. + */ + ContractedUnitPrice?: number | null; + + /** + * The amortized cost of the charge after applying all reduced rates, discounts, + * and the applicable portion of relevant, prepaid purchases (one-time or + * recurring) that covered the charge. + */ + EffectiveCost?: number | null; + + /** + * Cost calculated by multiplying ListUnitPrice and the corresponding + * PricingQuantity. + */ + ListCost?: number | null; + + /** + * Suggested provider-published unit price for a single PricingUnit of the + * associated billable metric, exclusive of any discounts. + */ + ListUnitPrice?: number | null; + + /** + * Volume of a given service used or purchased, based on the PricingUnit. + */ + PricingQuantity?: number | null; + + /** + * Provider-specified measurement unit for determining unit prices, indicating how + * the provider rates measured usage after applying pricing rules like block + * pricing. + */ + PricingUnit?: string | null; + + /** + * Provider-assigned identifier for an isolated geographic area where a service is + * provided. + */ + RegionId?: string | null; + + /** + * Name of an isolated geographic area where a service is provided. + */ + RegionName?: string | null; + + /** + * Unique identifier assigned to a grouping of services. For Cloudflare, this is + * the subscription or contract ID. + */ + SubAccountId?: string; + + /** + * Name assigned to a grouping of services. For Cloudflare, this is the + * subscription or contract display name. + */ + SubAccountName?: string; + + /** + * The unique identifier for the billable metric in the Cloudflare catalog. + * Cloudflare extension; replaces FOCUS SkuId. + */ + x_BillableMetricId?: string; + + /** + * The product family the charge belongs to (e.g., "R2", "Workers"). Cloudflare + * extension; replaces FOCUS ServiceName. + */ + x_ProductFamilyName?: string; + + /** + * The identifier for the Cloudflare zone (zone tag). Cloudflare extension. + */ + x_ZoneId?: string | null; + + /** + * The display name of the Cloudflare zone. Cloudflare extension. + */ + x_ZoneName?: string | null; + } +} + +/** + * Contains the array of billable usage records. + */ +export type UsagePaygoResponse = Array; + +export namespace UsagePaygoResponse { + /** + * Represents a single billable usage record. + */ + export interface UsagePaygoResponseItem { + /** + * Specifies the billing currency code (ISO 4217). + */ + BillingCurrency: string; + + /** + * Indicates the start of the billing period. + */ + BillingPeriodStart: string; + + /** + * Indicates the end of the charge period. + */ + ChargePeriodEnd: string; + + /** + * Indicates the start of the charge period. + */ + ChargePeriodStart: string; + + /** + * Specifies the quantity consumed during this charge period. + */ + ConsumedQuantity: number; + + /** + * A display name for the unit of measurement used for the product (for example, + * "GB-months", "GB-seconds"). May be empty when the unit is implicit in the + * service name. + */ + ConsumedUnit: string; + + /** + * Specifies the cost for this charge period in the billing currency. + */ + ContractedCost: number; + + /** + * Specifies the cumulated cost for the billing period in the billing currency. + */ + CumulatedContractedCost: number; + + /** + * Specifies the cumulated pricing quantity for the billing period. + */ + CumulatedPricingQuantity: number; + + /** + * Specifies the pricing quantity for this charge period. + */ + PricingQuantity: number; + + /** + * Identifies the Cloudflare service. + */ + ServiceName: string; + } +} + +export interface UsageGetParams { + /** + * Path param: Represents a Cloudflare resource identifier tag. + */ + account_id: string; + + /** + * Query param: Start date for the usage query (ISO 8601). Required if `to` is set. + * When omitted along with `to`, defaults to the start of the current month. + * Filters by charge period (when consumption happened), not billing period. The + * maximum date range is 31 days. + */ + from?: string; + + /** + * Query param: Filter results by billable metric id (e.g., + * workers_standard_requests). + */ + metric?: string; + + /** + * Query param: End date for the usage query (ISO 8601). Required if `from` is set. + * When omitted along with `from`, defaults to today. Filters by charge period + * (when consumption happened), not billing period. The maximum date range is 31 + * days. + */ + to?: string; +} + +export interface UsagePaygoParams { + /** + * Path param: Represents a Cloudflare resource identifier tag. + */ + account_id: string; + + /** + * Query param: Start date for the usage query (ISO 8601). + */ + from?: string; + + /** + * Query param: End date for the usage query (ISO 8601). + */ + to?: string; +} + +export declare namespace Usage { + export { + type UsageGetResponse as UsageGetResponse, + type UsagePaygoResponse as UsagePaygoResponse, + type UsageGetParams as UsageGetParams, + type UsagePaygoParams as UsagePaygoParams, + }; +} diff --git a/src/resources/organizations/api.md b/src/resources/organizations/api.md index cde589d54b..fa03e39571 100644 --- a/src/resources/organizations/api.md +++ b/src/resources/organizations/api.md @@ -35,3 +35,15 @@ Types: Methods: - client.organizations.logs.audit.list(organizationId, { ...params }) -> AuditListResponsesCursorPaginationAfter + +## Billing + +### Usage + +Types: + +- UsageGetResponse + +Methods: + +- client.organizations.billing.usage.get(organizationId, { ...params }) -> UsageGetResponse diff --git a/src/resources/organizations/billing.ts b/src/resources/organizations/billing.ts new file mode 100644 index 0000000000..565ff303e6 --- /dev/null +++ b/src/resources/organizations/billing.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './billing/index'; diff --git a/src/resources/organizations/billing/billing.ts b/src/resources/organizations/billing/billing.ts new file mode 100644 index 0000000000..98cc8ca70e --- /dev/null +++ b/src/resources/organizations/billing/billing.ts @@ -0,0 +1,15 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as UsageAPI from './usage'; +import { Usage, UsageGetParams, UsageGetResponse } from './usage'; + +export class Billing extends APIResource { + usage: UsageAPI.Usage = new UsageAPI.Usage(this._client); +} + +Billing.Usage = Usage; + +export declare namespace Billing { + export { Usage as Usage, type UsageGetResponse as UsageGetResponse, type UsageGetParams as UsageGetParams }; +} diff --git a/src/resources/organizations/billing/index.ts b/src/resources/organizations/billing/index.ts new file mode 100644 index 0000000000..625598c954 --- /dev/null +++ b/src/resources/organizations/billing/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { Billing } from './billing'; +export { Usage, type UsageGetResponse, type UsageGetParams } from './usage'; diff --git a/src/resources/organizations/billing/usage.ts b/src/resources/organizations/billing/usage.ts new file mode 100644 index 0000000000..211cd0892d --- /dev/null +++ b/src/resources/organizations/billing/usage.ts @@ -0,0 +1,270 @@ +// 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 Usage extends APIResource { + /** + * Returns cost and usage data for all accounts within an organization, aligned + * with the [FinOps FOCUS v1.3](https://focus.finops.org/focus-specification/v1-3/) + * Cost and Usage dataset specification. + * + * Each record represents one billable metric for one account on one day. This + * includes all metered usage, including usage that falls within free-tier + * allowances and may result in zero cost. The response includes usage for every + * account belonging to the specified organization. + * + * **Note:** Cost and pricing fields are not yet populated and will be absent from + * responses until billing integration is complete. + * + * When `from` and `to` are omitted, defaults to the start of the current month + * through today. The maximum date range is 31 days. + */ + get( + organizationId: string, + query?: UsageGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + get(organizationId: string, options?: Core.RequestOptions): Core.APIPromise; + get( + organizationId: string, + query: UsageGetParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.get(organizationId, {}, query); + } + return ( + this._client.get(`/organizations/${organizationId}/billable/usage`, { + query, + ...options, + }) as Core.APIPromise<{ result: UsageGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +/** + * Contains the array of cost and usage records. + */ +export type UsageGetResponse = Array; + +export namespace UsageGetResponse { + /** + * A single cost and usage record for a metered product within a specific charge + * period, aligned with the FinOps FOCUS v1.3 specification. + */ + export interface UsageGetResponseItem { + /** + * Public identifier of the Cloudflare account (account tag). + */ + BillingAccountId: string; + + /** + * Display name of the Cloudflare account. + */ + BillingAccountName: string; + + /** + * Highest-level classification of a charge based on the nature of how it gets + * billed. Currently only "Usage" is supported. + */ + ChargeCategory: 'Usage'; + + /** + * Self-contained summary of the charge's purpose and price. + */ + ChargeDescription: string; + + /** + * Indicates how often a charge occurs. Currently only "Usage-Based" is supported. + */ + ChargeFrequency: 'Usage-Based'; + + /** + * Exclusive end of the time interval during which the usage was consumed. + */ + ChargePeriodEnd: string; + + /** + * Inclusive start of the time interval during which the usage was consumed. + */ + ChargePeriodStart: string; + + /** + * Measured usage amount within the charge period. Reflects raw metered consumption + * before pricing transformations. + */ + ConsumedQuantity: number; + + /** + * Unit of measure for the consumed quantity (e.g., "GB", "Requests", + * "vCPU-Hours"). + */ + ConsumedUnit: string; + + /** + * Name of the entity providing the underlying infrastructure or platform. + */ + HostProviderName: string; + + /** + * Name of the entity responsible for invoicing for the services consumed. + */ + InvoiceIssuerName: string; + + /** + * Name of the entity that made the services available for purchase. + */ + ServiceProviderName: string; + + /** + * The display name of the billable metric. Cloudflare extension; replaces FOCUS + * SkuMeter. + */ + x_BillableMetricName: string; + + /** + * A charge serving as the basis for invoicing, inclusive of all reduced rates and + * discounts while excluding the amortization of upfront charges (one-time or + * recurring). + */ + BilledCost?: number | null; + + /** + * Currency that a charge was billed in (ISO 4217). + */ + BillingCurrency?: string | null; + + /** + * Exclusive end of the billing cycle that contains this usage record. + */ + BillingPeriodEnd?: string | null; + + /** + * Inclusive start of the billing cycle that contains this usage record. + */ + BillingPeriodStart?: string | null; + + /** + * Indicates whether the row represents a correction to one or more charges + * invoiced in a previous billing period. + */ + ChargeClass?: 'Correction' | null; + + /** + * Cost calculated by multiplying ContractedUnitPrice and the corresponding + * PricingQuantity. + */ + ContractedCost?: number | null; + + /** + * The agreed-upon unit price for a single PricingUnit of the associated billable + * metric, inclusive of negotiated discounts, if present, while excluding any other + * discounts. + */ + ContractedUnitPrice?: number | null; + + /** + * The amortized cost of the charge after applying all reduced rates, discounts, + * and the applicable portion of relevant, prepaid purchases (one-time or + * recurring) that covered the charge. + */ + EffectiveCost?: number | null; + + /** + * Cost calculated by multiplying ListUnitPrice and the corresponding + * PricingQuantity. + */ + ListCost?: number | null; + + /** + * Suggested provider-published unit price for a single PricingUnit of the + * associated billable metric, exclusive of any discounts. + */ + ListUnitPrice?: number | null; + + /** + * Volume of a given service used or purchased, based on the PricingUnit. + */ + PricingQuantity?: number | null; + + /** + * Provider-specified measurement unit for determining unit prices, indicating how + * the provider rates measured usage after applying pricing rules like block + * pricing. + */ + PricingUnit?: string | null; + + /** + * Provider-assigned identifier for an isolated geographic area where a service is + * provided. + */ + RegionId?: string | null; + + /** + * Name of an isolated geographic area where a service is provided. + */ + RegionName?: string | null; + + /** + * Unique identifier assigned to a grouping of services. For Cloudflare, this is + * the subscription or contract ID. + */ + SubAccountId?: string; + + /** + * Name assigned to a grouping of services. For Cloudflare, this is the + * subscription or contract display name. + */ + SubAccountName?: string; + + /** + * The unique identifier for the billable metric in the Cloudflare catalog. + * Cloudflare extension; replaces FOCUS SkuId. + */ + x_BillableMetricId?: string; + + /** + * The product family the charge belongs to (e.g., "R2", "Workers"). Cloudflare + * extension; replaces FOCUS ServiceName. + */ + x_ProductFamilyName?: string; + + /** + * The identifier for the Cloudflare zone (zone tag). Cloudflare extension. + */ + x_ZoneId?: string | null; + + /** + * The display name of the Cloudflare zone. Cloudflare extension. + */ + x_ZoneName?: string | null; + } +} + +export interface UsageGetParams { + /** + * Start date for the usage query (ISO 8601). Required if `to` is set. When omitted + * along with `to`, defaults to the start of the current month. Filters by charge + * period (when consumption happened), not billing period. The maximum date range + * is 31 days. + */ + from?: string; + + /** + * Filter results by billable metric id (e.g., workers_standard_requests). + */ + metric?: string; + + /** + * End date for the usage query (ISO 8601). Required if `from` is set. When omitted + * along with `from`, defaults to today. Filters by charge period (when consumption + * happened), not billing period. The maximum date range is 31 days. + */ + to?: string; +} + +export declare namespace Usage { + export { type UsageGetResponse as UsageGetResponse, type UsageGetParams as UsageGetParams }; +} diff --git a/src/resources/organizations/index.ts b/src/resources/organizations/index.ts index 1f684f2e80..dd4b054979 100644 --- a/src/resources/organizations/index.ts +++ b/src/resources/organizations/index.ts @@ -1,5 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +export { Billing } from './billing/index'; export { Logs } from './logs/index'; export { OrganizationProfileResource, diff --git a/src/resources/organizations/organizations.ts b/src/resources/organizations/organizations.ts index 24029702e7..05631945fe 100644 --- a/src/resources/organizations/organizations.ts +++ b/src/resources/organizations/organizations.ts @@ -9,6 +9,8 @@ import { OrganizationProfileResource, OrganizationProfileUpdateParams, } from './organization-profile'; +import * as BillingAPI from './billing/billing'; +import { Billing } from './billing/billing'; import * as LogsAPI from './logs/logs'; import { Logs } from './logs/logs'; import { SinglePage } from '../../pagination'; @@ -17,6 +19,7 @@ export class Organizations extends APIResource { organizationProfile: OrganizationProfileAPI.OrganizationProfileResource = new OrganizationProfileAPI.OrganizationProfileResource(this._client); logs: LogsAPI.Logs = new LogsAPI.Logs(this._client); + billing: BillingAPI.Billing = new BillingAPI.Billing(this._client); /** * Create a new organization for a user. (Currently in Public Beta - see @@ -300,6 +303,7 @@ export namespace OrganizationListParams { Organizations.OrganizationsSinglePage = OrganizationsSinglePage; Organizations.OrganizationProfileResource = OrganizationProfileResource; Organizations.Logs = Logs; +Organizations.Billing = Billing; export declare namespace Organizations { export { @@ -318,4 +322,6 @@ export declare namespace Organizations { }; export { Logs as Logs }; + + export { Billing as Billing }; } diff --git a/tests/api-resources/billing/usage.test.ts b/tests/api-resources/billing/usage.test.ts new file mode 100644 index 0000000000..17ea7447e7 --- /dev/null +++ b/tests/api-resources/billing/usage.test.ts @@ -0,0 +1,51 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource usage', () => { + test('get: only required params', async () => { + const responsePromise = client.billing.usage.get({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.billing.usage.get({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + from: '2025-05-01', + metric: 'workers_standard_requests', + to: '2025-05-31', + }); + }); + + test('paygo: only required params', async () => { + const responsePromise = client.billing.usage.paygo({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('paygo: required and optional params', async () => { + const response = await client.billing.usage.paygo({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + from: '2025-05-01', + to: '2025-05-31', + }); + }); +}); diff --git a/tests/api-resources/organizations/billing/usage.test.ts b/tests/api-resources/organizations/billing/usage.test.ts new file mode 100644 index 0000000000..3c959876b9 --- /dev/null +++ b/tests/api-resources/organizations/billing/usage.test.ts @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource usage', () => { + test('get', async () => { + const responsePromise = client.organizations.billing.usage.get('023e105f4ecef8ad9ca31a8372d0c353'); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: request options instead of params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.organizations.billing.usage.get('023e105f4ecef8ad9ca31a8372d0c353', { + path: '/_stainless_unknown_path', + }), + ).rejects.toThrow(Cloudflare.NotFoundError); + }); + + test('get: request options and params are passed correctly', async () => { + // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error + await expect( + client.organizations.billing.usage.get( + '023e105f4ecef8ad9ca31a8372d0c353', + { + from: '2025-05-01', + metric: 'workers_standard_requests', + to: '2025-05-31', + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Cloudflare.NotFoundError); + }); +}); diff --git a/tests/api-resources/organizations/logs/audit.test.ts b/tests/api-resources/organizations/logs/audit.test.ts index 23ff07799e..d56134d36b 100644 --- a/tests/api-resources/organizations/logs/audit.test.ts +++ b/tests/api-resources/organizations/logs/audit.test.ts @@ -10,7 +10,7 @@ const client = new Cloudflare({ }); describe('resource audit', () => { - // TODO: required params 'since' and 'before' not populated by Prism mock + // TODO DS-16345: required params 'since' and 'before' not populated by Prism mock test.skip('list: only required params', async () => { const responsePromise = client.organizations.logs.audit.list('a67e14daa5f8dceeb91fe5449ba496ef', { before: '2024-10-31', @@ -25,7 +25,7 @@ describe('resource audit', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // TODO: required params 'since' and 'before' not populated by Prism mock + // TODO DS-16345: required params 'since' and 'before' not populated by Prism mock test.skip('list: required and optional params', async () => { const response = await client.organizations.logs.audit.list('a67e14daa5f8dceeb91fe5449ba496ef', { before: '2024-10-31', From 4d559990930510b8a25204279bdf5e2400c30713 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 15:58:13 +0000 Subject: [PATCH 64/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/billing/usage.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index d79ed4d5be..dc3340493b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2272 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 8971031a5a99754bad74cc2f51730e51 +openapi_spec_hash: f60cc2af36bbe305cda4bc0ad0617ff6 config_hash: 0148d517bb02129e9e259f11db3933eb diff --git a/src/resources/billing/usage.ts b/src/resources/billing/usage.ts index c4ba65743d..14bff35e50 100644 --- a/src/resources/billing/usage.ts +++ b/src/resources/billing/usage.ts @@ -309,6 +309,11 @@ export namespace UsagePaygoResponse { * Identifies the Cloudflare service. */ ServiceName: string; + + /** + * Identifies the product family for the Cloudflare service. + */ + ServiceFamilyName?: string; } } From 4eb23bca5e2eb432d9941a486444c4ddceb0dc81 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 18:21:15 +0000 Subject: [PATCH 65/73] chore(api): update composite API spec --- .stats.yml | 2 +- src/resources/email-sending/email-sending.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index dc3340493b..0577a14a90 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2272 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: f60cc2af36bbe305cda4bc0ad0617ff6 +openapi_spec_hash: 5cb356a7285c13aebeecc5b9e9a89f39 config_hash: 0148d517bb02129e9e259f11db3933eb diff --git a/src/resources/email-sending/email-sending.ts b/src/resources/email-sending/email-sending.ts index da2106b749..a5c7c3980f 100644 --- a/src/resources/email-sending/email-sending.ts +++ b/src/resources/email-sending/email-sending.ts @@ -155,7 +155,7 @@ export interface EmailSendingSendParams { /** * Body param: HTML body of the email. At least one of text or html must be - * provided. + * provided (non-empty). */ html?: string; @@ -167,7 +167,7 @@ export interface EmailSendingSendParams { /** * Body param: Plain text body of the email. At least one of text or html must be - * provided. + * provided (non-empty). */ text?: string; } From 8dd49f2e95474a447a7809259cfb40f36ce052ea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 May 2026 06:08:21 +0000 Subject: [PATCH 66/73] chore(api): update composite API spec --- .stats.yml | 2 +- .../dispatch/namespaces/scripts/scripts.ts | 18 ++++++++ .../dispatch/namespaces/scripts/settings.ts | 27 +++++++++++ src/resources/workers/beta/workers/workers.ts | 36 +++++++++++++++ .../scripts/script-and-version-settings.ts | 27 +++++++++++ src/resources/workers/scripts/scripts.ts | 45 +++++++++++++++++++ src/resources/workers/scripts/settings.ts | 9 ++++ .../namespaces/scripts/scripts.test.ts | 1 + .../namespaces/scripts/settings.test.ts | 1 + .../workers/beta/workers/workers.test.ts | 3 ++ .../script-and-version-settings.test.ts | 1 + .../workers/scripts/scripts.test.ts | 1 + .../workers/scripts/settings.test.ts | 1 + 13 files changed, 171 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 0577a14a90..5f42f4728d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2272 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 5cb356a7285c13aebeecc5b9e9a89f39 +openapi_spec_hash: 1eb5ca50c3a6934eeb13505783d992bf config_hash: 0148d517bb02129e9e259f11db3933eb diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts index 90b84a0bc8..0e8321affa 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.ts @@ -398,6 +398,15 @@ export namespace ScriptUpdateResponse { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -1718,6 +1727,15 @@ export namespace ScriptUpdateParams { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } diff --git a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/settings.ts b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/settings.ts index 61cc86d93d..0f84937444 100644 --- a/src/resources/workers-for-platforms/dispatch/namespaces/scripts/settings.ts +++ b/src/resources/workers-for-platforms/dispatch/namespaces/scripts/settings.ts @@ -1023,6 +1023,15 @@ export namespace SettingEditResponse { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -2087,6 +2096,15 @@ export namespace SettingGetResponse { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -3206,6 +3224,15 @@ export namespace SettingEditParams { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } diff --git a/src/resources/workers/beta/workers/workers.ts b/src/resources/workers/beta/workers/workers.ts index 663d32de8b..560abe8725 100644 --- a/src/resources/workers/beta/workers/workers.ts +++ b/src/resources/workers/beta/workers/workers.ts @@ -306,6 +306,15 @@ export namespace Worker { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -631,6 +640,15 @@ export namespace WorkerCreateParams { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -778,6 +796,15 @@ export namespace WorkerUpdateParams { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -949,6 +976,15 @@ export namespace WorkerEditParams { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } diff --git a/src/resources/workers/scripts/script-and-version-settings.ts b/src/resources/workers/scripts/script-and-version-settings.ts index 539ba15c3e..a79c472432 100644 --- a/src/resources/workers/scripts/script-and-version-settings.ts +++ b/src/resources/workers/scripts/script-and-version-settings.ts @@ -1044,6 +1044,15 @@ export namespace ScriptAndVersionSettingEditResponse { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -2133,6 +2142,15 @@ export namespace ScriptAndVersionSettingGetResponse { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -3269,6 +3287,15 @@ export namespace ScriptAndVersionSettingEditParams { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } diff --git a/src/resources/workers/scripts/scripts.ts b/src/resources/workers/scripts/scripts.ts index e89ab5bd5d..39fbcd352c 100644 --- a/src/resources/workers/scripts/scripts.ts +++ b/src/resources/workers/scripts/scripts.ts @@ -446,6 +446,15 @@ export namespace Script { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -751,6 +760,15 @@ export namespace ScriptSetting { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } } @@ -979,6 +997,15 @@ export namespace ScriptUpdateResponse { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -1401,6 +1428,15 @@ export namespace ScriptListResponse { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } @@ -2802,6 +2838,15 @@ export namespace ScriptUpdateParams { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } diff --git a/src/resources/workers/scripts/settings.ts b/src/resources/workers/scripts/settings.ts index c0c914ce11..7013744d69 100644 --- a/src/resources/workers/scripts/settings.ts +++ b/src/resources/workers/scripts/settings.ts @@ -173,6 +173,15 @@ export namespace SettingEditParams { * Whether trace persistence is enabled for the Worker. */ persist?: boolean; + + /** + * Controls how inbound trace context (traceparent/tracestate) headers on incoming + * requests are handled. "authenticated" (default) honors inbound trace context + * only when accompanied by a valid trace auth token. "accept" unconditionally + * accepts inbound trace context. Requires the trace propagation feature to be + * enabled. + */ + propagation_policy?: 'authenticated' | 'accept'; } } } diff --git a/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.test.ts b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.test.ts index 532c922715..837c08369c 100644 --- a/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.test.ts +++ b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/scripts.test.ts @@ -93,6 +93,7 @@ describe('resource scripts', () => { enabled: true, head_sampling_rate: 0.1, persist: true, + propagation_policy: 'authenticated', }, }, placement: { mode: 'smart' }, diff --git a/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/settings.test.ts b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/settings.test.ts index 3c669f83ff..611dc2cfa4 100644 --- a/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/settings.test.ts +++ b/tests/api-resources/workers-for-platforms/dispatch/namespaces/scripts/settings.test.ts @@ -75,6 +75,7 @@ describe('resource settings', () => { enabled: true, head_sampling_rate: 0.1, persist: true, + propagation_policy: 'authenticated', }, }, placement: { mode: 'smart' }, diff --git a/tests/api-resources/workers/beta/workers/workers.test.ts b/tests/api-resources/workers/beta/workers/workers.test.ts index 4cce795492..807cefd628 100644 --- a/tests/api-resources/workers/beta/workers/workers.test.ts +++ b/tests/api-resources/workers/beta/workers/workers.test.ts @@ -46,6 +46,7 @@ describe('resource workers', () => { enabled: true, head_sampling_rate: 1, persist: true, + propagation_policy: 'authenticated', }, }, subdomain: { enabled: true, previews_enabled: true }, @@ -90,6 +91,7 @@ describe('resource workers', () => { enabled: true, head_sampling_rate: 1, persist: true, + propagation_policy: 'authenticated', }, }, subdomain: { enabled: true, previews_enabled: true }, @@ -179,6 +181,7 @@ describe('resource workers', () => { enabled: true, head_sampling_rate: 1, persist: true, + propagation_policy: 'authenticated', }, }, subdomain: { enabled: true, previews_enabled: true }, diff --git a/tests/api-resources/workers/scripts/script-and-version-settings.test.ts b/tests/api-resources/workers/scripts/script-and-version-settings.test.ts index 651d7d56d9..a863e79782 100644 --- a/tests/api-resources/workers/scripts/script-and-version-settings.test.ts +++ b/tests/api-resources/workers/scripts/script-and-version-settings.test.ts @@ -71,6 +71,7 @@ describe('resource scriptAndVersionSettings', () => { enabled: true, head_sampling_rate: 0.1, persist: true, + propagation_policy: 'authenticated', }, }, placement: { mode: 'smart' }, diff --git a/tests/api-resources/workers/scripts/scripts.test.ts b/tests/api-resources/workers/scripts/scripts.test.ts index 2210b3ea82..c6286a4e1c 100644 --- a/tests/api-resources/workers/scripts/scripts.test.ts +++ b/tests/api-resources/workers/scripts/scripts.test.ts @@ -87,6 +87,7 @@ describe('resource scripts', () => { enabled: true, head_sampling_rate: 0.1, persist: true, + propagation_policy: 'authenticated', }, }, placement: { mode: 'smart' }, diff --git a/tests/api-resources/workers/scripts/settings.test.ts b/tests/api-resources/workers/scripts/settings.test.ts index ae17a36873..e8e705f043 100644 --- a/tests/api-resources/workers/scripts/settings.test.ts +++ b/tests/api-resources/workers/scripts/settings.test.ts @@ -42,6 +42,7 @@ describe('resource settings', () => { enabled: true, head_sampling_rate: 0.1, persist: true, + propagation_policy: 'authenticated', }, }, tags: ['my-team', 'my-public-api'], From 52762cc1d2758fa5f474da8188735c700d7fa175 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 May 2026 09:20:40 +0000 Subject: [PATCH 67/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 5f42f4728d..d566e72da8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2272 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 1eb5ca50c3a6934eeb13505783d992bf +openapi_spec_hash: 871426c229b3c4a1d675f71512f933cb config_hash: 0148d517bb02129e9e259f11db3933eb From c0182f927323d63c88bcd4b87a8ff901e41eb4e3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 May 2026 12:32:26 +0000 Subject: [PATCH 68/73] chore(api): update composite API spec --- .stats.yml | 4 +- src/resources/realtime-kit/api.md | 2 + src/resources/realtime-kit/apps.ts | 43 +- src/resources/realtime-kit/index.ts | 2 + src/resources/realtime-kit/livestreams.ts | 97 +- src/resources/realtime-kit/meetings.ts | 465 ++++++++++ src/resources/realtime-kit/realtime-kit.ts | 4 + src/resources/realtime-kit/recordings.ts | 212 +++++ src/resources/realtime-kit/sessions.ts | 826 +++--------------- tests/api-resources/realtime-kit/apps.test.ts | 18 +- .../realtime-kit/livestreams.test.ts | 29 +- .../realtime-kit/meetings.test.ts | 40 + .../realtime-kit/sessions.test.ts | 140 +-- 13 files changed, 1114 insertions(+), 768 deletions(-) diff --git a/.stats.yml b/.stats.yml index d566e72da8..2740aeb030 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2272 +configured_endpoints: 2273 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 871426c229b3c4a1d675f71512f933cb +openapi_spec_hash: 6195c88a622982f684a53b4864623309 config_hash: 0148d517bb02129e9e259f11db3933eb diff --git a/src/resources/realtime-kit/api.md b/src/resources/realtime-kit/api.md index 5e51d31c58..27b40f1c6e 100644 --- a/src/resources/realtime-kit/api.md +++ b/src/resources/realtime-kit/api.md @@ -148,6 +148,7 @@ Types: - LivestreamGetActiveLivestreamsForLivestreamIDResponse - LivestreamGetAllLivestreamsResponse - LivestreamGetLivestreamAnalyticsCompleteResponse +- LivestreamGetLivestreamAnalyticsDaywiseResponse - LivestreamGetLivestreamSessionDetailsForSessionIDResponse - LivestreamGetLivestreamSessionForLivestreamIDResponse - LivestreamGetMeetingActiveLivestreamsResponse @@ -161,6 +162,7 @@ Methods: - client.realtimeKit.livestreams.getActiveLivestreamsForLivestreamId(appId, livestreamId, { ...params }) -> LivestreamGetActiveLivestreamsForLivestreamIDResponse - client.realtimeKit.livestreams.getAllLivestreams(appId, { ...params }) -> LivestreamGetAllLivestreamsResponse - client.realtimeKit.livestreams.getLivestreamAnalyticsComplete(appId, { ...params }) -> LivestreamGetLivestreamAnalyticsCompleteResponse +- client.realtimeKit.livestreams.getLivestreamAnalyticsDaywise(appId, { ...params }) -> LivestreamGetLivestreamAnalyticsDaywiseResponse - client.realtimeKit.livestreams.getLivestreamSessionDetailsForSessionId(appId, livestreamSessionId, { ...params }) -> LivestreamGetLivestreamSessionDetailsForSessionIDResponse - client.realtimeKit.livestreams.getLivestreamSessionForLivestreamId(appId, livestreamId, { ...params }) -> LivestreamGetLivestreamSessionForLivestreamIDResponse - client.realtimeKit.livestreams.getMeetingActiveLivestreams(appId, meetingId, { ...params }) -> LivestreamGetMeetingActiveLivestreamsResponse diff --git a/src/resources/realtime-kit/apps.ts b/src/resources/realtime-kit/apps.ts index 322180ca80..7b6caa7f8c 100644 --- a/src/resources/realtime-kit/apps.ts +++ b/src/resources/realtime-kit/apps.ts @@ -15,8 +15,8 @@ export class Apps extends APIResource { * ``` */ get(params: AppGetParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; - return this._client.get(`/accounts/${account_id}/realtime/kit/apps`, options); + const { account_id, ...query } = params; + return this._client.get(`/accounts/${account_id}/realtime/kit/apps`, { query, ...options }); } /** @@ -25,8 +25,8 @@ export class Apps extends APIResource { * @example * ```ts * const response = await client.realtimeKit.apps.post({ - * account_id: 'account_id', - * name: 'name', + * account_id: '023e105f4ecef8ad9ca31a8372d0c353', + * name: 'x', * }); * ``` */ @@ -39,6 +39,8 @@ export class Apps extends APIResource { export interface AppGetResponse { data?: Array; + paging?: AppGetResponse.Paging; + success?: boolean; } @@ -50,6 +52,14 @@ export namespace AppGetResponse { name?: string; } + + export interface Paging { + end_offset?: number; + + start_offset?: number; + + total_count?: number; + } } export interface AppPostResponse { @@ -76,14 +86,35 @@ export namespace AppPostResponse { export interface AppGetParams { /** - * The account identifier tag. + * Path param: The account identifier tag. */ account_id: string; + + /** + * Query param: The page number from which you want your page search results to be + * displayed. + */ + page_no?: number; + + /** + * Query param: Number of results per page. + */ + per_page?: number; + + /** + * Query param: Search string that matches apps by name. + */ + search?: string; + + /** + * Query param: Sort order for apps by creation time. + */ + sort_order?: 'ASC' | 'DESC'; } export interface AppPostParams { /** - * Path param + * Path param: The account identifier tag. */ account_id: string; diff --git a/src/resources/realtime-kit/index.ts b/src/resources/realtime-kit/index.ts index 424b69ca5a..f8728acc85 100644 --- a/src/resources/realtime-kit/index.ts +++ b/src/resources/realtime-kit/index.ts @@ -29,6 +29,7 @@ export { type LivestreamGetActiveLivestreamsForLivestreamIDResponse, type LivestreamGetAllLivestreamsResponse, type LivestreamGetLivestreamAnalyticsCompleteResponse, + type LivestreamGetLivestreamAnalyticsDaywiseResponse, type LivestreamGetLivestreamSessionDetailsForSessionIDResponse, type LivestreamGetLivestreamSessionForLivestreamIDResponse, type LivestreamGetMeetingActiveLivestreamsResponse, @@ -39,6 +40,7 @@ export { type LivestreamGetActiveLivestreamsForLivestreamIDParams, type LivestreamGetAllLivestreamsParams, type LivestreamGetLivestreamAnalyticsCompleteParams, + type LivestreamGetLivestreamAnalyticsDaywiseParams, type LivestreamGetLivestreamSessionDetailsForSessionIDParams, type LivestreamGetLivestreamSessionForLivestreamIDParams, type LivestreamGetMeetingActiveLivestreamsParams, diff --git a/src/resources/realtime-kit/livestreams.ts b/src/resources/realtime-kit/livestreams.ts index fd95452447..06b0d5416f 100644 --- a/src/resources/realtime-kit/livestreams.ts +++ b/src/resources/realtime-kit/livestreams.ts @@ -112,6 +112,30 @@ export class Livestreams extends APIResource { }); } + /** + * Returns day-wise livestream analytics for the specified time range. + * + * @example + * ```ts + * const response = + * await client.realtimeKit.livestreams.getLivestreamAnalyticsDaywise( + * 'app_id', + * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + * ); + * ``` + */ + getLivestreamAnalyticsDaywise( + appId: string, + params: LivestreamGetLivestreamAnalyticsDaywiseParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...query } = params; + return this._client.get(`/accounts/${account_id}/realtime/kit/${appId}/analytics/livestreams/daywise`, { + query, + ...options, + }); + } + /** * Returns livestream session details for the given livestream session ID. Retrieve * the `livestream_session_id`using the @@ -517,6 +541,36 @@ export namespace LivestreamGetLivestreamAnalyticsCompleteResponse { } } +export interface LivestreamGetLivestreamAnalyticsDaywiseResponse { + data?: Array; + + success?: boolean; +} + +export namespace LivestreamGetLivestreamAnalyticsDaywiseResponse { + export interface Data { + /** + * Count of total livestream sessions. + */ + count?: number; + + /** + * Analytics date. + */ + date?: string | null; + + /** + * Total time duration for which the input was given or the meeting was streamed. + */ + total_ingest_seconds?: number; + + /** + * Total view time for which the viewers watched the stream. + */ + total_viewer_seconds?: number; + } +} + export interface LivestreamGetLivestreamSessionDetailsForSessionIDResponse { data?: LivestreamGetLivestreamSessionDetailsForSessionIDResponse.Data; @@ -952,16 +1006,45 @@ export interface LivestreamGetLivestreamAnalyticsCompleteParams { account_id: string; /** - * Query param: Specify the end time range in ISO format to access the livestream - * analytics. + * Query param: Specify the end time as a Unix timestamp in seconds to access the + * livestream analytics. */ - end_time?: string; + end_time?: number; /** - * Query param: Specify the start time range in ISO format to access the livestream - * analytics. + * Query param: Optional filters for livestream analytics. */ - start_time?: string; + filters?: string; + + /** + * Query param: Specify the start time as a Unix timestamp in seconds to access the + * livestream analytics. + */ + start_time?: number; +} + +export interface LivestreamGetLivestreamAnalyticsDaywiseParams { + /** + * Path param: The account identifier tag. + */ + account_id: string; + + /** + * Query param: Specify the end time as a Unix timestamp in seconds to access the + * livestream analytics. + */ + end_time?: number; + + /** + * Query param: Optional filters for livestream analytics. + */ + filters?: string; + + /** + * Query param: Specify the start time as a Unix timestamp in seconds to access the + * livestream analytics. + */ + start_time?: number; } export interface LivestreamGetLivestreamSessionDetailsForSessionIDParams { @@ -1057,6 +1140,7 @@ export declare namespace Livestreams { type LivestreamGetActiveLivestreamsForLivestreamIDResponse as LivestreamGetActiveLivestreamsForLivestreamIDResponse, type LivestreamGetAllLivestreamsResponse as LivestreamGetAllLivestreamsResponse, type LivestreamGetLivestreamAnalyticsCompleteResponse as LivestreamGetLivestreamAnalyticsCompleteResponse, + type LivestreamGetLivestreamAnalyticsDaywiseResponse as LivestreamGetLivestreamAnalyticsDaywiseResponse, type LivestreamGetLivestreamSessionDetailsForSessionIDResponse as LivestreamGetLivestreamSessionDetailsForSessionIDResponse, type LivestreamGetLivestreamSessionForLivestreamIDResponse as LivestreamGetLivestreamSessionForLivestreamIDResponse, type LivestreamGetMeetingActiveLivestreamsResponse as LivestreamGetMeetingActiveLivestreamsResponse, @@ -1067,6 +1151,7 @@ export declare namespace Livestreams { type LivestreamGetActiveLivestreamsForLivestreamIDParams as LivestreamGetActiveLivestreamsForLivestreamIDParams, type LivestreamGetAllLivestreamsParams as LivestreamGetAllLivestreamsParams, type LivestreamGetLivestreamAnalyticsCompleteParams as LivestreamGetLivestreamAnalyticsCompleteParams, + type LivestreamGetLivestreamAnalyticsDaywiseParams as LivestreamGetLivestreamAnalyticsDaywiseParams, type LivestreamGetLivestreamSessionDetailsForSessionIDParams as LivestreamGetLivestreamSessionDetailsForSessionIDParams, type LivestreamGetLivestreamSessionForLivestreamIDParams as LivestreamGetLivestreamSessionForLivestreamIDParams, type LivestreamGetMeetingActiveLivestreamsParams as LivestreamGetMeetingActiveLivestreamsParams, diff --git a/src/resources/realtime-kit/meetings.ts b/src/resources/realtime-kit/meetings.ts index 94ed2e1700..5971988a31 100644 --- a/src/resources/realtime-kit/meetings.ts +++ b/src/resources/realtime-kit/meetings.ts @@ -375,6 +375,11 @@ export namespace MeetingCreateResponse { * Title of the meeting. */ title?: string; + + /** + * Automatically generate transcripts when the meeting ends. + */ + transcribe_on_end?: boolean; } export namespace Data { @@ -845,6 +850,13 @@ export namespace MeetingGetResponse { */ record_on_start?: boolean; + /** + * Recording Configurations to be used for this meeting. This level of configs + * takes higher preference over App level configs on the RealtimeKit developer + * portal. + */ + recording_config?: Data.RecordingConfig; + /** * Time in seconds, for which a session remains active, after the last participant * has left the meeting. @@ -867,6 +879,211 @@ export namespace MeetingGetResponse { * Title of the meeting. */ title?: string; + + /** + * Automatically generate transcripts when the meeting ends. + */ + transcribe_on_end?: boolean; + } + + export namespace Data { + /** + * Recording Configurations to be used for this meeting. This level of configs + * takes higher preference over App level configs on the RealtimeKit developer + * portal. + */ + export interface RecordingConfig { + /** + * Object containing configuration regarding the audio that is being recorded. + */ + audio_config?: RecordingConfig.AudioConfig; + + /** + * Adds a prefix to the beginning of the file name of the recording. + */ + file_name_prefix?: string; + + live_streaming_config?: RecordingConfig.LiveStreamingConfig; + + /** + * Specifies the maximum duration for recording in seconds, ranging from a minimum + * of 60 seconds to a maximum of 24 hours. + */ + max_seconds?: number; + + realtimekit_bucket_config?: RecordingConfig.RealtimekitBucketConfig; + + storage_config?: RecordingConfig.StorageConfig | null; + + video_config?: RecordingConfig.VideoConfig; + } + + export namespace RecordingConfig { + /** + * Object containing configuration regarding the audio that is being recorded. + */ + export interface AudioConfig { + /** + * Audio signal pathway within an audio file that carries a specific sound source. + */ + channel?: 'mono' | 'stereo'; + + /** + * Codec using which the recording will be encoded. If VP8/VP9 is selected for + * videoConfig, changing audioConfig is not allowed. In this case, the codec in the + * audioConfig is automatically set to vorbis. + */ + codec?: 'MP3' | 'AAC'; + + /** + * Controls whether to export audio file seperately + */ + export_file?: boolean; + } + + export interface LiveStreamingConfig { + /** + * RTMP URL to stream to + */ + rtmp_url?: string; + } + + export interface RealtimekitBucketConfig { + /** + * Controls whether recordings are uploaded to RealtimeKit's bucket. If set to + * false, `download_url`, `audio_download_url`, `download_url_expiry` won't be + * generated for a recording. + */ + enabled: boolean; + } + + export interface StorageConfig { + /** + * Type of storage media. + */ + type: 'aws' | 'azure' | 'digitalocean' | 'gcs' | 'sftp'; + + /** + * Authentication method used for "sftp" type storage medium + */ + auth_method?: 'KEY' | 'PASSWORD'; + + /** + * Name of the storage medium's bucket. + */ + bucket?: string; + + /** + * SSH destination server host for SFTP type storage medium + */ + host?: string; + + /** + * SSH destination server password for SFTP type storage medium when auth_method is + * "PASSWORD". If auth_method is "KEY", this specifies the password for the ssh + * private key. + */ + password?: string; + + /** + * Path relative to the bucket root at which the recording will be placed. + */ + path?: string; + + /** + * SSH destination server port for SFTP type storage medium + */ + port?: number; + + /** + * Private key used to login to destination SSH server for SFTP type storage + * medium, when auth_method used is "KEY" + */ + private_key?: string; + + /** + * Region of the storage medium. + */ + region?: string; + + /** + * Secret key of the storage medium. Similar to `access_key`, it is only writeable + * by clients, not readable. + */ + secret?: string; + + /** + * SSH destination server username for SFTP type storage medium + */ + username?: string; + } + + export interface VideoConfig { + /** + * Codec using which the recording will be encoded. + */ + codec?: 'H264' | 'VP8'; + + /** + * Controls whether to export video file seperately + */ + export_file?: boolean; + + /** + * Height of the recording video in pixels + */ + height?: number; + + /** + * Watermark to be added to the recording + */ + watermark?: VideoConfig.Watermark; + + /** + * Width of the recording video in pixels + */ + width?: number; + } + + export namespace VideoConfig { + /** + * Watermark to be added to the recording + */ + export interface Watermark { + /** + * Position of the watermark + */ + position?: 'left top' | 'right top' | 'left bottom' | 'right bottom'; + + /** + * Size of the watermark + */ + size?: Watermark.Size; + + /** + * URL of the watermark image + */ + url?: string; + } + + export namespace Watermark { + /** + * Size of the watermark + */ + export interface Size { + /** + * Height of the watermark in px + */ + height?: number; + + /** + * Width of the watermark in px + */ + width?: number; + } + } + } + } } export interface Paging { @@ -961,6 +1178,11 @@ export namespace MeetingGetMeetingByIDResponse { * Title of the meeting. */ title?: string; + + /** + * Automatically generate transcripts when the meeting ends. + */ + transcribe_on_end?: boolean; } export namespace Data { @@ -1450,6 +1672,11 @@ export namespace MeetingReplaceMeetingByIDResponse { * Title of the meeting. */ title?: string; + + /** + * Automatically generate transcripts when the meeting ends. + */ + transcribe_on_end?: boolean; } export namespace Data { @@ -1803,6 +2030,11 @@ export namespace MeetingUpdateMeetingByIDResponse { * Title of the meeting. */ title?: string; + + /** + * Automatically generate transcripts when the meeting ends. + */ + transcribe_on_end?: boolean; } export namespace Data { @@ -2126,6 +2358,11 @@ export interface MeetingCreateParams { * Body param: Title of the meeting */ title?: string | null; + + /** + * Body param: Automatically generate transcripts when the meeting ends. + */ + transcribe_on_end?: boolean; } export namespace MeetingCreateParams { @@ -2494,6 +2731,11 @@ export interface MeetingGetParams { * The time must be specified in ISO format. */ start_time?: string; + + /** + * Query param: Filter meetings by status. + */ + status?: 'ACTIVE' | 'INACTIVE'; } export interface MeetingGetMeetingByIDParams { @@ -2593,6 +2835,11 @@ export interface MeetingReplaceMeetingByIDParams { * Body param: Title of the meeting */ title?: string | null; + + /** + * Body param: Automatically generate transcripts when the meeting ends. + */ + transcribe_on_end?: boolean; } export namespace MeetingReplaceMeetingByIDParams { @@ -2899,6 +3146,13 @@ export interface MeetingUpdateMeetingByIDParams { */ record_on_start?: boolean; + /** + * Body param: Recording Configurations to be used for this meeting. This level of + * configs takes higher preference over App level configs on the RealtimeKit + * developer portal. + */ + recording_config?: MeetingUpdateMeetingByIDParams.RecordingConfig; + /** * Body param: Time in seconds, for which a session remains active, after the last * participant has left the meeting. @@ -2922,6 +3176,11 @@ export interface MeetingUpdateMeetingByIDParams { * Body param: Title of the meeting */ title?: string; + + /** + * Body param: Automatically generate transcripts when the meeting ends. + */ + transcribe_on_end?: boolean; } export namespace MeetingUpdateMeetingByIDParams { @@ -2991,6 +3250,212 @@ export namespace MeetingUpdateMeetingByIDParams { profanity_filter?: boolean; } } + + /** + * Recording Configurations to be used for this meeting. This level of configs + * takes higher preference over App level configs on the RealtimeKit developer + * portal. + */ + export interface RecordingConfig { + /** + * Object containing configuration regarding the audio that is being recorded. + */ + audio_config?: RecordingConfig.AudioConfig; + + /** + * Adds a prefix to the beginning of the file name of the recording. + */ + file_name_prefix?: string; + + live_streaming_config?: RecordingConfig.LiveStreamingConfig; + + /** + * Specifies the maximum duration for recording in seconds, ranging from a minimum + * of 60 seconds to a maximum of 24 hours. + */ + max_seconds?: number; + + realtimekit_bucket_config?: RecordingConfig.RealtimekitBucketConfig; + + storage_config?: RecordingConfig.StorageConfig | null; + + video_config?: RecordingConfig.VideoConfig; + } + + export namespace RecordingConfig { + /** + * Object containing configuration regarding the audio that is being recorded. + */ + export interface AudioConfig { + /** + * Audio signal pathway within an audio file that carries a specific sound source. + */ + channel?: 'mono' | 'stereo'; + + /** + * Codec using which the recording will be encoded. If VP8/VP9 is selected for + * videoConfig, changing audioConfig is not allowed. In this case, the codec in the + * audioConfig is automatically set to vorbis. + */ + codec?: 'MP3' | 'AAC'; + + /** + * Controls whether to export audio file seperately + */ + export_file?: boolean; + } + + export interface LiveStreamingConfig { + /** + * RTMP URL to stream to + */ + rtmp_url?: string; + } + + export interface RealtimekitBucketConfig { + /** + * Controls whether recordings are uploaded to RealtimeKit's bucket. If set to + * false, `download_url`, `audio_download_url`, `download_url_expiry` won't be + * generated for a recording. + */ + enabled: boolean; + } + + export interface StorageConfig { + /** + * Type of storage media. + */ + type: 'aws' | 'azure' | 'digitalocean' | 'gcs' | 'sftp'; + + /** + * Access key of the storage medium. Access key is not required for the `gcs` + * storage media type. + * + * Note that this field is not readable by clients, only writeable. + */ + access_key?: string; + + /** + * Authentication method used for "sftp" type storage medium + */ + auth_method?: 'KEY' | 'PASSWORD'; + + /** + * Name of the storage medium's bucket. + */ + bucket?: string; + + /** + * SSH destination server host for SFTP type storage medium + */ + host?: string; + + /** + * SSH destination server password for SFTP type storage medium when auth_method is + * "PASSWORD". If auth_method is "KEY", this specifies the password for the ssh + * private key. + */ + password?: string; + + /** + * Path relative to the bucket root at which the recording will be placed. + */ + path?: string; + + /** + * SSH destination server port for SFTP type storage medium + */ + port?: number; + + /** + * Private key used to login to destination SSH server for SFTP type storage + * medium, when auth_method used is "KEY" + */ + private_key?: string; + + /** + * Region of the storage medium. + */ + region?: string; + + /** + * Secret key of the storage medium. Similar to `access_key`, it is only writeable + * by clients, not readable. + */ + secret?: string; + + /** + * SSH destination server username for SFTP type storage medium + */ + username?: string; + } + + export interface VideoConfig { + /** + * Codec using which the recording will be encoded. + */ + codec?: 'H264' | 'VP8'; + + /** + * Controls whether to export video file seperately + */ + export_file?: boolean; + + /** + * Height of the recording video in pixels + */ + height?: number; + + /** + * Watermark to be added to the recording + */ + watermark?: VideoConfig.Watermark; + + /** + * Width of the recording video in pixels + */ + width?: number; + } + + export namespace VideoConfig { + /** + * Watermark to be added to the recording + */ + export interface Watermark { + /** + * Position of the watermark + */ + position?: 'left top' | 'right top' | 'left bottom' | 'right bottom'; + + /** + * Size of the watermark + */ + size?: Watermark.Size; + + /** + * URL of the watermark image + */ + url?: string; + } + + export namespace Watermark { + /** + * Size of the watermark + */ + export interface Size { + /** + * Height of the watermark in px + */ + height?: number; + + /** + * Width of the watermark in px + */ + width?: number; + } + } + } + } } export declare namespace Meetings { diff --git a/src/resources/realtime-kit/realtime-kit.ts b/src/resources/realtime-kit/realtime-kit.ts index 1023be36b9..a4f5f6d67c 100644 --- a/src/resources/realtime-kit/realtime-kit.ts +++ b/src/resources/realtime-kit/realtime-kit.ts @@ -27,6 +27,8 @@ import { LivestreamGetAllLivestreamsResponse, LivestreamGetLivestreamAnalyticsCompleteParams, LivestreamGetLivestreamAnalyticsCompleteResponse, + LivestreamGetLivestreamAnalyticsDaywiseParams, + LivestreamGetLivestreamAnalyticsDaywiseResponse, LivestreamGetLivestreamSessionDetailsForSessionIDParams, LivestreamGetLivestreamSessionDetailsForSessionIDResponse, LivestreamGetLivestreamSessionForLivestreamIDParams, @@ -275,6 +277,7 @@ export declare namespace RealtimeKit { type LivestreamGetActiveLivestreamsForLivestreamIDResponse as LivestreamGetActiveLivestreamsForLivestreamIDResponse, type LivestreamGetAllLivestreamsResponse as LivestreamGetAllLivestreamsResponse, type LivestreamGetLivestreamAnalyticsCompleteResponse as LivestreamGetLivestreamAnalyticsCompleteResponse, + type LivestreamGetLivestreamAnalyticsDaywiseResponse as LivestreamGetLivestreamAnalyticsDaywiseResponse, type LivestreamGetLivestreamSessionDetailsForSessionIDResponse as LivestreamGetLivestreamSessionDetailsForSessionIDResponse, type LivestreamGetLivestreamSessionForLivestreamIDResponse as LivestreamGetLivestreamSessionForLivestreamIDResponse, type LivestreamGetMeetingActiveLivestreamsResponse as LivestreamGetMeetingActiveLivestreamsResponse, @@ -285,6 +288,7 @@ export declare namespace RealtimeKit { type LivestreamGetActiveLivestreamsForLivestreamIDParams as LivestreamGetActiveLivestreamsForLivestreamIDParams, type LivestreamGetAllLivestreamsParams as LivestreamGetAllLivestreamsParams, type LivestreamGetLivestreamAnalyticsCompleteParams as LivestreamGetLivestreamAnalyticsCompleteParams, + type LivestreamGetLivestreamAnalyticsDaywiseParams as LivestreamGetLivestreamAnalyticsDaywiseParams, type LivestreamGetLivestreamSessionDetailsForSessionIDParams as LivestreamGetLivestreamSessionDetailsForSessionIDParams, type LivestreamGetLivestreamSessionForLivestreamIDParams as LivestreamGetLivestreamSessionForLivestreamIDParams, type LivestreamGetMeetingActiveLivestreamsParams as LivestreamGetMeetingActiveLivestreamsParams, diff --git a/src/resources/realtime-kit/recordings.ts b/src/resources/realtime-kit/recordings.ts index 6f7e6cc1c7..f404a70ca0 100644 --- a/src/resources/realtime-kit/recordings.ts +++ b/src/resources/realtime-kit/recordings.ts @@ -607,6 +607,13 @@ export namespace RecordingGetRecordingsResponse { */ record_on_start?: boolean; + /** + * Recording Configurations to be used for this meeting. This level of configs + * takes higher preference over App level configs on the RealtimeKit developer + * portal. + */ + recording_config?: Meeting.RecordingConfig; + /** * Time in seconds, for which a session remains active, after the last participant * has left the meeting. @@ -629,6 +636,211 @@ export namespace RecordingGetRecordingsResponse { * Title of the meeting. */ title?: string; + + /** + * Automatically generate transcripts when the meeting ends. + */ + transcribe_on_end?: boolean; + } + + export namespace Meeting { + /** + * Recording Configurations to be used for this meeting. This level of configs + * takes higher preference over App level configs on the RealtimeKit developer + * portal. + */ + export interface RecordingConfig { + /** + * Object containing configuration regarding the audio that is being recorded. + */ + audio_config?: RecordingConfig.AudioConfig; + + /** + * Adds a prefix to the beginning of the file name of the recording. + */ + file_name_prefix?: string; + + live_streaming_config?: RecordingConfig.LiveStreamingConfig; + + /** + * Specifies the maximum duration for recording in seconds, ranging from a minimum + * of 60 seconds to a maximum of 24 hours. + */ + max_seconds?: number; + + realtimekit_bucket_config?: RecordingConfig.RealtimekitBucketConfig; + + storage_config?: RecordingConfig.StorageConfig | null; + + video_config?: RecordingConfig.VideoConfig; + } + + export namespace RecordingConfig { + /** + * Object containing configuration regarding the audio that is being recorded. + */ + export interface AudioConfig { + /** + * Audio signal pathway within an audio file that carries a specific sound source. + */ + channel?: 'mono' | 'stereo'; + + /** + * Codec using which the recording will be encoded. If VP8/VP9 is selected for + * videoConfig, changing audioConfig is not allowed. In this case, the codec in the + * audioConfig is automatically set to vorbis. + */ + codec?: 'MP3' | 'AAC'; + + /** + * Controls whether to export audio file seperately + */ + export_file?: boolean; + } + + export interface LiveStreamingConfig { + /** + * RTMP URL to stream to + */ + rtmp_url?: string; + } + + export interface RealtimekitBucketConfig { + /** + * Controls whether recordings are uploaded to RealtimeKit's bucket. If set to + * false, `download_url`, `audio_download_url`, `download_url_expiry` won't be + * generated for a recording. + */ + enabled: boolean; + } + + export interface StorageConfig { + /** + * Type of storage media. + */ + type: 'aws' | 'azure' | 'digitalocean' | 'gcs' | 'sftp'; + + /** + * Authentication method used for "sftp" type storage medium + */ + auth_method?: 'KEY' | 'PASSWORD'; + + /** + * Name of the storage medium's bucket. + */ + bucket?: string; + + /** + * SSH destination server host for SFTP type storage medium + */ + host?: string; + + /** + * SSH destination server password for SFTP type storage medium when auth_method is + * "PASSWORD". If auth_method is "KEY", this specifies the password for the ssh + * private key. + */ + password?: string; + + /** + * Path relative to the bucket root at which the recording will be placed. + */ + path?: string; + + /** + * SSH destination server port for SFTP type storage medium + */ + port?: number; + + /** + * Private key used to login to destination SSH server for SFTP type storage + * medium, when auth_method used is "KEY" + */ + private_key?: string; + + /** + * Region of the storage medium. + */ + region?: string; + + /** + * Secret key of the storage medium. Similar to `access_key`, it is only writeable + * by clients, not readable. + */ + secret?: string; + + /** + * SSH destination server username for SFTP type storage medium + */ + username?: string; + } + + export interface VideoConfig { + /** + * Codec using which the recording will be encoded. + */ + codec?: 'H264' | 'VP8'; + + /** + * Controls whether to export video file seperately + */ + export_file?: boolean; + + /** + * Height of the recording video in pixels + */ + height?: number; + + /** + * Watermark to be added to the recording + */ + watermark?: VideoConfig.Watermark; + + /** + * Width of the recording video in pixels + */ + width?: number; + } + + export namespace VideoConfig { + /** + * Watermark to be added to the recording + */ + export interface Watermark { + /** + * Position of the watermark + */ + position?: 'left top' | 'right top' | 'left bottom' | 'right bottom'; + + /** + * Size of the watermark + */ + size?: Watermark.Size; + + /** + * URL of the watermark image + */ + url?: string; + } + + export namespace Watermark { + /** + * Size of the watermark + */ + export interface Size { + /** + * Height of the watermark in px + */ + height?: number; + + /** + * Width of the watermark in px + */ + width?: number; + } + } + } + } } export interface StorageConfig { diff --git a/src/resources/realtime-kit/sessions.ts b/src/resources/realtime-kit/sessions.ts index a89a1bd01b..801959dba4 100644 --- a/src/resources/realtime-kit/sessions.ts +++ b/src/resources/realtime-kit/sessions.ts @@ -11,7 +11,7 @@ export class Sessions extends APIResource { * ```ts * await client.realtimeKit.sessions.generateSummaryOfTranscripts( * 'app_id', - * 'session_id', + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -38,7 +38,7 @@ export class Sessions extends APIResource { * const response = * await client.realtimeKit.sessions.getParticipantDataFromPeerId( * 'app_id', - * 'peer_id', + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -64,7 +64,7 @@ export class Sessions extends APIResource { * const response = * await client.realtimeKit.sessions.getSessionChat( * 'app_id', - * 'session_id', + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -90,7 +90,7 @@ export class Sessions extends APIResource { * const response = * await client.realtimeKit.sessions.getSessionDetails( * 'app_id', - * 'session_id', + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -117,8 +117,8 @@ export class Sessions extends APIResource { * const response = * await client.realtimeKit.sessions.getSessionParticipantDetails( * 'app_id', - * 'session_id', - * 'participant_id', + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -145,7 +145,7 @@ export class Sessions extends APIResource { * const response = * await client.realtimeKit.sessions.getSessionParticipants( * 'app_id', - * 'session_id', + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -172,7 +172,7 @@ export class Sessions extends APIResource { * const response = * await client.realtimeKit.sessions.getSessionSummary( * 'app_id', - * 'session_id', + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -198,7 +198,7 @@ export class Sessions extends APIResource { * const response = * await client.realtimeKit.sessions.getSessionTranscripts( * 'app_id', - * 'session_id', + * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` @@ -245,494 +245,76 @@ export interface SessionGetParticipantDataFromPeerIDResponse { export namespace SessionGetParticipantDataFromPeerIDResponse { export interface Data { - participant?: Data.Participant; - } - - export namespace Data { - export interface Participant { - id?: string; - - created_at?: string; - - custom_participant_id?: string; - - display_name?: string; - - duration?: number; - - joined_at?: string; - - left_at?: string; - - peer_report?: Participant.PeerReport; - - peer_stats?: Participant.PeerStats; - - quality_stats?: Participant.QualityStats; - - role?: string; - - updated_at?: string; - - user_id?: string; - } - - export namespace Participant { - export interface PeerReport { - metadata?: PeerReport.Metadata; - - quality?: PeerReport.Quality; - } - - export namespace PeerReport { - export interface Metadata { - audio_devices_updates?: Array; - - browser_metadata?: Metadata.BrowserMetadata; - - candidate_pairs?: Metadata.CandidatePairs; - - device_info?: Metadata.DeviceInfo; - - events?: Array; - - ip_information?: Metadata.IPInformation; - - pc_metadata?: Array; - - room_view_type?: string; - - sdk_name?: string; - - sdk_version?: string; - - selected_device_updates?: Array; - - speaker_devices_updates?: Array; - - video_devices_updates?: Array; - } - - export namespace Metadata { - export interface BrowserMetadata { - browser?: string; - - browser_version?: string; - - engine?: string; - - user_agent?: string; - - webgl_support?: string; - } - - export interface CandidatePairs { - consuming_transport?: Array; - - producing_transport?: Array; - } - - export namespace CandidatePairs { - export interface ProducingTransport { - available_outgoing_bitrate?: number; - - bytes_discarded_on_send?: number; - - bytes_received?: number; - - bytes_sent?: number; - - current_round_trip_time?: number; - - last_packet_received_timestamp?: number; - - last_packet_sent_timestamp?: number; - - local_candidate_address?: string; - - local_candidate_id?: string; - - local_candidate_network_type?: string; - - local_candidate_port?: number; - - local_candidate_protocol?: string; - - local_candidate_related_address?: string; - - local_candidate_related_port?: number; - - local_candidate_type?: string; - - nominated?: boolean; - - packets_discarded_on_send?: number; - - packets_received?: number; - - packets_sent?: number; - - remote_candidate_address?: string; - - remote_candidate_id?: string; - - remote_candidate_port?: number; - - remote_candidate_protocol?: string; - - remote_candidate_type?: string; - - total_round_trip_time?: number; - } - } - - export interface DeviceInfo { - cpus?: number; - - is_mobile?: boolean; - - os?: string; - - os_version?: string; - } - - export interface Event { - name?: string; - - timestamp?: string; - } - - export interface IPInformation { - asn?: IPInformation.ASN; - - city?: string; - - country?: string; - - ipv4?: string; - - region?: string; - - timezone?: string; - } - - export namespace IPInformation { - export interface ASN { - asn?: string; - } - } - - export interface PcMetadata { - effective_network_type?: string; - - reflexive_connectivity?: boolean; - - relay_connectivity?: boolean; - - timestamp?: string; - - turn_connectivity?: boolean; - } - } - - export interface Quality { - audio_consumer?: Array; - - audio_consumer_cumulative?: unknown; - - audio_producer?: Array; - - audio_producer_cumulative?: Quality.AudioProducerCumulative; - - screenshare_audio_consumer?: Array; - - screenshare_audio_consumer_cumulative?: unknown; - - screenshare_audio_producer?: Array; - - screenshare_audio_producer_cumulative?: unknown; - - screenshare_video_consumer?: Array; - - screenshare_video_consumer_cumulative?: unknown; - - screenshare_video_producer?: Array; - - screenshare_video_producer_cumulative?: unknown; - - video_consumer?: Array; - - video_consumer_cumulative?: unknown; - - video_producer?: Array; - - video_producer_cumulative?: unknown; - } - - export namespace Quality { - export interface AudioProducer { - bytes_sent?: number; - - jitter?: number; - - mid?: string; - - mos_quality?: number; - - packets_lost?: number; - - packets_sent?: number; - - producer_id?: string; - - rtt?: number; - - ssrc?: number; - - timestamp?: string; - } - - export interface AudioProducerCumulative { - packet_loss?: AudioProducerCumulative.PacketLoss; - - quality_mos?: AudioProducerCumulative.QualityMos; - - rtt?: AudioProducerCumulative.RTT; - } - - export namespace AudioProducerCumulative { - export interface PacketLoss { - '10_or_greater_event_fraction'?: number; - - '25_or_greater_event_fraction'?: number; - - '5_or_greater_event_fraction'?: number; - - '50_or_greater_event_fraction'?: number; - - avg?: number; - } - - export interface QualityMos { - avg?: number; - - p50?: number; - - p75?: number; - - p90?: number; - } - - export interface RTT { - '100ms_or_greater_event_fraction'?: number; - - '250ms_or_greater_event_fraction'?: number; - - '500ms_or_greater_event_fraction'?: number; - - avg?: number; - } - } - } - } - - export interface PeerStats { - device_info?: PeerStats.DeviceInfo; - - events?: Array; - - ip_information?: PeerStats.IPInformation; - - precall_network_information?: PeerStats.PrecallNetworkInformation; - } - - export namespace PeerStats { - export interface DeviceInfo { - browser?: string; - - browser_version?: string; - - cpus?: number; - - engine?: string; - - is_mobile?: boolean; - - os?: string; - - os_version?: string; - - sdk_name?: string; - - sdk_version?: string; - - user_agent?: string; - - webgl_support?: string; - } - - export interface Event { - metadata?: Event.Metadata; - - timestamp?: string; - - type?: string; - } - - export namespace Event { - export interface Metadata { - connection_info?: Metadata.ConnectionInfo; - } - - export namespace Metadata { - export interface ConnectionInfo { - backend_r_t_t?: number; - - connectivity?: ConnectionInfo.Connectivity; - - effective_network_type?: string; - - fractional_loss?: number; - - ip_details?: ConnectionInfo.IPDetails; - - jitter?: number; - - location?: ConnectionInfo.Location; - - r_t_t?: number; - - throughput?: number; - - turn_connectivity?: boolean; - } - - export namespace ConnectionInfo { - export interface Connectivity { - host?: boolean; - - reflexive?: boolean; - - relay?: boolean; - } - - export interface IPDetails { - asn?: IPDetails.ASN; - - city?: string; - - country?: string; - - ip?: string; - - loc?: string; - - postal?: string; - - region?: string; - - timezone?: string; - } - - export namespace IPDetails { - export interface ASN { - asn?: string; - } - } - - export interface Location { - coords?: Location.Coords; - } - - export namespace Location { - export interface Coords { - latitude?: number; - - longitude?: number; - } - } - } - } - } - - export interface IPInformation { - asn?: IPInformation.ASN; - - city?: string; - - country?: string; - - ip_location?: string; - - ipv4?: string; - - org?: string; - - region?: string; - - timezone?: string; - } - - export namespace IPInformation { - export interface ASN { - asn?: string; - } - } - - export interface PrecallNetworkInformation { - backend_rtt?: number; - - effective_networktype?: string; - - fractional_loss?: number; - - jitter?: number; - - reflexive_connectivity?: boolean; - - relay_connectivity?: boolean; - - rtt?: number; - - throughput?: number; - - turn_connectivity?: boolean; - } - } - - export interface QualityStats { - audio_bandwidth?: number; + /** + * Participant ID. This maps to the corresponding peerId. + */ + id?: string; - audio_stats?: Array; + /** + * timestamp when this participant was created. + */ + created_at?: string; - average_quality?: number; + /** + * ID passed by client to create this participant. + */ + custom_participant_id?: string; - end?: string | null; + /** + * Display name of participant when joining the session. + */ + display_name?: string; - first_audio_packet_received?: string; + /** + * number of minutes for which the participant was in the session. + */ + duration?: number; - first_video_packet_received?: string; + /** + * timestamp at which participant joined the session. + */ + joined_at?: string; - last_audio_packet_received?: string; + /** + * timestamp at which participant left the session. + */ + left_at?: string; - last_video_packet_received?: string; + peer_events?: Array<{ [key: string]: unknown }>; - peer_ids?: Array; + /** + * Peer call statistics report. + */ + peer_report?: Data.PeerReport; - start?: string | null; + /** + * Name of the preset associated with the participant. + */ + preset_name?: string; - total_audio_packets?: number; + session_id?: string; - total_audio_packets_lost?: number; + /** + * timestamp when this participant's data was last updated. + */ + updated_at?: string; - total_video_packets?: number; + /** + * User id for this participant. + */ + user_id?: string; + } - total_video_packets_lost?: number; + export namespace Data { + /** + * Peer call statistics report. + */ + export interface PeerReport { + metadata?: { [key: string]: unknown }; - video_bandwidth?: number; + quality?: { [key: string]: unknown }; - video_stats?: Array; - } + [k: string]: unknown; } } } @@ -765,85 +347,79 @@ export interface SessionGetSessionDetailsResponse { export namespace SessionGetSessionDetailsResponse { export interface Data { - session?: Data.Session; - } - - export namespace Data { - export interface Session { - /** - * ID of the session - */ - id: string; + /** + * ID of the session + */ + id: string; - /** - * ID of the meeting this session is associated with. In the case of V2 meetings, - * it is always a UUID. In V1 meetings, it is a room name of the form - * `abcdef-ghijkl` - */ - associated_id: string; + /** + * ID of the meeting this session is associated with. In the case of V2 meetings, + * it is always a UUID. In V1 meetings, it is a room name of the form + * `abcdef-ghijkl` + */ + associated_id: string; - /** - * timestamp when session created - */ - created_at: string; + /** + * timestamp when session created + */ + created_at: string; - /** - * number of participants currently in the session - */ - live_participants: number; + /** + * number of participants currently in the session + */ + live_participants: number; - /** - * number of maximum participants that were in the session - */ - max_concurrent_participants: number; + /** + * number of maximum participants that were in the session + */ + max_concurrent_participants: number; - /** - * Title of the meeting this session belongs to - */ - meeting_display_name: string; + /** + * Title of the meeting this session belongs to + */ + meeting_display_name: string; - /** - * number of minutes consumed since the session started - */ - minutes_consumed: number; + /** + * number of minutes consumed since the session started + */ + minutes_consumed: number; - /** - * App id that hosted this session - */ - organization_id: string; + /** + * App id that hosted this session + */ + organization_id: string; - /** - * timestamp when session started - */ - started_at: string; + /** + * timestamp when session started + */ + started_at: string; - /** - * current status of session - */ - status: 'LIVE' | 'ENDED'; + /** + * current status of session + */ + status: 'LIVE' | 'ENDED'; - /** - * type of session - */ - type: 'meeting' | 'livestream' | 'participant'; + /** + * type of session + */ + type: 'meeting' | 'livestream' | 'participant'; - /** - * timestamp when session was last updated - */ - updated_at: string; + /** + * timestamp when session was last updated + */ + updated_at: string; - breakout_rooms?: Array; + breakout_rooms?: Array; - /** - * timestamp when session ended - */ - ended_at?: string; + /** + * timestamp when session ended + */ + ended_at?: string; - /** - * Any meta data about session. - */ - meta?: unknown; - } + /** + * Any meta data about session. + */ + meta?: unknown; } } @@ -895,15 +471,11 @@ export namespace SessionGetSessionParticipantDetailsResponse { */ left_at?: string; - peer_stats?: Participant.PeerStats; - /** * Name of the preset associated with the participant. */ preset_name?: string; - quality_stats?: Array; - /** * timestamp when this participant's data was last updated. */ @@ -914,148 +486,6 @@ export namespace SessionGetSessionParticipantDetailsResponse { */ user_id?: string; } - - export namespace Participant { - export interface PeerStats { - config?: string; - - device_info?: PeerStats.DeviceInfo; - - events?: Array; - - ip_information?: PeerStats.IPInformation; - - precall_network_information?: PeerStats.PrecallNetworkInformation; - - status?: string; - } - - export namespace PeerStats { - export interface DeviceInfo { - browser?: string; - - browser_version?: string; - - cpus?: number; - - engine?: string; - - is_mobile?: boolean; - - memory?: number; - - os?: string; - - os_version?: string; - - sdk_name?: string; - - sdk_version?: string; - - user_agent?: string; - - webgl_support?: string; - } - - export interface Event { - timestamp?: string; - - type?: string; - } - - export interface IPInformation { - city?: string; - - country?: string; - - ip_location?: string; - - ipv4?: string; - - org?: string; - - portal?: string; - - region?: string; - - timezone?: string; - } - - export interface PrecallNetworkInformation { - backend_rtt?: number; - - effective_networktype?: string; - - fractional_loss?: number; - - jitter?: number; - - reflexive_connectivity?: boolean; - - relay_connectivity?: boolean; - - rtt?: number; - - throughtput?: number; - - turn_connectivity?: boolean; - } - } - - export interface QualityStat { - audio_bandwidth?: number; - - audio_packet_loss?: number; - - audio_stats?: Array; - - average_quality?: number; - - end?: string; - - peer_id?: string; - - start?: string; - - video_bandwidth?: number; - - video_packet_loss?: number; - - video_stats?: Array; - } - - export namespace QualityStat { - export interface AudioStat { - concealment_events?: number; - - jitter?: number; - - packets_lost?: number; - - quality?: number; - - timestamp?: string; - } - - export interface VideoStat { - frame_height?: number; - - frame_width?: number; - - frames_dropped?: number; - - frames_per_second?: number; - - jitter?: number; - - packets_lost?: number; - - quality?: number; - - timestamp?: string; - } - } - } } } @@ -1172,6 +602,8 @@ export namespace SessionGetSessionTranscriptsResponse { export interface SessionGetSessionsResponse { data?: SessionGetSessionsResponse.Data; + paging?: SessionGetSessionsResponse.Paging; + success?: boolean; } @@ -1257,6 +689,14 @@ export namespace SessionGetSessionsResponse { meta?: unknown; } } + + export interface Paging { + end_offset?: number; + + start_offset?: number; + + total_count?: number; + } } export interface SessionGenerateSummaryOfTranscriptsParams { diff --git a/tests/api-resources/realtime-kit/apps.test.ts b/tests/api-resources/realtime-kit/apps.test.ts index 6514479849..54784d2ada 100644 --- a/tests/api-resources/realtime-kit/apps.test.ts +++ b/tests/api-resources/realtime-kit/apps.test.ts @@ -24,12 +24,21 @@ describe('resource apps', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('get: required and optional params', async () => { - const response = await client.realtimeKit.apps.get({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const response = await client.realtimeKit.apps.get({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + page_no: 1, + per_page: 1, + search: 'search', + sort_order: 'ASC', + }); }); // TODO: HTTP 401 from prism, support api tokens test.skip('post: only required params', async () => { - const responsePromise = client.realtimeKit.apps.post({ account_id: 'account_id', name: 'name' }); + const responsePromise = client.realtimeKit.apps.post({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + name: 'x', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -41,6 +50,9 @@ describe('resource apps', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('post: required and optional params', async () => { - const response = await client.realtimeKit.apps.post({ account_id: 'account_id', name: 'name' }); + const response = await client.realtimeKit.apps.post({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + name: 'x', + }); }); }); diff --git a/tests/api-resources/realtime-kit/livestreams.test.ts b/tests/api-resources/realtime-kit/livestreams.test.ts index 1605152c0c..25f6b895ce 100644 --- a/tests/api-resources/realtime-kit/livestreams.test.ts +++ b/tests/api-resources/realtime-kit/livestreams.test.ts @@ -103,8 +103,33 @@ describe('resource livestreams', () => { test.skip('getLivestreamAnalyticsComplete: required and optional params', async () => { const response = await client.realtimeKit.livestreams.getLivestreamAnalyticsComplete('app_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', - end_time: '2019-12-27T18:11:19.117Z', - start_time: '2019-12-27T18:11:19.117Z', + end_time: 0, + filters: 'filters', + start_time: 0, + }); + }); + + // TODO: HTTP 401 from prism, support api tokens + test.skip('getLivestreamAnalyticsDaywise: only required params', async () => { + const responsePromise = client.realtimeKit.livestreams.getLivestreamAnalyticsDaywise('app_id', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + // TODO: HTTP 401 from prism, support api tokens + test.skip('getLivestreamAnalyticsDaywise: required and optional params', async () => { + const response = await client.realtimeKit.livestreams.getLivestreamAnalyticsDaywise('app_id', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + end_time: 0, + filters: 'filters', + start_time: 0, }); }); diff --git a/tests/api-resources/realtime-kit/meetings.test.ts b/tests/api-resources/realtime-kit/meetings.test.ts index b1622a2911..9fdbffd9c7 100644 --- a/tests/api-resources/realtime-kit/meetings.test.ts +++ b/tests/api-resources/realtime-kit/meetings.test.ts @@ -82,6 +82,7 @@ describe('resource meetings', () => { session_keep_alive_time_in_secs: 60, summarize_on_end: true, title: 'title', + transcribe_on_end: true, }); }); @@ -202,6 +203,7 @@ describe('resource meetings', () => { per_page: 0, search: 'search', start_time: '2019-12-27T18:11:19.117Z', + status: 'ACTIVE', }); }); @@ -390,6 +392,7 @@ describe('resource meetings', () => { session_keep_alive_time_in_secs: 60, summarize_on_end: true, title: 'title', + transcribe_on_end: true, }, ); }); @@ -432,10 +435,47 @@ describe('resource meetings', () => { live_stream_on_start: true, persist_chat: true, record_on_start: true, + recording_config: { + audio_config: { + channel: 'mono', + codec: 'MP3', + export_file: true, + }, + file_name_prefix: 'file_name_prefix', + live_streaming_config: { rtmp_url: 'rtmp://a.rtmp.youtube.com/live2' }, + max_seconds: 60, + realtimekit_bucket_config: { enabled: true }, + storage_config: { + type: 'aws', + access_key: 'access_key', + auth_method: 'KEY', + bucket: 'bucket', + host: 'host', + password: 'password', + path: 'path', + port: 0, + private_key: 'private_key', + region: 'us-east-1', + secret: 'secret', + username: 'username', + }, + video_config: { + codec: 'H264', + export_file: true, + height: 720, + watermark: { + position: 'left top', + size: { height: 1, width: 1 }, + url: 'https://example.com', + }, + width: 1280, + }, + }, session_keep_alive_time_in_secs: 60, status: 'INACTIVE', summarize_on_end: true, title: 'title', + transcribe_on_end: true, }, ); }); diff --git a/tests/api-resources/realtime-kit/sessions.test.ts b/tests/api-resources/realtime-kit/sessions.test.ts index 5362ed8754..b1a2ee2a29 100644 --- a/tests/api-resources/realtime-kit/sessions.test.ts +++ b/tests/api-resources/realtime-kit/sessions.test.ts @@ -12,9 +12,11 @@ const client = new Cloudflare({ describe('resource sessions', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('generateSummaryOfTranscripts: only required params', async () => { - const responsePromise = client.realtimeKit.sessions.generateSummaryOfTranscripts('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const responsePromise = client.realtimeKit.sessions.generateSummaryOfTranscripts( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -26,16 +28,20 @@ describe('resource sessions', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('generateSummaryOfTranscripts: required and optional params', async () => { - const response = await client.realtimeKit.sessions.generateSummaryOfTranscripts('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const response = await client.realtimeKit.sessions.generateSummaryOfTranscripts( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); }); // TODO: HTTP 401 from prism, support api tokens test.skip('getParticipantDataFromPeerId: only required params', async () => { - const responsePromise = client.realtimeKit.sessions.getParticipantDataFromPeerId('app_id', 'peer_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const responsePromise = client.realtimeKit.sessions.getParticipantDataFromPeerId( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -47,17 +53,20 @@ describe('resource sessions', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('getParticipantDataFromPeerId: required and optional params', async () => { - const response = await client.realtimeKit.sessions.getParticipantDataFromPeerId('app_id', 'peer_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - filters: 'device_info', - }); + const response = await client.realtimeKit.sessions.getParticipantDataFromPeerId( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353', filters: 'device_info' }, + ); }); // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionChat: only required params', async () => { - const responsePromise = client.realtimeKit.sessions.getSessionChat('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const responsePromise = client.realtimeKit.sessions.getSessionChat( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -69,16 +78,20 @@ describe('resource sessions', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionChat: required and optional params', async () => { - const response = await client.realtimeKit.sessions.getSessionChat('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const response = await client.realtimeKit.sessions.getSessionChat( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); }); // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionDetails: only required params', async () => { - const responsePromise = client.realtimeKit.sessions.getSessionDetails('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const responsePromise = client.realtimeKit.sessions.getSessionDetails( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -90,18 +103,19 @@ describe('resource sessions', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionDetails: required and optional params', async () => { - const response = await client.realtimeKit.sessions.getSessionDetails('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - include_breakout_rooms: true, - }); + const response = await client.realtimeKit.sessions.getSessionDetails( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353', include_breakout_rooms: true }, + ); }); // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionParticipantDetails: only required params', async () => { const responsePromise = client.realtimeKit.sessions.getSessionParticipantDetails( 'app_id', - 'session_id', - 'participant_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); const rawResponse = await responsePromise.asResponse(); @@ -117,8 +131,8 @@ describe('resource sessions', () => { test.skip('getSessionParticipantDetails: required and optional params', async () => { const response = await client.realtimeKit.sessions.getSessionParticipantDetails( 'app_id', - 'session_id', - 'participant_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', filters: 'device_info', @@ -129,9 +143,11 @@ describe('resource sessions', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionParticipants: only required params', async () => { - const responsePromise = client.realtimeKit.sessions.getSessionParticipants('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const responsePromise = client.realtimeKit.sessions.getSessionParticipants( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -143,23 +159,29 @@ describe('resource sessions', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionParticipants: required and optional params', async () => { - const response = await client.realtimeKit.sessions.getSessionParticipants('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - include_peer_events: true, - page_no: 0, - per_page: 0, - search: 'search', - sort_by: 'joinedAt', - sort_order: 'ASC', - view: 'raw', - }); + const response = await client.realtimeKit.sessions.getSessionParticipants( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + include_peer_events: true, + page_no: 0, + per_page: 0, + search: 'search', + sort_by: 'joinedAt', + sort_order: 'ASC', + view: 'raw', + }, + ); }); // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionSummary: only required params', async () => { - const responsePromise = client.realtimeKit.sessions.getSessionSummary('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const responsePromise = client.realtimeKit.sessions.getSessionSummary( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -171,16 +193,20 @@ describe('resource sessions', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionSummary: required and optional params', async () => { - const response = await client.realtimeKit.sessions.getSessionSummary('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const response = await client.realtimeKit.sessions.getSessionSummary( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); }); // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionTranscripts: only required params', async () => { - const responsePromise = client.realtimeKit.sessions.getSessionTranscripts('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const responsePromise = client.realtimeKit.sessions.getSessionTranscripts( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -192,9 +218,11 @@ describe('resource sessions', () => { // TODO: HTTP 401 from prism, support api tokens test.skip('getSessionTranscripts: required and optional params', async () => { - const response = await client.realtimeKit.sessions.getSessionTranscripts('app_id', 'session_id', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const response = await client.realtimeKit.sessions.getSessionTranscripts( + 'app_id', + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, + ); }); // TODO: HTTP 401 from prism, support api tokens @@ -215,7 +243,7 @@ describe('resource sessions', () => { test.skip('getSessions: required and optional params', async () => { const response = await client.realtimeKit.sessions.getSessions('app_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', - associated_id: 'associated_id', + associated_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', end_time: '2019-12-27T18:11:19.117Z', page_no: 0, participants: '1:10', From 6cfa424b56cd7b415299fd27cbe0dd8ac0366b50 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 May 2026 14:35:05 +0000 Subject: [PATCH 69/73] feat: feat(dls): add DLS regions and prefix_binding resources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(dls): add DLS regions and prefix_binding resources Maps the DLS regions (read-only) and regional_services/prefix_bindings (CRUD) endpoints to Stainless so they are picked up for SDK, Terraform, and developers.cloudflare.com/api generation. Endpoints: - regions.list: GET /accounts/{account_id}/dls/regions - regions.get: GET /accounts/{account_id}/dls/regions/{region_id} - prefix_bindings.list: GET /accounts/{account_id}/dls/regional_services/prefix_bindings - prefix_bindings.get: GET /accounts/{account_id}/dls/regional_services/prefix_bindings/{binding_id} - prefix_bindings.create: POST /accounts/{account_id}/dls/regional_services/prefix_bindings - prefix_bindings.edit: PATCH /accounts/{account_id}/dls/regional_services/prefix_bindings/{binding_id} - prefix_bindings.delete: DELETE /accounts/{account_id}/dls/regional_services/prefix_bindings/{binding_id} Terraform resource: cloudflare_dls_prefix_binding (regions are read-only — no Terraform managed resource). Registers dls in custom_casings with the explicit 'Data Localization Suite' display name (pascal/camel/snake remain DLS/dls/dls so SDK class and field names are unchanged), and adds a new top-level 'Data Localization Suite' category under docs.resources containing dls. --- .stats.yml | 4 +- api.md | 2 + scripts/detect-breaking-changes | 4 + src/index.ts | 5 + src/resources/dls.ts | 3 + src/resources/dls/api.md | 33 ++ src/resources/dls/dls.ts | 38 +++ src/resources/dls/index.ts | 12 + src/resources/dls/regional-services.ts | 3 + src/resources/dls/regional-services/index.ts | 17 + .../dls/regional-services/prefix-bindings.ts | 301 ++++++++++++++++++ .../regional-services/regional-services.ts | 42 +++ src/resources/dls/regions.ts | 118 +++++++ src/resources/index.ts | 1 + .../regional-services/prefix-bindings.test.ts | 119 +++++++ tests/api-resources/dls/regions.test.ts | 47 +++ 16 files changed, 747 insertions(+), 2 deletions(-) create mode 100644 src/resources/dls.ts create mode 100644 src/resources/dls/api.md create mode 100644 src/resources/dls/dls.ts create mode 100644 src/resources/dls/index.ts create mode 100644 src/resources/dls/regional-services.ts create mode 100644 src/resources/dls/regional-services/index.ts create mode 100644 src/resources/dls/regional-services/prefix-bindings.ts create mode 100644 src/resources/dls/regional-services/regional-services.ts create mode 100644 src/resources/dls/regions.ts create mode 100644 tests/api-resources/dls/regional-services/prefix-bindings.test.ts create mode 100644 tests/api-resources/dls/regions.test.ts diff --git a/.stats.yml b/.stats.yml index 2740aeb030..dfcc2dc341 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 2273 +configured_endpoints: 2280 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: 6195c88a622982f684a53b4864623309 -config_hash: 0148d517bb02129e9e259f11db3933eb +config_hash: 873a029df6d61c21b0ec8b6da9e67ce4 diff --git a/api.md b/api.md index 5bfb9e5cad..834fb30949 100644 --- a/api.md +++ b/api.md @@ -115,6 +115,8 @@ Types: # [Addressing](src/resources/addressing/api.md) +# [DLS](src/resources/dls/api.md) + # [AuditLogs](src/resources/audit-logs/api.md) # [Billing](src/resources/billing/api.md) diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes index 79d033667d..c23faf6f2f 100755 --- a/scripts/detect-breaking-changes +++ b/scripts/detect-breaking-changes @@ -278,6 +278,10 @@ TEST_PATHS=( tests/api-resources/addressing/prefixes/bgp-prefixes.test.ts tests/api-resources/addressing/prefixes/advertisement-status.test.ts tests/api-resources/addressing/prefixes/delegations.test.ts + tests/api-resources/dls/dls.test.ts + tests/api-resources/dls/regions.test.ts + tests/api-resources/dls/regional-services/regional-services.test.ts + tests/api-resources/dls/regional-services/prefix-bindings.test.ts tests/api-resources/audit-logs.test.ts tests/api-resources/billing/billing.test.ts tests/api-resources/billing/profiles.test.ts diff --git a/src/index.ts b/src/index.ts index 8e74e9dde1..6fb863d77c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -53,6 +53,7 @@ import { D1Resource } from './resources/d1/d1'; import { DCVDelegation } from './resources/dcv-delegation/dcv-delegation'; import { DDoSProtection } from './resources/ddos-protection/ddos-protection'; import { Diagnostics } from './resources/diagnostics/diagnostics'; +import { DLS } from './resources/dls/dls'; import { DNSFirewall } from './resources/dns-firewall/dns-firewall'; import { DNS } from './resources/dns/dns'; import { DurableObjects } from './resources/durable-objects/durable-objects'; @@ -322,6 +323,7 @@ export class Cloudflare extends Core.APIClient { urlNormalization: API.URLNormalization = new API.URLNormalization(this); spectrum: API.Spectrum = new API.Spectrum(this); addressing: API.Addressing = new API.Addressing(this); + dls: API.DLS = new API.DLS(this); auditLogs: API.AuditLogs = new API.AuditLogs(this); billing: API.Billing = new API.Billing(this); brandProtection: API.BrandProtection = new API.BrandProtection(this); @@ -572,6 +574,7 @@ Cloudflare.Rulesets = Rulesets; Cloudflare.URLNormalization = URLNormalization; Cloudflare.Spectrum = Spectrum; Cloudflare.Addressing = Addressing; +Cloudflare.DLS = DLS; Cloudflare.AuditLogs = AuditLogs; Cloudflare.Billing = Billing; Cloudflare.BrandProtection = BrandProtection; @@ -761,6 +764,8 @@ export declare namespace Cloudflare { export { Addressing as Addressing }; + export { DLS as DLS }; + export { AuditLogs as AuditLogs }; export { Billing as Billing }; diff --git a/src/resources/dls.ts b/src/resources/dls.ts new file mode 100644 index 0000000000..e67c9e5a9e --- /dev/null +++ b/src/resources/dls.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './dls/index'; diff --git a/src/resources/dls/api.md b/src/resources/dls/api.md new file mode 100644 index 0000000000..79e80f7544 --- /dev/null +++ b/src/resources/dls/api.md @@ -0,0 +1,33 @@ +# DLS + +## Regions + +Types: + +- RegionListResponse +- RegionGetResponse + +Methods: + +- client.dls.regions.list({ ...params }) -> RegionListResponsesCursorPagination +- client.dls.regions.get(regionId, { ...params }) -> RegionGetResponse + +## RegionalServices + +### PrefixBindings + +Types: + +- PrefixBindingCreateResponse +- PrefixBindingListResponse +- PrefixBindingDeleteResponse +- PrefixBindingEditResponse +- PrefixBindingGetResponse + +Methods: + +- client.dls.regionalServices.prefixBindings.create({ ...params }) -> PrefixBindingCreateResponse +- client.dls.regionalServices.prefixBindings.list({ ...params }) -> PrefixBindingListResponsesCursorPagination +- client.dls.regionalServices.prefixBindings.delete(bindingId, { ...params }) -> PrefixBindingDeleteResponse +- client.dls.regionalServices.prefixBindings.edit(bindingId, { ...params }) -> PrefixBindingEditResponse +- client.dls.regionalServices.prefixBindings.get(bindingId, { ...params }) -> PrefixBindingGetResponse diff --git a/src/resources/dls/dls.ts b/src/resources/dls/dls.ts new file mode 100644 index 0000000000..eb47d54de2 --- /dev/null +++ b/src/resources/dls/dls.ts @@ -0,0 +1,38 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as RegionsAPI from './regions'; +import { + RegionGetParams, + RegionGetResponse, + RegionListParams, + RegionListResponse, + RegionListResponsesCursorPagination, + Regions, +} from './regions'; +import * as RegionalServicesAPI from './regional-services/regional-services'; +import { RegionalServices } from './regional-services/regional-services'; + +export class DLS extends APIResource { + regions: RegionsAPI.Regions = new RegionsAPI.Regions(this._client); + regionalServices: RegionalServicesAPI.RegionalServices = new RegionalServicesAPI.RegionalServices( + this._client, + ); +} + +DLS.Regions = Regions; +DLS.RegionListResponsesCursorPagination = RegionListResponsesCursorPagination; +DLS.RegionalServices = RegionalServices; + +export declare namespace DLS { + export { + Regions as Regions, + type RegionListResponse as RegionListResponse, + type RegionGetResponse as RegionGetResponse, + RegionListResponsesCursorPagination as RegionListResponsesCursorPagination, + type RegionListParams as RegionListParams, + type RegionGetParams as RegionGetParams, + }; + + export { RegionalServices as RegionalServices }; +} diff --git a/src/resources/dls/index.ts b/src/resources/dls/index.ts new file mode 100644 index 0000000000..186b2e28a0 --- /dev/null +++ b/src/resources/dls/index.ts @@ -0,0 +1,12 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { DLS } from './dls'; +export { + RegionListResponsesCursorPagination, + Regions, + type RegionListResponse, + type RegionGetResponse, + type RegionListParams, + type RegionGetParams, +} from './regions'; +export { RegionalServices } from './regional-services/index'; diff --git a/src/resources/dls/regional-services.ts b/src/resources/dls/regional-services.ts new file mode 100644 index 0000000000..e4a6bc9773 --- /dev/null +++ b/src/resources/dls/regional-services.ts @@ -0,0 +1,3 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export * from './regional-services/index'; diff --git a/src/resources/dls/regional-services/index.ts b/src/resources/dls/regional-services/index.ts new file mode 100644 index 0000000000..acdc03292c --- /dev/null +++ b/src/resources/dls/regional-services/index.ts @@ -0,0 +1,17 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + PrefixBindingListResponsesCursorPagination, + PrefixBindings, + type PrefixBindingCreateResponse, + type PrefixBindingListResponse, + type PrefixBindingDeleteResponse, + type PrefixBindingEditResponse, + type PrefixBindingGetResponse, + type PrefixBindingCreateParams, + type PrefixBindingListParams, + type PrefixBindingDeleteParams, + type PrefixBindingEditParams, + type PrefixBindingGetParams, +} from './prefix-bindings'; +export { RegionalServices } from './regional-services'; diff --git a/src/resources/dls/regional-services/prefix-bindings.ts b/src/resources/dls/regional-services/prefix-bindings.ts new file mode 100644 index 0000000000..4b2b3335fb --- /dev/null +++ b/src/resources/dls/regional-services/prefix-bindings.ts @@ -0,0 +1,301 @@ +// 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 { CursorPagination, type CursorPaginationParams } from '../../../pagination'; + +export class PrefixBindings extends APIResource { + /** + * Create a DLS prefix binding + * + * @example + * ```ts + * const prefixBinding = + * await client.dls.regionalServices.prefixBindings.create({ + * account_id: 0, + * cidr: '10.0.1.0/24', + * prefix_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + * region_key: 'eu', + * }); + * ``` + */ + create( + params: PrefixBindingCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/dls/regional_services/prefix_bindings`, { + body, + ...options, + }) as Core.APIPromise<{ result: PrefixBindingCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List DLS prefix bindings for an account + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const prefixBindingListResponse of client.dls.regionalServices.prefixBindings.list( + * { account_id: 0 }, + * )) { + * // ... + * } + * ``` + */ + list( + params: PrefixBindingListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/dls/regional_services/prefix_bindings`, + PrefixBindingListResponsesCursorPagination, + { query, ...options }, + ); + } + + /** + * Delete a DLS prefix binding + * + * @example + * ```ts + * const prefixBinding = + * await client.dls.regionalServices.prefixBindings.delete( + * 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + * { account_id: 0 }, + * ); + * ``` + */ + delete( + bindingId: string, + params: PrefixBindingDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return this._client.delete( + `/accounts/${account_id}/dls/regional_services/prefix_bindings/${bindingId}`, + options, + ); + } + + /** + * Update a DLS prefix binding + * + * @example + * ```ts + * const response = + * await client.dls.regionalServices.prefixBindings.edit( + * 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + * { account_id: 0, region_key: 'eu' }, + * ); + * ``` + */ + edit( + bindingId: string, + params: PrefixBindingEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/dls/regional_services/prefix_bindings/${bindingId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: PrefixBindingEditResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get a DLS prefix binding + * + * @example + * ```ts + * const prefixBinding = + * await client.dls.regionalServices.prefixBindings.get( + * 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + * { account_id: 0 }, + * ); + * ``` + */ + get( + bindingId: string, + params: PrefixBindingGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/dls/regional_services/prefix_bindings/${bindingId}`, + options, + ) as Core.APIPromise<{ result: PrefixBindingGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class PrefixBindingListResponsesCursorPagination extends CursorPagination {} + +export interface PrefixBindingCreateResponse { + /** + * The ID of the binding. + */ + id: string; + + /** + * The CIDR that is bound. + */ + cidr: string; + + /** + * The ID of the parent prefix. + */ + prefix_id: string; + + /** + * The region key used for the binding. + */ + region_key: string; +} + +export interface PrefixBindingListResponse { + /** + * The ID of the binding. + */ + id: string; + + /** + * The CIDR that is bound. + */ + cidr: string; + + /** + * The ID of the parent prefix. + */ + prefix_id: string; + + /** + * The region key used for the binding. + */ + region_key: string; +} + +export interface PrefixBindingDeleteResponse { + messages: Array; + + success: boolean; + + errors?: Array; +} + +export interface PrefixBindingEditResponse { + /** + * The ID of the binding. + */ + id: string; + + /** + * The CIDR that is bound. + */ + cidr: string; + + /** + * The ID of the parent prefix. + */ + prefix_id: string; + + /** + * The region key used for the binding. + */ + region_key: string; +} + +export interface PrefixBindingGetResponse { + /** + * The ID of the binding. + */ + id: string; + + /** + * The CIDR that is bound. + */ + cidr: string; + + /** + * The ID of the parent prefix. + */ + prefix_id: string; + + /** + * The region key used for the binding. + */ + region_key: string; +} + +export interface PrefixBindingCreateParams { + /** + * Path param + */ + account_id: number; + + /** + * Body param: IP prefix in CIDR notation to bind. + */ + cidr: string; + + /** + * Body param: The ID of the parent IP prefix that contains the CIDR. + */ + prefix_id: string; + + /** + * Body param: Region key from managed regions (e.g., "us", "eu"). + */ + region_key: string; +} + +export interface PrefixBindingListParams extends CursorPaginationParams { + /** + * Path param + */ + account_id: number; +} + +export interface PrefixBindingDeleteParams { + account_id: number; +} + +export interface PrefixBindingEditParams { + /** + * Path param + */ + account_id: number; + + /** + * Body param: New region key to assign (e.g., "us", "eu", "cfcanary"). + */ + region_key: string; +} + +export interface PrefixBindingGetParams { + account_id: number; +} + +PrefixBindings.PrefixBindingListResponsesCursorPagination = PrefixBindingListResponsesCursorPagination; + +export declare namespace PrefixBindings { + export { + type PrefixBindingCreateResponse as PrefixBindingCreateResponse, + type PrefixBindingListResponse as PrefixBindingListResponse, + type PrefixBindingDeleteResponse as PrefixBindingDeleteResponse, + type PrefixBindingEditResponse as PrefixBindingEditResponse, + type PrefixBindingGetResponse as PrefixBindingGetResponse, + PrefixBindingListResponsesCursorPagination as PrefixBindingListResponsesCursorPagination, + type PrefixBindingCreateParams as PrefixBindingCreateParams, + type PrefixBindingListParams as PrefixBindingListParams, + type PrefixBindingDeleteParams as PrefixBindingDeleteParams, + type PrefixBindingEditParams as PrefixBindingEditParams, + type PrefixBindingGetParams as PrefixBindingGetParams, + }; +} diff --git a/src/resources/dls/regional-services/regional-services.ts b/src/resources/dls/regional-services/regional-services.ts new file mode 100644 index 0000000000..fe9ce63bf6 --- /dev/null +++ b/src/resources/dls/regional-services/regional-services.ts @@ -0,0 +1,42 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../../resource'; +import * as PrefixBindingsAPI from './prefix-bindings'; +import { + PrefixBindingCreateParams, + PrefixBindingCreateResponse, + PrefixBindingDeleteParams, + PrefixBindingDeleteResponse, + PrefixBindingEditParams, + PrefixBindingEditResponse, + PrefixBindingGetParams, + PrefixBindingGetResponse, + PrefixBindingListParams, + PrefixBindingListResponse, + PrefixBindingListResponsesCursorPagination, + PrefixBindings, +} from './prefix-bindings'; + +export class RegionalServices extends APIResource { + prefixBindings: PrefixBindingsAPI.PrefixBindings = new PrefixBindingsAPI.PrefixBindings(this._client); +} + +RegionalServices.PrefixBindings = PrefixBindings; +RegionalServices.PrefixBindingListResponsesCursorPagination = PrefixBindingListResponsesCursorPagination; + +export declare namespace RegionalServices { + export { + PrefixBindings as PrefixBindings, + type PrefixBindingCreateResponse as PrefixBindingCreateResponse, + type PrefixBindingListResponse as PrefixBindingListResponse, + type PrefixBindingDeleteResponse as PrefixBindingDeleteResponse, + type PrefixBindingEditResponse as PrefixBindingEditResponse, + type PrefixBindingGetResponse as PrefixBindingGetResponse, + PrefixBindingListResponsesCursorPagination as PrefixBindingListResponsesCursorPagination, + type PrefixBindingCreateParams as PrefixBindingCreateParams, + type PrefixBindingListParams as PrefixBindingListParams, + type PrefixBindingDeleteParams as PrefixBindingDeleteParams, + type PrefixBindingEditParams as PrefixBindingEditParams, + type PrefixBindingGetParams as PrefixBindingGetParams, + }; +} diff --git a/src/resources/dls/regions.ts b/src/resources/dls/regions.ts new file mode 100644 index 0000000000..75568c47cc --- /dev/null +++ b/src/resources/dls/regions.ts @@ -0,0 +1,118 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import { CursorPagination, type CursorPaginationParams } from '../../pagination'; + +export class Regions extends APIResource { + /** + * List DLS regions for an account + * + * @example + * ```ts + * // Automatically fetches more pages as needed. + * for await (const regionListResponse of client.dls.regions.list( + * { account_id: 0 }, + * )) { + * // ... + * } + * ``` + */ + list( + params: RegionListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id, ...query } = params; + return this._client.getAPIList( + `/accounts/${account_id}/dls/regions`, + RegionListResponsesCursorPagination, + { query, ...options }, + ); + } + + /** + * Get a DLS region + * + * @example + * ```ts + * const region = await client.dls.regions.get( + * 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + * { account_id: 0 }, + * ); + * ``` + */ + get( + regionId: string, + params: RegionGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/dls/regions/${regionId}`, options) as Core.APIPromise<{ + result: RegionGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class RegionListResponsesCursorPagination extends CursorPagination {} + +export interface RegionListResponse { + id: string; + + created_on: string; + + modified_on: string; + + name: string; + + region_key: string; + + version: number; + + version_created_on: string; +} + +export interface RegionGetResponse { + id: string; + + created_on: string; + + modified_on: string; + + name: string; + + region_key: string; + + version: number; + + version_created_on: string; +} + +export interface RegionListParams extends CursorPaginationParams { + /** + * Path param + */ + account_id: number; + + /** + * Query param: Filter regions by type. Omit to return all regions. + */ + type?: 'managed' | 'custom'; +} + +export interface RegionGetParams { + account_id: number; +} + +Regions.RegionListResponsesCursorPagination = RegionListResponsesCursorPagination; + +export declare namespace Regions { + export { + type RegionListResponse as RegionListResponse, + type RegionGetResponse as RegionGetResponse, + RegionListResponsesCursorPagination as RegionListResponsesCursorPagination, + type RegionListParams as RegionListParams, + type RegionGetParams as RegionGetParams, + }; +} diff --git a/src/resources/index.ts b/src/resources/index.ts index a217543e3c..3725086f4e 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -33,6 +33,7 @@ export { CustomPages } from './custom-pages/custom-pages'; export { D1Resource } from './d1/d1'; export { DCVDelegation } from './dcv-delegation'; export { DDoSProtection } from './ddos-protection/ddos-protection'; +export { DLS } from './dls/dls'; export { DNS } from './dns/dns'; export { DNSFirewall } from './dns-firewall/dns-firewall'; export { Diagnostics } from './diagnostics/diagnostics'; diff --git a/tests/api-resources/dls/regional-services/prefix-bindings.test.ts b/tests/api-resources/dls/regional-services/prefix-bindings.test.ts new file mode 100644 index 0000000000..0b94a283ad --- /dev/null +++ b/tests/api-resources/dls/regional-services/prefix-bindings.test.ts @@ -0,0 +1,119 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource prefixBindings', () => { + test('create: only required params', async () => { + const responsePromise = client.dls.regionalServices.prefixBindings.create({ + account_id: 0, + cidr: '10.0.1.0/24', + prefix_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + region_key: 'eu', + }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('create: required and optional params', async () => { + const response = await client.dls.regionalServices.prefixBindings.create({ + account_id: 0, + cidr: '10.0.1.0/24', + prefix_id: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + region_key: 'eu', + }); + }); + + test('list: only required params', async () => { + const responsePromise = client.dls.regionalServices.prefixBindings.list({ account_id: 0 }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.dls.regionalServices.prefixBindings.list({ + account_id: 0, + cursor: 'cursor', + per_page: 1, + }); + }); + + test('delete: only required params', async () => { + const responsePromise = client.dls.regionalServices.prefixBindings.delete( + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + { account_id: 0 }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('delete: required and optional params', async () => { + const response = await client.dls.regionalServices.prefixBindings.delete( + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + { account_id: 0 }, + ); + }); + + test('edit: only required params', async () => { + const responsePromise = client.dls.regionalServices.prefixBindings.edit( + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + { account_id: 0, region_key: 'eu' }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('edit: required and optional params', async () => { + const response = await client.dls.regionalServices.prefixBindings.edit( + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + { account_id: 0, region_key: 'eu' }, + ); + }); + + test('get: only required params', async () => { + const responsePromise = client.dls.regionalServices.prefixBindings.get( + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + { account_id: 0 }, + ); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.dls.regionalServices.prefixBindings.get( + 'a1b2c3d4-e5f6-7890-abcd-ef1234567890', + { account_id: 0 }, + ); + }); +}); diff --git a/tests/api-resources/dls/regions.test.ts b/tests/api-resources/dls/regions.test.ts new file mode 100644 index 0000000000..5cb8f2515e --- /dev/null +++ b/tests/api-resources/dls/regions.test.ts @@ -0,0 +1,47 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const client = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource regions', () => { + test('list: only required params', async () => { + const responsePromise = client.dls.regions.list({ account_id: 0 }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('list: required and optional params', async () => { + const response = await client.dls.regions.list({ + account_id: 0, + cursor: 'cursor', + per_page: 1, + type: 'managed', + }); + }); + + test('get: only required params', async () => { + const responsePromise = client.dls.regions.get('a1b2c3d4-e5f6-7890-abcd-ef1234567890', { account_id: 0 }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.dls.regions.get('a1b2c3d4-e5f6-7890-abcd-ef1234567890', { account_id: 0 }); + }); +}); From 85dd0f9827028c86cc6d348572f7da849f9b9d2c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 21 May 2026 14:59:17 +0000 Subject: [PATCH 70/73] chore(api): update composite API spec --- .stats.yml | 2 +- .../access/ai-controls/mcp/portals.ts | 236 +++++++++++++++++ .../access/ai-controls/mcp/servers.ts | 248 +++++++++++++++++- .../access/ai-controls/mcp/portals.test.ts | 2 + .../access/ai-controls/mcp/servers.test.ts | 2 + 5 files changed, 487 insertions(+), 3 deletions(-) diff --git a/.stats.yml b/.stats.yml index dfcc2dc341..344c370f93 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2280 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 6195c88a622982f684a53b4864623309 +openapi_spec_hash: 26772c26b37d468fb9752aa22ea815b9 config_hash: 873a029df6d61c21b0ec8b6da9e67ce4 diff --git a/src/resources/zero-trust/access/ai-controls/mcp/portals.ts b/src/resources/zero-trust/access/ai-controls/mcp/portals.ts index be7cef80e4..92081eed35 100644 --- a/src/resources/zero-trust/access/ai-controls/mcp/portals.ts +++ b/src/resources/zero-trust/access/ai-controls/mcp/portals.ts @@ -197,6 +197,17 @@ export namespace PortalCreateResponse { error?: string; + error_details?: Server.ErrorDetails; + + /** + * When true, the gateway worker uses the shared Cloudflare-owned OAuth callback + * endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the + * customer portal hostname. New servers default to true; existing servers default + * to false. Effective behavior is gated by the gateway worker's per-env rollout + * mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + last_successful_sync?: string; last_synced?: string; @@ -215,28 +226,75 @@ export namespace PortalCreateResponse { } export namespace Server { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } + export interface UpdatedPrompt { name: string; + /** + * @deprecated Deprecated: use `portal_description` or `server_description` + * instead. Populated for backward compatibility — portal-level wins when present, + * otherwise falls back to server-level. Will be removed after the deprecation + * window. + */ description?: string; enabled?: boolean; portal_alias?: string; + portal_description?: string; + server_alias?: string; + + server_description?: string; } export interface UpdatedTool { name: string; + /** + * @deprecated Deprecated: use `portal_description` or `server_description` + * instead. Populated for backward compatibility — portal-level wins when present, + * otherwise falls back to server-level. Will be removed after the deprecation + * window. + */ description?: string; enabled?: boolean; portal_alias?: string; + portal_description?: string; + server_alias?: string; + + server_description?: string; } } } @@ -301,6 +359,17 @@ export namespace PortalUpdateResponse { error?: string; + error_details?: Server.ErrorDetails; + + /** + * When true, the gateway worker uses the shared Cloudflare-owned OAuth callback + * endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the + * customer portal hostname. New servers default to true; existing servers default + * to false. Effective behavior is gated by the gateway worker's per-env rollout + * mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + last_successful_sync?: string; last_synced?: string; @@ -319,28 +388,75 @@ export namespace PortalUpdateResponse { } export namespace Server { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } + export interface UpdatedPrompt { name: string; + /** + * @deprecated Deprecated: use `portal_description` or `server_description` + * instead. Populated for backward compatibility — portal-level wins when present, + * otherwise falls back to server-level. Will be removed after the deprecation + * window. + */ description?: string; enabled?: boolean; portal_alias?: string; + portal_description?: string; + server_alias?: string; + + server_description?: string; } export interface UpdatedTool { name: string; + /** + * @deprecated Deprecated: use `portal_description` or `server_description` + * instead. Populated for backward compatibility — portal-level wins when present, + * otherwise falls back to server-level. Will be removed after the deprecation + * window. + */ description?: string; enabled?: boolean; portal_alias?: string; + portal_description?: string; + server_alias?: string; + + server_description?: string; } } } @@ -405,6 +521,17 @@ export namespace PortalListResponse { error?: string; + error_details?: Server.ErrorDetails; + + /** + * When true, the gateway worker uses the shared Cloudflare-owned OAuth callback + * endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the + * customer portal hostname. New servers default to true; existing servers default + * to false. Effective behavior is gated by the gateway worker's per-env rollout + * mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + last_successful_sync?: string; last_synced?: string; @@ -423,28 +550,75 @@ export namespace PortalListResponse { } export namespace Server { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } + export interface UpdatedPrompt { name: string; + /** + * @deprecated Deprecated: use `portal_description` or `server_description` + * instead. Populated for backward compatibility — portal-level wins when present, + * otherwise falls back to server-level. Will be removed after the deprecation + * window. + */ description?: string; enabled?: boolean; portal_alias?: string; + portal_description?: string; + server_alias?: string; + + server_description?: string; } export interface UpdatedTool { name: string; + /** + * @deprecated Deprecated: use `portal_description` or `server_description` + * instead. Populated for backward compatibility — portal-level wins when present, + * otherwise falls back to server-level. Will be removed after the deprecation + * window. + */ description?: string; enabled?: boolean; portal_alias?: string; + portal_description?: string; + server_alias?: string; + + server_description?: string; } } } @@ -540,6 +714,17 @@ export namespace PortalReadResponse { error?: string; + error_details?: Server.ErrorDetails; + + /** + * When true, the gateway worker uses the shared Cloudflare-owned OAuth callback + * endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the + * customer portal hostname. New servers default to true; existing servers default + * to false. Effective behavior is gated by the gateway worker's per-env rollout + * mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + last_successful_sync?: string; last_synced?: string; @@ -558,28 +743,75 @@ export namespace PortalReadResponse { } export namespace Server { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } + export interface UpdatedPrompt { name: string; + /** + * @deprecated Deprecated: use `portal_description` or `server_description` + * instead. Populated for backward compatibility — portal-level wins when present, + * otherwise falls back to server-level. Will be removed after the deprecation + * window. + */ description?: string; enabled?: boolean; portal_alias?: string; + portal_description?: string; + server_alias?: string; + + server_description?: string; } export interface UpdatedTool { name: string; + /** + * @deprecated Deprecated: use `portal_description` or `server_description` + * instead. Populated for backward compatibility — portal-level wins when present, + * otherwise falls back to server-level. Will be removed after the deprecation + * window. + */ description?: string; enabled?: boolean; portal_alias?: string; + portal_description?: string; + server_alias?: string; + + server_description?: string; } } } @@ -635,6 +867,8 @@ export namespace PortalCreateParams { default_disabled?: boolean; + is_shared_oauth_callback_enabled?: boolean; + on_behalf?: boolean; updated_prompts?: Array; @@ -711,6 +945,8 @@ export namespace PortalUpdateParams { default_disabled?: boolean; + is_shared_oauth_callback_enabled?: boolean; + on_behalf?: boolean; updated_prompts?: Array; diff --git a/src/resources/zero-trust/access/ai-controls/mcp/servers.ts b/src/resources/zero-trust/access/ai-controls/mcp/servers.ts index 33729452c7..5f283f57ef 100644 --- a/src/resources/zero-trust/access/ai-controls/mcp/servers.ts +++ b/src/resources/zero-trust/access/ai-controls/mcp/servers.ts @@ -136,7 +136,8 @@ export class Servers extends APIResource { } /** - * Syncs an MCP server's tool catalog with the portal. + * Syncs an MCP server's capabilities and returns the updated server state, + * including any connection errors. * * @example * ```ts @@ -188,6 +189,17 @@ export interface ServerCreateResponse { error?: string; + error_details?: ServerCreateResponse.ErrorDetails; + + /** + * When true, the gateway worker uses the shared Cloudflare-owned OAuth callback + * endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the + * customer portal hostname. New servers default to true; existing servers default + * to false. Effective behavior is gated by the gateway worker's per-env rollout + * mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + last_successful_sync?: string; last_synced?: string; @@ -204,6 +216,33 @@ export interface ServerCreateResponse { } export namespace ServerCreateResponse { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } + export interface UpdatedPrompt { name: string; @@ -249,6 +288,17 @@ export interface ServerUpdateResponse { error?: string; + error_details?: ServerUpdateResponse.ErrorDetails; + + /** + * When true, the gateway worker uses the shared Cloudflare-owned OAuth callback + * endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the + * customer portal hostname. New servers default to true; existing servers default + * to false. Effective behavior is gated by the gateway worker's per-env rollout + * mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + last_successful_sync?: string; last_synced?: string; @@ -265,6 +315,33 @@ export interface ServerUpdateResponse { } export namespace ServerUpdateResponse { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } + export interface UpdatedPrompt { name: string; @@ -310,6 +387,17 @@ export interface ServerListResponse { error?: string; + error_details?: ServerListResponse.ErrorDetails; + + /** + * When true, the gateway worker uses the shared Cloudflare-owned OAuth callback + * endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the + * customer portal hostname. New servers default to true; existing servers default + * to false. Effective behavior is gated by the gateway worker's per-env rollout + * mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + last_successful_sync?: string; last_synced?: string; @@ -326,6 +414,33 @@ export interface ServerListResponse { } export namespace ServerListResponse { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } + export interface UpdatedPrompt { name: string; @@ -371,6 +486,17 @@ export interface ServerDeleteResponse { error?: string; + error_details?: ServerDeleteResponse.ErrorDetails; + + /** + * When true, the gateway worker uses the shared Cloudflare-owned OAuth callback + * endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the + * customer portal hostname. New servers default to true; existing servers default + * to false. Effective behavior is gated by the gateway worker's per-env rollout + * mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + last_successful_sync?: string; last_synced?: string; @@ -387,6 +513,33 @@ export interface ServerDeleteResponse { } export namespace ServerDeleteResponse { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } + export interface UpdatedPrompt { name: string; @@ -432,6 +585,17 @@ export interface ServerReadResponse { error?: string; + error_details?: ServerReadResponse.ErrorDetails; + + /** + * When true, the gateway worker uses the shared Cloudflare-owned OAuth callback + * endpoint as the redirect_uri for upstream on-behalf OAuth, instead of the + * customer portal hostname. New servers default to true; existing servers default + * to false. Effective behavior is gated by the gateway worker's per-env rollout + * mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + last_successful_sync?: string; last_synced?: string; @@ -448,6 +612,33 @@ export interface ServerReadResponse { } export namespace ServerReadResponse { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } + export interface UpdatedPrompt { name: string; @@ -469,7 +660,42 @@ export namespace ServerReadResponse { } } -export type ServerSyncResponse = unknown; +export interface ServerSyncResponse { + error?: string; + + error_details?: ServerSyncResponse.ErrorDetails; + + status?: string; +} + +export namespace ServerSyncResponse { + export interface ErrorDetails { + /** + * Underlying error message + */ + cause?: string; + + /** + * True = MCP server returned an error. False = couldn't reach the server + */ + is_upstream?: boolean; + + /** + * MCP protocol error code + */ + mcp_code?: number; + + /** + * Whether the error is transient and worth retrying + */ + retryable?: boolean; + + /** + * HTTP status code from the server + */ + status_code?: number; + } +} export interface ServerCreateParams { /** @@ -507,6 +733,15 @@ export interface ServerCreateParams { */ description?: string | null; + /** + * Body param: When true, the gateway worker uses the shared Cloudflare-owned OAuth + * callback endpoint as the redirect_uri for upstream on-behalf OAuth, instead of + * the customer portal hostname. New servers default to true; existing servers + * default to false. Effective behavior is gated by the gateway worker's per-env + * rollout mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + /** * Body param */ @@ -556,6 +791,15 @@ export interface ServerUpdateParams { */ description?: string | null; + /** + * Body param: When true, the gateway worker uses the shared Cloudflare-owned OAuth + * callback endpoint as the redirect_uri for upstream on-behalf OAuth, instead of + * the customer portal hostname. New servers default to true; existing servers + * default to false. Effective behavior is gated by the gateway worker's per-env + * rollout mode KV key. + */ + is_shared_oauth_callback_enabled?: boolean; + /** * Body param */ diff --git a/tests/api-resources/zero-trust/access/ai-controls/mcp/portals.test.ts b/tests/api-resources/zero-trust/access/ai-controls/mcp/portals.test.ts index 7b8de46f91..ccec3c72aa 100644 --- a/tests/api-resources/zero-trust/access/ai-controls/mcp/portals.test.ts +++ b/tests/api-resources/zero-trust/access/ai-controls/mcp/portals.test.ts @@ -39,6 +39,7 @@ describe('resource portals', () => { { server_id: 'my-mcp-server', default_disabled: true, + is_shared_oauth_callback_enabled: true, on_behalf: true, updated_prompts: [ { @@ -86,6 +87,7 @@ describe('resource portals', () => { { server_id: 'my-mcp-server', default_disabled: true, + is_shared_oauth_callback_enabled: true, on_behalf: true, updated_prompts: [ { diff --git a/tests/api-resources/zero-trust/access/ai-controls/mcp/servers.test.ts b/tests/api-resources/zero-trust/access/ai-controls/mcp/servers.test.ts index 81b8030f75..26246c6801 100644 --- a/tests/api-resources/zero-trust/access/ai-controls/mcp/servers.test.ts +++ b/tests/api-resources/zero-trust/access/ai-controls/mcp/servers.test.ts @@ -36,6 +36,7 @@ describe('resource servers', () => { name: 'My MCP Server', auth_credentials: 'auth_credentials', description: 'This is one remote mcp server', + is_shared_oauth_callback_enabled: true, updated_prompts: [ { name: 'name', @@ -73,6 +74,7 @@ describe('resource servers', () => { account_id: 'a86a8f5c339544d7bdc89926de14fb8c', auth_credentials: 'auth_credentials', description: 'This is one remote mcp server', + is_shared_oauth_callback_enabled: true, name: 'My MCP Server', updated_prompts: [ { From ce026175c1d30c1245756570165c210f0956d9e3 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 May 2026 14:50:28 +0000 Subject: [PATCH 71/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 344c370f93..be8f0b13d2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2280 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: 26772c26b37d468fb9752aa22ea815b9 +openapi_spec_hash: a33a59810f4ca01d1a2a6221bd746dce config_hash: 873a029df6d61c21b0ec8b6da9e67ce4 From 6ccfdc4a343e1b207cb4deae174c509248e46a38 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 May 2026 15:42:17 +0000 Subject: [PATCH 72/73] feat: feat(snippets): add terraform id_property annotations for snippet and snippet_rules * feat(snippets): add terraform id_property annotations for snippet and snippet_rules Add terraform annotations to enable ImportState and proper Read generation: snippet: add id_property/id_path_param on get, update, delete snippet_rules: add get endpoint, id_property on get, update, delete ESCALATION-1786 Fixes https://github.com/cloudflare/terraform-provider-cloudflare/issues/7049 --- .stats.yml | 2 +- src/resources/snippets/api.md | 2 ++ src/resources/snippets/index.ts | 2 ++ src/resources/snippets/rules.ts | 26 ++++++++++++++++++++++ src/resources/snippets/snippets.ts | 4 ++++ tests/api-resources/snippets/rules.test.ts | 15 +++++++++++++ 6 files changed, 50 insertions(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index be8f0b13d2..f5ef585dab 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2280 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml openapi_spec_hash: a33a59810f4ca01d1a2a6221bd746dce -config_hash: 873a029df6d61c21b0ec8b6da9e67ce4 +config_hash: 3504379ebb14928a9890a391899a2e10 diff --git a/src/resources/snippets/api.md b/src/resources/snippets/api.md index dd61f2a4ba..91a26d802d 100644 --- a/src/resources/snippets/api.md +++ b/src/resources/snippets/api.md @@ -27,9 +27,11 @@ Types: - RuleUpdateResponse - RuleListResponse - RuleDeleteResponse +- RuleGetResponse Methods: - client.snippets.rules.update({ ...params }) -> RuleUpdateResponse - client.snippets.rules.list({ ...params }) -> RuleListResponse - client.snippets.rules.delete({ ...params }) -> RuleDeleteResponse +- client.snippets.rules.get({ ...params }) -> RuleGetResponse diff --git a/src/resources/snippets/index.ts b/src/resources/snippets/index.ts index cee6af4eb2..479b8e17f7 100644 --- a/src/resources/snippets/index.ts +++ b/src/resources/snippets/index.ts @@ -6,8 +6,10 @@ export { type RuleUpdateResponse, type RuleListResponse, type RuleDeleteResponse, + type RuleGetResponse, type RuleUpdateParams, type RuleListParams, type RuleDeleteParams, + type RuleGetParams, } from './rules'; export { Snippets } from './snippets'; diff --git a/src/resources/snippets/rules.ts b/src/resources/snippets/rules.ts index 7f5bc962c4..ebc737807e 100644 --- a/src/resources/snippets/rules.ts +++ b/src/resources/snippets/rules.ts @@ -39,6 +39,18 @@ export class Rules extends APIResource { }> )._thenUnwrap((obj) => obj.result); } + + /** + * Fetches all snippet rules belonging to the zone. + */ + get(params: RuleGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/snippets/snippet_rules`, options) as Core.APIPromise<{ + result: RuleGetResponse; + }> + )._thenUnwrap((obj) => obj.result); + } } /** @@ -56,6 +68,11 @@ export type RuleListResponse = unknown; */ export type RuleDeleteResponse = unknown; +/** + * Contain the response result. + */ +export type RuleGetResponse = unknown; + export interface RuleUpdateParams { /** * Path param: Use this field to specify the unique ID of the zone. @@ -109,13 +126,22 @@ export interface RuleDeleteParams { zone_id: string; } +export interface RuleGetParams { + /** + * Use this field to specify the unique ID of the zone. + */ + zone_id: string; +} + export declare namespace Rules { export { type RuleUpdateResponse as RuleUpdateResponse, type RuleListResponse as RuleListResponse, type RuleDeleteResponse as RuleDeleteResponse, + type RuleGetResponse as RuleGetResponse, type RuleUpdateParams as RuleUpdateParams, type RuleListParams as RuleListParams, type RuleDeleteParams as RuleDeleteParams, + type RuleGetParams as RuleGetParams, }; } diff --git a/src/resources/snippets/snippets.ts b/src/resources/snippets/snippets.ts index ec3ffce08d..e7c1ebbadc 100644 --- a/src/resources/snippets/snippets.ts +++ b/src/resources/snippets/snippets.ts @@ -8,6 +8,8 @@ import * as RulesAPI from './rules'; import { RuleDeleteParams, RuleDeleteResponse, + RuleGetParams, + RuleGetResponse, RuleListParams, RuleListResponse, RuleUpdateParams, @@ -222,8 +224,10 @@ export declare namespace Snippets { type RuleUpdateResponse as RuleUpdateResponse, type RuleListResponse as RuleListResponse, type RuleDeleteResponse as RuleDeleteResponse, + type RuleGetResponse as RuleGetResponse, type RuleUpdateParams as RuleUpdateParams, type RuleListParams as RuleListParams, type RuleDeleteParams as RuleDeleteParams, + type RuleGetParams as RuleGetParams, }; } diff --git a/tests/api-resources/snippets/rules.test.ts b/tests/api-resources/snippets/rules.test.ts index 5f329ac748..506f48276d 100644 --- a/tests/api-resources/snippets/rules.test.ts +++ b/tests/api-resources/snippets/rules.test.ts @@ -67,4 +67,19 @@ describe('resource rules', () => { test('delete: required and optional params', async () => { const response = await client.snippets.rules.delete({ zone_id: '9f1839b6152d298aca64c4e906b6d074' }); }); + + test('get: only required params', async () => { + const responsePromise = client.snippets.rules.get({ zone_id: '9f1839b6152d298aca64c4e906b6d074' }); + const rawResponse = await responsePromise.asResponse(); + expect(rawResponse).toBeInstanceOf(Response); + const response = await responsePromise; + expect(response).not.toBeInstanceOf(Response); + const dataAndResponse = await responsePromise.withResponse(); + expect(dataAndResponse.data).toBe(response); + expect(dataAndResponse.response).toBe(rawResponse); + }); + + test('get: required and optional params', async () => { + const response = await client.snippets.rules.get({ zone_id: '9f1839b6152d298aca64c4e906b6d074' }); + }); }); From bdb34964c6b1950a032c87a09de34f42441327b8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 22 May 2026 16:59:52 +0000 Subject: [PATCH 73/73] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f5ef585dab..d3e46d00ff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 2280 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-a6c352830d1270d0abb5bb983058ea21815e1bb7d2e163965335dcb0e706f057.yml -openapi_spec_hash: a33a59810f4ca01d1a2a6221bd746dce +openapi_spec_hash: 9fa1bf5d59398da9212855e06ad932b3 config_hash: 3504379ebb14928a9890a391899a2e10