diff --git a/.stats.yml b/.stats.yml index be95bf8bbf..0346a89ff9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1283 +configured_endpoints: 1296 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-241f970730129e553d466806420a1cf2f6d665abec11667004cb9cf070932a1e.yml diff --git a/api.md b/api.md index 5c421bf48e..d2ca83390e 100644 --- a/api.md +++ b/api.md @@ -3345,6 +3345,7 @@ Methods: - client.magicTransit.sites.update(siteId, { ...params }) -> Site - client.magicTransit.sites.list({ ...params }) -> SitesSinglePage - client.magicTransit.sites.delete(siteId, { ...params }) -> Site +- client.magicTransit.sites.edit(siteId, { ...params }) -> Site - client.magicTransit.sites.get(siteId, { ...params }) -> Site ### ACLs @@ -3362,6 +3363,7 @@ Methods: - client.magicTransit.sites.acls.update(siteId, aclIdentifier, { ...params }) -> ACL - client.magicTransit.sites.acls.list(siteId, { ...params }) -> ACLsSinglePage - client.magicTransit.sites.acls.delete(siteId, aclIdentifier, { ...params }) -> ACL +- client.magicTransit.sites.acls.edit(siteId, aclIdentifier, { ...params }) -> ACL - client.magicTransit.sites.acls.get(siteId, aclIdentifier, { ...params }) -> ACL ### LANs @@ -3382,6 +3384,7 @@ Methods: - client.magicTransit.sites.lans.update(siteId, lanId, { ...params }) -> LAN - client.magicTransit.sites.lans.list(siteId, { ...params }) -> LANsSinglePage - client.magicTransit.sites.lans.delete(siteId, lanId, { ...params }) -> LAN +- client.magicTransit.sites.lans.edit(siteId, lanId, { ...params }) -> LAN - client.magicTransit.sites.lans.get(siteId, lanId, { ...params }) -> LAN ### WANs @@ -3398,6 +3401,7 @@ Methods: - client.magicTransit.sites.wans.update(siteId, wanId, { ...params }) -> WAN - client.magicTransit.sites.wans.list(siteId, { ...params }) -> WANsSinglePage - client.magicTransit.sites.wans.delete(siteId, wanId, { ...params }) -> WAN +- client.magicTransit.sites.wans.edit(siteId, wanId, { ...params }) -> WAN - client.magicTransit.sites.wans.get(siteId, wanId, { ...params }) -> WAN ## Connectors @@ -3992,11 +3996,16 @@ Types: - QueryResult - DatabaseCreateResponse - DatabaseListResponse +- DatabaseDeleteResponse +- DatabaseQueryResponse Methods: - client.d1.database.create({ ...params }) -> DatabaseCreateResponse - client.d1.database.list({ ...params }) -> DatabaseListResponsesV4PagePaginationArray +- client.d1.database.delete(databaseId, { ...params }) -> DatabaseDeleteResponse +- client.d1.database.get(databaseId, { ...params }) -> D1 +- client.d1.database.query(databaseId, { ...params }) -> DatabaseQueryResponse # R2 @@ -5186,6 +5195,34 @@ Methods: - client.zeroTrust.riskScoring.summary.get(accountIdentifier, { ...params }) -> SummaryGetResponse +### Integrations + +Types: + +- IntegrationCreateResponse +- IntegrationUpdateResponse +- IntegrationListResponse +- IntegrationDeleteResponse +- IntegrationGetResponse + +Methods: + +- client.zeroTrust.riskScoring.integrations.create({ ...params }) -> IntegrationCreateResponse +- client.zeroTrust.riskScoring.integrations.update(integrationId, { ...params }) -> IntegrationUpdateResponse +- client.zeroTrust.riskScoring.integrations.list({ ...params }) -> IntegrationListResponsesSinglePage +- client.zeroTrust.riskScoring.integrations.delete(integrationId, { ...params }) -> IntegrationDeleteResponse +- client.zeroTrust.riskScoring.integrations.get(integrationId, { ...params }) -> IntegrationGetResponse + +#### References + +Types: + +- ReferenceGetResponse + +Methods: + +- client.zeroTrust.riskScoring.integrations.references.get(referenceId, { ...params }) -> ReferenceGetResponse + # Challenges ## Widgets diff --git a/src/resources/d1/d1.ts b/src/resources/d1/d1.ts index cc7ca3d91b..494b3c4ae2 100644 --- a/src/resources/d1/d1.ts +++ b/src/resources/d1/d1.ts @@ -32,7 +32,12 @@ export namespace D1Resource { export import QueryResult = DatabaseAPI.QueryResult; export import DatabaseCreateResponse = DatabaseAPI.DatabaseCreateResponse; export import DatabaseListResponse = DatabaseAPI.DatabaseListResponse; + export import DatabaseDeleteResponse = DatabaseAPI.DatabaseDeleteResponse; + export import DatabaseQueryResponse = DatabaseAPI.DatabaseQueryResponse; export import DatabaseListResponsesV4PagePaginationArray = DatabaseAPI.DatabaseListResponsesV4PagePaginationArray; export import DatabaseCreateParams = DatabaseAPI.DatabaseCreateParams; export import DatabaseListParams = DatabaseAPI.DatabaseListParams; + export import DatabaseDeleteParams = DatabaseAPI.DatabaseDeleteParams; + export import DatabaseGetParams = DatabaseAPI.DatabaseGetParams; + export import DatabaseQueryParams = DatabaseAPI.DatabaseQueryParams; } diff --git a/src/resources/d1/database.ts b/src/resources/d1/database.ts index d10994584e..f9a12d153e 100644 --- a/src/resources/d1/database.ts +++ b/src/resources/d1/database.ts @@ -3,6 +3,7 @@ import * as Core from '../../core'; import { APIResource } from '../../resource'; import * as DatabaseAPI from './database'; +import * as D1API from './d1'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class Database extends APIResource { @@ -35,6 +36,55 @@ export class Database extends APIResource { { query, ...options }, ); } + + /** + * Deletes the specified D1 database. + */ + delete( + databaseId: string, + params: DatabaseDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete(`/accounts/${account_id}/d1/database/${databaseId}`, options) as Core.APIPromise<{ + result: DatabaseDeleteResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Returns the specified D1 database. + */ + get( + databaseId: string, + params: DatabaseGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get(`/accounts/${account_id}/d1/database/${databaseId}`, options) as Core.APIPromise<{ + result: D1API.D1; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Returns the query result. + */ + query( + databaseId: string, + params: DatabaseQueryParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/d1/database/${databaseId}/query`, { + body, + ...options, + }) as Core.APIPromise<{ result: DatabaseQueryResponse }> + )._thenUnwrap((obj) => obj.result); + } } export class DatabaseListResponsesV4PagePaginationArray extends V4PagePaginationArray {} @@ -91,6 +141,10 @@ export interface DatabaseListResponse { version?: string; } +export type DatabaseDeleteResponse = unknown | string | null; + +export type DatabaseQueryResponse = Array; + export interface DatabaseCreateParams { /** * Path param: Account identifier tag. @@ -115,11 +169,47 @@ export interface DatabaseListParams extends V4PagePaginationArrayParams { name?: string; } +export interface DatabaseDeleteParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +export interface DatabaseGetParams { + /** + * Account identifier tag. + */ + account_id: string; +} + +export interface DatabaseQueryParams { + /** + * Path param: Account identifier tag. + */ + account_id: string; + + /** + * Body param: + */ + sql: string; + + /** + * Body param: + */ + params?: Array; +} + export namespace Database { export import QueryResult = DatabaseAPI.QueryResult; export import DatabaseCreateResponse = DatabaseAPI.DatabaseCreateResponse; export import DatabaseListResponse = DatabaseAPI.DatabaseListResponse; + export import DatabaseDeleteResponse = DatabaseAPI.DatabaseDeleteResponse; + export import DatabaseQueryResponse = DatabaseAPI.DatabaseQueryResponse; export import DatabaseListResponsesV4PagePaginationArray = DatabaseAPI.DatabaseListResponsesV4PagePaginationArray; export import DatabaseCreateParams = DatabaseAPI.DatabaseCreateParams; export import DatabaseListParams = DatabaseAPI.DatabaseListParams; + export import DatabaseDeleteParams = DatabaseAPI.DatabaseDeleteParams; + export import DatabaseGetParams = DatabaseAPI.DatabaseGetParams; + export import DatabaseQueryParams = DatabaseAPI.DatabaseQueryParams; } diff --git a/src/resources/d1/index.ts b/src/resources/d1/index.ts index 7fe552b020..13afa77f41 100644 --- a/src/resources/d1/index.ts +++ b/src/resources/d1/index.ts @@ -5,8 +5,13 @@ export { QueryResult, DatabaseCreateResponse, DatabaseListResponse, + DatabaseDeleteResponse, + DatabaseQueryResponse, DatabaseCreateParams, DatabaseListParams, + DatabaseDeleteParams, + DatabaseGetParams, + DatabaseQueryParams, DatabaseListResponsesV4PagePaginationArray, Database, } from './database'; diff --git a/src/resources/magic-transit/index.ts b/src/resources/magic-transit/index.ts index 1caa622a1e..7cf93a87f5 100644 --- a/src/resources/magic-transit/index.ts +++ b/src/resources/magic-transit/index.ts @@ -74,6 +74,7 @@ export { SiteUpdateParams, SiteListParams, SiteDeleteParams, + SiteEditParams, SiteGetParams, SitesSinglePage, Sites, diff --git a/src/resources/magic-transit/magic-transit.ts b/src/resources/magic-transit/magic-transit.ts index 1d29fb2d2e..85b272ab44 100644 --- a/src/resources/magic-transit/magic-transit.ts +++ b/src/resources/magic-transit/magic-transit.ts @@ -164,6 +164,7 @@ export namespace MagicTransit { export import SiteUpdateParams = SitesAPI.SiteUpdateParams; export import SiteListParams = SitesAPI.SiteListParams; export import SiteDeleteParams = SitesAPI.SiteDeleteParams; + export import SiteEditParams = SitesAPI.SiteEditParams; export import SiteGetParams = SitesAPI.SiteGetParams; export import Connectors = ConnectorsAPI.Connectors; export import ConnectorUpdateResponse = ConnectorsAPI.ConnectorUpdateResponse; diff --git a/src/resources/magic-transit/sites/acls.ts b/src/resources/magic-transit/sites/acls.ts index 8b370b2383..c044399a9c 100644 --- a/src/resources/magic-transit/sites/acls.ts +++ b/src/resources/magic-transit/sites/acls.ts @@ -71,6 +71,24 @@ export class ACLs extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Patch a specific Site ACL. + */ + edit( + siteId: string, + aclIdentifier: string, + params: ACLEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/magic/sites/${siteId}/acls/${aclIdentifier}`, { + body, + ...options, + }) as Core.APIPromise<{ result: ACL }> + )._thenUnwrap((obj) => obj.result); + } + /** * Get a specific Site ACL. */ @@ -290,6 +308,46 @@ export interface ACLDeleteParams { account_id: string; } +export interface ACLEditParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: Description for the ACL. + */ + description?: string; + + /** + * Body param: The desired forwarding action for this ACL policy. If set to + * "false", the policy will forward traffic to Cloudflare. If set to "true", the + * policy will forward traffic locally on the Magic WAN Connector. If not included + * in request, will default to false. + */ + forward_locally?: boolean; + + /** + * Body param: + */ + lan_1?: ACLConfigurationParam; + + /** + * Body param: + */ + lan_2?: ACLConfigurationParam; + + /** + * Body param: The name of the ACL. + */ + name?: string; + + /** + * Body param: + */ + protocols?: Array; +} + export interface ACLGetParams { /** * Identifier @@ -307,5 +365,6 @@ export namespace ACLs { export import ACLUpdateParams = ACLsAPI.ACLUpdateParams; export import ACLListParams = ACLsAPI.ACLListParams; export import ACLDeleteParams = ACLsAPI.ACLDeleteParams; + export import ACLEditParams = ACLsAPI.ACLEditParams; export import ACLGetParams = ACLsAPI.ACLGetParams; } diff --git a/src/resources/magic-transit/sites/index.ts b/src/resources/magic-transit/sites/index.ts index d1a1a5a659..d401e52d54 100644 --- a/src/resources/magic-transit/sites/index.ts +++ b/src/resources/magic-transit/sites/index.ts @@ -9,6 +9,7 @@ export { ACLUpdateParams, ACLListParams, ACLDeleteParams, + ACLEditParams, ACLGetParams, ACLsSinglePage, ACLs, @@ -25,6 +26,7 @@ export { LANUpdateParams, LANListParams, LANDeleteParams, + LANEditParams, LANGetParams, LANsSinglePage, LANs, @@ -36,6 +38,7 @@ export { SiteUpdateParams, SiteListParams, SiteDeleteParams, + SiteEditParams, SiteGetParams, SitesSinglePage, Sites, @@ -48,6 +51,7 @@ export { WANUpdateParams, WANListParams, WANDeleteParams, + WANEditParams, WANGetParams, WANsSinglePage, WANs, diff --git a/src/resources/magic-transit/sites/lans.ts b/src/resources/magic-transit/sites/lans.ts index 944bc980bd..a84bb7d0cf 100644 --- a/src/resources/magic-transit/sites/lans.ts +++ b/src/resources/magic-transit/sites/lans.ts @@ -76,6 +76,24 @@ export class LANs extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Patch a specific LAN. + */ + edit( + siteId: string, + lanId: string, + params: LANEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/magic/sites/${siteId}/lans/${lanId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: LAN }> + )._thenUnwrap((obj) => obj.result); + } + /** * Get a specific LAN. */ @@ -389,6 +407,46 @@ export interface LANDeleteParams { account_id: string; } +export interface LANEditParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: + */ + name?: string; + + /** + * Body param: + */ + nat?: NatParam; + + /** + * Body param: + */ + physport?: number; + + /** + * Body param: + */ + routed_subnets?: Array; + + /** + * Body param: If the site is not configured in high availability mode, this + * configuration is optional (if omitted, use DHCP). However, if in high + * availability mode, static_address is required along with secondary and virtual + * address. + */ + static_addressing?: LANStaticAddressingParam; + + /** + * Body param: VLAN port number. + */ + vlan_tag?: number; +} + export interface LANGetParams { /** * Identifier @@ -409,5 +467,6 @@ export namespace LANs { export import LANUpdateParams = LANsAPI.LANUpdateParams; export import LANListParams = LANsAPI.LANListParams; export import LANDeleteParams = LANsAPI.LANDeleteParams; + export import LANEditParams = LANsAPI.LANEditParams; export import LANGetParams = LANsAPI.LANGetParams; } diff --git a/src/resources/magic-transit/sites/sites.ts b/src/resources/magic-transit/sites/sites.ts index a85ad5d8d0..36283bcca9 100644 --- a/src/resources/magic-transit/sites/sites.ts +++ b/src/resources/magic-transit/sites/sites.ts @@ -63,6 +63,19 @@ export class Sites extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Patch a specific Site. + */ + edit(siteId: string, params: SiteEditParams, options?: Core.RequestOptions): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/magic/sites/${siteId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: Site }> + )._thenUnwrap((obj) => obj.result); + } + /** * Get a specific Site. */ @@ -234,6 +247,39 @@ export interface SiteDeleteParams { account_id: string; } +export interface SiteEditParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: Magic WAN Connector identifier tag. + */ + connector_id?: string; + + /** + * Body param: + */ + description?: string; + + /** + * Body param: Location of site in latitude and longitude. + */ + location?: SiteLocationParam; + + /** + * Body param: The name of the site. + */ + name?: string; + + /** + * Body param: Magic WAN Connector identifier tag. Used when high availability mode + * is on. + */ + secondary_connector_id?: string; +} + export interface SiteGetParams { /** * Identifier @@ -249,6 +295,7 @@ export namespace Sites { export import SiteUpdateParams = SitesAPI.SiteUpdateParams; export import SiteListParams = SitesAPI.SiteListParams; export import SiteDeleteParams = SitesAPI.SiteDeleteParams; + export import SiteEditParams = SitesAPI.SiteEditParams; export import SiteGetParams = SitesAPI.SiteGetParams; export import ACLs = ACLsAPI.ACLs; export import ACL = ACLsAPI.ACL; @@ -260,6 +307,7 @@ export namespace Sites { export import ACLUpdateParams = ACLsAPI.ACLUpdateParams; export import ACLListParams = ACLsAPI.ACLListParams; export import ACLDeleteParams = ACLsAPI.ACLDeleteParams; + export import ACLEditParams = ACLsAPI.ACLEditParams; export import ACLGetParams = ACLsAPI.ACLGetParams; export import LANs = LANsAPI.LANs; export import DHCPRelay = LANsAPI.DHCPRelay; @@ -274,6 +322,7 @@ export namespace Sites { export import LANUpdateParams = LANsAPI.LANUpdateParams; export import LANListParams = LANsAPI.LANListParams; export import LANDeleteParams = LANsAPI.LANDeleteParams; + export import LANEditParams = LANsAPI.LANEditParams; export import LANGetParams = LANsAPI.LANGetParams; export import WANs = WANsAPI.WANs; export import WAN = WANsAPI.WAN; @@ -284,5 +333,6 @@ export namespace Sites { export import WANUpdateParams = WANsAPI.WANUpdateParams; export import WANListParams = WANsAPI.WANListParams; export import WANDeleteParams = WANsAPI.WANDeleteParams; + export import WANEditParams = WANsAPI.WANEditParams; export import WANGetParams = WANsAPI.WANGetParams; } diff --git a/src/resources/magic-transit/sites/wans.ts b/src/resources/magic-transit/sites/wans.ts index 80ff42d5fb..d3d58d29bf 100644 --- a/src/resources/magic-transit/sites/wans.ts +++ b/src/resources/magic-transit/sites/wans.ts @@ -75,6 +75,24 @@ export class WANs extends APIResource { )._thenUnwrap((obj) => obj.result); } + /** + * Patch a specific WAN. + */ + edit( + siteId: string, + wanId: string, + params: WANEditParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.patch(`/accounts/${account_id}/magic/sites/${siteId}/wans/${wanId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: WAN }> + )._thenUnwrap((obj) => obj.result); + } + /** * Get a specific WAN. */ @@ -252,6 +270,39 @@ export interface WANDeleteParams { account_id: string; } +export interface WANEditParams { + /** + * Path param: Identifier + */ + account_id: string; + + /** + * Body param: + */ + name?: string; + + /** + * Body param: + */ + physport?: number; + + /** + * Body param: + */ + priority?: number; + + /** + * Body param: (optional) if omitted, use DHCP. Submit secondary_address when site + * is in high availability mode. + */ + static_addressing?: WANStaticAddressingParam; + + /** + * Body param: VLAN port number. + */ + vlan_tag?: number; +} + export interface WANGetParams { /** * Identifier @@ -268,5 +319,6 @@ export namespace WANs { export import WANUpdateParams = WANsAPI.WANUpdateParams; export import WANListParams = WANsAPI.WANListParams; export import WANDeleteParams = WANsAPI.WANDeleteParams; + export import WANEditParams = WANsAPI.WANEditParams; export import WANGetParams = WANsAPI.WANGetParams; } diff --git a/src/resources/zero-trust/risk-scoring/index.ts b/src/resources/zero-trust/risk-scoring/index.ts index a20f923015..97dfa937ea 100644 --- a/src/resources/zero-trust/risk-scoring/index.ts +++ b/src/resources/zero-trust/risk-scoring/index.ts @@ -6,6 +6,20 @@ export { BehaviourUpdateParams, Behaviours, } from './behaviours'; +export { + IntegrationCreateResponse, + IntegrationUpdateResponse, + IntegrationListResponse, + IntegrationDeleteResponse, + IntegrationGetResponse, + IntegrationCreateParams, + IntegrationUpdateParams, + IntegrationListParams, + IntegrationDeleteParams, + IntegrationGetParams, + IntegrationListResponsesSinglePage, + Integrations, +} from './integrations/index'; export { RiskScoringGetResponse, RiskScoringResetResponse, diff --git a/src/resources/zero-trust/risk-scoring/integrations/index.ts b/src/resources/zero-trust/risk-scoring/integrations/index.ts new file mode 100644 index 0000000000..f2630784e4 --- /dev/null +++ b/src/resources/zero-trust/risk-scoring/integrations/index.ts @@ -0,0 +1,17 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { + IntegrationCreateResponse, + IntegrationUpdateResponse, + IntegrationListResponse, + IntegrationDeleteResponse, + IntegrationGetResponse, + IntegrationCreateParams, + IntegrationUpdateParams, + IntegrationListParams, + IntegrationDeleteParams, + IntegrationGetParams, + IntegrationListResponsesSinglePage, + Integrations, +} from './integrations'; +export { ReferenceGetResponse, ReferenceGetParams, References } from './references'; diff --git a/src/resources/zero-trust/risk-scoring/integrations/integrations.ts b/src/resources/zero-trust/risk-scoring/integrations/integrations.ts new file mode 100644 index 0000000000..ac7e812e40 --- /dev/null +++ b/src/resources/zero-trust/risk-scoring/integrations/integrations.ts @@ -0,0 +1,321 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../../core'; +import { APIResource } from '../../../../resource'; +import * as IntegrationsAPI from './integrations'; +import * as ReferencesAPI from './references'; +import { SinglePage } from '../../../../pagination'; + +export class Integrations extends APIResource { + references: ReferencesAPI.References = new ReferencesAPI.References(this._client); + + /** + * Create new risk score integration. + */ + create( + params: IntegrationCreateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.post(`/accounts/${account_id}/zt_risk_scoring/integrations`, { + body, + ...options, + }) as Core.APIPromise<{ result: IntegrationCreateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Update a risk score integration. + * + * Overwrite the reference_id, tenant_url, and active values with the ones provided + */ + update( + integrationId: string, + params: IntegrationUpdateParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id, ...body } = params; + return ( + this._client.put(`/accounts/${account_id}/zt_risk_scoring/integrations/${integrationId}`, { + body, + ...options, + }) as Core.APIPromise<{ result: IntegrationUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * List all risk score integrations for the account. + */ + list( + params: IntegrationListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { account_id } = params; + return this._client.getAPIList( + `/accounts/${account_id}/zt_risk_scoring/integrations`, + IntegrationListResponsesSinglePage, + options, + ); + } + + /** + * Delete a risk score integration. + */ + delete( + integrationId: string, + params: IntegrationDeleteParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.delete( + `/accounts/${account_id}/zt_risk_scoring/integrations/${integrationId}`, + options, + ) as Core.APIPromise<{ result: IntegrationDeleteResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Get risk score integration by id. + */ + get( + integrationId: string, + params: IntegrationGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/zt_risk_scoring/integrations/${integrationId}`, + options, + ) as Core.APIPromise<{ result: IntegrationGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export class IntegrationListResponsesSinglePage extends SinglePage {} + +export interface IntegrationCreateResponse { + /** + * The id of the integration, a UUIDv4. + */ + id: string; + + /** + * The Cloudflare account tag. + */ + account_tag: string; + + /** + * Whether this integration is enabled and should export changes in risk score. + */ + active: boolean; + + /** + * When the integration was created in RFC3339 format. + */ + created_at: string; + + integration_type: 'Okta'; + + /** + * A reference ID defined by the client. Should be set to the Access-Okta IDP + * integration ID. Useful when the risk-score integration needs to be associated + * with a secondary asset and recalled using that ID. + */ + reference_id: string; + + /** + * The base URL for the tenant. E.g. "https://tenant.okta.com" + */ + tenant_url: string; +} + +export interface IntegrationUpdateResponse { + /** + * The id of the integration, a UUIDv4. + */ + id: string; + + /** + * The Cloudflare account tag. + */ + account_tag: string; + + /** + * Whether this integration is enabled and should export changes in risk score. + */ + active: boolean; + + /** + * When the integration was created in RFC3339 format. + */ + created_at: string; + + integration_type: 'Okta'; + + /** + * A reference ID defined by the client. Should be set to the Access-Okta IDP + * integration ID. Useful when the risk-score integration needs to be associated + * with a secondary asset and recalled using that ID. + */ + reference_id: string; + + /** + * The base URL for the tenant. E.g. "https://tenant.okta.com" + */ + tenant_url: string; +} + +export interface IntegrationListResponse { + /** + * The id of the integration, a UUIDv4. + */ + id: string; + + /** + * The Cloudflare account tag. + */ + account_tag: string; + + /** + * Whether this integration is enabled and should export changes in risk score. + */ + active: boolean; + + /** + * When the integration was created in RFC3339 format. + */ + created_at: string; + + integration_type: 'Okta'; + + /** + * A reference ID defined by the client. Should be set to the Access-Okta IDP + * integration ID. Useful when the risk-score integration needs to be associated + * with a secondary asset and recalled using that ID. + */ + reference_id: string; + + /** + * The base URL for the tenant. E.g. "https://tenant.okta.com" + */ + tenant_url: string; +} + +export type IntegrationDeleteResponse = unknown; + +export interface IntegrationGetResponse { + /** + * The id of the integration, a UUIDv4. + */ + id: string; + + /** + * The Cloudflare account tag. + */ + account_tag: string; + + /** + * Whether this integration is enabled and should export changes in risk score. + */ + active: boolean; + + /** + * When the integration was created in RFC3339 format. + */ + created_at: string; + + integration_type: 'Okta'; + + /** + * A reference ID defined by the client. Should be set to the Access-Okta IDP + * integration ID. Useful when the risk-score integration needs to be associated + * with a secondary asset and recalled using that ID. + */ + reference_id: string; + + /** + * The base URL for the tenant. E.g. "https://tenant.okta.com" + */ + tenant_url: string; +} + +export interface IntegrationCreateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: + */ + integration_type: 'Okta'; + + /** + * Body param: The base url of the tenant, e.g. "https://tenant.okta.com" + */ + tenant_url: string; + + /** + * Body param: A reference id that can be supplied by the client. Currently this + * should be set to the Access-Okta IDP ID (a UUIDv4). + * https://developers.cloudflare.com/api/operations/access-identity-providers-get-an-access-identity-provider + */ + reference_id?: string | null; +} + +export interface IntegrationUpdateParams { + /** + * Path param: + */ + account_id: string; + + /** + * Body param: Whether this integration is enabled. If disabled, no risk changes + * will be exported to the third-party. + */ + active: boolean; + + /** + * Body param: The base url of the tenant, e.g. "https://tenant.okta.com" + */ + tenant_url: string; + + /** + * Body param: A reference id that can be supplied by the client. Currently this + * should be set to the Access-Okta IDP ID (a UUIDv4). + * https://developers.cloudflare.com/api/operations/access-identity-providers-get-an-access-identity-provider + */ + reference_id?: string | null; +} + +export interface IntegrationListParams { + account_id: string; +} + +export interface IntegrationDeleteParams { + account_id: string; +} + +export interface IntegrationGetParams { + account_id: string; +} + +export namespace Integrations { + export import IntegrationCreateResponse = IntegrationsAPI.IntegrationCreateResponse; + export import IntegrationUpdateResponse = IntegrationsAPI.IntegrationUpdateResponse; + export import IntegrationListResponse = IntegrationsAPI.IntegrationListResponse; + export import IntegrationDeleteResponse = IntegrationsAPI.IntegrationDeleteResponse; + export import IntegrationGetResponse = IntegrationsAPI.IntegrationGetResponse; + export import IntegrationListResponsesSinglePage = IntegrationsAPI.IntegrationListResponsesSinglePage; + export import IntegrationCreateParams = IntegrationsAPI.IntegrationCreateParams; + export import IntegrationUpdateParams = IntegrationsAPI.IntegrationUpdateParams; + export import IntegrationListParams = IntegrationsAPI.IntegrationListParams; + export import IntegrationDeleteParams = IntegrationsAPI.IntegrationDeleteParams; + export import IntegrationGetParams = IntegrationsAPI.IntegrationGetParams; + export import References = ReferencesAPI.References; + export import ReferenceGetResponse = ReferencesAPI.ReferenceGetResponse; + export import ReferenceGetParams = ReferencesAPI.ReferenceGetParams; +} diff --git a/src/resources/zero-trust/risk-scoring/integrations/references.ts b/src/resources/zero-trust/risk-scoring/integrations/references.ts new file mode 100644 index 0000000000..54a8b84fb8 --- /dev/null +++ b/src/resources/zero-trust/risk-scoring/integrations/references.ts @@ -0,0 +1,69 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import * as Core from '../../../../core'; +import { APIResource } from '../../../../resource'; +import * as ReferencesAPI from './references'; + +export class References extends APIResource { + /** + * Get risk score integration by reference id. + */ + get( + referenceId: string, + params: ReferenceGetParams, + options?: Core.RequestOptions, + ): Core.APIPromise { + const { account_id } = params; + return ( + this._client.get( + `/accounts/${account_id}/zt_risk_scoring/integrations/reference_id/${referenceId}`, + options, + ) as Core.APIPromise<{ result: ReferenceGetResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface ReferenceGetResponse { + /** + * The id of the integration, a UUIDv4. + */ + id: string; + + /** + * The Cloudflare account tag. + */ + account_tag: string; + + /** + * Whether this integration is enabled and should export changes in risk score. + */ + active: boolean; + + /** + * When the integration was created in RFC3339 format. + */ + created_at: string; + + integration_type: 'Okta'; + + /** + * A reference ID defined by the client. Should be set to the Access-Okta IDP + * integration ID. Useful when the risk-score integration needs to be associated + * with a secondary asset and recalled using that ID. + */ + reference_id: string; + + /** + * The base URL for the tenant. E.g. "https://tenant.okta.com" + */ + tenant_url: string; +} + +export interface ReferenceGetParams { + account_id: string; +} + +export namespace References { + export import ReferenceGetResponse = ReferencesAPI.ReferenceGetResponse; + export import ReferenceGetParams = ReferencesAPI.ReferenceGetParams; +} diff --git a/src/resources/zero-trust/risk-scoring/risk-scoring.ts b/src/resources/zero-trust/risk-scoring/risk-scoring.ts index 6f4e81aab3..5c3111b09a 100644 --- a/src/resources/zero-trust/risk-scoring/risk-scoring.ts +++ b/src/resources/zero-trust/risk-scoring/risk-scoring.ts @@ -6,10 +6,12 @@ import { isRequestOptions } from '../../../core'; import * as RiskScoringAPI from './risk-scoring'; import * as BehavioursAPI from './behaviours'; import * as SummaryAPI from './summary'; +import * as IntegrationsAPI from './integrations/integrations'; export class RiskScoring extends APIResource { behaviours: BehavioursAPI.Behaviours = new BehavioursAPI.Behaviours(this._client); summary: SummaryAPI.Summary = new SummaryAPI.Summary(this._client); + integrations: IntegrationsAPI.Integrations = new IntegrationsAPI.Integrations(this._client); /** * Get risk event/score information for a specific user @@ -108,4 +110,16 @@ export namespace RiskScoring { export import Summary = SummaryAPI.Summary; export import SummaryGetResponse = SummaryAPI.SummaryGetResponse; export import SummaryGetParams = SummaryAPI.SummaryGetParams; + export import Integrations = IntegrationsAPI.Integrations; + export import IntegrationCreateResponse = IntegrationsAPI.IntegrationCreateResponse; + export import IntegrationUpdateResponse = IntegrationsAPI.IntegrationUpdateResponse; + export import IntegrationListResponse = IntegrationsAPI.IntegrationListResponse; + export import IntegrationDeleteResponse = IntegrationsAPI.IntegrationDeleteResponse; + export import IntegrationGetResponse = IntegrationsAPI.IntegrationGetResponse; + export import IntegrationListResponsesSinglePage = IntegrationsAPI.IntegrationListResponsesSinglePage; + export import IntegrationCreateParams = IntegrationsAPI.IntegrationCreateParams; + export import IntegrationUpdateParams = IntegrationsAPI.IntegrationUpdateParams; + export import IntegrationListParams = IntegrationsAPI.IntegrationListParams; + export import IntegrationDeleteParams = IntegrationsAPI.IntegrationDeleteParams; + export import IntegrationGetParams = IntegrationsAPI.IntegrationGetParams; } diff --git a/tests/api-resources/d1/database.test.ts b/tests/api-resources/d1/database.test.ts index 8deb5aa1ea..c13216b1b2 100644 --- a/tests/api-resources/d1/database.test.ts +++ b/tests/api-resources/d1/database.test.ts @@ -50,4 +50,64 @@ describe('resource database', () => { per_page: 10, }); }); + + test('delete: only required params', async () => { + const responsePromise = cloudflare.d1.database.delete('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', { + 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 cloudflare.d1.database.delete('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); + + test('get: only required params', async () => { + const responsePromise = cloudflare.d1.database.get('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', { + 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 cloudflare.d1.database.get('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); + + test('query: only required params', async () => { + const responsePromise = cloudflare.d1.database.query('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + sql: 'SELECT * FROM myTable WHERE field = ? OR field = ?;', + }); + 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('query: required and optional params', async () => { + const response = await cloudflare.d1.database.query('xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + sql: 'SELECT * FROM myTable WHERE field = ? OR field = ?;', + params: ['firstParam', 'secondParam'], + }); + }); }); diff --git a/tests/api-resources/magic-transit/sites/acls.test.ts b/tests/api-resources/magic-transit/sites/acls.test.ts index f5468401e1..87763d424d 100644 --- a/tests/api-resources/magic-transit/sites/acls.test.ts +++ b/tests/api-resources/magic-transit/sites/acls.test.ts @@ -131,6 +131,47 @@ describe('resource acls', () => { ); }); + test('edit: only required params', async () => { + const responsePromise = cloudflare.magicTransit.sites.acls.edit( + '023e105f4ecef8ad9ca31a8372d0c353', + '023e105f4ecef8ad9ca31a8372d0c353', + { 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 cloudflare.magicTransit.sites.acls.edit( + '023e105f4ecef8ad9ca31a8372d0c353', + '023e105f4ecef8ad9ca31a8372d0c353', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + description: 'Allows local traffic between PIN pads and cash register.', + forward_locally: true, + lan_1: { + lan_id: 'string', + lan_name: 'string', + ports: [1, 1, 1], + subnets: ['192.0.2.1', '192.0.2.1', '192.0.2.1'], + }, + lan_2: { + lan_id: 'string', + lan_name: 'string', + ports: [1, 1, 1], + subnets: ['192.0.2.1', '192.0.2.1', '192.0.2.1'], + }, + name: 'PIN Pad - Cash Register', + protocols: ['tcp', 'udp', 'icmp'], + }, + ); + }); + test('get: only required params', async () => { const responsePromise = cloudflare.magicTransit.sites.acls.get( '023e105f4ecef8ad9ca31a8372d0c353', diff --git a/tests/api-resources/magic-transit/sites/lans.test.ts b/tests/api-resources/magic-transit/sites/lans.test.ts index 0cdc11012e..f4b5abda36 100644 --- a/tests/api-resources/magic-transit/sites/lans.test.ts +++ b/tests/api-resources/magic-transit/sites/lans.test.ts @@ -141,6 +141,52 @@ describe('resource lans', () => { ); }); + test('edit: only required params', async () => { + const responsePromise = cloudflare.magicTransit.sites.lans.edit( + '023e105f4ecef8ad9ca31a8372d0c353', + '023e105f4ecef8ad9ca31a8372d0c353', + { 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 cloudflare.magicTransit.sites.lans.edit( + '023e105f4ecef8ad9ca31a8372d0c353', + '023e105f4ecef8ad9ca31a8372d0c353', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + name: 'string', + nat: { static_prefix: '192.0.2.0/24' }, + physport: 1, + routed_subnets: [ + { nat: { static_prefix: '192.0.2.0/24' }, next_hop: '192.0.2.1', prefix: '192.0.2.0/24' }, + { nat: { static_prefix: '192.0.2.0/24' }, next_hop: '192.0.2.1', prefix: '192.0.2.0/24' }, + { nat: { static_prefix: '192.0.2.0/24' }, next_hop: '192.0.2.1', prefix: '192.0.2.0/24' }, + ], + static_addressing: { + address: '192.0.2.0/24', + dhcp_relay: { server_addresses: ['192.0.2.1', '192.0.2.1', '192.0.2.1'] }, + dhcp_server: { + dhcp_pool_end: '192.0.2.1', + dhcp_pool_start: '192.0.2.1', + dns_server: '192.0.2.1', + reservations: { '00:11:22:33:44:55': '192.0.2.100', 'AA:BB:CC:DD:EE:FF': '192.168.1.101' }, + }, + secondary_address: '192.0.2.0/24', + virtual_address: '192.0.2.0/24', + }, + vlan_tag: 0, + }, + ); + }); + test('get: only required params', async () => { const responsePromise = cloudflare.magicTransit.sites.lans.get( '023e105f4ecef8ad9ca31a8372d0c353', diff --git a/tests/api-resources/magic-transit/sites/sites.test.ts b/tests/api-resources/magic-transit/sites/sites.test.ts index 8f3288195d..3c5313d0b1 100644 --- a/tests/api-resources/magic-transit/sites/sites.test.ts +++ b/tests/api-resources/magic-transit/sites/sites.test.ts @@ -99,6 +99,30 @@ describe('resource sites', () => { }); }); + test('edit: only required params', async () => { + const responsePromise = cloudflare.magicTransit.sites.edit('023e105f4ecef8ad9ca31a8372d0c353', { + 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 cloudflare.magicTransit.sites.edit('023e105f4ecef8ad9ca31a8372d0c353', { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + connector_id: 'ac60d3d0435248289d446cedd870bcf4', + description: 'string', + location: { lat: '37.6192', lon: '122.3816' }, + name: 'site_1', + secondary_connector_id: '8d67040d3835dbcf46ce29da440dc482', + }); + }); + test('get: only required params', async () => { const responsePromise = cloudflare.magicTransit.sites.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', diff --git a/tests/api-resources/magic-transit/sites/wans.test.ts b/tests/api-resources/magic-transit/sites/wans.test.ts index c6aaab40cc..335d1092da 100644 --- a/tests/api-resources/magic-transit/sites/wans.test.ts +++ b/tests/api-resources/magic-transit/sites/wans.test.ts @@ -116,6 +116,40 @@ describe('resource wans', () => { ); }); + test('edit: only required params', async () => { + const responsePromise = cloudflare.magicTransit.sites.wans.edit( + '023e105f4ecef8ad9ca31a8372d0c353', + '023e105f4ecef8ad9ca31a8372d0c353', + { 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 cloudflare.magicTransit.sites.wans.edit( + '023e105f4ecef8ad9ca31a8372d0c353', + '023e105f4ecef8ad9ca31a8372d0c353', + { + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + name: 'string', + physport: 1, + priority: 0, + static_addressing: { + address: '192.0.2.0/24', + gateway_address: '192.0.2.1', + secondary_address: '192.0.2.0/24', + }, + vlan_tag: 0, + }, + ); + }); + test('get: only required params', async () => { const responsePromise = cloudflare.magicTransit.sites.wans.get( '023e105f4ecef8ad9ca31a8372d0c353', diff --git a/tests/api-resources/zero-trust/risk-scoring/integrations/integrations.test.ts b/tests/api-resources/zero-trust/risk-scoring/integrations/integrations.test.ts new file mode 100644 index 0000000000..d27a386214 --- /dev/null +++ b/tests/api-resources/zero-trust/risk-scoring/integrations/integrations.test.ts @@ -0,0 +1,114 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = new Cloudflare({ + apiKey: '144c9defac04969c7bfad8efaa8ea194', + apiEmail: 'user@example.com', + baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', +}); + +describe('resource integrations', () => { + test('create: only required params', async () => { + const responsePromise = cloudflare.zeroTrust.riskScoring.integrations.create({ + account_id: 'string', + integration_type: 'Okta', + tenant_url: 'https://example.com', + }); + 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 cloudflare.zeroTrust.riskScoring.integrations.create({ + account_id: 'string', + integration_type: 'Okta', + tenant_url: 'https://example.com', + reference_id: 'string', + }); + }); + + test('update: only required params', async () => { + const responsePromise = cloudflare.zeroTrust.riskScoring.integrations.update( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: 'string', active: true, tenant_url: 'https://example.com' }, + ); + 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 cloudflare.zeroTrust.riskScoring.integrations.update( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: 'string', active: true, tenant_url: 'https://example.com', reference_id: 'string' }, + ); + }); + + test('list: only required params', async () => { + const responsePromise = cloudflare.zeroTrust.riskScoring.integrations.list({ account_id: 'string' }); + 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 cloudflare.zeroTrust.riskScoring.integrations.list({ account_id: 'string' }); + }); + + test('delete: only required params', async () => { + const responsePromise = cloudflare.zeroTrust.riskScoring.integrations.delete( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: 'string' }, + ); + 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 cloudflare.zeroTrust.riskScoring.integrations.delete( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: 'string' }, + ); + }); + + test('get: only required params', async () => { + const responsePromise = cloudflare.zeroTrust.riskScoring.integrations.get( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: 'string' }, + ); + 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 cloudflare.zeroTrust.riskScoring.integrations.get( + '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + { account_id: 'string' }, + ); + }); +}); diff --git a/tests/api-resources/zero-trust/risk-scoring/integrations/references.test.ts b/tests/api-resources/zero-trust/risk-scoring/integrations/references.test.ts new file mode 100644 index 0000000000..e95f034e24 --- /dev/null +++ b/tests/api-resources/zero-trust/risk-scoring/integrations/references.test.ts @@ -0,0 +1,31 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import Cloudflare from 'cloudflare'; +import { Response } from 'node-fetch'; + +const cloudflare = 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 = cloudflare.zeroTrust.riskScoring.integrations.references.get('string', { + account_id: 'string', + }); + 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 cloudflare.zeroTrust.riskScoring.integrations.references.get('string', { + account_id: 'string', + }); + }); +});