diff --git a/.stats.yml b/.stats.yml index 23bd6be188..fb607b8531 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1252 +configured_endpoints: 1256 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9f6e9da01b27f4f387991ca14ecafe0c42a356cc3c47b269e5f8b4f6cd0ed700.yml diff --git a/api.md b/api.md index 6981df481d..2e4c0d0c7e 100644 --- a/api.md +++ b/api.md @@ -6015,6 +6015,18 @@ Methods: - client.radar.trafficAnomalies.locations.get({ ...params }) -> LocationGetResponse +## TCPResetsTimeouts + +Types: + +- TCPResetsTimeoutSummaryResponse +- TCPResetsTimeoutTimeseriesGroupsResponse + +Methods: + +- client.radar.tcpResetsTimeouts.summary({ ...params }) -> TCPResetsTimeoutSummaryResponse +- client.radar.tcpResetsTimeouts.timeseriesGroups({ ...params }) -> TCPResetsTimeoutTimeseriesGroupsResponse + # BotManagement Types: @@ -6339,3 +6351,17 @@ Methods: - client.iam.resourceGroups.list({ ...params }) -> ResourceGroupListResponsesV4PagePaginationArray - client.iam.resourceGroups.delete(resourceGroupId, { ...params }) -> ResourceGroupDeleteResponse | null - client.iam.resourceGroups.get(resourceGroupId, { ...params }) -> ResourceGroupGetResponse + +# CloudConnector + +## Rules + +Types: + +- RuleUpdateResponse +- RuleListResponse + +Methods: + +- client.cloudConnector.rules.update([ ...body ]) -> RuleUpdateResponse +- client.cloudConnector.rules.list({ ...params }) -> RuleListResponsesSinglePage diff --git a/src/index.ts b/src/index.ts index f74cbb714e..27056ebbce 100644 --- a/src/index.ts +++ b/src/index.ts @@ -229,6 +229,7 @@ export class Cloudflare extends Core.APIClient { eventNotifications: API.EventNotifications = new API.EventNotifications(this); aiGateway: API.AIGateway = new API.AIGateway(this); iam: API.IAM = new API.IAM(this); + cloudConnector: API.CloudConnector = new API.CloudConnector(this); protected override defaultQuery(): Core.DefaultQuery | undefined { return this._options.defaultQuery; @@ -563,6 +564,8 @@ export namespace Cloudflare { export import IAM = API.IAM; + export import CloudConnector = API.CloudConnector; + export import ASN = API.ASN; export import AuditLog = API.AuditLog; export import CertificateCA = API.CertificateCA; diff --git a/src/resources/cloud-connector/cloud-connector.ts b/src/resources/cloud-connector/cloud-connector.ts new file mode 100644 index 0000000000..a2c79bef89 --- /dev/null +++ b/src/resources/cloud-connector/cloud-connector.ts @@ -0,0 +1,17 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as RulesAPI from './rules'; + +export class CloudConnector extends APIResource { + rules: RulesAPI.Rules = new RulesAPI.Rules(this._client); +} + +export namespace CloudConnector { + export import Rules = RulesAPI.Rules; + export import RuleUpdateResponse = RulesAPI.RuleUpdateResponse; + export import RuleListResponse = RulesAPI.RuleListResponse; + export import RuleListResponsesSinglePage = RulesAPI.RuleListResponsesSinglePage; + export import RuleUpdateParams = RulesAPI.RuleUpdateParams; + export import RuleListParams = RulesAPI.RuleListParams; +} diff --git a/src/resources/cloud-connector/index.ts b/src/resources/cloud-connector/index.ts new file mode 100644 index 0000000000..e9ab704b2a --- /dev/null +++ b/src/resources/cloud-connector/index.ts @@ -0,0 +1,11 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { CloudConnector } from './cloud-connector'; +export { + RuleUpdateResponse, + RuleListResponse, + RuleUpdateParams, + RuleListParams, + RuleListResponsesSinglePage, + Rules, +} from './rules'; diff --git a/src/resources/cloud-connector/rules.ts b/src/resources/cloud-connector/rules.ts new file mode 100644 index 0000000000..2b71047aaa --- /dev/null +++ b/src/resources/cloud-connector/rules.ts @@ -0,0 +1,170 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as Core from '../../core'; +import * as RulesAPI from './rules'; +import { SinglePage } from '../../pagination'; + +export class Rules extends APIResource { + /** + * Put Rules + */ + update(params: RuleUpdateParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id, body } = params; + return ( + this._client.put(`/zones/${zone_id}/cloud_connector/rules`, { + body: body, + ...options, + }) as Core.APIPromise<{ result: RuleUpdateResponse }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Rules + */ + list( + params: RuleListParams, + options?: Core.RequestOptions, + ): Core.PagePromise { + const { zone_id } = params; + return this._client.getAPIList( + `/zones/${zone_id}/cloud_connector/rules`, + RuleListResponsesSinglePage, + options, + ); + } +} + +export class RuleListResponsesSinglePage extends SinglePage {} + +/** + * List of Cloud Connector rules + */ +export type RuleUpdateResponse = Array; + +export namespace RuleUpdateResponse { + export interface RuleUpdateResponseItem { + id?: string; + + description?: string; + + enabled?: boolean; + + expression?: string; + + /** + * Parameters of Cloud Connector Rule + */ + parameters?: RuleUpdateResponseItem.Parameters; + + /** + * Cloud Provider type + */ + provider?: 'aws_s3' | 'r2' | 'gcp_storage' | 'azure_storage'; + } + + export namespace RuleUpdateResponseItem { + /** + * Parameters of Cloud Connector Rule + */ + export interface Parameters { + /** + * Host to perform Cloud Connection to + */ + host?: string; + } + } +} + +export interface RuleListResponse { + id?: string; + + description?: string; + + enabled?: boolean; + + expression?: string; + + /** + * Parameters of Cloud Connector Rule + */ + parameters?: RuleListResponse.Parameters; + + /** + * Cloud Provider type + */ + provider?: 'aws_s3' | 'r2' | 'gcp_storage' | 'azure_storage'; +} + +export namespace RuleListResponse { + /** + * Parameters of Cloud Connector Rule + */ + export interface Parameters { + /** + * Host to perform Cloud Connection to + */ + host?: string; + } +} + +export interface RuleUpdateParams { + /** + * Path param: Identifier + */ + zone_id: string; + + /** + * Body param: List of Cloud Connector rules + */ + body: Array; +} + +export namespace RuleUpdateParams { + export interface Body { + id?: string; + + description?: string; + + enabled?: boolean; + + expression?: string; + + /** + * Parameters of Cloud Connector Rule + */ + parameters?: Body.Parameters; + + /** + * Cloud Provider type + */ + provider?: 'aws_s3' | 'r2' | 'gcp_storage' | 'azure_storage'; + } + + export namespace Body { + /** + * Parameters of Cloud Connector Rule + */ + export interface Parameters { + /** + * Host to perform Cloud Connection to + */ + host?: string; + } + } +} + +export interface RuleListParams { + /** + * Identifier + */ + zone_id: string; +} + +export namespace Rules { + export import RuleUpdateResponse = RulesAPI.RuleUpdateResponse; + export import RuleListResponse = RulesAPI.RuleListResponse; + export import RuleListResponsesSinglePage = RulesAPI.RuleListResponsesSinglePage; + export import RuleUpdateParams = RulesAPI.RuleUpdateParams; + export import RuleListParams = RulesAPI.RuleListParams; +} diff --git a/src/resources/index.ts b/src/resources/index.ts index 492ea7315e..a72a097310 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -17,6 +17,7 @@ export { Calls } from './calls/calls'; export { CertificateAuthorities } from './certificate-authorities/certificate-authorities'; export { Challenges } from './challenges/challenges'; export { ClientCertificates } from './client-certificates'; +export { CloudConnector } from './cloud-connector/cloud-connector'; export { CloudforceOne } from './cloudforce-one/cloudforce-one'; export { CustomCertificates } from './custom-certificates/custom-certificates'; export { CustomHostnames } from './custom-hostnames/custom-hostnames'; diff --git a/src/resources/radar/index.ts b/src/resources/radar/index.ts index 62fd3b62db..95ca31c05d 100644 --- a/src/resources/radar/index.ts +++ b/src/resources/radar/index.ts @@ -28,6 +28,13 @@ export { Ranking, } from './ranking/index'; export { SearchGlobalResponse, SearchGlobalParams, Search } from './search'; +export { + TCPResetsTimeoutSummaryResponse, + TCPResetsTimeoutTimeseriesGroupsResponse, + TCPResetsTimeoutSummaryParams, + TCPResetsTimeoutTimeseriesGroupsParams, + TCPResetsTimeouts, +} from './tcp-resets-timeouts'; export { TrafficAnomalyGetResponse, TrafficAnomalyGetParams, diff --git a/src/resources/radar/radar.ts b/src/resources/radar/radar.ts index 460a342e53..ffb496fdcb 100644 --- a/src/resources/radar/radar.ts +++ b/src/resources/radar/radar.ts @@ -4,6 +4,7 @@ import { APIResource } from '../../resource'; import * as ConnectionTamperingAPI from './connection-tampering'; import * as DatasetsAPI from './datasets'; import * as SearchAPI from './search'; +import * as TCPResetsTimeoutsAPI from './tcp-resets-timeouts'; import * as AnnotationsAPI from './annotations/annotations'; import * as AS112API from './as112/as112'; import * as AttacksAPI from './attacks/attacks'; @@ -38,6 +39,9 @@ export class Radar extends APIResource { trafficAnomalies: TrafficAnomaliesAPI.TrafficAnomalies = new TrafficAnomaliesAPI.TrafficAnomalies( this._client, ); + tcpResetsTimeouts: TCPResetsTimeoutsAPI.TCPResetsTimeouts = new TCPResetsTimeoutsAPI.TCPResetsTimeouts( + this._client, + ); } export namespace Radar { @@ -82,4 +86,9 @@ export namespace Radar { export import TrafficAnomalies = TrafficAnomaliesAPI.TrafficAnomalies; export import TrafficAnomalyGetResponse = TrafficAnomaliesAPI.TrafficAnomalyGetResponse; export import TrafficAnomalyGetParams = TrafficAnomaliesAPI.TrafficAnomalyGetParams; + export import TCPResetsTimeouts = TCPResetsTimeoutsAPI.TCPResetsTimeouts; + export import TCPResetsTimeoutSummaryResponse = TCPResetsTimeoutsAPI.TCPResetsTimeoutSummaryResponse; + export import TCPResetsTimeoutTimeseriesGroupsResponse = TCPResetsTimeoutsAPI.TCPResetsTimeoutTimeseriesGroupsResponse; + export import TCPResetsTimeoutSummaryParams = TCPResetsTimeoutsAPI.TCPResetsTimeoutSummaryParams; + export import TCPResetsTimeoutTimeseriesGroupsParams = TCPResetsTimeoutsAPI.TCPResetsTimeoutTimeseriesGroupsParams; } diff --git a/src/resources/radar/tcp-resets-timeouts.ts b/src/resources/radar/tcp-resets-timeouts.ts new file mode 100644 index 0000000000..05b12d1e2d --- /dev/null +++ b/src/resources/radar/tcp-resets-timeouts.ts @@ -0,0 +1,341 @@ +// 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 TCPResetsTimeoutsAPI from './tcp-resets-timeouts'; + +export class TCPResetsTimeouts extends APIResource { + /** + * Percentage distribution by connection stage of TCP connections terminated within + * the first 10 packets by a reset or timeout, for a given time period. + */ + summary( + query?: TCPResetsTimeoutSummaryParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + summary(options?: Core.RequestOptions): Core.APIPromise; + summary( + query: TCPResetsTimeoutSummaryParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.summary({}, query); + } + return ( + this._client.get('/radar/tcp_resets_timeouts/summary', { query, ...options }) as Core.APIPromise<{ + result: TCPResetsTimeoutSummaryResponse; + }> + )._thenUnwrap((obj) => obj.result); + } + + /** + * Percentage distribution by connection stage of TCP connections terminated within + * the first 10 packets by a reset or timeout, over time. + */ + timeseriesGroups( + query?: TCPResetsTimeoutTimeseriesGroupsParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + timeseriesGroups(options?: Core.RequestOptions): Core.APIPromise; + timeseriesGroups( + query: TCPResetsTimeoutTimeseriesGroupsParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.timeseriesGroups({}, query); + } + return ( + this._client.get('/radar/tcp_resets_timeouts/timeseries_groups', { + query, + ...options, + }) as Core.APIPromise<{ result: TCPResetsTimeoutTimeseriesGroupsResponse }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface TCPResetsTimeoutSummaryResponse { + meta: TCPResetsTimeoutSummaryResponse.Meta; + + summary_0: TCPResetsTimeoutSummaryResponse.Summary0; +} + +export namespace TCPResetsTimeoutSummaryResponse { + export interface Meta { + dateRange: Array; + + confidenceInfo?: Meta.ConfidenceInfo; + } + + export namespace Meta { + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface ConfidenceInfo { + annotations?: Array; + + level?: number; + } + + export namespace ConfidenceInfo { + export interface Annotation { + dataSource: string; + + description: string; + + eventType: string; + + isInstantaneous: boolean; + + endTime?: string; + + linkedUrl?: string; + + startTime?: string; + } + } + } + + export interface Summary0 { + /** + * Connection resets within the first 10 packets from the client, but after the + * server has received multiple data packets. + */ + later_in_flow: string; + + /** + * All other connections. + */ + no_match: string; + + /** + * Connection resets or timeouts after the server received both a SYN packet and an + * ACK packet, meaning the connection was successfully established. + */ + post_ack: string; + + /** + * Connection resets or timeouts after the server received a packet with PSH flag + * set, following connection establishment. + */ + post_psh: string; + + /** + * Connection resets or timeouts after the server received only a single SYN + * packet. + */ + post_syn: string; + } +} + +export interface TCPResetsTimeoutTimeseriesGroupsResponse { + meta: TCPResetsTimeoutTimeseriesGroupsResponse.Meta; + + serie_0: TCPResetsTimeoutTimeseriesGroupsResponse.Serie0; +} + +export namespace TCPResetsTimeoutTimeseriesGroupsResponse { + export interface Meta { + aggInterval: string; + + dateRange: Array; + + lastUpdated: string; + + confidenceInfo?: Meta.ConfidenceInfo; + } + + export namespace Meta { + export interface DateRange { + /** + * Adjusted end of date range. + */ + endTime: string; + + /** + * Adjusted start of date range. + */ + startTime: string; + } + + export interface ConfidenceInfo { + annotations?: Array; + + level?: number; + } + + export namespace ConfidenceInfo { + export interface Annotation { + dataSource: string; + + description: string; + + eventType: string; + + isInstantaneous: boolean; + + endTime?: string; + + linkedUrl?: string; + + startTime?: string; + } + } + } + + export interface Serie0 { + /** + * Connection resets within the first 10 packets from the client, but after the + * server has received multiple data packets. + */ + later_in_flow: Array; + + /** + * All other connections. + */ + no_match: Array; + + /** + * Connection resets or timeouts after the server received both a SYN packet and an + * ACK packet, meaning the connection was successfully established. + */ + post_ack: Array; + + /** + * Connection resets or timeouts after the server received a packet with PSH flag + * set, following connection establishment. + */ + post_psh: Array; + + /** + * Connection resets or timeouts after the server received only a single SYN + * packet. + */ + post_syn: Array; + + timestamps: Array; + } +} + +export interface TCPResetsTimeoutSummaryParams { + /** + * Array of comma separated list of ASNs, start with `-` to exclude from results. + * For example, `-174, 3356` excludes results from AS174, but includes results from + * AS3356. + */ + asn?: Array; + + /** + * Array of comma separated list of continents (alpha-2 continent codes). Start + * with `-` to exclude from results. For example, `-EU,NA` excludes results from + * Europe, but includes results from North America. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * For example, use `7d` and `7dControl` to compare this week with the previous + * week. Use this parameter or set specific start and end dates (`dateStart` and + * `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Array of datetimes to filter the start of a series. + */ + dateStart?: Array; + + /** + * Format results are returned in. + */ + format?: 'JSON' | 'CSV'; + + /** + * Array of comma separated list of locations (alpha-2 country codes). Start with + * `-` to exclude from results. For example, `-US,PT` excludes results from the US, + * but includes results from PT. + */ + location?: Array; + + /** + * Array of names that will be used to name the series in responses. + */ + name?: Array; +} + +export interface TCPResetsTimeoutTimeseriesGroupsParams { + /** + * Aggregation interval results should be returned in (for example, in 15 minutes + * or 1 hour intervals). Refer to + * [Aggregation intervals](https://developers.cloudflare.com/radar/concepts/aggregation-intervals/). + */ + aggInterval?: '15m' | '1h' | '1d' | '1w'; + + /** + * Array of comma separated list of ASNs, start with `-` to exclude from results. + * For example, `-174, 3356` excludes results from AS174, but includes results from + * AS3356. + */ + asn?: Array; + + /** + * Array of comma separated list of continents (alpha-2 continent codes). Start + * with `-` to exclude from results. For example, `-EU,NA` excludes results from + * Europe, but includes results from North America. + */ + continent?: Array; + + /** + * End of the date range (inclusive). + */ + dateEnd?: Array; + + /** + * For example, use `7d` and `7dControl` to compare this week with the previous + * week. Use this parameter or set specific start and end dates (`dateStart` and + * `dateEnd` parameters). + */ + dateRange?: Array; + + /** + * Array of datetimes to filter the start of a series. + */ + dateStart?: Array; + + /** + * Format results are returned in. + */ + format?: 'JSON' | 'CSV'; + + /** + * Array of comma separated list of locations (alpha-2 country codes). Start with + * `-` to exclude from results. For example, `-US,PT` excludes results from the US, + * but includes results from PT. + */ + location?: Array; + + /** + * Array of names that will be used to name the series in responses. + */ + name?: Array; +} + +export namespace TCPResetsTimeouts { + export import TCPResetsTimeoutSummaryResponse = TCPResetsTimeoutsAPI.TCPResetsTimeoutSummaryResponse; + export import TCPResetsTimeoutTimeseriesGroupsResponse = TCPResetsTimeoutsAPI.TCPResetsTimeoutTimeseriesGroupsResponse; + export import TCPResetsTimeoutSummaryParams = TCPResetsTimeoutsAPI.TCPResetsTimeoutSummaryParams; + export import TCPResetsTimeoutTimeseriesGroupsParams = TCPResetsTimeoutsAPI.TCPResetsTimeoutTimeseriesGroupsParams; +} diff --git a/tests/api-resources/cloud-connector/rules.test.ts b/tests/api-resources/cloud-connector/rules.test.ts new file mode 100644 index 0000000000..fd07781de0 --- /dev/null +++ b/tests/api-resources/cloud-connector/rules.test.ts @@ -0,0 +1,77 @@ +// 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 rules', () => { + test('update: only required params', async () => { + const responsePromise = cloudflare.cloudConnector.rules.update({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + body: [{}, {}, {}], + }); + 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.cloudConnector.rules.update({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + body: [ + { + description: 'Rule description', + enabled: true, + expression: 'http.cookie eq "a=b"', + id: '95c365e17e1b46599cd99e5b231fac4e', + parameters: { host: 'examplebucket.s3.eu-north-1.amazonaws.com' }, + provider: 'aws_s3', + }, + { + description: 'Rule description', + enabled: true, + expression: 'http.cookie eq "a=b"', + id: '95c365e17e1b46599cd99e5b231fac4e', + parameters: { host: 'examplebucket.s3.eu-north-1.amazonaws.com' }, + provider: 'aws_s3', + }, + { + description: 'Rule description', + enabled: true, + expression: 'http.cookie eq "a=b"', + id: '95c365e17e1b46599cd99e5b231fac4e', + parameters: { host: 'examplebucket.s3.eu-north-1.amazonaws.com' }, + provider: 'aws_s3', + }, + ], + }); + }); + + test('list: only required params', async () => { + const responsePromise = cloudflare.cloudConnector.rules.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 cloudflare.cloudConnector.rules.list({ + zone_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); + }); +}); diff --git a/tests/api-resources/radar/tcp-resets-timeouts.test.ts b/tests/api-resources/radar/tcp-resets-timeouts.test.ts new file mode 100644 index 0000000000..14d61612b1 --- /dev/null +++ b/tests/api-resources/radar/tcp-resets-timeouts.test.ts @@ -0,0 +1,87 @@ +// 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 tcpResetsTimeouts', () => { + test('summary', async () => { + const responsePromise = cloudflare.radar.tcpResetsTimeouts.summary(); + 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('summary: 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( + cloudflare.radar.tcpResetsTimeouts.summary({ path: '/_stainless_unknown_path' }), + ).rejects.toThrow(Cloudflare.NotFoundError); + }); + + test('summary: 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( + cloudflare.radar.tcpResetsTimeouts.summary( + { + asn: ['string', 'string', 'string'], + continent: ['string', 'string', 'string'], + dateEnd: ['2019-12-27T18:11:19.117Z', '2019-12-27T18:11:19.117Z', '2019-12-27T18:11:19.117Z'], + dateRange: ['7d', '7d', '7d'], + dateStart: ['2019-12-27T18:11:19.117Z', '2019-12-27T18:11:19.117Z', '2019-12-27T18:11:19.117Z'], + format: 'JSON', + location: ['string', 'string', 'string'], + name: ['string', 'string', 'string'], + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Cloudflare.NotFoundError); + }); + + test('timeseriesGroups', async () => { + const responsePromise = cloudflare.radar.tcpResetsTimeouts.timeseriesGroups(); + 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('timeseriesGroups: 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( + cloudflare.radar.tcpResetsTimeouts.timeseriesGroups({ path: '/_stainless_unknown_path' }), + ).rejects.toThrow(Cloudflare.NotFoundError); + }); + + test('timeseriesGroups: 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( + cloudflare.radar.tcpResetsTimeouts.timeseriesGroups( + { + aggInterval: '1h', + asn: ['string', 'string', 'string'], + continent: ['string', 'string', 'string'], + dateEnd: ['2019-12-27T18:11:19.117Z', '2019-12-27T18:11:19.117Z', '2019-12-27T18:11:19.117Z'], + dateRange: ['7d', '7d', '7d'], + dateStart: ['2019-12-27T18:11:19.117Z', '2019-12-27T18:11:19.117Z', '2019-12-27T18:11:19.117Z'], + format: 'JSON', + location: ['string', 'string', 'string'], + name: ['string', 'string', 'string'], + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Cloudflare.NotFoundError); + }); +});