From 6fd7aa45b8a4589a2a4134a49bce4329e94f7c08 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Fri, 27 Sep 2024 01:06:05 +0000 Subject: [PATCH] feat(api): enable iam resource, dns_firewall, secondary_dns, logpush datasources, queue consumer, registrar domains, stream --- .stats.yml | 4 +- api.md | 273 ++++---- src/index.ts | 32 +- src/resources/accounts/accounts.ts | 11 - src/resources/accounts/index.ts | 11 - src/resources/accounts/subscriptions.ts | 144 ----- src/resources/ai-gateway/logs.ts | 2 +- .../turnstile.ts => challenges/challenges.ts} | 4 +- .../{turnstile => challenges}/index.ts | 2 +- .../{turnstile => challenges}/widgets.ts | 0 .../cloudforce-one/requests/assets.ts | 203 ------ .../cloudforce-one/requests/index.ts | 9 - .../cloudforce-one/requests/requests.ts | 9 - src/resources/dns/firewall/firewall.ts | 7 - src/resources/dns/firewall/index.ts | 7 - src/resources/dns/firewall/reverse-dns.ts | 81 --- .../event-notifications.ts | 12 + src/resources/event-notifications/index.ts | 4 + .../r2}/configuration/configuration.ts | 0 .../r2}/configuration/index.ts | 0 .../r2}/configuration/queues.ts | 0 .../r2}/index.ts | 2 +- .../r2/r2.ts} | 4 +- src/resources/index.ts | 8 +- src/resources/magic-transit/index.ts | 12 - src/resources/magic-transit/magic-transit.ts | 12 - ...naged-transforms.ts => managed-headers.ts} | 24 +- .../{magic-transit => }/pcaps/download.ts | 6 +- .../{magic-transit => }/pcaps/index.ts | 13 +- .../{magic-transit => }/pcaps/ownership.ts | 4 +- .../{magic-transit => }/pcaps/pcaps.ts | 15 +- src/resources/{zones => }/plans.ts | 14 +- src/resources/r2/index.ts | 1 - src/resources/r2/r2.ts | 5 - src/resources/rate-plans.ts | 78 +++ src/resources/registrar/index.ts | 1 + src/resources/registrar/registrar.ts | 3 + src/resources/registrar/terraform.ts | 5 + src/resources/shared.ts | 163 ----- src/resources/url-scanner/index.ts | 2 - src/resources/url-scanner/scans.ts | 162 ----- src/resources/url-scanner/url-scanner.ts | 164 ++++- src/resources/user/index.ts | 4 + src/resources/user/subscriptions.ts | 172 ++++- src/resources/user/user.ts | 4 + src/resources/zero-trust/access/access.ts | 3 - src/resources/zero-trust/access/index.ts | 1 - .../zero-trust/access/infrastructure/index.ts | 16 - .../access/infrastructure/infrastructure.ts | 22 - .../access/infrastructure/targets.ts | 594 ------------------ src/resources/zero-trust/dex/dex.ts | 7 +- .../zero-trust/dex/http-tests/http-tests.ts | 2 +- src/resources/zero-trust/dex/index.ts | 10 +- src/resources/zero-trust/dex/tests/index.ts | 8 +- src/resources/zero-trust/dex/tests/tests.ts | 88 +-- .../zero-trust/dex/traceroute-tests.ts | 2 +- src/resources/zero-trust/index.ts | 2 +- src/resources/zero-trust/zero-trust.ts | 2 +- src/resources/zones/index.ts | 8 - src/resources/zones/rate-plans.ts | 86 --- src/resources/zones/subscriptions.ts | 18 +- src/resources/zones/zones.ts | 12 - .../accounts/subscriptions.test.ts | 108 ---- tests/api-resources/ai-gateway/logs.test.ts | 2 +- .../{turnstile => challenges}/widgets.test.ts | 26 +- .../cloudforce-one/requests/assets.test.ts | 105 ---- .../dns/firewall/reverse-dns.test.ts | 51 -- .../r2}/configuration/configuration.test.ts | 4 +- .../r2}/configuration/queues.test.ts | 8 +- ...sforms.test.ts => managed-headers.test.ts} | 10 +- .../pcaps/download.test.ts | 2 +- .../pcaps/ownership.test.ts | 20 +- .../{magic-transit => }/pcaps/pcaps.test.ts | 14 +- tests/api-resources/{zones => }/plans.test.ts | 8 +- .../{zones => }/rate-plans.test.ts | 4 +- tests/api-resources/url-scanner/scans.test.ts | 48 -- .../url-scanner/url-scanner.test.ts | 60 ++ .../access/infrastructure/targets.test.ts | 142 ----- .../zero-trust/dex/tests/tests.test.ts | 36 -- 79 files changed, 735 insertions(+), 2487 deletions(-) delete mode 100644 src/resources/accounts/subscriptions.ts rename src/resources/{turnstile/turnstile.ts => challenges/challenges.ts} (92%) rename src/resources/{turnstile => challenges}/index.ts (89%) rename src/resources/{turnstile => challenges}/widgets.ts (100%) delete mode 100644 src/resources/cloudforce-one/requests/assets.ts delete mode 100644 src/resources/dns/firewall/reverse-dns.ts create mode 100644 src/resources/event-notifications/event-notifications.ts create mode 100644 src/resources/event-notifications/index.ts rename src/resources/{r2/event-notifications => event-notifications/r2}/configuration/configuration.ts (100%) rename src/resources/{r2/event-notifications => event-notifications/r2}/configuration/index.ts (100%) rename src/resources/{r2/event-notifications => event-notifications/r2}/configuration/queues.ts (100%) rename src/resources/{r2/event-notifications => event-notifications/r2}/index.ts (76%) rename src/resources/{r2/event-notifications/event-notifications.ts => event-notifications/r2/r2.ts} (85%) rename src/resources/{managed-transforms.ts => managed-headers.ts} (76%) rename src/resources/{magic-transit => }/pcaps/download.ts (83%) rename src/resources/{magic-transit => }/pcaps/index.ts (61%) rename src/resources/{magic-transit => }/pcaps/ownership.ts (97%) rename src/resources/{magic-transit => }/pcaps/pcaps.ts (94%) rename src/resources/{zones => }/plans.ts (82%) create mode 100644 src/resources/rate-plans.ts create mode 100644 src/resources/registrar/terraform.ts delete mode 100644 src/resources/zero-trust/access/infrastructure/index.ts delete mode 100644 src/resources/zero-trust/access/infrastructure/infrastructure.ts delete mode 100644 src/resources/zero-trust/access/infrastructure/targets.ts delete mode 100644 src/resources/zones/rate-plans.ts delete mode 100644 tests/api-resources/accounts/subscriptions.test.ts rename tests/api-resources/{turnstile => challenges}/widgets.test.ts (84%) delete mode 100644 tests/api-resources/cloudforce-one/requests/assets.test.ts delete mode 100644 tests/api-resources/dns/firewall/reverse-dns.test.ts rename tests/api-resources/{r2/event-notifications => event-notifications/r2}/configuration/configuration.test.ts (89%) rename tests/api-resources/{r2/event-notifications => event-notifications/r2}/configuration/queues.test.ts (89%) rename tests/api-resources/{managed-transforms.test.ts => managed-headers.test.ts} (83%) rename tests/api-resources/{magic-transit => }/pcaps/download.test.ts (83%) rename tests/api-resources/{magic-transit => }/pcaps/ownership.test.ts (80%) rename tests/api-resources/{magic-transit => }/pcaps/pcaps.test.ts (82%) rename tests/api-resources/{zones => }/plans.test.ts (79%) rename tests/api-resources/{zones => }/rate-plans.test.ts (81%) create mode 100644 tests/api-resources/url-scanner/url-scanner.test.ts delete mode 100644 tests/api-resources/zero-trust/access/infrastructure/targets.test.ts delete mode 100644 tests/api-resources/zero-trust/dex/tests/tests.test.ts diff --git a/.stats.yml b/.stats.yml index ca1ff98568..2f26608b59 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 1336 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-ffc1bb60a27e3b339b4d7ab2698041e08185e4b4eb2a9c1238156594bf6c2bcb.yml +configured_endpoints: 1320 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-9444873299c32d0d292a92b00c4f6f9571f2ccad0948f30e0dd3c7c82a275959.yml diff --git a/api.md b/api.md index e3f4cb0b9d..0bf397f825 100644 --- a/api.md +++ b/api.md @@ -14,14 +14,10 @@ Types: - PaginationInfo - Permission - PermissionGrant -- RatePlan - ResponseInfo - Result - Role - SortDirection -- Subscription -- SubscriptionComponent -- SubscriptionZone # Accounts @@ -69,22 +65,6 @@ Methods: - client.accounts.roles.list({ ...params }) -> RolesSinglePage - client.accounts.roles.get(roleId, { ...params }) -> RoleGetResponse -## Subscriptions - -Types: - -- SubscriptionCreateResponse -- SubscriptionUpdateResponse -- SubscriptionDeleteResponse -- SubscriptionGetResponse - -Methods: - -- client.accounts.subscriptions.create({ ...params }) -> SubscriptionCreateResponse -- client.accounts.subscriptions.update(subscriptionIdentifier, { ...params }) -> SubscriptionUpdateResponse -- client.accounts.subscriptions.delete(subscriptionIdentifier, { ...params }) -> SubscriptionDeleteResponse -- client.accounts.subscriptions.get({ ...params }) -> SubscriptionGetResponse | null - # OriginCACertificates Types: @@ -199,6 +179,10 @@ Methods: Types: +- RatePlan +- Subscription +- SubscriptionComponent +- SubscriptionZone - SubscriptionUpdateResponse - SubscriptionDeleteResponse - SubscriptionGetResponse @@ -377,27 +361,6 @@ Methods: - client.zones.subscriptions.update(identifier, { ...params }) -> SubscriptionUpdateResponse - client.zones.subscriptions.get(identifier) -> SubscriptionGetResponse -## Plans - -Types: - -- AvailableRatePlan - -Methods: - -- client.zones.plans.list({ ...params }) -> AvailableRatePlansSinglePage -- client.zones.plans.get(planIdentifier, { ...params }) -> AvailableRatePlan - -## RatePlans - -Types: - -- RatePlanGetResponse - -Methods: - -- client.zones.ratePlans.get({ ...params }) -> RatePlanGetResponse | null - # LoadBalancers Types: @@ -736,6 +699,28 @@ Methods: - client.argo.tieredCaching.edit({ ...params }) -> TieredCachingEditResponse - client.argo.tieredCaching.get({ ...params }) -> TieredCachingGetResponse +# Plans + +Types: + +- AvailableRatePlan + +Methods: + +- client.plans.list({ ...params }) -> AvailableRatePlansSinglePage +- client.plans.get(planIdentifier, { ...params }) -> AvailableRatePlan + +# RatePlans + +Types: + +- RatePlan +- RatePlanGetResponse + +Methods: + +- client.ratePlans.get({ ...params }) -> RatePlanGetResponse | null + # CertificateAuthorities ## HostnameAssociations @@ -977,18 +962,6 @@ Methods: - client.dns.firewall.analytics.reports.bytimes.get(dnsFirewallId, { ...params }) -> ByTime -### ReverseDNS - -Types: - -- ReverseDNSEditResponse -- ReverseDNSGetResponse - -Methods: - -- client.dns.firewall.reverseDNS.edit(dnsFirewallId, { ...params }) -> ReverseDNSEditResponse -- client.dns.firewall.reverseDNS.get(dnsFirewallId, { ...params }) -> ReverseDNSGetResponse - # DNSSEC Types: @@ -2302,18 +2275,18 @@ Methods: - client.apiGateway.userSchemas.operations.list(schemaId, { ...params }) -> OperationListResponsesV4PagePaginationArray -# ManagedTransforms +# ManagedHeaders Types: -- RequestModel -- ManagedTransformListResponse -- ManagedTransformEditResponse +- RequestModel +- ManagedHeaderListResponse +- ManagedHeaderEditResponse Methods: -- client.managedTransforms.list({ ...params }) -> ManagedTransformListResponse -- client.managedTransforms.edit({ ...params }) -> ManagedTransformEditResponse +- client.managedHeaders.list({ ...params }) -> ManagedHeaderListResponse +- client.managedHeaders.edit({ ...params }) -> ManagedHeaderEditResponse # PageShield @@ -3253,42 +3226,6 @@ Methods: - client.magicTransit.connectors.edit(connectorId, { ...params }) -> ConnectorEditResponse - client.magicTransit.connectors.get(connectorId, { ...params }) -> ConnectorGetResponse -## PCAPs - -Types: - -- PCAP -- PCAPFilter -- PCAPCreateResponse -- PCAPListResponse -- PCAPGetResponse - -Methods: - -- client.magicTransit.pcaps.create({ ...params }) -> PCAPCreateResponse -- client.magicTransit.pcaps.list({ ...params }) -> PCAPListResponsesSinglePage -- client.magicTransit.pcaps.get(pcapId, { ...params }) -> PCAPGetResponse - -### Ownership - -Types: - -- Ownership -- OwnershipGetResponse - -Methods: - -- client.magicTransit.pcaps.ownership.create({ ...params }) -> Ownership -- client.magicTransit.pcaps.ownership.delete(ownershipId, { ...params }) -> void -- client.magicTransit.pcaps.ownership.get({ ...params }) -> OwnershipGetResponse | null -- client.magicTransit.pcaps.ownership.validate({ ...params }) -> Ownership - -### Download - -Methods: - -- client.magicTransit.pcaps.download.get(pcapId, { ...params }) -> Response - # MagicNetworkMonitoring ## Configs @@ -3427,8 +3364,46 @@ Methods: - client.pages.projects.domains.edit(projectName, domainName, { ...params }) -> DomainEditResponse | null - client.pages.projects.domains.get(projectName, domainName, { ...params }) -> DomainGetResponse | null +# PCAPs + +Types: + +- PCAP +- PCAPFilter +- PCAPCreateResponse +- PCAPListResponse +- PCAPGetResponse + +Methods: + +- client.pcaps.create({ ...params }) -> PCAPCreateResponse +- client.pcaps.list({ ...params }) -> PCAPListResponsesSinglePage +- client.pcaps.get(pcapId, { ...params }) -> PCAPGetResponse + +## Ownership + +Types: + +- Ownership +- OwnershipGetResponse + +Methods: + +- client.pcaps.ownership.create({ ...params }) -> Ownership +- client.pcaps.ownership.delete(ownershipId, { ...params }) -> void +- client.pcaps.ownership.get({ ...params }) -> OwnershipGetResponse | null +- client.pcaps.ownership.validate({ ...params }) -> Ownership + +## Download + +Methods: + +- client.pcaps.download.get(pcapId, { ...params }) -> Response + # Registrar +## Terraform + ## Domains Types: @@ -3913,30 +3888,6 @@ Methods: - client.r2.domains.managed.update(bucketName, { ...params }) -> ManagedUpdateResponse - client.r2.domains.managed.list(bucketName, { ...params }) -> ManagedListResponse -## EventNotifications - -### Configuration - -Types: - -- ConfigurationGetResponse - -Methods: - -- client.r2.eventNotifications.configuration.get(bucketName, { ...params }) -> ConfigurationGetResponse - -#### Queues - -Types: - -- QueueUpdateResponse -- QueueDeleteResponse - -Methods: - -- client.r2.eventNotifications.configuration.queues.update(bucketName, queueId, { ...params }) -> QueueUpdateResponse -- client.r2.eventNotifications.configuration.queues.delete(bucketName, queueId, { ...params }) -> QueueDeleteResponse - # WARPConnector Types: @@ -4334,25 +4285,6 @@ Types: - SAMLGroupRule - ServiceTokenRule -### Infrastructure - -#### Targets - -Types: - -- TargetCreateResponse -- TargetUpdateResponse -- TargetListResponse -- TargetGetResponse - -Methods: - -- client.zeroTrust.access.infrastructure.targets.create({ ...params }) -> TargetCreateResponse -- client.zeroTrust.access.infrastructure.targets.update(targetId, { ...params }) -> TargetUpdateResponse -- client.zeroTrust.access.infrastructure.targets.list({ ...params }) -> TargetListResponsesV4PagePaginationArray -- client.zeroTrust.access.infrastructure.targets.delete(targetId, { ...params }) -> void -- client.zeroTrust.access.infrastructure.targets.get(targetId, { ...params }) -> TargetGetResponse - ### Applications Types: @@ -4658,7 +4590,7 @@ Methods: Types: -- DigitalExperienceMonitor +- DeviceExperienceMonitor - NetworkPath - NetworkPathResponse - Percentiles @@ -4722,11 +4654,6 @@ Types: - AggregateTimePeriod - Tests -- TestListResponse - -Methods: - -- client.zeroTrust.dex.tests.list({ ...params }) -> TestListResponsesV4PagePagination #### UniqueDevices @@ -5267,24 +5194,24 @@ Methods: - client.zeroTrust.riskScoring.integrations.references.get(referenceId, { ...params }) -> ReferenceGetResponse -# Turnstile +# Challenges ## Widgets Types: -- Widget -- WidgetDomain -- WidgetListResponse +- Widget +- WidgetDomain +- WidgetListResponse Methods: -- client.turnstile.widgets.create({ ...params }) -> Widget -- client.turnstile.widgets.update(sitekey, { ...params }) -> Widget -- client.turnstile.widgets.list({ ...params }) -> WidgetListResponsesV4PagePaginationArray -- client.turnstile.widgets.delete(sitekey, { ...params }) -> Widget -- client.turnstile.widgets.get(sitekey, { ...params }) -> Widget -- client.turnstile.widgets.rotateSecret(sitekey, { ...params }) -> Widget +- client.challenges.widgets.create({ ...params }) -> Widget +- client.challenges.widgets.update(sitekey, { ...params }) -> Widget +- client.challenges.widgets.list({ ...params }) -> WidgetListResponsesV4PagePaginationArray +- client.challenges.widgets.delete(sitekey, { ...params }) -> Widget +- client.challenges.widgets.get(sitekey, { ...params }) -> Widget +- client.challenges.widgets.rotateSecret(sitekey, { ...params }) -> Widget # Hyperdrive @@ -5389,6 +5316,14 @@ Methods: # URLScanner +Types: + +- URLScannerScanResponse + +Methods: + +- client.urlScanner.scan(accountId, { ...params }) -> URLScannerScanResponse + ## Scans Types: @@ -5396,14 +5331,12 @@ Types: - URLScannerDomain - URLScannerTask - ScanCreateResponse -- ScanListResponse - ScanGetResponse - ScanHarResponse Methods: - client.urlScanner.scans.create(accountId, { ...params }) -> ScanCreateResponse -- client.urlScanner.scans.list(accountId, { ...params }) -> ScanListResponse - client.urlScanner.scans.get(accountId, scanId, { ...params }) -> ScanGetResponse - client.urlScanner.scans.har(accountId, scanId) -> ScanHarResponse - client.urlScanner.scans.screenshot(accountId, scanId, { ...params }) -> Response @@ -6603,21 +6536,31 @@ Methods: - client.cloudforceOne.requests.priority.get(accountIdentifier, priorityIdentifer) -> Item - client.cloudforceOne.requests.priority.quota(accountIdentifier) -> Quota -### Assets +# EventNotifications + +## R2 + +### Configuration + +Types: + +- ConfigurationGetResponse + +Methods: + +- client.eventNotifications.r2.configuration.get(bucketName, { ...params }) -> ConfigurationGetResponse + +#### Queues Types: -- AssetCreateResponse -- AssetUpdateResponse -- AssetDeleteResponse -- AssetGetResponse +- QueueUpdateResponse +- QueueDeleteResponse Methods: -- client.cloudforceOne.requests.assets.create(accountIdentifier, requestIdentifier, { ...params }) -> AssetCreateResponse -- client.cloudforceOne.requests.assets.update(accountIdentifier, requestIdentifier, assetIdentifer, { ...params }) -> AssetUpdateResponse -- client.cloudforceOne.requests.assets.delete(accountIdentifier, requestIdentifier, assetIdentifer) -> AssetDeleteResponse -- client.cloudforceOne.requests.assets.get(accountIdentifier, requestIdentifier, assetIdentifer) -> AssetGetResponse +- client.eventNotifications.r2.configuration.queues.update(bucketName, queueId, { ...params }) -> QueueUpdateResponse +- client.eventNotifications.r2.configuration.queues.delete(bucketName, queueId, { ...params }) -> QueueDeleteResponse # AIGateway diff --git a/src/index.ts b/src/index.ts index 42f215b3cd..bfd8faaae9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,22 +10,22 @@ import * as API from './resources/index'; export interface ClientOptions { /** - * The preferred authorization scheme for interacting with the Cloudflare API. [Create a token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/). + * Defaults to process.env['CLOUDFLARE_API_TOKEN']. */ apiToken?: string | null | undefined; /** - * The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys. + * Defaults to process.env['CLOUDFLARE_API_KEY']. */ apiKey?: string | null | undefined; /** - * The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key. + * Defaults to process.env['CLOUDFLARE_EMAIL']. */ apiEmail?: string | null | undefined; /** - * Used when interacting with the Origin CA certificates API. [View/change your key](https://developers.cloudflare.com/fundamentals/api/get-started/ca-keys/#viewchange-your-origin-ca-keys). + * Defaults to process.env['CLOUDFLARE_API_USER_SERVICE_KEY']. */ userServiceKey?: string | null | undefined; @@ -156,6 +156,8 @@ export class Cloudflare extends Core.APIClient { ssl: API.SSL = new API.SSL(this); acm: API.ACM = new API.ACM(this); argo: API.Argo = new API.Argo(this); + plans: API.Plans = new API.Plans(this); + ratePlans: API.RatePlans = new API.RatePlans(this); certificateAuthorities: API.CertificateAuthorities = new API.CertificateAuthorities(this); clientCertificates: API.ClientCertificates = new API.ClientCertificates(this); customCertificates: API.CustomCertificates = new API.CustomCertificates(this); @@ -182,7 +184,7 @@ export class Cloudflare extends Core.APIClient { durableObjects: API.DurableObjects = new API.DurableObjects(this); queues: API.Queues = new API.Queues(this); apiGateway: API.APIGateway = new API.APIGateway(this); - managedTransforms: API.ManagedTransforms = new API.ManagedTransforms(this); + managedHeaders: API.ManagedHeaders = new API.ManagedHeaders(this); pageShield: API.PageShield = new API.PageShield(this); rulesets: API.Rulesets = new API.Rulesets(this); urlNormalization: API.URLNormalization = new API.URLNormalization(this); @@ -198,6 +200,7 @@ export class Cloudflare extends Core.APIClient { magicNetworkMonitoring: API.MagicNetworkMonitoring = new API.MagicNetworkMonitoring(this); mtlsCertificates: API.MTLSCertificates = new API.MTLSCertificates(this); pages: API.Pages = new API.Pages(this); + pcaps: API.PCAPs = new API.PCAPs(this); registrar: API.Registrar = new API.Registrar(this); requestTracers: API.RequestTracers = new API.RequestTracers(this); rules: API.Rules = new API.Rules(this); @@ -209,7 +212,7 @@ export class Cloudflare extends Core.APIClient { warpConnector: API.WARPConnector = new API.WARPConnector(this); workersForPlatforms: API.WorkersForPlatforms = new API.WorkersForPlatforms(this); zeroTrust: API.ZeroTrust = new API.ZeroTrust(this); - turnstile: API.Turnstile = new API.Turnstile(this); + challenges: API.Challenges = new API.Challenges(this); hyperdrive: API.HyperdriveResource = new API.HyperdriveResource(this); rum: API.RUM = new API.RUM(this); vectorize: API.Vectorize = new API.Vectorize(this); @@ -223,6 +226,7 @@ export class Cloudflare extends Core.APIClient { snippets: API.Snippets = new API.Snippets(this); calls: API.Calls = new API.Calls(this); cloudforceOne: API.CloudforceOne = new API.CloudforceOne(this); + eventNotifications: API.EventNotifications = new API.EventNotifications(this); aiGateway: API.AIGateway = new API.AIGateway(this); iam: API.IAM = new API.IAM(this); cloudConnector: API.CloudConnector = new API.CloudConnector(this); @@ -416,6 +420,10 @@ export namespace Cloudflare { export import Argo = API.Argo; + export import Plans = API.Plans; + + export import RatePlans = API.RatePlans; + export import CertificateAuthorities = API.CertificateAuthorities; export import ClientCertificates = API.ClientCertificates; @@ -468,7 +476,7 @@ export namespace Cloudflare { export import APIGateway = API.APIGateway; - export import ManagedTransforms = API.ManagedTransforms; + export import ManagedHeaders = API.ManagedHeaders; export import PageShield = API.PageShield; @@ -500,6 +508,8 @@ export namespace Cloudflare { export import Pages = API.Pages; + export import PCAPs = API.PCAPs; + export import Registrar = API.Registrar; export import RequestTracers = API.RequestTracers; @@ -522,7 +532,7 @@ export namespace Cloudflare { export import ZeroTrust = API.ZeroTrust; - export import Turnstile = API.Turnstile; + export import Challenges = API.Challenges; export import HyperdriveResource = API.HyperdriveResource; @@ -550,6 +560,8 @@ export namespace Cloudflare { export import CloudforceOne = API.CloudforceOne; + export import EventNotifications = API.EventNotifications; + export import AIGateway = API.AIGateway; export import IAM = API.IAM; @@ -570,14 +582,10 @@ export namespace Cloudflare { export import PaginationInfo = API.PaginationInfo; export import Permission = API.Permission; export import PermissionGrant = API.PermissionGrant; - export import RatePlan = API.RatePlan; export import ResponseInfo = API.ResponseInfo; export import Result = API.Result; export import Role = API.Role; export import SortDirection = API.SortDirection; - export import Subscription = API.Subscription; - export import SubscriptionComponent = API.SubscriptionComponent; - export import SubscriptionZone = API.SubscriptionZone; } export default Cloudflare; diff --git a/src/resources/accounts/accounts.ts b/src/resources/accounts/accounts.ts index fdbf97c0ea..b83c58396e 100644 --- a/src/resources/accounts/accounts.ts +++ b/src/resources/accounts/accounts.ts @@ -5,13 +5,11 @@ import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as MembersAPI from './members'; import * as RolesAPI from './roles'; -import * as SubscriptionsAPI from './subscriptions'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; export class Accounts extends APIResource { members: MembersAPI.Members = new MembersAPI.Members(this._client); roles: RolesAPI.Roles = new RolesAPI.Roles(this._client); - subscriptions: SubscriptionsAPI.Subscriptions = new SubscriptionsAPI.Subscriptions(this._client); /** * Create an account (only available for tenant admins at this time) @@ -287,13 +285,4 @@ export namespace Accounts { export import RoleGetResponse = RolesAPI.RoleGetResponse; export import RoleListParams = RolesAPI.RoleListParams; export import RoleGetParams = RolesAPI.RoleGetParams; - export import Subscriptions = SubscriptionsAPI.Subscriptions; - export import SubscriptionCreateResponse = SubscriptionsAPI.SubscriptionCreateResponse; - export import SubscriptionUpdateResponse = SubscriptionsAPI.SubscriptionUpdateResponse; - export import SubscriptionDeleteResponse = SubscriptionsAPI.SubscriptionDeleteResponse; - export import SubscriptionGetResponse = SubscriptionsAPI.SubscriptionGetResponse; - export import SubscriptionCreateParams = SubscriptionsAPI.SubscriptionCreateParams; - export import SubscriptionUpdateParams = SubscriptionsAPI.SubscriptionUpdateParams; - export import SubscriptionDeleteParams = SubscriptionsAPI.SubscriptionDeleteParams; - export import SubscriptionGetParams = SubscriptionsAPI.SubscriptionGetParams; } diff --git a/src/resources/accounts/index.ts b/src/resources/accounts/index.ts index b0aca173a9..9651605ee3 100644 --- a/src/resources/accounts/index.ts +++ b/src/resources/accounts/index.ts @@ -18,14 +18,3 @@ export { MemberListResponsesV4PagePaginationArray, Members, } from './members'; -export { - SubscriptionCreateResponse, - SubscriptionUpdateResponse, - SubscriptionDeleteResponse, - SubscriptionGetResponse, - SubscriptionCreateParams, - SubscriptionUpdateParams, - SubscriptionDeleteParams, - SubscriptionGetParams, - Subscriptions, -} from './subscriptions'; diff --git a/src/resources/accounts/subscriptions.ts b/src/resources/accounts/subscriptions.ts deleted file mode 100644 index 884b4e9930..0000000000 --- a/src/resources/accounts/subscriptions.ts +++ /dev/null @@ -1,144 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as SubscriptionsAPI from './subscriptions'; -import * as Shared from '../shared'; - -export class Subscriptions extends APIResource { - /** - * Creates an account subscription. - */ - create( - params: SubscriptionCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.post(`/accounts/${account_id}/subscriptions`, { body, ...options }) as Core.APIPromise<{ - result: SubscriptionCreateResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Updates an account subscription. - */ - update( - subscriptionIdentifier: string, - params: SubscriptionUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.put(`/accounts/${account_id}/subscriptions/${subscriptionIdentifier}`, { - body, - ...options, - }) as Core.APIPromise<{ result: SubscriptionUpdateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Deletes an account's subscription. - */ - delete( - subscriptionIdentifier: string, - params: SubscriptionDeleteParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.delete( - `/accounts/${account_id}/subscriptions/${subscriptionIdentifier}`, - options, - ) as Core.APIPromise<{ result: SubscriptionDeleteResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Lists all of an account's subscriptions. - */ - get( - params: SubscriptionGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get(`/accounts/${account_id}/subscriptions`, options) as Core.APIPromise<{ - result: SubscriptionGetResponse | null; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export type SubscriptionCreateResponse = unknown | string | null; - -export type SubscriptionUpdateResponse = unknown | string | null; - -export interface SubscriptionDeleteResponse { - /** - * Subscription identifier tag. - */ - subscription_id?: string; -} - -export type SubscriptionGetResponse = Array; - -export interface SubscriptionCreateParams { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: How often the subscription is renewed automatically. - */ - frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; - - /** - * Body param: The rate plan applied to the subscription. - */ - rate_plan?: Shared.RatePlanParam; -} - -export interface SubscriptionUpdateParams { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: How often the subscription is renewed automatically. - */ - frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; - - /** - * Body param: The rate plan applied to the subscription. - */ - rate_plan?: Shared.RatePlanParam; -} - -export interface SubscriptionDeleteParams { - /** - * Identifier - */ - account_id: string; -} - -export interface SubscriptionGetParams { - /** - * Identifier - */ - account_id: string; -} - -export namespace Subscriptions { - export import SubscriptionCreateResponse = SubscriptionsAPI.SubscriptionCreateResponse; - export import SubscriptionUpdateResponse = SubscriptionsAPI.SubscriptionUpdateResponse; - export import SubscriptionDeleteResponse = SubscriptionsAPI.SubscriptionDeleteResponse; - export import SubscriptionGetResponse = SubscriptionsAPI.SubscriptionGetResponse; - export import SubscriptionCreateParams = SubscriptionsAPI.SubscriptionCreateParams; - export import SubscriptionUpdateParams = SubscriptionsAPI.SubscriptionUpdateParams; - export import SubscriptionDeleteParams = SubscriptionsAPI.SubscriptionDeleteParams; - export import SubscriptionGetParams = SubscriptionsAPI.SubscriptionGetParams; -} diff --git a/src/resources/ai-gateway/logs.ts b/src/resources/ai-gateway/logs.ts index 76dd3c6a25..e0e9230974 100644 --- a/src/resources/ai-gateway/logs.ts +++ b/src/resources/ai-gateway/logs.ts @@ -93,7 +93,7 @@ export interface LogListParams extends V4PagePaginationArrayParams { /** * Query param: */ - feedback?: 0 | 1; + feedback?: -1 | 0 | 1; /** * Query param: diff --git a/src/resources/turnstile/turnstile.ts b/src/resources/challenges/challenges.ts similarity index 92% rename from src/resources/turnstile/turnstile.ts rename to src/resources/challenges/challenges.ts index 4a7b9ae739..6c4e7c2629 100644 --- a/src/resources/turnstile/turnstile.ts +++ b/src/resources/challenges/challenges.ts @@ -3,11 +3,11 @@ import { APIResource } from '../../resource'; import * as WidgetsAPI from './widgets'; -export class Turnstile extends APIResource { +export class Challenges extends APIResource { widgets: WidgetsAPI.Widgets = new WidgetsAPI.Widgets(this._client); } -export namespace Turnstile { +export namespace Challenges { export import Widgets = WidgetsAPI.Widgets; export import Widget = WidgetsAPI.Widget; export import WidgetDomain = WidgetsAPI.WidgetDomain; diff --git a/src/resources/turnstile/index.ts b/src/resources/challenges/index.ts similarity index 89% rename from src/resources/turnstile/index.ts rename to src/resources/challenges/index.ts index 9e1742571c..3b0bf982b7 100644 --- a/src/resources/turnstile/index.ts +++ b/src/resources/challenges/index.ts @@ -1,6 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { Turnstile } from './turnstile'; +export { Challenges } from './challenges'; export { Widget, WidgetDomain, diff --git a/src/resources/turnstile/widgets.ts b/src/resources/challenges/widgets.ts similarity index 100% rename from src/resources/turnstile/widgets.ts rename to src/resources/challenges/widgets.ts diff --git a/src/resources/cloudforce-one/requests/assets.ts b/src/resources/cloudforce-one/requests/assets.ts deleted file mode 100644 index 0b0b10b549..0000000000 --- a/src/resources/cloudforce-one/requests/assets.ts +++ /dev/null @@ -1,203 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as AssetsAPI from './assets'; -import * as Shared from '../../shared'; - -export class Assets extends APIResource { - /** - * List Request Assets - */ - create( - accountIdentifier: string, - requestIdentifier: string, - body: AssetCreateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.post(`/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/asset`, { - body, - ...options, - }) as Core.APIPromise<{ result: AssetCreateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Update a Request Asset - */ - update( - accountIdentifier: string, - requestIdentifier: string, - assetIdentifer: string, - body: AssetUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.put( - `/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/asset/${assetIdentifer}`, - { body, ...options }, - ) as Core.APIPromise<{ result: AssetUpdateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Delete a Request Asset - */ - delete( - accountIdentifier: string, - requestIdentifier: string, - assetIdentifer: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return this._client.delete( - `/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/asset/${assetIdentifer}`, - options, - ); - } - - /** - * Get a Request Asset - */ - get( - accountIdentifier: string, - requestIdentifier: string, - assetIdentifer: string, - options?: Core.RequestOptions, - ): Core.APIPromise { - return ( - this._client.get( - `/accounts/${accountIdentifier}/cloudforce-one/requests/${requestIdentifier}/asset/${assetIdentifer}`, - options, - ) as Core.APIPromise<{ result: AssetGetResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export type AssetCreateResponse = Array; - -export namespace AssetCreateResponse { - export interface AssetCreateResponseItem { - /** - * Asset ID - */ - id: number; - - /** - * Asset name - */ - name: string; - - /** - * Asset creation time - */ - created?: string; - - /** - * Asset description - */ - description?: string; - - /** - * Asset file type - */ - file_type?: string; - } -} - -export interface AssetUpdateResponse { - /** - * Asset ID - */ - id: number; - - /** - * Asset name - */ - name: string; - - /** - * Asset creation time - */ - created?: string; - - /** - * Asset description - */ - description?: string; - - /** - * Asset file type - */ - file_type?: string; -} - -export interface AssetDeleteResponse { - errors: Array; - - messages: Array; - - /** - * Whether the API call was successful - */ - success: true; -} - -export type AssetGetResponse = Array; - -export namespace AssetGetResponse { - export interface AssetGetResponseItem { - /** - * Asset ID - */ - id: number; - - /** - * Asset name - */ - name: string; - - /** - * Asset creation time - */ - created?: string; - - /** - * Asset description - */ - description?: string; - - /** - * Asset file type - */ - file_type?: string; - } -} - -export interface AssetCreateParams { - /** - * Page number of results - */ - page: number; - - /** - * Number of results per page - */ - per_page: number; -} - -export interface AssetUpdateParams { - /** - * Asset file to upload - */ - source?: string; -} - -export namespace Assets { - export import AssetCreateResponse = AssetsAPI.AssetCreateResponse; - export import AssetUpdateResponse = AssetsAPI.AssetUpdateResponse; - export import AssetDeleteResponse = AssetsAPI.AssetDeleteResponse; - export import AssetGetResponse = AssetsAPI.AssetGetResponse; - export import AssetCreateParams = AssetsAPI.AssetCreateParams; - export import AssetUpdateParams = AssetsAPI.AssetUpdateParams; -} diff --git a/src/resources/cloudforce-one/requests/index.ts b/src/resources/cloudforce-one/requests/index.ts index 8849ef84bf..d1a1dac5d8 100644 --- a/src/resources/cloudforce-one/requests/index.ts +++ b/src/resources/cloudforce-one/requests/index.ts @@ -1,14 +1,5 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - AssetCreateResponse, - AssetUpdateResponse, - AssetDeleteResponse, - AssetGetResponse, - AssetCreateParams, - AssetUpdateParams, - Assets, -} from './assets'; export { Item, ListItem, diff --git a/src/resources/cloudforce-one/requests/requests.ts b/src/resources/cloudforce-one/requests/requests.ts index 4beb85b625..93c2acf1db 100644 --- a/src/resources/cloudforce-one/requests/requests.ts +++ b/src/resources/cloudforce-one/requests/requests.ts @@ -4,7 +4,6 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; import * as RequestsAPI from './requests'; import * as Shared from '../../shared'; -import * as AssetsAPI from './assets'; import * as MessageAPI from './message'; import * as PriorityAPI from './priority'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; @@ -12,7 +11,6 @@ import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../. export class Requests extends APIResource { message: MessageAPI.MessageResource = new MessageAPI.MessageResource(this._client); priority: PriorityAPI.PriorityResource = new PriorityAPI.PriorityResource(this._client); - assets: AssetsAPI.Assets = new AssetsAPI.Assets(this._client); /** * Creating a request adds the request into the Cloudforce One queue for analysis. @@ -413,11 +411,4 @@ export namespace Requests { export import PriorityDeleteResponse = PriorityAPI.PriorityDeleteResponse; export import PriorityCreateParams = PriorityAPI.PriorityCreateParams; export import PriorityUpdateParams = PriorityAPI.PriorityUpdateParams; - export import Assets = AssetsAPI.Assets; - export import AssetCreateResponse = AssetsAPI.AssetCreateResponse; - export import AssetUpdateResponse = AssetsAPI.AssetUpdateResponse; - export import AssetDeleteResponse = AssetsAPI.AssetDeleteResponse; - export import AssetGetResponse = AssetsAPI.AssetGetResponse; - export import AssetCreateParams = AssetsAPI.AssetCreateParams; - export import AssetUpdateParams = AssetsAPI.AssetUpdateParams; } diff --git a/src/resources/dns/firewall/firewall.ts b/src/resources/dns/firewall/firewall.ts index 0c0c635da5..008cc4ac99 100644 --- a/src/resources/dns/firewall/firewall.ts +++ b/src/resources/dns/firewall/firewall.ts @@ -3,13 +3,11 @@ import { APIResource } from '../../../resource'; import * as Core from '../../../core'; import * as FirewallAPI from './firewall'; -import * as ReverseDNSAPI from './reverse-dns'; import * as AnalyticsAPI from './analytics/analytics'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../pagination'; export class Firewall extends APIResource { analytics: AnalyticsAPI.Analytics = new AnalyticsAPI.Analytics(this._client); - reverseDNS: ReverseDNSAPI.ReverseDNS = new ReverseDNSAPI.ReverseDNS(this._client); /** * Create a DNS Firewall cluster @@ -588,9 +586,4 @@ export namespace Firewall { export import FirewallGetParams = FirewallAPI.FirewallGetParams; export import Analytics = AnalyticsAPI.Analytics; export import Delta = AnalyticsAPI.Delta; - export import ReverseDNS = ReverseDNSAPI.ReverseDNS; - export import ReverseDNSEditResponse = ReverseDNSAPI.ReverseDNSEditResponse; - export import ReverseDNSGetResponse = ReverseDNSAPI.ReverseDNSGetResponse; - export import ReverseDNSEditParams = ReverseDNSAPI.ReverseDNSEditParams; - export import ReverseDNSGetParams = ReverseDNSAPI.ReverseDNSGetParams; } diff --git a/src/resources/dns/firewall/index.ts b/src/resources/dns/firewall/index.ts index 2f4421e04a..017d263aa5 100644 --- a/src/resources/dns/firewall/index.ts +++ b/src/resources/dns/firewall/index.ts @@ -18,10 +18,3 @@ export { Firewall, } from './firewall'; export { Delta, Analytics } from './analytics/index'; -export { - ReverseDNSEditResponse, - ReverseDNSGetResponse, - ReverseDNSEditParams, - ReverseDNSGetParams, - ReverseDNS, -} from './reverse-dns'; diff --git a/src/resources/dns/firewall/reverse-dns.ts b/src/resources/dns/firewall/reverse-dns.ts deleted file mode 100644 index 9acd297423..0000000000 --- a/src/resources/dns/firewall/reverse-dns.ts +++ /dev/null @@ -1,81 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; -import * as ReverseDNSAPI from './reverse-dns'; - -export class ReverseDNS extends APIResource { - /** - * Update reverse DNS configuration (PTR records) for a DNS Firewall cluster - */ - edit( - dnsFirewallId: string, - params: ReverseDNSEditParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.patch(`/accounts/${account_id}/dns_firewall/${dnsFirewallId}/reverse_dns`, { - body, - ...options, - }) as Core.APIPromise<{ result: ReverseDNSEditResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Show reverse DNS configuration (PTR records) for a DNS Firewall cluster - */ - get( - dnsFirewallId: string, - params: ReverseDNSGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get( - `/accounts/${account_id}/dns_firewall/${dnsFirewallId}/reverse_dns`, - options, - ) as Core.APIPromise<{ result: ReverseDNSGetResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export interface ReverseDNSEditResponse { - /** - * Map of cluster IP addresses to PTR record contents - */ - ptr: Record; -} - -export interface ReverseDNSGetResponse { - /** - * Map of cluster IP addresses to PTR record contents - */ - ptr: Record; -} - -export interface ReverseDNSEditParams { - /** - * Path param: Identifier - */ - account_id: string; - - /** - * Body param: Map of cluster IP addresses to PTR record contents - */ - ptr?: Record; -} - -export interface ReverseDNSGetParams { - /** - * Identifier - */ - account_id: string; -} - -export namespace ReverseDNS { - export import ReverseDNSEditResponse = ReverseDNSAPI.ReverseDNSEditResponse; - export import ReverseDNSGetResponse = ReverseDNSAPI.ReverseDNSGetResponse; - export import ReverseDNSEditParams = ReverseDNSAPI.ReverseDNSEditParams; - export import ReverseDNSGetParams = ReverseDNSAPI.ReverseDNSGetParams; -} diff --git a/src/resources/event-notifications/event-notifications.ts b/src/resources/event-notifications/event-notifications.ts new file mode 100644 index 0000000000..f428122919 --- /dev/null +++ b/src/resources/event-notifications/event-notifications.ts @@ -0,0 +1,12 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; +import * as R2API from './r2/r2'; + +export class EventNotifications extends APIResource { + r2: R2API.R2 = new R2API.R2(this._client); +} + +export namespace EventNotifications { + export import R2 = R2API.R2; +} diff --git a/src/resources/event-notifications/index.ts b/src/resources/event-notifications/index.ts new file mode 100644 index 0000000000..656e57f2d2 --- /dev/null +++ b/src/resources/event-notifications/index.ts @@ -0,0 +1,4 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +export { EventNotifications } from './event-notifications'; +export { R2 } from './r2/index'; diff --git a/src/resources/r2/event-notifications/configuration/configuration.ts b/src/resources/event-notifications/r2/configuration/configuration.ts similarity index 100% rename from src/resources/r2/event-notifications/configuration/configuration.ts rename to src/resources/event-notifications/r2/configuration/configuration.ts diff --git a/src/resources/r2/event-notifications/configuration/index.ts b/src/resources/event-notifications/r2/configuration/index.ts similarity index 100% rename from src/resources/r2/event-notifications/configuration/index.ts rename to src/resources/event-notifications/r2/configuration/index.ts diff --git a/src/resources/r2/event-notifications/configuration/queues.ts b/src/resources/event-notifications/r2/configuration/queues.ts similarity index 100% rename from src/resources/r2/event-notifications/configuration/queues.ts rename to src/resources/event-notifications/r2/configuration/queues.ts diff --git a/src/resources/r2/event-notifications/index.ts b/src/resources/event-notifications/r2/index.ts similarity index 76% rename from src/resources/r2/event-notifications/index.ts rename to src/resources/event-notifications/r2/index.ts index 4933f5958e..601572c2dd 100644 --- a/src/resources/r2/event-notifications/index.ts +++ b/src/resources/event-notifications/r2/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { ConfigurationGetResponse, ConfigurationGetParams, Configuration } from './configuration/index'; -export { EventNotifications } from './event-notifications'; +export { R2 } from './r2'; diff --git a/src/resources/r2/event-notifications/event-notifications.ts b/src/resources/event-notifications/r2/r2.ts similarity index 85% rename from src/resources/r2/event-notifications/event-notifications.ts rename to src/resources/event-notifications/r2/r2.ts index c24a945988..ace8e1f627 100644 --- a/src/resources/r2/event-notifications/event-notifications.ts +++ b/src/resources/event-notifications/r2/r2.ts @@ -3,11 +3,11 @@ import { APIResource } from '../../../resource'; import * as ConfigurationAPI from './configuration/configuration'; -export class EventNotifications extends APIResource { +export class R2 extends APIResource { configuration: ConfigurationAPI.Configuration = new ConfigurationAPI.Configuration(this._client); } -export namespace EventNotifications { +export namespace R2 { export import Configuration = ConfigurationAPI.Configuration; export import ConfigurationGetResponse = ConfigurationAPI.ConfigurationGetResponse; export import ConfigurationGetParams = ConfigurationAPI.ConfigurationGetParams; diff --git a/src/resources/index.ts b/src/resources/index.ts index 9c5c264096..b7e13a1c06 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -16,6 +16,7 @@ export { BrandProtection } from './brand-protection'; export { Cache } from './cache/cache'; export { Calls } from './calls/calls'; export { CertificateAuthorities } from './certificate-authorities/certificate-authorities'; +export { Challenges } from './challenges/challenges'; export { ClientCertificates } from './client-certificates'; export { CloudConnector } from './cloud-connector/cloud-connector'; export { CloudforceOne } from './cloudforce-one/cloudforce-one'; @@ -30,6 +31,7 @@ export { Diagnostics } from './diagnostics/diagnostics'; export { DurableObjects } from './durable-objects/durable-objects'; export { EmailRouting } from './email-routing/email-routing'; export { EmailSecurity } from './email-security/email-security'; +export { EventNotifications } from './event-notifications/event-notifications'; export { Filters } from './filters'; export { Firewall } from './firewall/firewall'; export { Healthchecks } from './healthchecks/healthchecks'; @@ -47,19 +49,22 @@ export { Logs } from './logs/logs'; export { MTLSCertificates } from './mtls-certificates/mtls-certificates'; export { MagicNetworkMonitoring } from './magic-network-monitoring/magic-network-monitoring'; export { MagicTransit } from './magic-transit/magic-transit'; -export { ManagedTransforms } from './managed-transforms'; +export { ManagedHeaders } from './managed-headers'; export { Memberships } from './memberships'; export { OriginCACertificates } from './origin-ca-certificates'; export { OriginPostQuantumEncryption } from './origin-post-quantum-encryption'; export { OriginTLSClientAuth } from './origin-tls-client-auth/origin-tls-client-auth'; +export { PCAPs } from './pcaps/pcaps'; export { PageShield } from './page-shield/page-shield'; export { Pagerules } from './pagerules/pagerules'; export { Pages } from './pages/pages'; +export { Plans } from './plans'; export { Queues } from './queues/queues'; export { R2 } from './r2/r2'; export { RUM } from './rum/rum'; export { Radar } from './radar/radar'; export { RateLimits } from './rate-limits'; +export { RatePlans } from './rate-plans'; export { Registrar } from './registrar/registrar'; export { RequestTracers } from './request-tracers/request-tracers'; export { Rules } from './rules/rules'; @@ -71,7 +76,6 @@ export { Spectrum } from './spectrum/spectrum'; export { Speed } from './speed/speed'; export { Storage } from './storage/storage'; export { Stream } from './stream/stream'; -export { Turnstile } from './turnstile/turnstile'; export { URLNormalization } from './url-normalization'; export { URLScanner } from './url-scanner/url-scanner'; export { User } from './user/user'; diff --git a/src/resources/magic-transit/index.ts b/src/resources/magic-transit/index.ts index 18fec56d77..e8710f4ca0 100644 --- a/src/resources/magic-transit/index.ts +++ b/src/resources/magic-transit/index.ts @@ -47,18 +47,6 @@ export { GRETunnels, } from './gre-tunnels'; export { MagicTransit } from './magic-transit'; -export { - PCAP, - PCAPFilter, - PCAPCreateResponse, - PCAPListResponse, - PCAPGetResponse, - PCAPCreateParams, - PCAPListParams, - PCAPGetParams, - PCAPListResponsesSinglePage, - PCAPs, -} from './pcaps/index'; export { PSKMetadata, IPSECTunnelCreateResponse, diff --git a/src/resources/magic-transit/magic-transit.ts b/src/resources/magic-transit/magic-transit.ts index f875fe27eb..91007679c4 100644 --- a/src/resources/magic-transit/magic-transit.ts +++ b/src/resources/magic-transit/magic-transit.ts @@ -7,7 +7,6 @@ import * as ConnectorsAPI from './connectors'; import * as GRETunnelsAPI from './gre-tunnels'; import * as IPSECTunnelsAPI from './ipsec-tunnels'; import * as RoutesAPI from './routes'; -import * as PCAPsAPI from './pcaps/pcaps'; import * as SitesAPI from './sites/sites'; export class MagicTransit extends APIResource { @@ -18,7 +17,6 @@ export class MagicTransit extends APIResource { routes: RoutesAPI.Routes = new RoutesAPI.Routes(this._client); sites: SitesAPI.Sites = new SitesAPI.Sites(this._client); connectors: ConnectorsAPI.Connectors = new ConnectorsAPI.Connectors(this._client); - pcaps: PCAPsAPI.PCAPs = new PCAPsAPI.PCAPs(this._client); } export interface HealthCheck { @@ -190,14 +188,4 @@ export namespace MagicTransit { export import ConnectorListParams = ConnectorsAPI.ConnectorListParams; export import ConnectorEditParams = ConnectorsAPI.ConnectorEditParams; export import ConnectorGetParams = ConnectorsAPI.ConnectorGetParams; - export import PCAPs = PCAPsAPI.PCAPs; - export import PCAP = PCAPsAPI.PCAP; - export import PCAPFilter = PCAPsAPI.PCAPFilter; - export import PCAPCreateResponse = PCAPsAPI.PCAPCreateResponse; - export import PCAPListResponse = PCAPsAPI.PCAPListResponse; - export import PCAPGetResponse = PCAPsAPI.PCAPGetResponse; - export import PCAPListResponsesSinglePage = PCAPsAPI.PCAPListResponsesSinglePage; - export import PCAPCreateParams = PCAPsAPI.PCAPCreateParams; - export import PCAPListParams = PCAPsAPI.PCAPListParams; - export import PCAPGetParams = PCAPsAPI.PCAPGetParams; } diff --git a/src/resources/managed-transforms.ts b/src/resources/managed-headers.ts similarity index 76% rename from src/resources/managed-transforms.ts rename to src/resources/managed-headers.ts index c4d9bc70e8..145f245242 100644 --- a/src/resources/managed-transforms.ts +++ b/src/resources/managed-headers.ts @@ -3,14 +3,14 @@ import { APIResource } from '../resource'; import * as Core from '../core'; -export class ManagedTransforms extends APIResource { +export class ManagedHeaders extends APIResource { /** * Fetches a list of all Managed Transforms. */ list( - params: ManagedTransformListParams, + params: ManagedHeaderListParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id } = params; return this._client.get(`/zones/${zone_id}/managed_headers`, options); } @@ -19,9 +19,9 @@ export class ManagedTransforms extends APIResource { * Updates the status of one or more Managed Transforms. */ edit( - params: ManagedTransformEditParams, + params: ManagedHeaderEditParams, options?: Core.RequestOptions, - ): Core.APIPromise { + ): Core.APIPromise { const { zone_id, ...body } = params; return this._client.patch(`/zones/${zone_id}/managed_headers`, { body, ...options }); } @@ -51,19 +51,19 @@ export interface RequestModelParam { enabled?: boolean; } -export interface ManagedTransformListResponse { +export interface ManagedHeaderListResponse { managed_request_headers?: Array; managed_response_headers?: Array; } -export interface ManagedTransformEditResponse { - managed_request_headers?: Array; +export interface ManagedHeaderEditResponse { + managed_request_headers?: Array; - managed_response_headers?: Array; + managed_response_headers?: Array; } -export namespace ManagedTransformEditResponse { +export namespace ManagedHeaderEditResponse { export interface ManagedRequestHeader { /** * Human-readable identifier of the Managed Transform. @@ -99,14 +99,14 @@ export namespace ManagedTransformEditResponse { } } -export interface ManagedTransformListParams { +export interface ManagedHeaderListParams { /** * Identifier */ zone_id: string; } -export interface ManagedTransformEditParams { +export interface ManagedHeaderEditParams { /** * Path param: Identifier */ diff --git a/src/resources/magic-transit/pcaps/download.ts b/src/resources/pcaps/download.ts similarity index 83% rename from src/resources/magic-transit/pcaps/download.ts rename to src/resources/pcaps/download.ts index 7109e4c0f4..9e001f1fe2 100644 --- a/src/resources/magic-transit/pcaps/download.ts +++ b/src/resources/pcaps/download.ts @@ -1,9 +1,9 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; +import { APIResource } from '../../resource'; +import * as Core from '../../core'; import * as DownloadAPI from './download'; -import { type Response } from '../../../_shims/index'; +import { type Response } from '../../_shims/index'; export class Download extends APIResource { /** diff --git a/src/resources/magic-transit/pcaps/index.ts b/src/resources/pcaps/index.ts similarity index 61% rename from src/resources/magic-transit/pcaps/index.ts rename to src/resources/pcaps/index.ts index d1559e59df..416c8b86b4 100644 --- a/src/resources/magic-transit/pcaps/index.ts +++ b/src/resources/pcaps/index.ts @@ -10,15 +10,4 @@ export { OwnershipValidateParams, OwnershipResource, } from './ownership'; -export { - PCAP, - PCAPFilter, - PCAPCreateResponse, - PCAPListResponse, - PCAPGetResponse, - PCAPCreateParams, - PCAPListParams, - PCAPGetParams, - PCAPListResponsesSinglePage, - PCAPs, -} from './pcaps'; +export { PCAPs } from './pcaps'; diff --git a/src/resources/magic-transit/pcaps/ownership.ts b/src/resources/pcaps/ownership.ts similarity index 97% rename from src/resources/magic-transit/pcaps/ownership.ts rename to src/resources/pcaps/ownership.ts index 9c5be18f44..1b67e20f2d 100644 --- a/src/resources/magic-transit/pcaps/ownership.ts +++ b/src/resources/pcaps/ownership.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; +import { APIResource } from '../../resource'; +import * as Core from '../../core'; import * as OwnershipAPI from './ownership'; export class OwnershipResource extends APIResource { diff --git a/src/resources/magic-transit/pcaps/pcaps.ts b/src/resources/pcaps/pcaps.ts similarity index 94% rename from src/resources/magic-transit/pcaps/pcaps.ts rename to src/resources/pcaps/pcaps.ts index 93e3c5e483..f92aa8754a 100644 --- a/src/resources/magic-transit/pcaps/pcaps.ts +++ b/src/resources/pcaps/pcaps.ts @@ -1,11 +1,11 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../../resource'; -import * as Core from '../../../core'; +import { APIResource } from '../../resource'; +import * as Core from '../../core'; import * as PCAPsAPI from './pcaps'; import * as DownloadAPI from './download'; import * as OwnershipAPI from './ownership'; -import { SinglePage } from '../../../pagination'; +import { SinglePage } from '../../pagination'; export class PCAPs extends APIResource { ownership: OwnershipAPI.OwnershipResource = new OwnershipAPI.OwnershipResource(this._client); @@ -489,15 +489,6 @@ export interface PCAPGetParams { } export namespace PCAPs { - export import PCAP = PCAPsAPI.PCAP; - export import PCAPFilter = PCAPsAPI.PCAPFilter; - export import PCAPCreateResponse = PCAPsAPI.PCAPCreateResponse; - export import PCAPListResponse = PCAPsAPI.PCAPListResponse; - export import PCAPGetResponse = PCAPsAPI.PCAPGetResponse; - export import PCAPListResponsesSinglePage = PCAPsAPI.PCAPListResponsesSinglePage; - export import PCAPCreateParams = PCAPsAPI.PCAPCreateParams; - export import PCAPListParams = PCAPsAPI.PCAPListParams; - export import PCAPGetParams = PCAPsAPI.PCAPGetParams; export import OwnershipResource = OwnershipAPI.OwnershipResource; export import Ownership = OwnershipAPI.Ownership; export import OwnershipGetResponse = OwnershipAPI.OwnershipGetResponse; diff --git a/src/resources/zones/plans.ts b/src/resources/plans.ts similarity index 82% rename from src/resources/zones/plans.ts rename to src/resources/plans.ts index b7d78a72b2..7eb80e22e6 100644 --- a/src/resources/zones/plans.ts +++ b/src/resources/plans.ts @@ -1,9 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as PlansAPI from './plans'; -import { SinglePage } from '../../pagination'; +import { APIResource } from '../resource'; +import * as Core from '../core'; +import { SinglePage } from '../pagination'; export class Plans extends APIResource { /** @@ -105,10 +104,3 @@ export interface PlanGetParams { */ zone_id: string; } - -export namespace Plans { - export import AvailableRatePlan = PlansAPI.AvailableRatePlan; - export import AvailableRatePlansSinglePage = PlansAPI.AvailableRatePlansSinglePage; - export import PlanListParams = PlansAPI.PlanListParams; - export import PlanGetParams = PlansAPI.PlanGetParams; -} diff --git a/src/resources/r2/index.ts b/src/resources/r2/index.ts index 4dee04ebd8..f256d3dacb 100644 --- a/src/resources/r2/index.ts +++ b/src/resources/r2/index.ts @@ -11,7 +11,6 @@ export { Buckets, } from './buckets'; export { Domains } from './domains/index'; -export { EventNotifications } from './event-notifications/index'; export { Provider, Sippy, diff --git a/src/resources/r2/r2.ts b/src/resources/r2/r2.ts index 3290fb50b8..1d6d739dc4 100644 --- a/src/resources/r2/r2.ts +++ b/src/resources/r2/r2.ts @@ -5,7 +5,6 @@ import * as BucketsAPI from './buckets'; import * as SippyAPI from './sippy'; import * as TemporaryCredentialsAPI from './temporary-credentials'; import * as DomainsAPI from './domains/domains'; -import * as EventNotificationsAPI from './event-notifications/event-notifications'; export class R2 extends APIResource { buckets: BucketsAPI.Buckets = new BucketsAPI.Buckets(this._client); @@ -13,9 +12,6 @@ export class R2 extends APIResource { temporaryCredentials: TemporaryCredentialsAPI.TemporaryCredentials = new TemporaryCredentialsAPI.TemporaryCredentials(this._client); domains: DomainsAPI.Domains = new DomainsAPI.Domains(this._client); - eventNotifications: EventNotificationsAPI.EventNotifications = new EventNotificationsAPI.EventNotifications( - this._client, - ); } export namespace R2 { @@ -39,5 +35,4 @@ export namespace R2 { export import TemporaryCredentialCreateResponse = TemporaryCredentialsAPI.TemporaryCredentialCreateResponse; export import TemporaryCredentialCreateParams = TemporaryCredentialsAPI.TemporaryCredentialCreateParams; export import Domains = DomainsAPI.Domains; - export import EventNotifications = EventNotificationsAPI.EventNotifications; } diff --git a/src/resources/rate-plans.ts b/src/resources/rate-plans.ts new file mode 100644 index 0000000000..c75e6d8abd --- /dev/null +++ b/src/resources/rate-plans.ts @@ -0,0 +1,78 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../resource'; +import * as Core from '../core'; + +export class RatePlans extends APIResource { + /** + * Lists all rate plans the zone can subscribe to. + */ + get(params: RatePlanGetParams, options?: Core.RequestOptions): Core.APIPromise { + const { zone_id } = params; + return ( + this._client.get(`/zones/${zone_id}/available_rate_plans`, options) as Core.APIPromise<{ + result: RatePlanGetResponse | null; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface RatePlan { + /** + * Plan identifier tag. + */ + id?: string; + + /** + * Array of available components values for the plan. + */ + components?: Array; + + /** + * The monetary unit in which pricing information is displayed. + */ + currency?: string; + + /** + * The duration of the plan subscription. + */ + duration?: number; + + /** + * The frequency at which you will be billed for this plan. + */ + frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; + + /** + * The plan name. + */ + name?: string; +} + +export namespace RatePlan { + export interface Component { + /** + * The default amount allocated. + */ + default?: number; + + /** + * The unique component. + */ + name?: 'zones' | 'page_rules' | 'dedicated_certificates' | 'dedicated_certificates_custom'; + + /** + * The unit price of the addon. + */ + unit_price?: number; + } +} + +export type RatePlanGetResponse = Array; + +export interface RatePlanGetParams { + /** + * Identifier + */ + zone_id: string; +} diff --git a/src/resources/registrar/index.ts b/src/resources/registrar/index.ts index 61d7c2bc95..4cc7b2cfc8 100644 --- a/src/resources/registrar/index.ts +++ b/src/resources/registrar/index.ts @@ -12,3 +12,4 @@ export { Domains, } from './domains'; export { Registrar } from './registrar'; +export { Terraform } from './terraform'; diff --git a/src/resources/registrar/registrar.ts b/src/resources/registrar/registrar.ts index e82728df22..67c7fe3f0a 100644 --- a/src/resources/registrar/registrar.ts +++ b/src/resources/registrar/registrar.ts @@ -2,12 +2,15 @@ import { APIResource } from '../../resource'; import * as DomainsAPI from './domains'; +import * as TerraformAPI from './terraform'; export class Registrar extends APIResource { + terraform: TerraformAPI.Terraform = new TerraformAPI.Terraform(this._client); domains: DomainsAPI.Domains = new DomainsAPI.Domains(this._client); } export namespace Registrar { + export import Terraform = TerraformAPI.Terraform; export import Domains = DomainsAPI.Domains; export import Domain = DomainsAPI.Domain; export import DomainUpdateResponse = DomainsAPI.DomainUpdateResponse; diff --git a/src/resources/registrar/terraform.ts b/src/resources/registrar/terraform.ts new file mode 100644 index 0000000000..9d12a93728 --- /dev/null +++ b/src/resources/registrar/terraform.ts @@ -0,0 +1,5 @@ +// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +import { APIResource } from '../../resource'; + +export class Terraform extends APIResource {} diff --git a/src/resources/shared.ts b/src/resources/shared.ts index 6200cbd15e..4f5bcc2bf3 100644 --- a/src/resources/shared.ts +++ b/src/resources/shared.ts @@ -405,86 +405,6 @@ export interface PermissionGrantParam { write?: boolean; } -/** - * The rate plan applied to the subscription. - */ -export interface RatePlan { - /** - * The ID of the rate plan. - */ - id?: string; - - /** - * The currency applied to the rate plan subscription. - */ - currency?: string; - - /** - * Whether this rate plan is managed externally from Cloudflare. - */ - externally_managed?: boolean; - - /** - * Whether a rate plan is enterprise-based (or newly adopted term contract). - */ - is_contract?: boolean; - - /** - * The full name of the rate plan. - */ - public_name?: string; - - /** - * The scope that this rate plan applies to. - */ - scope?: string; - - /** - * The list of sets this rate plan applies to. - */ - sets?: Array; -} - -/** - * The rate plan applied to the subscription. - */ -export interface RatePlanParam { - /** - * The ID of the rate plan. - */ - id?: string; - - /** - * The currency applied to the rate plan subscription. - */ - currency?: string; - - /** - * Whether this rate plan is managed externally from Cloudflare. - */ - externally_managed?: boolean; - - /** - * Whether a rate plan is enterprise-based (or newly adopted term contract). - */ - is_contract?: boolean; - - /** - * The full name of the rate plan. - */ - public_name?: string; - - /** - * The scope that this rate plan applies to. - */ - scope?: string; - - /** - * The list of sets this rate plan applies to. - */ - sets?: Array; -} - export interface ResponseInfo { code: number; @@ -548,89 +468,6 @@ export type SortDirection = 'asc' | 'desc'; */ export type SortDirectionParam = 'asc' | 'desc'; -export interface Subscription { - /** - * Subscription identifier tag. - */ - id?: string; - - /** - * The monetary unit in which pricing information is displayed. - */ - currency?: string; - - /** - * The end of the current period and also when the next billing is due. - */ - current_period_end?: string; - - /** - * When the current billing period started. May match initial_period_start if this - * is the first period. - */ - current_period_start?: string; - - /** - * How often the subscription is renewed automatically. - */ - frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; - - /** - * The price of the subscription that will be billed, in US dollars. - */ - price?: number; - - /** - * The rate plan applied to the subscription. - */ - rate_plan?: RatePlan; - - /** - * The state that the subscription is in. - */ - state?: 'Trial' | 'Provisioned' | 'Paid' | 'AwaitingPayment' | 'Cancelled' | 'Failed' | 'Expired'; -} - -/** - * A component value for a subscription. - */ -export interface SubscriptionComponent { - /** - * The default amount assigned. - */ - default?: number; - - /** - * The name of the component value. - */ - name?: string; - - /** - * The unit price for the component value. - */ - price?: number; - - /** - * The amount of the component value assigned. - */ - value?: number; -} - -/** - * A simple zone object. May have null properties if not a zone subscription. - */ -export interface SubscriptionZone { - /** - * Identifier - */ - id?: string; - - /** - * The domain name - */ - name?: string; -} - export class RolesSinglePage extends SinglePage {} export class AuditLogsV4PagePaginationArray extends V4PagePaginationArray {} diff --git a/src/resources/url-scanner/index.ts b/src/resources/url-scanner/index.ts index 8c5ab60f67..b797d001ec 100644 --- a/src/resources/url-scanner/index.ts +++ b/src/resources/url-scanner/index.ts @@ -5,11 +5,9 @@ export { URLScannerDomain, URLScannerTask, ScanCreateResponse, - ScanListResponse, ScanGetResponse, ScanHarResponse, ScanCreateParams, - ScanListParams, ScanGetParams, ScanScreenshotParams, Scans, diff --git a/src/resources/url-scanner/scans.ts b/src/resources/url-scanner/scans.ts index 35c839e716..421ed83591 100644 --- a/src/resources/url-scanner/scans.ts +++ b/src/resources/url-scanner/scans.ts @@ -24,35 +24,6 @@ export class Scans extends APIResource { )._thenUnwrap((obj) => obj.result); } - /** - * Search scans by date and webpages' requests, including full URL (after - * redirects), hostname, and path.
A successful scan will appear in search - * results a few minutes after finishing but may take much longer if the system in - * under load. By default, only successfully completed scans will appear in search - * results, unless searching by `scanId`. Please take into account that older scans - * may be removed from the search index at an unspecified time. - */ - list( - accountId: string, - query?: ScanListParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - list(accountId: string, options?: Core.RequestOptions): Core.APIPromise; - list( - accountId: string, - query: ScanListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.list(accountId, {}, query); - } - return ( - this._client.get(`/accounts/${accountId}/urlscanner/scan`, { query, ...options }) as Core.APIPromise<{ - result: ScanListResponse; - }> - )._thenUnwrap((obj) => obj.result); - } - /** * Get URL scan by uuid */ @@ -181,44 +152,6 @@ export interface ScanCreateResponse { visibility: string; } -export interface ScanListResponse { - tasks: Array; -} - -export namespace ScanListResponse { - export interface Task { - /** - * Alpha-2 country code - */ - country: string; - - /** - * Whether scan was successful or not - */ - success: boolean; - - /** - * When scan was submitted (UTC) - */ - time: string; - - /** - * Scan url (after redirects) - */ - url: string; - - /** - * Scan id - */ - uuid: string; - - /** - * Visibility status. - */ - visibility: string; - } -} - export interface ScanGetResponse { scan: ScanGetResponse.Scan; } @@ -931,99 +864,6 @@ export interface ScanCreateParams { visibility?: 'Public' | 'Unlisted'; } -export interface ScanListParams { - /** - * Return only scans created by account. - */ - account_scans?: boolean; - - /** - * Filter scans by Autonomous System Number (ASN) of _any_ request made by the - * webpage. - */ - asn?: string; - - /** - * Filter scans requested before date (inclusive). - */ - date_end?: string; - - /** - * Filter scans requested after date (inclusive). - */ - date_start?: string; - - /** - * Filter scans by hash of any html/js/css request made by the webpage. - */ - hash?: string; - - /** - * Filter scans by hostname of _any_ request made by the webpage. - */ - hostname?: string; - - /** - * Filter scans by IP address (IPv4 or IPv6) of _any_ request made by the webpage. - */ - ip?: string; - - /** - * Filter scans by malicious verdict. - */ - is_malicious?: boolean; - - /** - * Limit the number of objects in the response. - */ - limit?: number; - - /** - * Pagination cursor to get the next set of results. - */ - next_cursor?: string; - - /** - * Filter scans by main page Autonomous System Number (ASN). - */ - page_asn?: string; - - /** - * Filter scans by main page hostname (domain of effective URL). - */ - page_hostname?: string; - - /** - * Filter scans by main page IP address (IPv4 or IPv6). - */ - page_ip?: string; - - /** - * Filter scans by exact match of effective URL path (also supports suffix search). - */ - page_path?: string; - - /** - * Filter scans by submitted or scanned URL - */ - page_url?: string; - - /** - * Filter scans by url path of _any_ request made by the webpage. - */ - path?: string; - - /** - * Scan uuid - */ - scanId?: string; - - /** - * Filter scans by URL of _any_ request made by the webpage - */ - url?: string; -} - export interface ScanGetParams { /** * Whether to return full report (scan summary and network log). @@ -1042,11 +882,9 @@ export namespace Scans { export import URLScannerDomain = ScansAPI.URLScannerDomain; export import URLScannerTask = ScansAPI.URLScannerTask; export import ScanCreateResponse = ScansAPI.ScanCreateResponse; - export import ScanListResponse = ScansAPI.ScanListResponse; export import ScanGetResponse = ScansAPI.ScanGetResponse; export import ScanHarResponse = ScansAPI.ScanHarResponse; export import ScanCreateParams = ScansAPI.ScanCreateParams; - export import ScanListParams = ScansAPI.ScanListParams; export import ScanGetParams = ScansAPI.ScanGetParams; export import ScanScreenshotParams = ScansAPI.ScanScreenshotParams; } diff --git a/src/resources/url-scanner/url-scanner.ts b/src/resources/url-scanner/url-scanner.ts index 3efb9f6e0b..1fe11bbe35 100644 --- a/src/resources/url-scanner/url-scanner.ts +++ b/src/resources/url-scanner/url-scanner.ts @@ -1,10 +1,172 @@ // 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 ScansAPI from './scans'; export class URLScanner extends APIResource { scans: ScansAPI.Scans = new ScansAPI.Scans(this._client); + + /** + * Search scans by date and webpages' requests, including full URL (after + * redirects), hostname, and path.
A successful scan will appear in search + * results a few minutes after finishing but may take much longer if the system in + * under load. By default, only successfully completed scans will appear in search + * results, unless searching by `scanId`. Please take into account that older scans + * may be removed from the search index at an unspecified time. + */ + scan( + accountId: string, + query?: URLScannerScanParams, + options?: Core.RequestOptions, + ): Core.APIPromise; + scan(accountId: string, options?: Core.RequestOptions): Core.APIPromise; + scan( + accountId: string, + query: URLScannerScanParams | Core.RequestOptions = {}, + options?: Core.RequestOptions, + ): Core.APIPromise { + if (isRequestOptions(query)) { + return this.scan(accountId, {}, query); + } + return ( + this._client.get(`/accounts/${accountId}/urlscanner/scan`, { query, ...options }) as Core.APIPromise<{ + result: URLScannerScanResponse; + }> + )._thenUnwrap((obj) => obj.result); + } +} + +export interface URLScannerScanResponse { + tasks: Array; +} + +export namespace URLScannerScanResponse { + export interface Task { + /** + * Alpha-2 country code + */ + country: string; + + /** + * Whether scan was successful or not + */ + success: boolean; + + /** + * When scan was submitted (UTC) + */ + time: string; + + /** + * Scan url (after redirects) + */ + url: string; + + /** + * Scan id + */ + uuid: string; + + /** + * Visibility status. + */ + visibility: string; + } +} + +export interface URLScannerScanParams { + /** + * Return only scans created by account. + */ + account_scans?: boolean; + + /** + * Filter scans by Autonomous System Number (ASN) of _any_ request made by the + * webpage. + */ + asn?: string; + + /** + * Filter scans requested before date (inclusive). + */ + date_end?: string; + + /** + * Filter scans requested after date (inclusive). + */ + date_start?: string; + + /** + * Filter scans by hash of any html/js/css request made by the webpage. + */ + hash?: string; + + /** + * Filter scans by hostname of _any_ request made by the webpage. + */ + hostname?: string; + + /** + * Filter scans by IP address (IPv4 or IPv6) of _any_ request made by the webpage. + */ + ip?: string; + + /** + * Filter scans by malicious verdict. + */ + is_malicious?: boolean; + + /** + * Limit the number of objects in the response. + */ + limit?: number; + + /** + * Pagination cursor to get the next set of results. + */ + next_cursor?: string; + + /** + * Filter scans by main page Autonomous System Number (ASN). + */ + page_asn?: string; + + /** + * Filter scans by main page hostname (domain of effective URL). + */ + page_hostname?: string; + + /** + * Filter scans by main page IP address (IPv4 or IPv6). + */ + page_ip?: string; + + /** + * Filter scans by exact match of effective URL path (also supports suffix search). + */ + page_path?: string; + + /** + * Filter scans by submitted or scanned URL + */ + page_url?: string; + + /** + * Filter scans by url path of _any_ request made by the webpage. + */ + path?: string; + + /** + * Scan uuid + */ + scanId?: string; + + /** + * Filter scans by URL of _any_ request made by the webpage + */ + url?: string; } export namespace URLScanner { @@ -12,11 +174,9 @@ export namespace URLScanner { export import URLScannerDomain = ScansAPI.URLScannerDomain; export import URLScannerTask = ScansAPI.URLScannerTask; export import ScanCreateResponse = ScansAPI.ScanCreateResponse; - export import ScanListResponse = ScansAPI.ScanListResponse; export import ScanGetResponse = ScansAPI.ScanGetResponse; export import ScanHarResponse = ScansAPI.ScanHarResponse; export import ScanCreateParams = ScansAPI.ScanCreateParams; - export import ScanListParams = ScansAPI.ScanListParams; export import ScanGetParams = ScansAPI.ScanGetParams; export import ScanScreenshotParams = ScansAPI.ScanScreenshotParams; } diff --git a/src/resources/user/index.ts b/src/resources/user/index.ts index 89cb1a206d..8dffb525c2 100644 --- a/src/resources/user/index.ts +++ b/src/resources/user/index.ts @@ -35,6 +35,10 @@ export { Organizations, } from './organizations'; export { + RatePlan, + Subscription, + SubscriptionComponent, + SubscriptionZone, SubscriptionUpdateResponse, SubscriptionDeleteResponse, SubscriptionGetResponse, diff --git a/src/resources/user/subscriptions.ts b/src/resources/user/subscriptions.ts index 7fa56be665..265a5e549c 100644 --- a/src/resources/user/subscriptions.ts +++ b/src/resources/user/subscriptions.ts @@ -3,7 +3,6 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; import * as SubscriptionsAPI from './subscriptions'; -import * as Shared from '../shared'; export class Subscriptions extends APIResource { /** @@ -40,6 +39,169 @@ export class Subscriptions extends APIResource { } } +/** + * The rate plan applied to the subscription. + */ +export interface RatePlan { + /** + * The ID of the rate plan. + */ + id?: string; + + /** + * The currency applied to the rate plan subscription. + */ + currency?: string; + + /** + * Whether this rate plan is managed externally from Cloudflare. + */ + externally_managed?: boolean; + + /** + * Whether a rate plan is enterprise-based (or newly adopted term contract). + */ + is_contract?: boolean; + + /** + * The full name of the rate plan. + */ + public_name?: string; + + /** + * The scope that this rate plan applies to. + */ + scope?: string; + + /** + * The list of sets this rate plan applies to. + */ + sets?: Array; +} + +/** + * The rate plan applied to the subscription. + */ +export interface RatePlanParam { + /** + * The ID of the rate plan. + */ + id?: string; + + /** + * The currency applied to the rate plan subscription. + */ + currency?: string; + + /** + * Whether this rate plan is managed externally from Cloudflare. + */ + externally_managed?: boolean; + + /** + * Whether a rate plan is enterprise-based (or newly adopted term contract). + */ + is_contract?: boolean; + + /** + * The full name of the rate plan. + */ + public_name?: string; + + /** + * The scope that this rate plan applies to. + */ + scope?: string; + + /** + * The list of sets this rate plan applies to. + */ + sets?: Array; +} + +export interface Subscription { + /** + * Subscription identifier tag. + */ + id?: string; + + /** + * The monetary unit in which pricing information is displayed. + */ + currency?: string; + + /** + * The end of the current period and also when the next billing is due. + */ + current_period_end?: string; + + /** + * When the current billing period started. May match initial_period_start if this + * is the first period. + */ + current_period_start?: string; + + /** + * How often the subscription is renewed automatically. + */ + frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; + + /** + * The price of the subscription that will be billed, in US dollars. + */ + price?: number; + + /** + * The rate plan applied to the subscription. + */ + rate_plan?: RatePlan; + + /** + * The state that the subscription is in. + */ + state?: 'Trial' | 'Provisioned' | 'Paid' | 'AwaitingPayment' | 'Cancelled' | 'Failed' | 'Expired'; +} + +/** + * A component value for a subscription. + */ +export interface SubscriptionComponent { + /** + * The default amount assigned. + */ + default?: number; + + /** + * The name of the component value. + */ + name?: string; + + /** + * The unit price for the component value. + */ + price?: number; + + /** + * The amount of the component value assigned. + */ + value?: number; +} + +/** + * A simple zone object. May have null properties if not a zone subscription. + */ +export interface SubscriptionZone { + /** + * Identifier + */ + id?: string; + + /** + * The domain name + */ + name?: string; +} + export type SubscriptionUpdateResponse = unknown | string | null; export interface SubscriptionDeleteResponse { @@ -49,7 +211,7 @@ export interface SubscriptionDeleteResponse { subscription_id?: string; } -export type SubscriptionGetResponse = Array; +export type SubscriptionGetResponse = Array; export interface SubscriptionUpdateParams { /** @@ -60,10 +222,14 @@ export interface SubscriptionUpdateParams { /** * The rate plan applied to the subscription. */ - rate_plan?: Shared.RatePlanParam; + rate_plan?: RatePlanParam; } export namespace Subscriptions { + export import RatePlan = SubscriptionsAPI.RatePlan; + export import Subscription = SubscriptionsAPI.Subscription; + export import SubscriptionComponent = SubscriptionsAPI.SubscriptionComponent; + export import SubscriptionZone = SubscriptionsAPI.SubscriptionZone; export import SubscriptionUpdateResponse = SubscriptionsAPI.SubscriptionUpdateResponse; export import SubscriptionDeleteResponse = SubscriptionsAPI.SubscriptionDeleteResponse; export import SubscriptionGetResponse = SubscriptionsAPI.SubscriptionGetResponse; diff --git a/src/resources/user/user.ts b/src/resources/user/user.ts index 4f29b660ba..a415daedf3 100644 --- a/src/resources/user/user.ts +++ b/src/resources/user/user.ts @@ -84,6 +84,10 @@ export namespace User { export import OrganizationsV4PagePaginationArray = OrganizationsAPI.OrganizationsV4PagePaginationArray; export import OrganizationListParams = OrganizationsAPI.OrganizationListParams; export import Subscriptions = SubscriptionsAPI.Subscriptions; + export import RatePlan = SubscriptionsAPI.RatePlan; + export import Subscription = SubscriptionsAPI.Subscription; + export import SubscriptionComponent = SubscriptionsAPI.SubscriptionComponent; + export import SubscriptionZone = SubscriptionsAPI.SubscriptionZone; export import SubscriptionUpdateResponse = SubscriptionsAPI.SubscriptionUpdateResponse; export import SubscriptionDeleteResponse = SubscriptionsAPI.SubscriptionDeleteResponse; export import SubscriptionGetResponse = SubscriptionsAPI.SubscriptionGetResponse; diff --git a/src/resources/zero-trust/access/access.ts b/src/resources/zero-trust/access/access.ts index e68b8de84a..367cc75495 100644 --- a/src/resources/zero-trust/access/access.ts +++ b/src/resources/zero-trust/access/access.ts @@ -11,12 +11,10 @@ import * as ServiceTokensAPI from './service-tokens'; import * as TagsAPI from './tags'; import * as ApplicationsAPI from './applications/applications'; import * as CertificatesAPI from './certificates/certificates'; -import * as InfrastructureAPI from './infrastructure/infrastructure'; import * as LogsAPI from './logs/logs'; import * as UsersAPI from './users/users'; export class Access extends APIResource { - infrastructure: InfrastructureAPI.Infrastructure = new InfrastructureAPI.Infrastructure(this._client); applications: ApplicationsAPI.Applications = new ApplicationsAPI.Applications(this._client); certificates: CertificatesAPI.Certificates = new CertificatesAPI.Certificates(this._client); groups: GroupsAPI.Groups = new GroupsAPI.Groups(this._client); @@ -741,7 +739,6 @@ export namespace Access { export import OktaGroupRule = AccessAPI.OktaGroupRule; export import SAMLGroupRule = AccessAPI.SAMLGroupRule; export import ServiceTokenRule = AccessAPI.ServiceTokenRule; - export import Infrastructure = InfrastructureAPI.Infrastructure; export import Applications = ApplicationsAPI.Applications; export import AllowedHeaders = ApplicationsAPI.AllowedHeaders; export import AllowedIdPs = ApplicationsAPI.AllowedIdPs; diff --git a/src/resources/zero-trust/access/index.ts b/src/resources/zero-trust/access/index.ts index 185aa0faa7..d1ceb9e7c3 100644 --- a/src/resources/zero-trust/access/index.ts +++ b/src/resources/zero-trust/access/index.ts @@ -97,7 +97,6 @@ export { CustomPageWithoutHTMLsSinglePage, CustomPages, } from './custom-pages'; -export { Infrastructure } from './infrastructure/index'; export { KeyUpdateResponse, KeyGetResponse, diff --git a/src/resources/zero-trust/access/infrastructure/index.ts b/src/resources/zero-trust/access/infrastructure/index.ts deleted file mode 100644 index b6d331aa91..0000000000 --- a/src/resources/zero-trust/access/infrastructure/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -export { Infrastructure } from './infrastructure'; -export { - TargetCreateResponse, - TargetUpdateResponse, - TargetListResponse, - TargetGetResponse, - TargetCreateParams, - TargetUpdateParams, - TargetListParams, - TargetDeleteParams, - TargetGetParams, - TargetListResponsesV4PagePaginationArray, - Targets, -} from './targets'; diff --git a/src/resources/zero-trust/access/infrastructure/infrastructure.ts b/src/resources/zero-trust/access/infrastructure/infrastructure.ts deleted file mode 100644 index 84014ef335..0000000000 --- a/src/resources/zero-trust/access/infrastructure/infrastructure.ts +++ /dev/null @@ -1,22 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../../resource'; -import * as TargetsAPI from './targets'; - -export class Infrastructure extends APIResource { - targets: TargetsAPI.Targets = new TargetsAPI.Targets(this._client); -} - -export namespace Infrastructure { - export import Targets = TargetsAPI.Targets; - export import TargetCreateResponse = TargetsAPI.TargetCreateResponse; - export import TargetUpdateResponse = TargetsAPI.TargetUpdateResponse; - export import TargetListResponse = TargetsAPI.TargetListResponse; - export import TargetGetResponse = TargetsAPI.TargetGetResponse; - export import TargetListResponsesV4PagePaginationArray = TargetsAPI.TargetListResponsesV4PagePaginationArray; - export import TargetCreateParams = TargetsAPI.TargetCreateParams; - export import TargetUpdateParams = TargetsAPI.TargetUpdateParams; - export import TargetListParams = TargetsAPI.TargetListParams; - export import TargetDeleteParams = TargetsAPI.TargetDeleteParams; - export import TargetGetParams = TargetsAPI.TargetGetParams; -} diff --git a/src/resources/zero-trust/access/infrastructure/targets.ts b/src/resources/zero-trust/access/infrastructure/targets.ts deleted file mode 100644 index 06dbaef5d3..0000000000 --- a/src/resources/zero-trust/access/infrastructure/targets.ts +++ /dev/null @@ -1,594 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../../../resource'; -import * as Core from '../../../../core'; -import * as TargetsAPI from './targets'; -import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../../../pagination'; - -export class Targets extends APIResource { - /** - * Create new target - */ - create(params: TargetCreateParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.post(`/accounts/${account_id}/infrastructure/targets`, { - body, - ...options, - }) as Core.APIPromise<{ result: TargetCreateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * Update target - */ - update( - targetId: string, - params: TargetUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id, ...body } = params; - return ( - this._client.put(`/accounts/${account_id}/infrastructure/targets/${targetId}`, { - body, - ...options, - }) as Core.APIPromise<{ result: TargetUpdateResponse }> - )._thenUnwrap((obj) => obj.result); - } - - /** - * List all targets - */ - list( - params: TargetListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { - const { account_id, ...query } = params; - return this._client.getAPIList( - `/accounts/${account_id}/infrastructure/targets`, - TargetListResponsesV4PagePaginationArray, - { query, ...options }, - ); - } - - /** - * Delete target - */ - delete(targetId: string, params: TargetDeleteParams, options?: Core.RequestOptions): Core.APIPromise { - const { account_id } = params; - return this._client.delete(`/accounts/${account_id}/infrastructure/targets/${targetId}`, { - ...options, - headers: { Accept: '*/*', ...options?.headers }, - }); - } - - /** - * Get target - */ - get( - targetId: string, - params: TargetGetParams, - options?: Core.RequestOptions, - ): Core.APIPromise { - const { account_id } = params; - return ( - this._client.get( - `/accounts/${account_id}/infrastructure/targets/${targetId}`, - options, - ) as Core.APIPromise<{ result: TargetGetResponse }> - )._thenUnwrap((obj) => obj.result); - } -} - -export class TargetListResponsesV4PagePaginationArray extends V4PagePaginationArray {} - -export interface TargetCreateResponse { - /** - * Target identifier - */ - id: string; - - /** - * Date and time at which the target was created - */ - created_at: string; - - /** - * A non-unique field that refers to a target - */ - hostname: string; - - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - ip: TargetCreateResponse.IP; - - /** - * Date and time at which the target was modified - */ - modified_at: string; -} - -export namespace TargetCreateResponse { - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - export interface IP { - /** - * The target's IPv4 address - */ - ipv4?: IP.IPV4; - - /** - * The target's IPv6 address - */ - ipv6?: IP.IPV6; - } - - export namespace IP { - /** - * The target's IPv4 address - */ - export interface IPV4 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - - /** - * The target's IPv6 address - */ - export interface IPV6 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - } -} - -export interface TargetUpdateResponse { - /** - * Target identifier - */ - id: string; - - /** - * Date and time at which the target was created - */ - created_at: string; - - /** - * A non-unique field that refers to a target - */ - hostname: string; - - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - ip: TargetUpdateResponse.IP; - - /** - * Date and time at which the target was modified - */ - modified_at: string; -} - -export namespace TargetUpdateResponse { - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - export interface IP { - /** - * The target's IPv4 address - */ - ipv4?: IP.IPV4; - - /** - * The target's IPv6 address - */ - ipv6?: IP.IPV6; - } - - export namespace IP { - /** - * The target's IPv4 address - */ - export interface IPV4 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - - /** - * The target's IPv6 address - */ - export interface IPV6 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - } -} - -export interface TargetListResponse { - /** - * Target identifier - */ - id: string; - - /** - * Date and time at which the target was created - */ - created_at: string; - - /** - * A non-unique field that refers to a target - */ - hostname: string; - - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - ip: TargetListResponse.IP; - - /** - * Date and time at which the target was modified - */ - modified_at: string; -} - -export namespace TargetListResponse { - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - export interface IP { - /** - * The target's IPv4 address - */ - ipv4?: IP.IPV4; - - /** - * The target's IPv6 address - */ - ipv6?: IP.IPV6; - } - - export namespace IP { - /** - * The target's IPv4 address - */ - export interface IPV4 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - - /** - * The target's IPv6 address - */ - export interface IPV6 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - } -} - -export interface TargetGetResponse { - /** - * Target identifier - */ - id: string; - - /** - * Date and time at which the target was created - */ - created_at: string; - - /** - * A non-unique field that refers to a target - */ - hostname: string; - - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - ip: TargetGetResponse.IP; - - /** - * Date and time at which the target was modified - */ - modified_at: string; -} - -export namespace TargetGetResponse { - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - export interface IP { - /** - * The target's IPv4 address - */ - ipv4?: IP.IPV4; - - /** - * The target's IPv6 address - */ - ipv6?: IP.IPV6; - } - - export namespace IP { - /** - * The target's IPv4 address - */ - export interface IPV4 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - - /** - * The target's IPv6 address - */ - export interface IPV6 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - } -} - -export interface TargetCreateParams { - /** - * Path param: Account identifier - */ - account_id: string; - - /** - * Body param: A non-unique field that refers to a target. Case insensitive, - * maximum length of 255 characters, supports the use of special characters dash - * and period, does not support spaces, and must start and end with an alphanumeric - * character. - */ - hostname: string; - - /** - * Body param: The IPv4/IPv6 address that identifies where to reach a target - */ - ip: TargetCreateParams.IP; -} - -export namespace TargetCreateParams { - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - export interface IP { - /** - * The target's IPv4 address - */ - ipv4?: IP.IPV4; - - /** - * The target's IPv6 address - */ - ipv6?: IP.IPV6; - } - - export namespace IP { - /** - * The target's IPv4 address - */ - export interface IPV4 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - - /** - * The target's IPv6 address - */ - export interface IPV6 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - } -} - -export interface TargetUpdateParams { - /** - * Path param: Account identifier - */ - account_id: string; - - /** - * Body param: A non-unique field that refers to a target. Case insensitive, - * maximum length of 255 characters, supports the use of special characters dash - * and period, does not support spaces, and must start and end with an alphanumeric - * character. - */ - hostname: string; - - /** - * Body param: The IPv4/IPv6 address that identifies where to reach a target - */ - ip: TargetUpdateParams.IP; -} - -export namespace TargetUpdateParams { - /** - * The IPv4/IPv6 address that identifies where to reach a target - */ - export interface IP { - /** - * The target's IPv4 address - */ - ipv4?: IP.IPV4; - - /** - * The target's IPv6 address - */ - ipv6?: IP.IPV6; - } - - export namespace IP { - /** - * The target's IPv4 address - */ - export interface IPV4 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - - /** - * The target's IPv6 address - */ - export interface IPV6 { - /** - * IP address of the target - */ - ip_addr?: string; - - /** - * Private virtual network identifier for the target - */ - virtual_network_id?: string; - } - } -} - -export interface TargetListParams extends V4PagePaginationArrayParams { - /** - * Path param: Account identifier - */ - account_id: string; - - /** - * Query param: Date and time at which the target was created - */ - created_after?: string | null; - - /** - * Query param: Hostname of a target - */ - hostname?: string | null; - - /** - * Query param: Partial match to the hostname of a target - */ - hostname_contains?: string | null; - - /** - * Query param: IPv4 address of the target - */ - ip_v4?: string | null; - - /** - * Query param: IPv6 address of the target - */ - ip_v6?: string | null; - - /** - * Query param: Date and time at which the target was modified - */ - modified_after?: string | null; - - /** - * Query param: Private virtual network identifier of the target - */ - virtual_network_id?: string | null; -} - -export interface TargetDeleteParams { - /** - * Account identifier - */ - account_id: string; -} - -export interface TargetGetParams { - /** - * Account identifier - */ - account_id: string; -} - -export namespace Targets { - export import TargetCreateResponse = TargetsAPI.TargetCreateResponse; - export import TargetUpdateResponse = TargetsAPI.TargetUpdateResponse; - export import TargetListResponse = TargetsAPI.TargetListResponse; - export import TargetGetResponse = TargetsAPI.TargetGetResponse; - export import TargetListResponsesV4PagePaginationArray = TargetsAPI.TargetListResponsesV4PagePaginationArray; - export import TargetCreateParams = TargetsAPI.TargetCreateParams; - export import TargetUpdateParams = TargetsAPI.TargetUpdateParams; - export import TargetListParams = TargetsAPI.TargetListParams; - export import TargetDeleteParams = TargetsAPI.TargetDeleteParams; - export import TargetGetParams = TargetsAPI.TargetGetParams; -} diff --git a/src/resources/zero-trust/dex/dex.ts b/src/resources/zero-trust/dex/dex.ts index 1b7731a2fb..ad5751c681 100644 --- a/src/resources/zero-trust/dex/dex.ts +++ b/src/resources/zero-trust/dex/dex.ts @@ -19,7 +19,7 @@ export class DEX extends APIResource { tracerouteTests: TracerouteTestsAPI.TracerouteTests = new TracerouteTestsAPI.TracerouteTests(this._client); } -export interface DigitalExperienceMonitor { +export interface DeviceExperienceMonitor { id: string; /** @@ -131,7 +131,7 @@ export interface Percentiles { } export namespace DEX { - export import DigitalExperienceMonitor = DEXAPI.DigitalExperienceMonitor; + export import DeviceExperienceMonitor = DEXAPI.DeviceExperienceMonitor; export import NetworkPath = DEXAPI.NetworkPath; export import NetworkPathResponse = DEXAPI.NetworkPathResponse; export import Percentiles = DEXAPI.Percentiles; @@ -149,9 +149,6 @@ export namespace DEX { export import HTTPTestGetParams = HTTPTestsAPI.HTTPTestGetParams; export import Tests = TestsAPI.Tests; export import AggregateTimePeriod = TestsAPI.AggregateTimePeriod; - export import TestListResponse = TestsAPI.TestListResponse; - export import TestListResponsesV4PagePagination = TestsAPI.TestListResponsesV4PagePagination; - export import TestListParams = TestsAPI.TestListParams; export import TracerouteTestResults = TracerouteTestResultsAPI.TracerouteTestResults; export import TracerouteTests = TracerouteTestsAPI.TracerouteTests; export import Traceroute = TracerouteTestsAPI.Traceroute; diff --git a/src/resources/zero-trust/dex/http-tests/http-tests.ts b/src/resources/zero-trust/dex/http-tests/http-tests.ts index 8a96a86e8a..2c2dde9c70 100644 --- a/src/resources/zero-trust/dex/http-tests/http-tests.ts +++ b/src/resources/zero-trust/dex/http-tests/http-tests.ts @@ -55,7 +55,7 @@ export interface HTTPDetails { */ name?: string; - target_policies?: Array | null; + target_policies?: Array | null; targeted?: boolean; } diff --git a/src/resources/zero-trust/dex/index.ts b/src/resources/zero-trust/dex/index.ts index 0801345bdc..47a465a526 100644 --- a/src/resources/zero-trust/dex/index.ts +++ b/src/resources/zero-trust/dex/index.ts @@ -1,14 +1,8 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - AggregateTimePeriod, - Tests, - TestListResponse, - TestListParams, - TestListResponsesV4PagePagination, -} from './tests/index'; +export { AggregateTimePeriod, Tests } from './tests/index'; export { ColoListResponse, ColoListParams, ColoListResponsesSinglePage, Colos } from './colos'; -export { DigitalExperienceMonitor, NetworkPath, NetworkPathResponse, Percentiles, DEX } from './dex'; +export { DeviceExperienceMonitor, NetworkPath, NetworkPathResponse, Percentiles, DEX } from './dex'; export { HTTPDetails, HTTPTestGetParams, HTTPTests } from './http-tests/index'; export { LiveStat, diff --git a/src/resources/zero-trust/dex/tests/index.ts b/src/resources/zero-trust/dex/tests/index.ts index f211a5683b..e0031d5365 100644 --- a/src/resources/zero-trust/dex/tests/index.ts +++ b/src/resources/zero-trust/dex/tests/index.ts @@ -1,10 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { - AggregateTimePeriod, - Tests, - TestListResponse, - TestListParams, - TestListResponsesV4PagePagination, -} from './tests'; +export { AggregateTimePeriod, Tests } from './tests'; export { UniqueDevices, UniqueDeviceListParams } from './unique-devices'; diff --git a/src/resources/zero-trust/dex/tests/tests.ts b/src/resources/zero-trust/dex/tests/tests.ts index 6f9cc902de..a835fc7a39 100644 --- a/src/resources/zero-trust/dex/tests/tests.ts +++ b/src/resources/zero-trust/dex/tests/tests.ts @@ -1,34 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../../../resource'; -import * as Core from '../../../../core'; import * as TestsAPI from './tests'; -import * as Shared from '../../../shared'; import * as DEXAPI from '../dex'; import * as UniqueDevicesAPI from './unique-devices'; -import { V4PagePagination, type V4PagePaginationParams } from '../../../../pagination'; export class Tests extends APIResource { uniqueDevices: UniqueDevicesAPI.UniqueDevices = new UniqueDevicesAPI.UniqueDevices(this._client); - - /** - * List DEX tests with overview metrics - */ - list( - params: TestListParams, - options?: Core.RequestOptions, - ): Core.PagePromise { - const { account_id, ...query } = params; - return this._client.getAPIList( - `/accounts/${account_id}/dex/tests/overview`, - TestListResponsesV4PagePagination, - { query, ...options }, - ); - } } -export class TestListResponsesV4PagePagination extends V4PagePagination {} - export interface AggregateTimePeriod { units: 'hours' | 'days' | 'testRuns'; @@ -112,7 +92,7 @@ export namespace Tests { */ method?: string; - target_policies?: Array | null; + target_policies?: Array | null; targeted?: boolean; @@ -286,75 +266,9 @@ export namespace Tests { } } -export interface TestListResponse { - errors: Array; - - messages: Array; - - /** - * Whether the API call was successful - */ - success: true; - - result?: Tests; - - result_info?: TestListResponse.ResultInfo; -} - -export namespace TestListResponse { - export interface ResultInfo { - /** - * Total number of results for the requested service - */ - count?: number; - - /** - * Current page within paginated list of results - */ - page?: number; - - /** - * Number of results per page of results - */ - per_page?: number; - - /** - * Total results available without any search parameters - */ - total_count?: number; - } -} - -export interface TestListParams extends V4PagePaginationParams { - /** - * Path param: unique identifier linked to an account in the API request path. - */ - account_id: string; - - /** - * Query param: Optionally filter result stats to a Cloudflare colo. Cannot be used - * in combination with deviceId param. - */ - colo?: string; - - /** - * Query param: Optionally filter result stats to a specific device(s). Cannot be - * used in combination with colo param. - */ - deviceId?: Array; - - /** - * Query param: Optionally filter results by test name - */ - testName?: string; -} - export namespace Tests { export import AggregateTimePeriod = TestsAPI.AggregateTimePeriod; export import Tests = TestsAPI.Tests; - export import TestListResponse = TestsAPI.TestListResponse; - export import TestListResponsesV4PagePagination = TestsAPI.TestListResponsesV4PagePagination; - export import TestListParams = TestsAPI.TestListParams; export import UniqueDevices = UniqueDevicesAPI.UniqueDevices; export import UniqueDeviceListParams = UniqueDevicesAPI.UniqueDeviceListParams; } diff --git a/src/resources/zero-trust/dex/traceroute-tests.ts b/src/resources/zero-trust/dex/traceroute-tests.ts index a7c88864a1..d6c9520402 100644 --- a/src/resources/zero-trust/dex/traceroute-tests.ts +++ b/src/resources/zero-trust/dex/traceroute-tests.ts @@ -79,7 +79,7 @@ export interface Traceroute { */ name: string; - target_policies?: Array | null; + target_policies?: Array | null; targeted?: boolean; diff --git a/src/resources/zero-trust/index.ts b/src/resources/zero-trust/index.ts index d14f129b78..c0aab263d0 100644 --- a/src/resources/zero-trust/index.ts +++ b/src/resources/zero-trust/index.ts @@ -70,7 +70,7 @@ export { DevicesSinglePage, Devices, } from './devices/index'; -export { DigitalExperienceMonitor, NetworkPath, NetworkPathResponse, Percentiles, DEX } from './dex/index'; +export { DeviceExperienceMonitor, NetworkPath, NetworkPathResponse, Percentiles, DEX } from './dex/index'; export { GatewayCreateResponse, GatewayListResponse, diff --git a/src/resources/zero-trust/zero-trust.ts b/src/resources/zero-trust/zero-trust.ts index f8c361a027..85d9780a94 100644 --- a/src/resources/zero-trust/zero-trust.ts +++ b/src/resources/zero-trust/zero-trust.ts @@ -87,7 +87,7 @@ export namespace ZeroTrust { export import SAMLGroupRule = AccessAPI.SAMLGroupRule; export import ServiceTokenRule = AccessAPI.ServiceTokenRule; export import DEX = DEXAPI.DEX; - export import DigitalExperienceMonitor = DEXAPI.DigitalExperienceMonitor; + export import DeviceExperienceMonitor = DEXAPI.DeviceExperienceMonitor; export import NetworkPath = DEXAPI.NetworkPath; export import NetworkPathResponse = DEXAPI.NetworkPathResponse; export import Percentiles = DEXAPI.Percentiles; diff --git a/src/resources/zones/index.ts b/src/resources/zones/index.ts index 00d9e40acf..c46113ef2a 100644 --- a/src/resources/zones/index.ts +++ b/src/resources/zones/index.ts @@ -61,13 +61,6 @@ export { SettingGetParams, Settings, } from './settings'; -export { - AvailableRatePlan, - PlanListParams, - PlanGetParams, - AvailableRatePlansSinglePage, - Plans, -} from './plans'; export { CustomNameserverUpdateResponse, CustomNameserverGetResponse, @@ -75,7 +68,6 @@ export { CustomNameserverGetParams, CustomNameservers, } from './custom-nameservers'; -export { RatePlanGetResponse, RatePlanGetParams, RatePlans } from './rate-plans'; export { SubscriptionCreateResponse, SubscriptionUpdateResponse, diff --git a/src/resources/zones/rate-plans.ts b/src/resources/zones/rate-plans.ts deleted file mode 100644 index 4e29d1f974..0000000000 --- a/src/resources/zones/rate-plans.ts +++ /dev/null @@ -1,86 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -import { APIResource } from '../../resource'; -import * as Core from '../../core'; -import * as RatePlansAPI from './rate-plans'; - -export class RatePlans extends APIResource { - /** - * Lists all rate plans the zone can subscribe to. - */ - get(params: RatePlanGetParams, options?: Core.RequestOptions): Core.APIPromise { - const { zone_id } = params; - return ( - this._client.get(`/zones/${zone_id}/available_rate_plans`, options) as Core.APIPromise<{ - result: RatePlanGetResponse | null; - }> - )._thenUnwrap((obj) => obj.result); - } -} - -export type RatePlanGetResponse = Array; - -export namespace RatePlanGetResponse { - export interface RatePlanGetResponseItem { - /** - * Plan identifier tag. - */ - id?: string; - - /** - * Array of available components values for the plan. - */ - components?: Array; - - /** - * The monetary unit in which pricing information is displayed. - */ - currency?: string; - - /** - * The duration of the plan subscription. - */ - duration?: number; - - /** - * The frequency at which you will be billed for this plan. - */ - frequency?: 'weekly' | 'monthly' | 'quarterly' | 'yearly'; - - /** - * The plan name. - */ - name?: string; - } - - export namespace RatePlanGetResponseItem { - export interface Component { - /** - * The default amount allocated. - */ - default?: number; - - /** - * The unique component. - */ - name?: 'zones' | 'page_rules' | 'dedicated_certificates' | 'dedicated_certificates_custom'; - - /** - * The unit price of the addon. - */ - unit_price?: number; - } - } -} - -export interface RatePlanGetParams { - /** - * Identifier - */ - zone_id: string; -} - -export namespace RatePlans { - export import RatePlanGetResponse = RatePlansAPI.RatePlanGetResponse; - export import RatePlanGetParams = RatePlansAPI.RatePlanGetParams; -} diff --git a/src/resources/zones/subscriptions.ts b/src/resources/zones/subscriptions.ts index 10926a040d..a60ec06ccb 100644 --- a/src/resources/zones/subscriptions.ts +++ b/src/resources/zones/subscriptions.ts @@ -2,8 +2,8 @@ import { APIResource } from '../../resource'; import * as Core from '../../core'; -import * as SubscriptionsAPI from './subscriptions'; -import * as Shared from '../shared'; +import * as ZonesSubscriptionsAPI from './subscriptions'; +import * as SubscriptionsAPI from '../user/subscriptions'; export class Subscriptions extends APIResource { /** @@ -63,7 +63,7 @@ export interface SubscriptionCreateParams { /** * The rate plan applied to the subscription. */ - rate_plan?: Shared.RatePlanParam; + rate_plan?: SubscriptionsAPI.RatePlanParam; } export interface SubscriptionUpdateParams { @@ -75,13 +75,13 @@ export interface SubscriptionUpdateParams { /** * The rate plan applied to the subscription. */ - rate_plan?: Shared.RatePlanParam; + rate_plan?: SubscriptionsAPI.RatePlanParam; } export namespace Subscriptions { - export import SubscriptionCreateResponse = SubscriptionsAPI.SubscriptionCreateResponse; - export import SubscriptionUpdateResponse = SubscriptionsAPI.SubscriptionUpdateResponse; - export import SubscriptionGetResponse = SubscriptionsAPI.SubscriptionGetResponse; - export import SubscriptionCreateParams = SubscriptionsAPI.SubscriptionCreateParams; - export import SubscriptionUpdateParams = SubscriptionsAPI.SubscriptionUpdateParams; + export import SubscriptionCreateResponse = ZonesSubscriptionsAPI.SubscriptionCreateResponse; + export import SubscriptionUpdateResponse = ZonesSubscriptionsAPI.SubscriptionUpdateResponse; + export import SubscriptionGetResponse = ZonesSubscriptionsAPI.SubscriptionGetResponse; + export import SubscriptionCreateParams = ZonesSubscriptionsAPI.SubscriptionCreateParams; + export import SubscriptionUpdateParams = ZonesSubscriptionsAPI.SubscriptionUpdateParams; } diff --git a/src/resources/zones/zones.ts b/src/resources/zones/zones.ts index e9d5514bb4..fc18fa69aa 100644 --- a/src/resources/zones/zones.ts +++ b/src/resources/zones/zones.ts @@ -6,8 +6,6 @@ import * as Core from '../../core'; import * as ActivationCheckAPI from './activation-check'; import * as CustomNameserversAPI from './custom-nameservers'; import * as HoldsAPI from './holds'; -import * as PlansAPI from './plans'; -import * as RatePlansAPI from './rate-plans'; import * as SettingsAPI from './settings'; import * as SubscriptionsAPI from './subscriptions'; import { V4PagePaginationArray, type V4PagePaginationArrayParams } from '../../pagination'; @@ -20,8 +18,6 @@ export class Zones extends APIResource { ); holds: HoldsAPI.Holds = new HoldsAPI.Holds(this._client); subscriptions: SubscriptionsAPI.Subscriptions = new SubscriptionsAPI.Subscriptions(this._client); - plans: PlansAPI.Plans = new PlansAPI.Plans(this._client); - ratePlans: RatePlansAPI.RatePlans = new RatePlansAPI.RatePlans(this._client); /** * Create Zone @@ -470,12 +466,4 @@ export namespace Zones { export import SubscriptionGetResponse = SubscriptionsAPI.SubscriptionGetResponse; export import SubscriptionCreateParams = SubscriptionsAPI.SubscriptionCreateParams; export import SubscriptionUpdateParams = SubscriptionsAPI.SubscriptionUpdateParams; - export import Plans = PlansAPI.Plans; - export import AvailableRatePlan = PlansAPI.AvailableRatePlan; - export import AvailableRatePlansSinglePage = PlansAPI.AvailableRatePlansSinglePage; - export import PlanListParams = PlansAPI.PlanListParams; - export import PlanGetParams = PlansAPI.PlanGetParams; - export import RatePlans = RatePlansAPI.RatePlans; - export import RatePlanGetResponse = RatePlansAPI.RatePlanGetResponse; - export import RatePlanGetParams = RatePlansAPI.RatePlanGetParams; } diff --git a/tests/api-resources/accounts/subscriptions.test.ts b/tests/api-resources/accounts/subscriptions.test.ts deleted file mode 100644 index 3b2923ffb1..0000000000 --- a/tests/api-resources/accounts/subscriptions.test.ts +++ /dev/null @@ -1,108 +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 subscriptions', () => { - test('create: only required params', async () => { - const responsePromise = client.accounts.subscriptions.create({ - 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.accounts.subscriptions.create({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - frequency: 'weekly', - rate_plan: { - id: 'free', - currency: 'USD', - externally_managed: false, - is_contract: false, - public_name: 'Business Plan', - scope: 'zone', - sets: ['string', 'string', 'string'], - }, - }); - }); - - test('update: only required params', async () => { - const responsePromise = client.accounts.subscriptions.update('506e3185e9c882d175a2d0cb0093d9f2', { - 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('update: required and optional params', async () => { - const response = await client.accounts.subscriptions.update('506e3185e9c882d175a2d0cb0093d9f2', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - frequency: 'weekly', - rate_plan: { - id: 'free', - currency: 'USD', - externally_managed: false, - is_contract: false, - public_name: 'Business Plan', - scope: 'zone', - sets: ['string', 'string', 'string'], - }, - }); - }); - - test('delete: only required params', async () => { - const responsePromise = client.accounts.subscriptions.delete('506e3185e9c882d175a2d0cb0093d9f2', { - 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.accounts.subscriptions.delete('506e3185e9c882d175a2d0cb0093d9f2', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - }); - - test('get: only required params', async () => { - const responsePromise = client.accounts.subscriptions.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.accounts.subscriptions.get({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - }); -}); diff --git a/tests/api-resources/ai-gateway/logs.test.ts b/tests/api-resources/ai-gateway/logs.test.ts index c68080d37e..fb32eb6dad 100644 --- a/tests/api-resources/ai-gateway/logs.test.ts +++ b/tests/api-resources/ai-gateway/logs.test.ts @@ -29,7 +29,7 @@ describe('resource logs', () => { cached: true, direction: 'asc', end_date: '2019-12-27T18:11:19.117Z', - feedback: 0, + feedback: -1, max_cost: 0, max_duration: 0, max_tokens_in: 0, diff --git a/tests/api-resources/turnstile/widgets.test.ts b/tests/api-resources/challenges/widgets.test.ts similarity index 84% rename from tests/api-resources/turnstile/widgets.test.ts rename to tests/api-resources/challenges/widgets.test.ts index 33ffa6fd89..dfc7d26ee0 100644 --- a/tests/api-resources/turnstile/widgets.test.ts +++ b/tests/api-resources/challenges/widgets.test.ts @@ -11,7 +11,7 @@ const client = new Cloudflare({ describe('resource widgets', () => { test('create: only required params', async () => { - const responsePromise = client.turnstile.widgets.create({ + const responsePromise = client.challenges.widgets.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', domains: ['203.0.113.1', 'cloudflare.com', 'blog.example.com'], mode: 'non-interactive', @@ -27,7 +27,7 @@ describe('resource widgets', () => { }); test('create: required and optional params', async () => { - const response = await client.turnstile.widgets.create({ + const response = await client.challenges.widgets.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', domains: ['203.0.113.1', 'cloudflare.com', 'blog.example.com'], mode: 'non-interactive', @@ -44,7 +44,7 @@ describe('resource widgets', () => { }); test('update: only required params', async () => { - const responsePromise = client.turnstile.widgets.update('0x4AAF00AAAABn0R22HWm-YUc', { + const responsePromise = client.challenges.widgets.update('0x4AAF00AAAABn0R22HWm-YUc', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', domains: ['203.0.113.1', 'cloudflare.com', 'blog.example.com'], mode: 'non-interactive', @@ -60,7 +60,7 @@ describe('resource widgets', () => { }); test('update: required and optional params', async () => { - const response = await client.turnstile.widgets.update('0x4AAF00AAAABn0R22HWm-YUc', { + const response = await client.challenges.widgets.update('0x4AAF00AAAABn0R22HWm-YUc', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', domains: ['203.0.113.1', 'cloudflare.com', 'blog.example.com'], mode: 'non-interactive', @@ -72,7 +72,9 @@ describe('resource widgets', () => { }); test('list: only required params', async () => { - const responsePromise = client.turnstile.widgets.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const responsePromise = client.challenges.widgets.list({ + account_id: '023e105f4ecef8ad9ca31a8372d0c353', + }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -83,7 +85,7 @@ describe('resource widgets', () => { }); test('list: required and optional params', async () => { - const response = await client.turnstile.widgets.list({ + const response = await client.challenges.widgets.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', direction: 'asc', order: 'id', @@ -93,7 +95,7 @@ describe('resource widgets', () => { }); test('delete: only required params', async () => { - const responsePromise = client.turnstile.widgets.delete('0x4AAF00AAAABn0R22HWm-YUc', { + const responsePromise = client.challenges.widgets.delete('0x4AAF00AAAABn0R22HWm-YUc', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); const rawResponse = await responsePromise.asResponse(); @@ -106,13 +108,13 @@ describe('resource widgets', () => { }); test('delete: required and optional params', async () => { - const response = await client.turnstile.widgets.delete('0x4AAF00AAAABn0R22HWm-YUc', { + const response = await client.challenges.widgets.delete('0x4AAF00AAAABn0R22HWm-YUc', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); test('get: only required params', async () => { - const responsePromise = client.turnstile.widgets.get('0x4AAF00AAAABn0R22HWm-YUc', { + const responsePromise = client.challenges.widgets.get('0x4AAF00AAAABn0R22HWm-YUc', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); const rawResponse = await responsePromise.asResponse(); @@ -125,13 +127,13 @@ describe('resource widgets', () => { }); test('get: required and optional params', async () => { - const response = await client.turnstile.widgets.get('0x4AAF00AAAABn0R22HWm-YUc', { + const response = await client.challenges.widgets.get('0x4AAF00AAAABn0R22HWm-YUc', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); test('rotateSecret: only required params', async () => { - const responsePromise = client.turnstile.widgets.rotateSecret('0x4AAF00AAAABn0R22HWm-YUc', { + const responsePromise = client.challenges.widgets.rotateSecret('0x4AAF00AAAABn0R22HWm-YUc', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); const rawResponse = await responsePromise.asResponse(); @@ -144,7 +146,7 @@ describe('resource widgets', () => { }); test('rotateSecret: required and optional params', async () => { - const response = await client.turnstile.widgets.rotateSecret('0x4AAF00AAAABn0R22HWm-YUc', { + const response = await client.challenges.widgets.rotateSecret('0x4AAF00AAAABn0R22HWm-YUc', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', invalidate_immediately: true, }); diff --git a/tests/api-resources/cloudforce-one/requests/assets.test.ts b/tests/api-resources/cloudforce-one/requests/assets.test.ts deleted file mode 100644 index 7325e0c7e9..0000000000 --- a/tests/api-resources/cloudforce-one/requests/assets.test.ts +++ /dev/null @@ -1,105 +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 assets', () => { - test('create: only required params', async () => { - const responsePromise = client.cloudforceOne.requests.assets.create( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { page: 0, per_page: 10 }, - ); - 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.cloudforceOne.requests.assets.create( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { page: 0, per_page: 10 }, - ); - }); - - test('update', async () => { - const responsePromise = client.cloudforceOne.requests.assets.update( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - {}, - ); - 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', async () => { - const responsePromise = client.cloudforceOne.requests.assets.delete( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); - 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: 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.cloudforceOne.requests.assets.delete( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('get', async () => { - const responsePromise = client.cloudforceOne.requests.assets.get( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - ); - 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.cloudforceOne.requests.assets.get( - '023e105f4ecef8ad9ca31a8372d0c353', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415', - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); -}); diff --git a/tests/api-resources/dns/firewall/reverse-dns.test.ts b/tests/api-resources/dns/firewall/reverse-dns.test.ts deleted file mode 100644 index 877c14f5f0..0000000000 --- a/tests/api-resources/dns/firewall/reverse-dns.test.ts +++ /dev/null @@ -1,51 +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 reverseDNS', () => { - test('edit: only required params', async () => { - const responsePromise = client.dns.firewall.reverseDNS.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 client.dns.firewall.reverseDNS.edit('023e105f4ecef8ad9ca31a8372d0c353', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - ptr: { foo: 'string' }, - }); - }); - - test('get: only required params', async () => { - const responsePromise = client.dns.firewall.reverseDNS.get('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('get: required and optional params', async () => { - const response = await client.dns.firewall.reverseDNS.get('023e105f4ecef8ad9ca31a8372d0c353', { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); - }); -}); diff --git a/tests/api-resources/r2/event-notifications/configuration/configuration.test.ts b/tests/api-resources/event-notifications/r2/configuration/configuration.test.ts similarity index 89% rename from tests/api-resources/r2/event-notifications/configuration/configuration.test.ts rename to tests/api-resources/event-notifications/r2/configuration/configuration.test.ts index 601820b046..cd8dbc001d 100644 --- a/tests/api-resources/r2/event-notifications/configuration/configuration.test.ts +++ b/tests/api-resources/event-notifications/r2/configuration/configuration.test.ts @@ -11,7 +11,7 @@ const client = new Cloudflare({ describe('resource configuration', () => { test('get: only required params', async () => { - const responsePromise = client.r2.eventNotifications.configuration.get('example-bucket', { + const responsePromise = client.eventNotifications.r2.configuration.get('example-bucket', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); const rawResponse = await responsePromise.asResponse(); @@ -24,7 +24,7 @@ describe('resource configuration', () => { }); test('get: required and optional params', async () => { - const response = await client.r2.eventNotifications.configuration.get('example-bucket', { + const response = await client.eventNotifications.r2.configuration.get('example-bucket', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); diff --git a/tests/api-resources/r2/event-notifications/configuration/queues.test.ts b/tests/api-resources/event-notifications/r2/configuration/queues.test.ts similarity index 89% rename from tests/api-resources/r2/event-notifications/configuration/queues.test.ts rename to tests/api-resources/event-notifications/r2/configuration/queues.test.ts index 5da1828558..150f3db811 100644 --- a/tests/api-resources/r2/event-notifications/configuration/queues.test.ts +++ b/tests/api-resources/event-notifications/r2/configuration/queues.test.ts @@ -11,7 +11,7 @@ const client = new Cloudflare({ describe('resource queues', () => { test('update: only required params', async () => { - const responsePromise = client.r2.eventNotifications.configuration.queues.update( + const responsePromise = client.eventNotifications.r2.configuration.queues.update( 'example-bucket', 'queue_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, @@ -26,7 +26,7 @@ describe('resource queues', () => { }); test('update: required and optional params', async () => { - const response = await client.r2.eventNotifications.configuration.queues.update( + const response = await client.eventNotifications.r2.configuration.queues.update( 'example-bucket', 'queue_id', { @@ -41,7 +41,7 @@ describe('resource queues', () => { }); test('delete: only required params', async () => { - const responsePromise = client.r2.eventNotifications.configuration.queues.delete( + const responsePromise = client.eventNotifications.r2.configuration.queues.delete( 'example-bucket', 'queue_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, @@ -56,7 +56,7 @@ describe('resource queues', () => { }); test('delete: required and optional params', async () => { - const response = await client.r2.eventNotifications.configuration.queues.delete( + const response = await client.eventNotifications.r2.configuration.queues.delete( 'example-bucket', 'queue_id', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, diff --git a/tests/api-resources/managed-transforms.test.ts b/tests/api-resources/managed-headers.test.ts similarity index 83% rename from tests/api-resources/managed-transforms.test.ts rename to tests/api-resources/managed-headers.test.ts index 0918aa173a..ab6d7f92ca 100644 --- a/tests/api-resources/managed-transforms.test.ts +++ b/tests/api-resources/managed-headers.test.ts @@ -9,9 +9,9 @@ const client = new Cloudflare({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010', }); -describe('resource managedTransforms', () => { +describe('resource managedHeaders', () => { test('list: only required params', async () => { - const responsePromise = client.managedTransforms.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const responsePromise = client.managedHeaders.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -22,11 +22,11 @@ describe('resource managedTransforms', () => { }); test('list: required and optional params', async () => { - const response = await client.managedTransforms.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const response = await client.managedHeaders.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); }); test('edit: only required params', async () => { - const responsePromise = client.managedTransforms.edit({ + const responsePromise = client.managedHeaders.edit({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', managed_request_headers: [{}, {}, {}], managed_response_headers: [{}, {}, {}], @@ -41,7 +41,7 @@ describe('resource managedTransforms', () => { }); test('edit: required and optional params', async () => { - const response = await client.managedTransforms.edit({ + const response = await client.managedHeaders.edit({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353', managed_request_headers: [ { id: 'add_cf-bot-score_header', enabled: true }, diff --git a/tests/api-resources/magic-transit/pcaps/download.test.ts b/tests/api-resources/pcaps/download.test.ts similarity index 83% rename from tests/api-resources/magic-transit/pcaps/download.test.ts rename to tests/api-resources/pcaps/download.test.ts index d72f3d7922..b71ffbe922 100644 --- a/tests/api-resources/magic-transit/pcaps/download.test.ts +++ b/tests/api-resources/pcaps/download.test.ts @@ -11,7 +11,7 @@ const client = new Cloudflare({ describe('resource download', () => { // TODO: investigate broken test test.skip('get: required and optional params', async () => { - const response = await client.magicTransit.pcaps.download.get('023e105f4ecef8ad9ca31a8372d0c353', { + const response = await client.pcaps.download.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); diff --git a/tests/api-resources/magic-transit/pcaps/ownership.test.ts b/tests/api-resources/pcaps/ownership.test.ts similarity index 80% rename from tests/api-resources/magic-transit/pcaps/ownership.test.ts rename to tests/api-resources/pcaps/ownership.test.ts index f50d98f7d4..fe74f8249f 100644 --- a/tests/api-resources/magic-transit/pcaps/ownership.test.ts +++ b/tests/api-resources/pcaps/ownership.test.ts @@ -11,7 +11,7 @@ const client = new Cloudflare({ describe('resource ownership', () => { test('create: only required params', async () => { - const responsePromise = client.magicTransit.pcaps.ownership.create({ + const responsePromise = client.pcaps.ownership.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', destination_conf: 's3://pcaps-bucket?region=us-east-1', }); @@ -25,14 +25,14 @@ describe('resource ownership', () => { }); test('create: required and optional params', async () => { - const response = await client.magicTransit.pcaps.ownership.create({ + const response = await client.pcaps.ownership.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', destination_conf: 's3://pcaps-bucket?region=us-east-1', }); }); test('delete: only required params', async () => { - const responsePromise = client.magicTransit.pcaps.ownership.delete('023e105f4ecef8ad9ca31a8372d0c353', { + const responsePromise = client.pcaps.ownership.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); const rawResponse = await responsePromise.asResponse(); @@ -45,15 +45,13 @@ describe('resource ownership', () => { }); test('delete: required and optional params', async () => { - const response = await client.magicTransit.pcaps.ownership.delete('023e105f4ecef8ad9ca31a8372d0c353', { + const response = await client.pcaps.ownership.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); test('get: only required params', async () => { - const responsePromise = client.magicTransit.pcaps.ownership.get({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const responsePromise = client.pcaps.ownership.get({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -64,13 +62,11 @@ describe('resource ownership', () => { }); test('get: required and optional params', async () => { - const response = await client.magicTransit.pcaps.ownership.get({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const response = await client.pcaps.ownership.get({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); }); test('validate: only required params', async () => { - const responsePromise = client.magicTransit.pcaps.ownership.validate({ + const responsePromise = client.pcaps.ownership.validate({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', destination_conf: 's3://pcaps-bucket?region=us-east-1', ownership_challenge: 'ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt', @@ -85,7 +81,7 @@ describe('resource ownership', () => { }); test('validate: required and optional params', async () => { - const response = await client.magicTransit.pcaps.ownership.validate({ + const response = await client.pcaps.ownership.validate({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', destination_conf: 's3://pcaps-bucket?region=us-east-1', ownership_challenge: 'ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt', diff --git a/tests/api-resources/magic-transit/pcaps/pcaps.test.ts b/tests/api-resources/pcaps/pcaps.test.ts similarity index 82% rename from tests/api-resources/magic-transit/pcaps/pcaps.test.ts rename to tests/api-resources/pcaps/pcaps.test.ts index 44f152e736..76a69ff876 100644 --- a/tests/api-resources/magic-transit/pcaps/pcaps.test.ts +++ b/tests/api-resources/pcaps/pcaps.test.ts @@ -11,7 +11,7 @@ const client = new Cloudflare({ describe('resource pcaps', () => { test('create: only required params', async () => { - const responsePromise = client.magicTransit.pcaps.create({ + const responsePromise = client.pcaps.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', packet_limit: 10000, system: 'magic-transit', @@ -28,7 +28,7 @@ describe('resource pcaps', () => { }); test('create: required and optional params', async () => { - const response = await client.magicTransit.pcaps.create({ + const response = await client.pcaps.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', packet_limit: 10000, system: 'magic-transit', @@ -45,9 +45,7 @@ describe('resource pcaps', () => { }); test('list: only required params', async () => { - const responsePromise = client.magicTransit.pcaps.list({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - }); + const responsePromise = client.pcaps.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -58,11 +56,11 @@ describe('resource pcaps', () => { }); test('list: required and optional params', async () => { - const response = await client.magicTransit.pcaps.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const response = await client.pcaps.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); }); test('get: only required params', async () => { - const responsePromise = client.magicTransit.pcaps.get('023e105f4ecef8ad9ca31a8372d0c353', { + const responsePromise = client.pcaps.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); const rawResponse = await responsePromise.asResponse(); @@ -75,7 +73,7 @@ describe('resource pcaps', () => { }); test('get: required and optional params', async () => { - const response = await client.magicTransit.pcaps.get('023e105f4ecef8ad9ca31a8372d0c353', { + const response = await client.pcaps.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); diff --git a/tests/api-resources/zones/plans.test.ts b/tests/api-resources/plans.test.ts similarity index 79% rename from tests/api-resources/zones/plans.test.ts rename to tests/api-resources/plans.test.ts index 20d787c64e..37af655740 100644 --- a/tests/api-resources/zones/plans.test.ts +++ b/tests/api-resources/plans.test.ts @@ -11,7 +11,7 @@ const client = new Cloudflare({ describe('resource plans', () => { test('list: only required params', async () => { - const responsePromise = client.zones.plans.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const responsePromise = client.plans.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -22,11 +22,11 @@ describe('resource plans', () => { }); test('list: required and optional params', async () => { - const response = await client.zones.plans.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const response = await client.plans.list({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); }); test('get: only required params', async () => { - const responsePromise = client.zones.plans.get('023e105f4ecef8ad9ca31a8372d0c353', { + const responsePromise = client.plans.get('023e105f4ecef8ad9ca31a8372d0c353', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); const rawResponse = await responsePromise.asResponse(); @@ -39,7 +39,7 @@ describe('resource plans', () => { }); test('get: required and optional params', async () => { - const response = await client.zones.plans.get('023e105f4ecef8ad9ca31a8372d0c353', { + const response = await client.plans.get('023e105f4ecef8ad9ca31a8372d0c353', { zone_id: '023e105f4ecef8ad9ca31a8372d0c353', }); }); diff --git a/tests/api-resources/zones/rate-plans.test.ts b/tests/api-resources/rate-plans.test.ts similarity index 81% rename from tests/api-resources/zones/rate-plans.test.ts rename to tests/api-resources/rate-plans.test.ts index 85f6bbe66d..a4032a6e21 100644 --- a/tests/api-resources/zones/rate-plans.test.ts +++ b/tests/api-resources/rate-plans.test.ts @@ -11,7 +11,7 @@ const client = new Cloudflare({ describe('resource ratePlans', () => { test('get: only required params', async () => { - const responsePromise = client.zones.ratePlans.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const responsePromise = client.ratePlans.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -22,6 +22,6 @@ describe('resource ratePlans', () => { }); test('get: required and optional params', async () => { - const response = await client.zones.ratePlans.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); + const response = await client.ratePlans.get({ zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }); }); }); diff --git a/tests/api-resources/url-scanner/scans.test.ts b/tests/api-resources/url-scanner/scans.test.ts index f1a68f7fdb..a3f7c0b7c4 100644 --- a/tests/api-resources/url-scanner/scans.test.ts +++ b/tests/api-resources/url-scanner/scans.test.ts @@ -30,54 +30,6 @@ describe('resource scans', () => { }); }); - test('list', async () => { - const responsePromise = client.urlScanner.scans.list('accountId'); - 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: 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.urlScanner.scans.list('accountId', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - - test('list: 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.urlScanner.scans.list( - 'accountId', - { - account_scans: true, - asn: '13335', - date_end: '2019-12-27T18:11:19.117Z', - date_start: '2019-12-27T18:11:19.117Z', - hash: 'hash', - hostname: 'example.com', - ip: '1.1.1.1', - is_malicious: true, - limit: 100, - next_cursor: 'next_cursor', - page_asn: 'page_asn', - page_hostname: 'page_hostname', - page_ip: 'page_ip', - page_path: 'page_path', - page_url: 'page_url', - path: '/samples/subresource-integrity/', - scanId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - url: 'https://example.com/?hello', - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Cloudflare.NotFoundError); - }); - test('get', async () => { const responsePromise = client.urlScanner.scans.get('accountId', '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e'); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/url-scanner/url-scanner.test.ts b/tests/api-resources/url-scanner/url-scanner.test.ts new file mode 100644 index 0000000000..24b4c73ed1 --- /dev/null +++ b/tests/api-resources/url-scanner/url-scanner.test.ts @@ -0,0 +1,60 @@ +// 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 urlScanner', () => { + test('scan', async () => { + const responsePromise = client.urlScanner.scan('accountId'); + 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('scan: 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.urlScanner.scan('accountId', { path: '/_stainless_unknown_path' })).rejects.toThrow( + Cloudflare.NotFoundError, + ); + }); + + test('scan: 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.urlScanner.scan( + 'accountId', + { + account_scans: true, + asn: '13335', + date_end: '2019-12-27T18:11:19.117Z', + date_start: '2019-12-27T18:11:19.117Z', + hash: 'hash', + hostname: 'example.com', + ip: '1.1.1.1', + is_malicious: true, + limit: 100, + next_cursor: 'next_cursor', + page_asn: 'page_asn', + page_hostname: 'page_hostname', + page_ip: 'page_ip', + page_path: 'page_path', + page_url: 'page_url', + path: '/samples/subresource-integrity/', + scanId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', + url: 'https://example.com/?hello', + }, + { path: '/_stainless_unknown_path' }, + ), + ).rejects.toThrow(Cloudflare.NotFoundError); + }); +}); diff --git a/tests/api-resources/zero-trust/access/infrastructure/targets.test.ts b/tests/api-resources/zero-trust/access/infrastructure/targets.test.ts deleted file mode 100644 index 89cf73ba0b..0000000000 --- a/tests/api-resources/zero-trust/access/infrastructure/targets.test.ts +++ /dev/null @@ -1,142 +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 targets', () => { - test('create: only required params', async () => { - const responsePromise = client.zeroTrust.access.infrastructure.targets.create({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - hostname: 'infra-access-target', - ip: {}, - }); - 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.access.infrastructure.targets.create({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - hostname: 'infra-access-target', - ip: { - ipv4: { ip_addr: '187.26.29.249', virtual_network_id: 'c77b744e-acc8-428f-9257-6878c046ed55' }, - ipv6: { - ip_addr: '64c0:64e8:f0b4:8dbf:7104:72b0:ec8f:f5e0', - virtual_network_id: 'c77b744e-acc8-428f-9257-6878c046ed55', - }, - }, - }); - }); - - test('update: only required params', async () => { - const responsePromise = client.zeroTrust.access.infrastructure.targets.update( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { account_id: '023e105f4ecef8ad9ca31a8372d0c353', hostname: 'infra-access-target', ip: {} }, - ); - 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.zeroTrust.access.infrastructure.targets.update( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - hostname: 'infra-access-target', - ip: { - ipv4: { ip_addr: '187.26.29.249', virtual_network_id: 'c77b744e-acc8-428f-9257-6878c046ed55' }, - ipv6: { - ip_addr: '64c0:64e8:f0b4:8dbf:7104:72b0:ec8f:f5e0', - virtual_network_id: 'c77b744e-acc8-428f-9257-6878c046ed55', - }, - }, - }, - ); - }); - - test('list: only required params', async () => { - const responsePromise = client.zeroTrust.access.infrastructure.targets.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.infrastructure.targets.list({ - account_id: '023e105f4ecef8ad9ca31a8372d0c353', - created_after: '2019-12-27T18:11:19.117Z', - hostname: 'hostname', - hostname_contains: 'hostname_contains', - ip_v4: 'ip_v4', - ip_v6: 'ip_v6', - modified_after: '2019-12-27T18:11:19.117Z', - page: 1, - per_page: 1, - virtual_network_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - }); - }); - - test('delete: only required params', async () => { - const responsePromise = client.zeroTrust.access.infrastructure.targets.delete( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { 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.zeroTrust.access.infrastructure.targets.delete( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - ); - }); - - test('get: only required params', async () => { - const responsePromise = client.zeroTrust.access.infrastructure.targets.get( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { 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.infrastructure.targets.get( - '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', - { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, - ); - }); -}); diff --git a/tests/api-resources/zero-trust/dex/tests/tests.test.ts b/tests/api-resources/zero-trust/dex/tests/tests.test.ts deleted file mode 100644 index 73d0bab2a9..0000000000 --- a/tests/api-resources/zero-trust/dex/tests/tests.test.ts +++ /dev/null @@ -1,36 +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 tests', () => { - test('list: only required params', async () => { - const responsePromise = client.zeroTrust.dex.tests.list({ - account_id: '01a7362d577a6c3019a474fd6f485823', - }); - 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.dex.tests.list({ - account_id: '01a7362d577a6c3019a474fd6f485823', - colo: 'colo', - deviceId: ['string', 'string', 'string'], - page: 1, - per_page: 1, - testName: 'testName', - }); - }); -});